/[radius]/radius/radiusd/auth.c
ViewVC logotype

Diff of /radius/radiusd/auth.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.102 by gray, Wed Nov 26 22:00:09 2003 UTC revision 1.103 by gray, Thu Nov 27 14:28:59 2003 UTC
# Line 408  rad_check_password(RADIUS_REQ *radreq, V Line 408  rad_check_password(RADIUS_REQ *radreq, V
408          return result;          return result;
409  }  }
410    
411    int
412    rad_auth_check_username(RADIUS_REQ *radreq, int activefd)
413    {
414            VALUE_PAIR *namepair = avl_find(radreq->request, DA_USER_NAME);
415    
416            log_open(L_AUTH);
417    
418            if (avp_null_string_p(namepair))
419                    radlog_req(L_ERR, radreq, _("No username"));
420            else if (check_user_name(namepair->avp_strvalue))
421                    radlog_req(L_ERR, radreq, _("Malformed username"));
422            else
423                    return 0;
424    
425            /* Process a malformed request */
426            if (auth_reject_malformed_names)
427                    radius_send_reply(RT_AUTHENTICATION_REJECT, radreq,
428                                      radreq->request,
429                                      message_text[MSG_ACCESS_DENIED],
430                                      activefd);
431            else
432                    stat_inc(auth, radreq->ipaddr, num_bad_req);
433            return -1;
434    }
435    
436  /* Initial step of authentication. */  /* Initial step of authentication. */
437  int  int
438  rad_auth_init(RADIUS_REQ *radreq, int activefd)  rad_auth_init(RADIUS_REQ *radreq, int activefd)
439  {  {
         VALUE_PAIR *namepair;  
440          LOCUS loc;          LOCUS loc;
441                    
442          log_open(L_AUTH);          log_open(L_AUTH);
         /*  
          * Get the username from the request  
          */  
         namepair = avl_find(radreq->request, DA_USER_NAME);  
   
         if (avp_null_string(namepair)) {  
                 radlog_req(L_ERR, radreq, _("No username"));  
                 stat_inc(auth, radreq->ipaddr, num_bad_req);  
                 return -1;  
         }  
         debug(1,("checking username: %s", namepair->avp_strvalue));  
         if (check_user_name(namepair->avp_strvalue)) {  
                 radlog_req(L_ERR, radreq, _("Malformed username"));  
                 if (auth_reject_malformed_names)  
                         radius_send_reply(RT_AUTHENTICATION_REJECT, radreq,  
                                           radreq->request,  
                                           message_text[MSG_ACCESS_DENIED],  
                                           activefd);  
                 else  
                         stat_inc(auth, radreq->ipaddr, num_bad_req);  
                 return -1;  
         }  
443                                    
444          if (auth_detail)          if (auth_detail)
445                  write_detail(radreq, REQ_AUTH_ZERO, "detail.auth");                  write_detail(radreq, REQ_AUTH_ZERO, "detail.auth");

Legend:
Removed from v.1.102  
changed lines
  Added in v.1.103

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26