~ubuntu-branches/ubuntu/jaunty/freeradius/jaunty-proposed

« back to all changes in this revision

Viewing changes to src/modules/rlm_mschap/rlm_mschap.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2008-09-22 08:42:02 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20080922084202-eyjprg3z55481ha5
Tags: 2.1.0+dfsg-0ubuntu1
* New upstream release.
* Fixes FTBFS issue with new libtool.
* Fixes listen on random port. (LP: #261809)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * rlm_mschap.c
3
3
 *
4
 
 * Version:     $Id: rlm_mschap.c,v 1.99 2008/01/09 13:20:56 aland Exp $
 
4
 * Version:     $Id$
5
5
 *
6
6
 *   This program is free software; you can redistribute it and/or modify
7
7
 *   it under the terms of the GNU General Public License as published by
43
43
/*  MPPE support from Takahiro Wagatsuma <waga@sic.shibaura-it.ac.jp> */
44
44
 
45
45
#include        <freeradius-devel/ident.h>
46
 
RCSID("$Id: rlm_mschap.c,v 1.99 2008/01/09 13:20:56 aland Exp $")
 
46
RCSID("$Id$")
47
47
 
48
48
#include        <freeradius-devel/radiusd.h>
49
49
#include        <freeradius-devel/modules.h>
50
50
#include        <freeradius-devel/rad_assert.h>
51
51
#include        <freeradius-devel/md5.h>
 
52
#include        <freeradius-devel/sha1.h>
52
53
 
53
54
#include        <ctype.h>
54
55
 
299
300
                chap_challenge = pairfind(request->packet->vps,
300
301
                                          PW_MSCHAP_CHALLENGE);
301
302
                if (!chap_challenge) {
302
 
                        DEBUG2("  rlm_mschap: No MS-CHAP-Challenge in the request.");
 
303
                        RDEBUG2("No MS-CHAP-Challenge in the request.");
303
304
                        return 0;
304
305
                }
305
306
 
308
309
                 *      for MS-CHAPv2
309
310
                 */
310
311
                if (chap_challenge->length == 8) {
311
 
                        DEBUG2(" mschap1: %02x",
 
312
                        RDEBUG2(" mschap1: %02x",
312
313
                               chap_challenge->vp_octets[0]);
313
314
                        data = chap_challenge->vp_octets;
314
315
                        data_len = 8;
320
321
                } else if (chap_challenge->length == 16) {
321
322
                        char *username_string;
322
323
 
323
 
                        DEBUG2(" mschap2: %02x", chap_challenge->vp_octets[0]);
 
324
                        RDEBUG2(" mschap2: %02x", chap_challenge->vp_octets[0]);
324
325
                        response = pairfind(request->packet->vps,
325
326
                                            PW_MSCHAP2_RESPONSE);
326
327
                        if (!response) {
327
 
                                DEBUG2("  rlm_mschap: MS-CHAP2-Response is required to calculate MS-CHAPv1 challenge.");
 
328
                                RDEBUG2("MS-CHAP2-Response is required to calculate MS-CHAPv1 challenge.");
328
329
                                return 0;
329
330
                        }
330
331
 
332
333
                         *      Responses are 50 octets.
333
334
                         */
334
335
                        if (response->length < 50) {
335
 
                                radlog(L_AUTH, "rlm_mschap: MS-CHAP-Response has the wrong format.");
 
336
                                radlog_request(L_AUTH, 0, request, "MS-CHAP-Response has the wrong format.");
336
337
                                return 0;
337
338
                        }
338
339
 
339
340
                        user_name = pairfind(request->packet->vps,
340
341
                                             PW_USER_NAME);
341
342
                        if (!user_name) {
342
 
                                DEBUG2("  rlm_mschap: User-Name is required to calculateMS-CHAPv1 Challenge.");
 
343
                                RDEBUG2("User-Name is required to calculateMS-CHAPv1 Challenge.");
343
344
                                return 0;
344
345
                        }
345
346
 
350
351
                                if (inst->with_ntdomain_hack) {
351
352
                                        username_string++;
352
353
                                } else {
353
 
                                        DEBUG2("  rlm_mschap: NT Domain delimeter found, should we have enabled with_ntdomain_hack?");
 
354
                                        RDEBUG2("NT Domain delimeter found, should we have enabled with_ntdomain_hack?");
354
355
                                        username_string = user_name->vp_strvalue;
355
356
                                }
356
357
                        } else {
368
369
                        data = buffer;
369
370
                        data_len = 8;
370
371
                } else {
371
 
                        DEBUG2("  rlm_mschap: Invalid MS-CHAP challenge length");
 
372
                        RDEBUG2("Invalid MS-CHAP challenge length");
372
373
                        return 0;
373
374
                }
374
375
 
382
383
                if (!response) response = pairfind(request->packet->vps,
383
384
                                                   PW_MSCHAP2_RESPONSE);
384
385
                if (!response) {
385
 
                        DEBUG2("  rlm_mschap: No MS-CHAP-Response or MS-CHAP2-Response was found in the request.");
 
386
                        RDEBUG2("No MS-CHAP-Response or MS-CHAP2-Response was found in the request.");
386
387
                        return 0;
387
388
                }
388
389
 
392
393
                 */
393
394
                if ((response->attribute == PW_MSCHAP_RESPONSE) &&
394
395
                    ((response->vp_octets[1] & 0x01) == 0)) {
395
 
                        DEBUG2("  rlm_mschap: No NT-Response in MS-CHAP-Response");
 
396
                        RDEBUG2("No NT-Response in MS-CHAP-Response");
396
397
                        return 0;
397
398
                }
398
399
 
412
413
                response = pairfind(request->packet->vps,
413
414
                                    PW_MSCHAP_RESPONSE);
414
415
                if (!response) {
415
 
                        DEBUG2("  rlm_mschap: No MS-CHAP-Response was found in the request.");
 
416
                        RDEBUG2("No MS-CHAP-Response was found in the request.");
416
417
                        return 0;
417
418
                }
418
419
 
421
422
                 *      if the second octet says so.
422
423
                 */
423
424
                if ((response->vp_octets[1] & 0x01) != 0) {
424
 
                        DEBUG2("  rlm_mschap: No LM-Response in MS-CHAP-Response");
 
425
                        RDEBUG2("No LM-Response in MS-CHAP-Response");
425
426
                        return 0;
426
427
                }
427
428
                data = response->vp_octets + 2;
435
436
 
436
437
                user_name = pairfind(request->packet->vps, PW_USER_NAME);
437
438
                if (!user_name) {
438
 
                        DEBUG2("  rlm_mschap: No User-Name was found in the request.");
 
439
                        RDEBUG2("No User-Name was found in the request.");
439
440
                        return 0;
440
441
                }
441
442
 
452
453
                         */
453
454
                        p = strchr(user_name->vp_strvalue, '.');
454
455
                        if (!p) {
455
 
                                DEBUG2("  rlm_mschap: setting NT-Domain to same as machine name");
 
456
                                RDEBUG2("setting NT-Domain to same as machine name");
456
457
                                strlcpy(out, user_name->vp_strvalue + 5, outlen);
457
458
                        } else {
458
459
                                p++;    /* skip the period */
468
469
                } else {
469
470
                        p = strchr(user_name->vp_strvalue, '\\');
470
471
                        if (!p) {
471
 
                                DEBUG2("  rlm_mschap: No NT-Domain was found in the User-Name.");
 
472
                                RDEBUG2("No NT-Domain was found in the User-Name.");
472
473
                                return 0;
473
474
                        }
474
475
 
490
491
 
491
492
                user_name = pairfind(request->packet->vps, PW_USER_NAME);
492
493
                if (!user_name) {
493
 
                        DEBUG2("  rlm_mschap: No User-Name was found in the request.");
 
494
                        RDEBUG2("No User-Name was found in the request.");
494
495
                        return 0;
495
496
                }
496
497
 
538
539
                p = fmt + 8;    /* 7 is the length of 'NT-Hash' */
539
540
                if ((p == '\0')  || (outlen <= 32))
540
541
                        return 0;
541
 
                DEBUG("rlm_mschap: NT-Hash: %s",p);
 
542
                RDEBUG("rlm_mschap: NT-Hash: %s",p);
542
543
                ntpwdhash(buffer,p);
543
544
 
544
545
                fr_bin2hex(buffer, out, 16);
545
546
                out[32] = '\0';
546
 
                DEBUG("rlm_mschap: NT-Hash: Result: %s",out);
 
547
                RDEBUG("rlm_mschap: NT-Hash: Result: %s",out);
547
548
                return 32;
548
549
 
549
550
                /*
556
557
                if ((p == '\0') || (outlen <= 32))
557
558
                        return 0;
558
559
 
559
 
                DEBUG("rlm_mschap: LM-Hash: %s",p);
 
560
                RDEBUG("rlm_mschap: LM-Hash: %s",p);
560
561
                smbdes_lmpwdhash(p, buffer);
561
562
                fr_bin2hex(buffer, out, 16);
562
563
                out[32] = '\0';
563
 
                DEBUG("rlm_mschap: LM-Hash: Result: %s",out);
 
564
                RDEBUG("rlm_mschap: LM-Hash: Result: %s",out);
564
565
                return 32;
565
566
        } else {
566
 
                DEBUG2("  rlm_mschap: Unknown expansion string \"%s\"",
 
567
                RDEBUG2("Unknown expansion string \"%s\"",
567
568
                       fmt);
568
569
                return 0;
569
570
        }
574
575
         *      Didn't set anything: this is bad.
575
576
         */
576
577
        if (!data) {
577
 
                DEBUG2("  rlm_mschap: Failed to do anything intelligent");
 
578
                RDEBUG2("Failed to do anything intelligent");
578
579
                return 0;
579
580
        }
580
581
 
691
692
 *      add_reply() adds either MS-CHAP2-Success or MS-CHAP-Error
692
693
 *      attribute to reply packet
693
694
 */
694
 
void mschap_add_reply(VALUE_PAIR** vp, unsigned char ident,
 
695
void mschap_add_reply(REQUEST *request, VALUE_PAIR** vp, unsigned char ident,
695
696
                      const char* name, const char* value, int len)
696
697
{
697
698
        VALUE_PAIR *reply_attr;
698
699
        reply_attr = pairmake(name, "", T_OP_EQ);
699
700
        if (!reply_attr) {
700
 
                DEBUG("  rlm_mschap: Failed to create attribute %s: %s\n", name, librad_errstr);
 
701
                RDEBUG("Failed to create attribute %s: %s\n", name, fr_strerror());
701
702
                return;
702
703
        }
703
704
 
716
717
       VALUE_PAIR *vp;
717
718
       vp = radius_pairmake(request, &request->reply->vps, name, "", T_OP_EQ);
718
719
       if (!vp) {
719
 
               DEBUG("rlm_mschap: mppe_add_reply failed to create attribute %s: %s\n", name, librad_errstr);
 
720
               RDEBUG("rlm_mschap: mppe_add_reply failed to create attribute %s: %s\n", name, fr_strerror());
720
721
               return;
721
722
       }
722
723
 
761
762
         *      know what to do...
762
763
         */
763
764
        if (!inst->ntlm_auth && do_ntlm_auth) {
764
 
                DEBUG2("  rlm_mschap: Asked to use ntlm_auth, but it was not configured in the mschap{} section.");
 
765
                RDEBUG2("Asked to use ntlm_auth, but it was not configured in the mschap{} section.");
765
766
                return -1;
766
767
        }
767
768
 
773
774
                 *      No password: can't do authentication.
774
775
                 */
775
776
                if (!password) {
776
 
                        DEBUG2("  rlm_mschap: FAILED: No NT/LM-Password.  Cannot perform authentication.");
 
777
                        RDEBUG2("FAILED: No NT/LM-Password.  Cannot perform authentication.");
777
778
                        return -1;
778
779
                }
779
780
 
806
807
                                             buffer, sizeof(buffer),
807
808
                                             NULL, NULL, 1);
808
809
                if (result != 0) {
809
 
                        DEBUG2("  rlm_mschap: External script failed.");
 
810
                        RDEBUG2("External script failed.");
810
811
                        return -1;
811
812
                }
812
813
 
817
818
                 *      NT_KEY: 000102030405060708090a0b0c0d0e0f
818
819
                 */
819
820
                if (memcmp(buffer, "NT_KEY: ", 8) != 0) {
820
 
                        DEBUG2("  rlm_mschap: Invalid output from ntlm_auth: expecting NT_KEY");
 
821
                        RDEBUG2("Invalid output from ntlm_auth: expecting NT_KEY");
821
822
                        return -1;
822
823
                }
823
824
 
826
827
                 *      with an LF at the end.
827
828
                 */
828
829
                if (strlen(buffer + 8) < 32) {
829
 
                        DEBUG2("  rlm_mschap: Invalid output from ntlm_auth: NT_KEY has unexpected length");
 
830
                        RDEBUG2("Invalid output from ntlm_auth: NT_KEY has unexpected length");
830
831
                        return -1;
831
832
                }
832
833
 
834
835
                 *      Update the NT hash hash, from the NT key.
835
836
                 */
836
837
                if (fr_hex2bin(buffer + 8, nthashhash, 16) != 16) {
837
 
                        DEBUG2("  rlm_mschap: Invalid output from ntlm_auth: NT_KEY has non-hex values");
 
838
                        RDEBUG2("Invalid output from ntlm_auth: NT_KEY has non-hex values");
838
839
                        return -1;
839
840
                }
840
841
        }
984
985
         *      Nothing we recognize.  Don't do anything.
985
986
         */
986
987
        if (!response) {
987
 
                DEBUG2("  rlm_mschap: Found MS-CHAP-Challenge, but no MS-CHAP-Response.");
 
988
                RDEBUG2("Found MS-CHAP-Challenge, but no MS-CHAP-Response.");
988
989
                return RLM_MODULE_NOOP;
989
990
        }
990
991
 
991
992
        if (pairfind(request->config_items, PW_AUTH_TYPE)) {
992
 
                DEBUG2("  rlm_mschap: Found existing Auth-Type.  Not changing it.");
 
993
                RDEBUG2("Found existing Auth-Type.  Not changing it.");
993
994
                return RLM_MODULE_NOOP;
994
995
        }
995
996
 
996
 
        DEBUG2("  rlm_mschap: Found MS-CHAP attributes.  Setting 'Auth-Type  = %s'", inst->xlat_name);
 
997
        RDEBUG2("Found MS-CHAP attributes.  Setting 'Auth-Type  = %s'", inst->xlat_name);
997
998
 
998
999
        /*
999
1000
         *      Set Auth-Type to MS-CHAP.  The authentication code
1067
1068
                 *      Password is not required.
1068
1069
                 */
1069
1070
                if ((smb_ctrl->vp_integer & ACB_PWNOTREQ) != 0) {
1070
 
                        DEBUG2("  rlm_mschap: SMB-Account-Ctrl says no password is required.");
 
1071
                        RDEBUG2("SMB-Account-Ctrl says no password is required.");
1071
1072
                        return RLM_MODULE_OK;
1072
1073
                }
1073
1074
        }
1089
1090
                    ((lm_password->length == 32) &&
1090
1091
                     (fr_hex2bin(lm_password->vp_strvalue,
1091
1092
                                 lm_password->vp_octets, 16) == 16))) {
1092
 
                        DEBUG2("  rlm_mschap: Found LM-Password");
 
1093
                        RDEBUG2("Found LM-Password");
1093
1094
                        lm_password->length = 16;
1094
1095
 
1095
1096
                } else {
1096
 
                        radlog(L_ERR, "rlm_mschap: Invalid LM-Password");
 
1097
                        radlog_request(L_ERR, 0, request, "Invalid LM-Password");
1097
1098
                        lm_password = NULL;
1098
1099
                }
1099
1100
 
1100
1101
        } else if (!password) {
1101
 
                DEBUG2("  rlm_mschap: No Cleartext-Password configured.  Cannot create LM-Password.");
 
1102
                RDEBUG2("No Cleartext-Password configured.  Cannot create LM-Password.");
1102
1103
 
1103
1104
        } else {                /* there is a configured Cleartext-Password */
1104
1105
                lm_password = radius_pairmake(request, &request->config_items,
1105
1106
                                              "LM-Password", "", T_OP_EQ);
1106
1107
                if (!lm_password) {
1107
 
                        radlog(L_ERR, "No memory");
 
1108
                        radlog_request(L_ERR, 0, request, "No memory");
1108
1109
                } else {
1109
1110
                        smbdes_lmpwdhash(password->vp_strvalue,
1110
1111
                                         lm_password->vp_octets);
1121
1122
                    ((nt_password->length == 32) &&
1122
1123
                     (fr_hex2bin(nt_password->vp_strvalue,
1123
1124
                                 nt_password->vp_octets, 16) == 16))) {
1124
 
                        DEBUG2("  rlm_mschap: Found NT-Password");
 
1125
                        RDEBUG2("Found NT-Password");
1125
1126
                        nt_password->length = 16;
1126
1127
 
1127
1128
                } else {
1128
 
                        radlog(L_ERR, "rlm_mschap: Invalid NT-Password");
 
1129
                        radlog_request(L_ERR, 0, request, "Invalid NT-Password");
1129
1130
                        nt_password = NULL;
1130
1131
                }
1131
1132
        } else if (!password) {
1132
 
                DEBUG2("  rlm_mschap: No Cleartext-Password configured.  Cannot create NT-Password.");
 
1133
                RDEBUG2("No Cleartext-Password configured.  Cannot create NT-Password.");
1133
1134
 
1134
1135
        } else {                /* there is a configured Cleartext-Password */
1135
1136
                nt_password = radius_pairmake(request, &request->config_items,
1136
1137
                                              "NT-Password", "", T_OP_EQ);
1137
1138
                if (!nt_password) {
1138
 
                        radlog(L_ERR, "No memory");
 
1139
                        radlog_request(L_ERR, 0, request, "No memory");
1139
1140
                        return RLM_MODULE_FAIL;
1140
1141
                } else {
1141
1142
                        ntpwdhash(nt_password->vp_octets,
1146
1147
 
1147
1148
        challenge = pairfind(request->packet->vps, PW_MSCHAP_CHALLENGE);
1148
1149
        if (!challenge) {
1149
 
                DEBUG2("  rlm_mschap: No MS-CHAP-Challenge in the request");
 
1150
                RDEBUG2("No MS-CHAP-Challenge in the request");
1150
1151
                return RLM_MODULE_REJECT;
1151
1152
        }
1152
1153
 
1165
1166
                 *      MS-CHAPv1 challenges are 8 octets.
1166
1167
                 */
1167
1168
                if (challenge->length < 8) {
1168
 
                        radlog(L_AUTH, "rlm_mschap: MS-CHAP-Challenge has the wrong format.");
 
1169
                        radlog_request(L_AUTH, 0, request, "MS-CHAP-Challenge has the wrong format.");
1169
1170
                        return RLM_MODULE_INVALID;
1170
1171
                }
1171
1172
 
1173
1174
                 *      Responses are 50 octets.
1174
1175
                 */
1175
1176
                if (response->length < 50) {
1176
 
                        radlog(L_AUTH, "rlm_mschap: MS-CHAP-Response has the wrong format.");
 
1177
                        radlog_request(L_AUTH, 0, request, "MS-CHAP-Response has the wrong format.");
1177
1178
                        return RLM_MODULE_INVALID;
1178
1179
                }
1179
1180
 
1182
1183
                 *      response
1183
1184
                 */
1184
1185
                if (response->vp_octets[1] & 0x01) {
1185
 
                        DEBUG2("  rlm_mschap: Told to do MS-CHAPv1 with NT-Password");
 
1186
                        RDEBUG2("Told to do MS-CHAPv1 with NT-Password");
1186
1187
                        password = nt_password;
1187
1188
                        offset = 26;
1188
1189
                } else {
1189
 
                        DEBUG2("  rlm_mschap: Told to do MS-CHAPv1 with LM-Password");
 
1190
                        RDEBUG2("Told to do MS-CHAPv1 with LM-Password");
1190
1191
                        password = lm_password;
1191
1192
                        offset = 2;
1192
1193
                }
1196
1197
                 */
1197
1198
                if (do_mschap(inst, request, password, challenge->vp_octets,
1198
1199
                              response->vp_octets + offset, nthashhash) < 0) {
1199
 
                        DEBUG2("  rlm_mschap: MS-CHAP-Response is incorrect.");
1200
 
                        mschap_add_reply(&request->reply->vps,
 
1200
                        RDEBUG2("MS-CHAP-Response is incorrect.");
 
1201
                        mschap_add_reply(request, &request->reply->vps,
1201
1202
                                         *response->vp_octets,
1202
1203
                                         "MS-CHAP-Error", "E=691 R=1", 9);
1203
1204
                        return RLM_MODULE_REJECT;
1212
1213
                 *      MS-CHAPv2 challenges are 16 octets.
1213
1214
                 */
1214
1215
                if (challenge->length < 16) {
1215
 
                        radlog(L_AUTH, "rlm_mschap: MS-CHAP-Challenge has the wrong format.");
 
1216
                        radlog_request(L_AUTH, 0, request, "MS-CHAP-Challenge has the wrong format.");
1216
1217
                        return RLM_MODULE_INVALID;
1217
1218
                }
1218
1219
 
1220
1221
                 *      Responses are 50 octets.
1221
1222
                 */
1222
1223
                if (response->length < 50) {
1223
 
                        radlog(L_AUTH, "rlm_mschap: MS-CHAP-Response has the wrong format.");
 
1224
                        radlog_request(L_AUTH, 0, request, "MS-CHAP-Response has the wrong format.");
1224
1225
                        return RLM_MODULE_INVALID;
1225
1226
                }
1226
1227
 
1229
1230
                 */
1230
1231
                username = pairfind(request->packet->vps, PW_USER_NAME);
1231
1232
                if (!username) {
1232
 
                        radlog(L_AUTH, "rlm_mschap: We require a User-Name for MS-CHAPv2");
 
1233
                        radlog_request(L_AUTH, 0, request, "We require a User-Name for MS-CHAPv2");
1233
1234
                        return RLM_MODULE_INVALID;
1234
1235
                }
1235
1236
 
1241
1242
                        if (inst->with_ntdomain_hack) {
1242
1243
                                username_string++;
1243
1244
                        } else {
1244
 
                                DEBUG2("  rlm_mschap: NT Domain delimeter found, should we have enabled with_ntdomain_hack?");
 
1245
                                RDEBUG2("  NT Domain delimeter found, should we have enabled with_ntdomain_hack?");
1245
1246
                                username_string = username->vp_strvalue;
1246
1247
                        }
1247
1248
                } else {
1254
1255
                 *      OpenDirectory authentication.
1255
1256
                 */
1256
1257
                if (!nt_password && inst->open_directory) {
1257
 
                        DEBUG2("  rlm_mschap: No NT-Password configured. Trying DirectoryService Authentication.");
 
1258
                        RDEBUG2("No NT-Password configured. Trying DirectoryService Authentication.");
1258
1259
                        return od_mschap_auth(request, challenge, username);
1259
1260
                }
1260
1261
#endif
1270
1271
                               username_string, /* user name */
1271
1272
                               mschapv1_challenge); /* resulting challenge */
1272
1273
 
1273
 
                DEBUG2("  rlm_mschap: Told to do MS-CHAPv2 for %s with NT-Password",
 
1274
                RDEBUG2("Told to do MS-CHAPv2 for %s with NT-Password",
1274
1275
                       username_string);
1275
1276
 
1276
1277
                if (do_mschap(inst, request, nt_password, mschapv1_challenge,
1277
1278
                              response->vp_octets + 26, nthashhash) < 0) {
1278
 
                        DEBUG2("  rlm_mschap: FAILED: MS-CHAP2-Response is incorrect");
1279
 
                        mschap_add_reply(&request->reply->vps,
 
1279
                        RDEBUG2("FAILED: MS-CHAP2-Response is incorrect");
 
1280
                        mschap_add_reply(request, &request->reply->vps,
1280
1281
                                         *response->vp_octets,
1281
1282
                                         "MS-CHAP-Error", "E=691 R=1", 9);
1282
1283
                        return RLM_MODULE_REJECT;
1294
1295
                              response->vp_octets + 2, /* peer challenge */
1295
1296
                              challenge->vp_octets, /* our challenge */
1296
1297
                              msch2resp); /* calculated MPPE key */
1297
 
                mschap_add_reply(&request->reply->vps, *response->vp_octets,
 
1298
                mschap_add_reply(request, &request->reply->vps, *response->vp_octets,
1298
1299
                                 "MS-CHAP2-Success", msch2resp, 42);
1299
1300
                chap = 2;
1300
1301
 
1301
1302
        } else {                /* Neither CHAPv1 or CHAPv2 response: die */
1302
 
                radlog(L_AUTH, "rlm_mschap: No MS-CHAP response found");
 
1303
                radlog_request(L_AUTH, 0, request, "No MS-CHAP response found");
1303
1304
                return RLM_MODULE_INVALID;
1304
1305
        }
1305
1306
 
1317
1318
                 */
1318
1319
                if (((smb_ctrl->vp_integer & ACB_DISABLED) != 0) ||
1319
1320
                    ((smb_ctrl->vp_integer & ACB_NORMAL) == 0)) {
1320
 
                        DEBUG2("  rlm_mschap: SMB-Account-Ctrl says that the account is disabled, or is not a normal account.");
1321
 
                        mschap_add_reply( &request->reply->vps,
 
1321
                        RDEBUG2("SMB-Account-Ctrl says that the account is disabled, or is not a normal account.");
 
1322
                        mschap_add_reply(request, &request->reply->vps,
1322
1323
                                          *response->vp_octets,
1323
1324
                                          "MS-CHAP-Error", "E=691 R=1", 9);
1324
1325
                        return RLM_MODULE_NOTFOUND;
1328
1329
                 *      User is locked out.
1329
1330
                 */
1330
1331
                if ((smb_ctrl->vp_integer & ACB_AUTOLOCK) != 0) {
1331
 
                        DEBUG2("  rlm_mschap: SMB-Account-Ctrl says that the account is locked out.");
1332
 
                        mschap_add_reply( &request->reply->vps,
 
1332
                        RDEBUG2("SMB-Account-Ctrl says that the account is locked out.");
 
1333
                        mschap_add_reply(request, &request->reply->vps,
1333
1334
                                          *response->vp_octets,
1334
1335
                                          "MS-CHAP-Error", "E=647 R=0", 9);
1335
1336
                        return RLM_MODULE_USERLOCK;
1342
1343
                uint8_t mppe_recvkey[34];
1343
1344
 
1344
1345
                if (chap == 1){
1345
 
                        DEBUG2("rlm_mschap: adding MS-CHAPv1 MPPE keys");
 
1346
                        RDEBUG2("adding MS-CHAPv1 MPPE keys");
1346
1347
                        memset(mppe_sendkey, 0, 32);
1347
1348
                        if (lm_password) {
1348
1349
                                memcpy(mppe_sendkey, lm_password->vp_octets, 8);
1366
1367
                                       "MS-CHAP-MPPE-Keys",
1367
1368
                                       mppe_sendkey, 32);
1368
1369
                } else if (chap == 2) {
1369
 
                        DEBUG2("rlm_mschap: adding MS-CHAPv2 MPPE keys");
 
1370
                        RDEBUG2("adding MS-CHAPv2 MPPE keys");
1370
1371
                        mppe_chap2_gen_keys128(nthashhash,
1371
1372
                                               response->vp_octets + 26,
1372
1373
                                               mppe_sendkey, mppe_recvkey);