~ubuntu-branches/ubuntu/natty/freeradius/natty-security

« back to all changes in this revision

Viewing changes to src/main/auth.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-11-04 11:08:45 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20091104110845-igbovikpfp5i1s0t
Tags: 2.1.7+dfsg-0ubuntu1
* New upstream release.
* Clean up packaging.
* debian/freeradius.init: 
  + Clean up init script.
  + Better init headers for dependency based boot stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
 * Make sure user/pass are clean
61
61
 * and then log them
62
62
 */
63
 
static int rad_authlog(const char *msg, REQUEST *request, int goodpass) {
64
 
 
 
63
static int rad_authlog(const char *msg, REQUEST *request, int goodpass)
 
64
{
 
65
        int logit;
 
66
        const char *extra_msg = NULL;
65
67
        char clean_password[1024];
66
68
        char clean_username[1024];
67
69
        char buf[1024];
 
70
        char extra[1024];
68
71
        VALUE_PAIR *username = NULL;
69
72
 
70
73
        if (!request->root->log_auth) {
117
120
        }
118
121
 
119
122
        if (goodpass) {
120
 
                radlog_request(L_AUTH, 0, request, "%s: [%s%s%s] (%s)",
121
 
                                msg,
122
 
                                clean_username,
123
 
                                request->root->log_auth_goodpass ? "/" : "",
124
 
                                request->root->log_auth_goodpass ? clean_password : "",
125
 
                                auth_name(buf, sizeof(buf), request, 1));
126
 
        } else {
127
 
                radlog_request(L_AUTH, 0, request, "%s: [%s%s%s] (%s)",
128
 
                                msg,
129
 
                                clean_username,
130
 
                                request->root->log_auth_badpass ? "/" : "",
131
 
                                request->root->log_auth_badpass ? clean_password : "",
132
 
                                auth_name(buf, sizeof(buf), request, 1));
133
 
        }
 
123
                logit = request->root->log_auth_goodpass;
 
124
                extra_msg = request->root->auth_goodpass_msg;
 
125
        } else {
 
126
                logit = request->root->log_auth_badpass;
 
127
                extra_msg = request->root->auth_badpass_msg;
 
128
        }
 
129
 
 
130
        if (extra_msg) {
 
131
                extra[0] = ' ';
 
132
                radius_xlat(extra + 1, sizeof(extra) - 1, extra_msg, request,
 
133
                            NULL);
 
134
        } else {
 
135
                *extra = '\0';
 
136
        }
 
137
 
 
138
        radlog_request(L_AUTH, 0, request, "%s: [%s%s%s] (%s)%s",
 
139
                       msg,
 
140
                       clean_username,
 
141
                       logit ? "/" : "",
 
142
                       logit ? clean_password : "",
 
143
                       auth_name(buf, sizeof(buf), request, 1),
 
144
                       extra);
134
145
 
135
146
        return 0;
136
147
}
494
505
                 *      done by the server, by rejecting them here.
495
506
                 */
496
507
                case PW_AUTHENTICATION_REJECT:
497
 
                default:
498
508
                        rad_authlog("Login incorrect (Home Server says so)",
499
509
                                    request, 0);
500
510
                        request->reply->code = PW_AUTHENTICATION_REJECT;
501
511
                        return RLM_MODULE_REJECT;
 
512
 
 
513
                default:
 
514
                        rad_authlog("Login incorrect (Home Server failed to respond)",
 
515
                                    request, 0);
 
516
                        return RLM_MODULE_REJECT;
502
517
                }
503
518
        }
504
519
#endif