2 * auth.c User authentication.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Copyright 2000 The FreeRADIUS server project
21 * Copyright 2000 Miquel van Smoorenburg <miquels@cistron.nl>
22 * Copyright 2000 Jeff Carneal <jeff@apex.net>
25 static const char rcsid[] = "$Id$";
28 #include "libradius.h"
34 #ifdef HAVE_NETINET_IN_H
35 # include <netinet/in.h>
42 * Return a short string showing the terminal server, port
43 * and calling station ID.
45 char *auth_name(char *buf, size_t buflen, REQUEST *request, int do_cli) {
50 if ((cli = pairfind(request->packet->vps, PW_CALLING_STATION_ID)) == NULL)
52 if ((pair = pairfind(request->packet->vps, PW_NAS_PORT)) != NULL)
55 snprintf(buf, buflen, "from client %.128s port %u%s%.128s",
56 client_name(request->packet->src_ipaddr), port,
57 (do_cli ? " cli " : ""), (do_cli ? (char *)cli->strvalue : ""));
64 * Check if account has expired, and if user may login now.
66 static int check_expiration(REQUEST *request)
69 VALUE_PAIR *check_item = request->config_items;
72 while (result == 0 && check_item != NULL) {
75 * Check expiration date if we are doing password aging.
77 if (check_item->attribute == PW_EXPIRATION) {
79 * Has this user's password expired?
81 * If so, remove ALL reply attributes,
82 * and add our own Reply-Message, saying
83 * why they're being rejected.
85 if (check_item->lvalue < (unsigned) time(NULL)) {
89 vp = pairmake("Reply-Message",
90 "Password Has Expired\r\n",
92 pairfree(&request->reply->vps);
93 request->reply->vps = vp;
97 check_item = check_item->next;
104 * Make sure user/pass are clean
107 static int rad_authlog(const char *msg, REQUEST *request, int goodpass) {
109 char clean_password[1024];
110 char clean_username[1024];
112 VALUE_PAIR *username = NULL;
114 if (!mainconfig.log_auth) {
119 * Get the correct username based on the configured value
121 if (log_stripped_names == 0) {
122 username = pairfind(request->packet->vps, PW_USER_NAME);
124 username = request->username;
128 * Clean up the username
130 if (username == NULL) {
131 strcpy(clean_username, "<no User-Name attribute>");
133 librad_safeprint((char *)username->strvalue,
135 clean_username, sizeof(clean_username));
139 * Clean up the password
141 if (mainconfig.log_auth_badpass || mainconfig.log_auth_goodpass) {
142 if (!request->password) {
143 strcpy(clean_password, "<no User-Password attribute>");
144 } else if (request->password->attribute == PW_CHAP_PASSWORD) {
145 strcpy(clean_password, "<CHAP-Password>");
147 librad_safeprint((char *)request->password->strvalue,
148 request->password->length,
149 clean_password, sizeof(clean_password));
154 radlog(L_AUTH, "%s: [%s%s%s] (%s)",
157 mainconfig.log_auth_goodpass ? "/" : "",
158 mainconfig.log_auth_goodpass ? clean_password : "",
159 auth_name(buf, sizeof(buf), request, 1));
161 radlog(L_AUTH, "%s: [%s%s%s] (%s)",
164 mainconfig.log_auth_badpass ? "/" : "",
165 mainconfig.log_auth_badpass ? clean_password : "",
166 auth_name(buf, sizeof(buf), request, 1));
177 * -2 Rejected (Auth-Type = Reject, send Port-Message back)
178 * 1 End check & return, don't reply
180 * NOTE: NOT the same as the RLM_ values !
182 int rad_check_password(REQUEST *request)
184 VALUE_PAIR *auth_type_pair;
185 VALUE_PAIR *cur_config_item;
186 VALUE_PAIR *password_pair;
187 VALUE_PAIR *auth_item;
188 char string[MAX_STRING_LEN];
191 int auth_type_count = 0;
195 * Look for matching check items. We skip the whole lot
196 * if the authentication type is PW_AUTHTYPE_ACCEPT or
197 * PW_AUTHTYPE_REJECT.
199 cur_config_item = request->config_items;
200 while(((auth_type_pair = pairfind(cur_config_item, PW_AUTH_TYPE))) != NULL) {
201 auth_type = auth_type_pair->lvalue;
204 DEBUG2(" rad_check_password: Found Auth-Type %s",
205 auth_type_pair->strvalue);
206 cur_config_item = auth_type_pair->next;
208 if (auth_type == PW_AUTHTYPE_REJECT) {
209 DEBUG2(" rad_check_password: Auth-Type = Reject, rejecting user");
214 if (( auth_type_count > 1) && (debug_flag)) {
215 radlog(L_ERR, "Warning: Found %d auth-types on request for user '%s'",
216 auth_type_count, request->username->strvalue);
220 * This means we have a proxy reply or an accept
221 * and it wasn't rejected in the above loop. So
222 * that means it is accepted and we do no further
225 if ((auth_type == PW_AUTHTYPE_ACCEPT) || (request->proxy)) {
226 DEBUG2(" rad_check_password: Auth-Type = Accept, accepting the user");
231 * Find the password from the users file.
233 if ((password_pair = pairfind(request->config_items, PW_CRYPT_PASSWORD)) != NULL) {
235 * Re-write Auth-Type, but ONLY if it isn't already
238 if (auth_type == -1) auth_type = PW_AUTHTYPE_CRYPT;
240 password_pair = pairfind(request->config_items, PW_PASSWORD);
245 auth_type = PW_AUTHTYPE_LOCAL;
248 * The admin hasn't told us how to
249 * authenticate the user, so we reject them!
253 DEBUG2("auth: No authenticate method (Auth-Type) configuration found for the request: Rejecting the user");
259 case PW_AUTHTYPE_CRYPT:
261 * Find the password sent by the user. It
262 * SHOULD be there, if it's not
263 * authentication fails.
265 auth_item = request->password;
266 if (auth_item == NULL) {
267 DEBUG2("auth: No User-Password or CHAP-Password attribute in the request");
271 DEBUG2("auth: type Crypt");
272 if (password_pair == NULL) {
273 DEBUG2("No Crypt-Password configured for the user");
274 rad_authlog("Login incorrect "
275 "(No Crypt-Password configured for the user)", request, 0);
279 switch (lrad_crypt_check((char *)auth_item->strvalue,
280 (char *)password_pair->strvalue)) {
282 rad_authlog("Login incorrect "
283 "(system failed to supply an encrypted password for comparison)", request, 0);
288 case PW_AUTHTYPE_LOCAL:
289 DEBUG2("auth: type Local");
292 * Find the password sent by the user. It
293 * SHOULD be there, if it's not
294 * authentication fails.
296 auth_item = request->password;
297 if (auth_item == NULL) {
298 DEBUG2("auth: No User-Password or CHAP-Password attribute in the request");
303 * Plain text password.
305 if (password_pair == NULL) {
306 DEBUG2("auth: No password configured for the user");
307 rad_authlog("Login incorrect "
308 "(No password configured for the user)", request, 0);
313 * Local password is just plain text.
315 if (auth_item->attribute == PW_PASSWORD) {
316 if (strcmp((char *)password_pair->strvalue,
317 (char *)auth_item->strvalue) != 0) {
318 DEBUG2("auth: user supplied User-Password does NOT match local User-Password");
321 DEBUG2("auth: user supplied User-Password matches local User-Password");
324 } else if (auth_item->attribute != PW_CHAP_PASSWORD) {
325 DEBUG2("The user did not supply a User-Password or a CHAP-Password attribute");
326 rad_authlog("Login incorrect "
327 "(no User-Password or CHAP-Password attribute)", request, 0);
331 rad_chap_encode(request->packet, string,
332 auth_item->strvalue[0], password_pair);
337 if (memcmp(string + 1, auth_item->strvalue + 1,
338 CHAP_VALUE_LENGTH) != 0) {
339 DEBUG2("auth: user supplied CHAP-Password does NOT match local User-Password");
342 DEBUG2("auth: user supplied CHAP-Password matches local User-Password");
345 DEBUG2("auth: type \"%s\"",
346 dict_valbyattr(PW_AUTH_TYPE, auth_type)->name);
348 * See if there is a module that handles
349 * this type, and turn the RLM_ return
350 * status into the values as defined at
351 * the top of this function.
353 result = module_authenticate(auth_type, request);
356 * An authentication module FAIL
357 * return code, or any return code that
358 * is not expected from authentication,
359 * is the same as an explicit REJECT!
361 case RLM_MODULE_FAIL:
362 case RLM_MODULE_REJECT:
363 case RLM_MODULE_USERLOCK:
364 case RLM_MODULE_INVALID:
365 case RLM_MODULE_NOTFOUND:
366 case RLM_MODULE_NOOP:
367 case RLM_MODULE_UPDATED:
373 case RLM_MODULE_HANDLED:
384 * Post-authentication step processes the response before it is
385 * sent to the NAS. It can receive both Access-Accept and Access-Reject
388 static int rad_postauth(REQUEST *request)
391 int postauth_type = 0;
392 VALUE_PAIR *postauth_type_item = NULL;
395 * Do post-authentication calls. ignoring the return code.
397 postauth_type_item = pairfind(request->config_items, PW_POST_AUTH_TYPE);
398 if (postauth_type_item)
399 postauth_type = postauth_type_item->lvalue;
400 result = module_post_auth(postauth_type, request);
406 * The module failed, or said to reject the user: Do so.
408 case RLM_MODULE_FAIL:
409 case RLM_MODULE_REJECT:
410 case RLM_MODULE_USERLOCK:
411 case RLM_MODULE_INVALID:
412 request->reply->code = PW_AUTHENTICATION_REJECT;
413 result = RLM_MODULE_REJECT;
417 * The module had a number of OK return codes.
419 case RLM_MODULE_NOTFOUND:
420 case RLM_MODULE_NOOP:
421 case RLM_MODULE_UPDATED:
423 case RLM_MODULE_HANDLED:
424 result = RLM_MODULE_OK;
431 * Process and reply to an authentication request
433 * The return value of this function isn't actually used right now, so
434 * it's not entirely clear if it is returning the right things. --Pac.
436 int rad_authenticate(REQUEST *request)
438 VALUE_PAIR *namepair;
439 VALUE_PAIR *check_item;
440 VALUE_PAIR *reply_item;
441 VALUE_PAIR *auth_item;
442 VALUE_PAIR *module_msg;
443 VALUE_PAIR *tmp = NULL;
445 char umsg[MAX_STRING_LEN + 1];
446 const char *user_msg = NULL;
447 const char *password;
450 int seen_callback_id;
451 char buf[1024], logstr[1024];
458 * If this request got proxied to another server,
459 * AND it was an authentication request, then we need
460 * to add an initial Auth-Type: Auth-Accept for success,
461 * Auth-Reject for fail. We also need to add the reply
462 * pairs from the server to the initial reply.
464 if ((request->proxy_reply) &&
465 (request->packet->code == PW_AUTHENTICATION_REQUEST)) {
466 tmp = paircreate(PW_AUTH_TYPE, PW_TYPE_INTEGER);
468 radlog(L_ERR|L_CONS, "no memory");
473 * Challenges are punted back to the NAS
474 * without any further processing.
476 if (request->proxy_reply->code == PW_ACCESS_CHALLENGE) {
477 request->reply->code = PW_ACCESS_CHALLENGE;
478 return RLM_MODULE_HANDLED;
482 * Reply of ACCEPT means accept, ALL other
483 * replies mean reject. This is fail-safe.
485 if (request->proxy_reply->code == PW_AUTHENTICATION_ACK)
486 tmp->lvalue = PW_AUTHTYPE_ACCEPT;
488 tmp->lvalue = PW_AUTHTYPE_REJECT;
489 pairadd(&request->config_items, tmp);
492 * If it's an Access-Reject, then do NOT do any
493 * authorization or authentication. They're being
494 * rejected, so we minimize the amount of work
495 * done by the server, by rejecting them here.
497 if ((request->proxy_reply->code != PW_AUTHENTICATION_ACK) &&
498 (request->proxy_reply->code != PW_ACCESS_CHALLENGE)) {
499 rad_authlog("Login incorrect (Home Server says so)", request, 0);
500 request->reply->code = PW_AUTHENTICATION_REJECT;
501 return RLM_MODULE_REJECT;
506 * Get the username from the request.
508 * Note that namepair MAY be NULL, in which case there
509 * is no User-Name attribute in the request.
511 namepair = request->username;
514 * Look for, and cache, passwords.
516 if (!request->password) {
517 request->password = pairfind(request->packet->vps,
522 * Discover which password we want to use.
524 auth_item = request->password;
526 password = (const char *)auth_item->strvalue;
530 * Maybe there's a CHAP-Password?
532 if ((auth_item = pairfind(request->packet->vps,
533 PW_CHAP_PASSWORD)) != NULL) {
534 password = "<CHAP-PASSWORD>";
538 * No password we recognize.
540 password = "<NO-PASSWORD>";
543 request->password = auth_item;
546 * Get the user's authorization information from the database
549 r = module_authorize(autz_type, request);
550 if (r != RLM_MODULE_NOTFOUND &&
551 r != RLM_MODULE_NOOP &&
552 r != RLM_MODULE_OK &&
553 r != RLM_MODULE_UPDATED) {
554 if (r != RLM_MODULE_FAIL && r != RLM_MODULE_HANDLED) {
555 if ((module_msg = pairfind(request->packet->vps,
556 PW_MODULE_FAILURE_MESSAGE)) != NULL){
557 char msg[MAX_STRING_LEN+16];
558 snprintf(msg, sizeof(msg), "Invalid user (%s)",
559 module_msg->strvalue);
560 rad_authlog(msg,request,0);
562 rad_authlog("Invalid user", request, 0);
564 request->reply->code = PW_AUTHENTICATION_REJECT;
569 VALUE_PAIR *autz_type_item = NULL;
570 autz_type_item = pairfind(request->config_items, PW_AUTZ_TYPE);
572 autz_type = autz_type_item->lvalue;
579 * If we haven't already proxied the packet, then check
580 * to see if we should. Maybe one of the authorize
581 * modules has decided that a proxy should be used. If
582 * so, get out of here and send the packet.
584 if ((request->proxy == NULL) &&
585 ((tmp = pairfind(request->config_items, PW_PROXY_TO_REALM)) != NULL)) {
589 * Catch users who set Proxy-To-Realm to a LOCAL
592 realm = realm_find(tmp->strvalue, 0);
593 if (realm && (realm->ipaddr == htonl(INADDR_NONE))) {
594 DEBUG2(" WARNING: You set Proxy-To-Realm = %s, but it is a LOCAL realm! Cancelling invalid proxy request.", realm->realm);
597 * Don't authenticate, as the request is
600 return RLM_MODULE_OK;
605 * Perhaps there is a Stripped-User-Name now.
607 namepair = request->username;
613 if ((result = check_expiration(request)) < 0)
615 result = rad_check_password(request);
618 return RLM_MODULE_HANDLED;
623 * Failed to validate the user.
625 * We PRESUME that the code which failed will clean up
626 * request->reply->vps, to be ONLY the reply items it
627 * wants to send back.
630 DEBUG2("auth: Failed to validate the user.");
631 request->reply->code = PW_AUTHENTICATION_REJECT;
633 if ((module_msg = pairfind(request->packet->vps,PW_MODULE_FAILURE_MESSAGE)) != NULL){
634 char msg[MAX_STRING_LEN+19];
636 snprintf(msg, sizeof(msg), "Login incorrect (%s)",
637 module_msg->strvalue);
638 rad_authlog(msg, request, 0);
640 rad_authlog("Login incorrect", request, 0);
643 /* double check: maybe the secret is wrong? */
644 if ((debug_flag > 1) && (auth_item != NULL) &&
645 (auth_item->attribute == PW_PASSWORD)) {
648 p = auth_item->strvalue;
650 if (!isprint((int) *p)) {
651 log_debug(" WARNING: Unprintable characters in the password.\n\t Double-check the shared secret on the server and the NAS!");
660 (check_item = pairfind(request->config_items, PW_SIMULTANEOUS_USE)) != NULL) {
661 VALUE_PAIR *session_type;
664 session_type = pairfind(request->config_items, PW_SESSION_TYPE);
666 sess_type = session_type->lvalue;
669 * User authenticated O.K. Now we have to check
670 * for the Simultaneous-Use parameter.
673 (r = module_checksimul(sess_type,request, check_item->lvalue)) != 0) {
677 /* Multilink attempt. Check if port-limit > simultaneous-use */
678 VALUE_PAIR *port_limit;
680 if ((port_limit = pairfind(request->reply->vps, PW_PORT_LIMIT)) != NULL &&
681 port_limit->lvalue > check_item->lvalue){
682 DEBUG2("main auth: MPP is OK");
687 if (check_item->lvalue > 1) {
688 snprintf(umsg, sizeof(umsg),
689 "\r\nYou are already logged in %d times - access denied\r\n\n",
690 (int)check_item->lvalue);
693 user_msg = "\r\nYou are already logged in - access denied\r\n\n";
696 request->reply->code = PW_AUTHENTICATION_REJECT;
699 * They're trying to log in too many times.
700 * Remove ALL reply attributes.
702 pairfree(&request->reply->vps);
703 tmp = pairmake("Reply-Message", user_msg, T_OP_SET);
704 request->reply->vps = tmp;
706 snprintf(logstr, sizeof(logstr), "Multiple logins (max %d) %s",
708 r == 2 ? "[MPP attempt]" : "");
709 rad_authlog(logstr, request, 1);
717 (check_item = pairfind(request->config_items, PW_LOGIN_TIME)) != NULL) {
720 * Authentication is OK. Now see if this
721 * user may login at this time of the day.
723 r = timestr_match((char *)check_item->strvalue,
726 if (r == 0) { /* unlimited */
728 * Do nothing: login-time is OK.
732 * Session-Timeout needs to be at least
733 * 60 seconds, some terminal servers
734 * ignore smaller values.
738 * User called outside allowed time interval.
741 user_msg = "You are calling outside your allowed timespan\r\n";
743 request->reply->code = PW_AUTHENTICATION_REJECT;
744 pairfree(&request->reply->vps);
746 tmp = pairmake("Reply-Message", user_msg, T_OP_SET);
747 request->reply->vps = tmp;
749 snprintf(logstr, sizeof(logstr), "Outside allowed timespan (time allowed %s)",
750 check_item->strvalue);
751 rad_authlog(logstr, request, 1);
756 * User is allowed, but set Session-Timeout.
758 if ((reply_item = pairfind(request->reply->vps,
759 PW_SESSION_TIMEOUT)) != NULL) {
760 if (reply_item->lvalue > (unsigned) r)
761 reply_item->lvalue = r;
763 if ((reply_item = paircreate(
765 PW_TYPE_INTEGER)) == NULL) {
766 radlog(L_ERR|L_CONS, "no memory");
769 reply_item->lvalue = r;
770 pairadd(&request->reply->vps, reply_item);
776 * Result should be >= 0 here - if not, it means the user
777 * is rejected, so we overwrite the Post-Auth-Type with
778 * the value REJECT and cal the post-authentication
784 dval = dict_valbyname(PW_POST_AUTH_TYPE, "REJECT");
786 pairdelete(&request->config_items, PW_POST_AUTH_TYPE);
787 tmp = paircreate(PW_POST_AUTH_TYPE, PW_TYPE_INTEGER);
788 tmp->lvalue = dval->value;
789 pairadd(&request->config_items, tmp);
790 rad_postauth(request);
792 return RLM_MODULE_OK;
796 * We might need this later. The 'password' string
797 * is NOT used anywhere below here, except for logging,
798 * so it should be safe...
800 if ((auth_item != NULL) && (auth_item->attribute == PW_CHAP_PASSWORD)) {
801 password = "CHAP-Password";
805 * Add the port number to the Framed-IP-Address if
806 * vp->addport is set.
808 if (((tmp = pairfind(request->reply->vps,
809 PW_FRAMED_IP_ADDRESS)) != NULL) &&
810 (tmp->flags.addport != 0)) {
811 VALUE_PAIR *vpPortId;
814 * Find the NAS port ID.
816 if ((vpPortId = pairfind(request->packet->vps,
817 PW_NAS_PORT)) != NULL) {
818 unsigned long tvalue = ntohl(tmp->lvalue);
819 tmp->lvalue = htonl(tvalue + vpPortId->lvalue);
820 tmp->flags.addport = 0;
821 ip_ntoa(tmp->strvalue, tmp->lvalue);
823 DEBUG2("WARNING: No NAS-Port attribute in request. CANNOT return a Framed-IP-Address + NAS-Port.\n");
824 pairdelete(&request->reply->vps, PW_FRAMED_IP_ADDRESS);
829 * See if we need to execute a program.
830 * FIXME: somehow cache this info, and only execute the
831 * program when we receive an Accounting-START packet.
832 * Only at that time we know dynamic IP etc.
836 if ((auth_item = pairfind(request->reply->vps, PW_EXEC_PROGRAM)) != NULL) {
838 exec_program = strdup((char *)auth_item->strvalue);
839 pairdelete(&request->reply->vps, PW_EXEC_PROGRAM);
841 if ((auth_item = pairfind(request->reply->vps, PW_EXEC_PROGRAM_WAIT)) != NULL) {
843 exec_program = strdup((char *)auth_item->strvalue);
844 pairdelete(&request->reply->vps, PW_EXEC_PROGRAM_WAIT);
848 * Hack - allow % expansion in certain value strings.
849 * This is nice for certain Exec-Program programs.
851 seen_callback_id = 0;
852 if ((auth_item = pairfind(request->reply->vps, PW_CALLBACK_ID)) != NULL) {
853 seen_callback_id = 1;
854 radius_xlat(buf, sizeof(auth_item->strvalue),
855 (char *)auth_item->strvalue, request, NULL);
856 strNcpy((char *)auth_item->strvalue, buf,
857 sizeof(auth_item->strvalue));
858 auth_item->length = strlen((char *)auth_item->strvalue);
863 * If we want to exec a program, but wait for it,
864 * do it first before sending the reply.
866 if (exec_program && exec_wait) {
867 r = radius_exec_program(exec_program, request,
870 request->packet->vps, &tmp);
875 * Always add the value-pairs to the reply.
877 pairmove(&request->reply->vps, &tmp);
882 * Error. radius_exec_program() returns -1 on
883 * fork/exec errors, or >0 if the exec'ed program
884 * had a non-zero exit status.
886 if (umsg[0] == '\0') {
887 user_msg = "\r\nAccess denied (external check failed).";
892 request->reply->code = PW_AUTHENTICATION_REJECT;
893 tmp = pairmake("Reply-Message", user_msg, T_OP_SET);
895 pairadd(&request->reply->vps, tmp);
896 rad_authlog("Login incorrect (external check failed)",
899 return RLM_MODULE_REJECT;
904 * Delete "normal" A/V pairs when using callback.
906 * FIXME: This is stupid. The portmaster should accept
907 * these settings instead of insisting on using a
910 * FIXME2: Move this into the above exec thingy?
911 * (if you knew how I use the exec_wait, you'd understand).
913 if (seen_callback_id) {
914 pairdelete(&request->reply->vps, PW_FRAMED_PROTOCOL);
915 pairdelete(&request->reply->vps, PW_FRAMED_IP_ADDRESS);
916 pairdelete(&request->reply->vps, PW_FRAMED_IP_NETMASK);
917 pairdelete(&request->reply->vps, PW_FRAMED_ROUTE);
918 pairdelete(&request->reply->vps, PW_FRAMED_MTU);
919 pairdelete(&request->reply->vps, PW_FRAMED_COMPRESSION);
920 pairdelete(&request->reply->vps, PW_FILTER_ID);
921 pairdelete(&request->reply->vps, PW_PORT_LIMIT);
922 pairdelete(&request->reply->vps, PW_CALLBACK_NUMBER);
926 * Filter (possibly multiple) Reply-Message attributes
927 * through radius_xlat, modifying them in place.
929 if (user_msg == NULL) {
930 reply_item = pairfind(request->reply->vps, PW_REPLY_MESSAGE);
932 radius_xlat(buf, sizeof(reply_item->strvalue),
933 (char *)reply_item->strvalue, request, NULL);
934 strNcpy((char *)reply_item->strvalue, buf,
935 sizeof(reply_item->strvalue));
936 reply_item->length = strlen((char *)reply_item->strvalue);
938 reply_item = pairfind(reply_item->next, PW_REPLY_MESSAGE);
943 * Set the reply to Access-Accept, if it hasn't already
944 * been set to something. (i.e. Access-Challenge)
946 if (request->reply->code == 0)
947 request->reply->code = PW_AUTHENTICATION_ACK;
949 if ((module_msg = pairfind(request->packet->vps,PW_MODULE_SUCCESS_MESSAGE)) != NULL){
950 char msg[MAX_STRING_LEN+12];
952 snprintf(msg, sizeof(msg), "Login OK (%s)",
953 module_msg->strvalue);
954 rad_authlog(msg, request, 1);
956 rad_authlog("Login OK", request, 1);
959 if (exec_program && !exec_wait) {
961 * No need to check the exit status here.
963 radius_exec_program(exec_program, request, exec_wait,
964 NULL, 0, request->packet->vps, NULL);
970 result = rad_postauth(request);