How to modify rlm_example to implement challenge/response authentication

classic Classic list List threaded Threaded
1 message Options
| Threaded
Open this post in threaded view
|

How to modify rlm_example to implement challenge/response authentication

Terry lee

Hi all,
I try to modify rlm_example.c to implement challenge/response authentication, but i dont' know how to code it,  i know i have to modify example_authenitcate function , but when i install it to my freeradius server , it cannot return RLM_MODULE_OK, anyone can help me with that, here is my implementation:

static int example_authenticate(void *instance, REQUEST *request)
{
        VALUE_PAIR *reply;
        VALUE_PAIR *state;

        instance = instance;
        request = request;

       
        state =  pairfind(request->packet->vps, PW_STATE);
        if (state != NULL) {
                DEBUG("***rlm_example: Found reply to access challenge");
                return RLM_MODULE_OK;
        }
       
        /*
         *  Create the challenge, and add it to the reply.
         */
        reply = pairmake("Reply-Message", "This is a challenge", T_OP_EQ);
        pairadd(&request->reply->vps, reply);
        state = pairmake("State", "0", T_OP_EQ);
        pairadd(&request->reply->vps, state);

        request->reply->code = PW_ACCESS_CHALLENGE;
        return RLM_MODULE_HANDLED;
}

thank!

Terry



_____________________________________________________________
Join SQAtester.com Community  ---> http://www.sqatester.com/testersarea/joinus.htm

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html