projects
/
freeradius.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
backport from HEAD
[freeradius.git]
/
src
/
modules
/
rlm_otp
/
otp_pwe.c
diff --git
a/src/modules/rlm_otp/otp_pwe.c
b/src/modules/rlm_otp/otp_pwe.c
index
0eac7fc
..
6fd23cc
100644
(file)
--- a/
src/modules/rlm_otp/otp_pwe.c
+++ b/
src/modules/rlm_otp/otp_pwe.c
@@
-29,7
+29,7
@@
#ifdef FREERADIUS
#define _LRAD_MD4_H
#define _LRAD_SHA1_H
#ifdef FREERADIUS
#define _LRAD_MD4_H
#define _LRAD_SHA1_H
-#include <
freeradius-devel/
rad_assert.h>
+#include <rad_assert.h>
#endif
#include "otp.h"
#include "otp_pwe.h"
#endif
#include "otp.h"
#include "otp_pwe.h"
@@
-157,7
+157,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
switch(pwattr[attr]) {
case PW_PASSWORD:
DEBUG("%s: %s: handling PW_PASSWORD", log_prefix, __func__);
switch(pwattr[attr]) {
case PW_PASSWORD:
DEBUG("%s: %s: handling PW_PASSWORD", log_prefix, __func__);
- nmatch = strcmp(password, resp_vp->
vp_
strvalue);
+ nmatch = strcmp(password, resp_vp->strvalue);
break;
case PW_CHAP_PASSWORD:
break;
case PW_CHAP_PASSWORD:
@@
-190,12
+190,12
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
nmatch = -1;
break;
}
nmatch = -1;
break;
}
- input[0] = *(resp_vp->
vp_
strvalue);
+ input[0] = *(resp_vp->strvalue);
(void) memcpy(&input[1], password, strlen(password));
(void) memcpy(&input[1], password, strlen(password));
- (void) memcpy(&input[1+strlen(password)], chal_vp->
vp_
strvalue,
+ (void) memcpy(&input[1+strlen(password)], chal_vp->strvalue,
chal_vp->length);
(void) MD5(input, 1 + strlen(password) + chal_vp->length, output);
chal_vp->length);
(void) MD5(input, 1 + strlen(password) + chal_vp->length, output);
- nmatch = memcmp(output, &(resp_vp->
vp_
strvalue)[1], MD5_DIGEST_LENGTH);
+ nmatch = memcmp(output, &(resp_vp->strvalue)[1], MD5_DIGEST_LENGTH);
} /* case PW_CHAP_PASSWORD */
break;
} /* case PW_CHAP_PASSWORD */
break;
@@
-237,7
+237,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
nmatch = -1;
break;
}
nmatch = -1;
break;
}
- if ((resp_vp->
vp_
strvalue)[1] != 1) {
+ if ((resp_vp->strvalue)[1] != 1) {
otp_log(OTP_LOG_AUTH,
"%s: %s: MS-CHAP-Response bad flags (LM not supported)",
log_prefix, __func__);
otp_log(OTP_LOG_AUTH,
"%s: %s: MS-CHAP-Response bad flags (LM not supported)",
log_prefix, __func__);
@@
-268,7
+268,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
(void) MD4(input, 2 * password_len, nt_keys);
/* The challenge gets encrypted. */
(void) MD4(input, 2 * password_len, nt_keys);
/* The challenge gets encrypted. */
- (void) memcpy(input, chal_vp->
vp_
strvalue, 8);
+ (void) memcpy(input, chal_vp->strvalue, 8);
/* Convert the password hash to keys, and do the encryptions. */
for (i = 0; i < 3; ++i) {
/* Convert the password hash to keys, and do the encryptions. */
for (i = 0; i < 3; ++i) {
@@
-282,7
+282,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
ks, DES_ENCRYPT);
}
ks, DES_ENCRYPT);
}
- nmatch = memcmp(output, resp_vp->
vp_
strvalue + 26, 24);
+ nmatch = memcmp(output, resp_vp->strvalue + 26, 24);
if (nmatch || !vps)
break;
if (nmatch || !vps)
break;
@@
-412,12
+412,12
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
{
SHA_CTX ctx;
unsigned char md[SHA_DIGEST_LENGTH];
{
SHA_CTX ctx;
unsigned char md[SHA_DIGEST_LENGTH];
- char *username = request->username->
vp_
strvalue;
+ char *username = request->username->strvalue;
int username_len = request->username->length;
SHA1_Init(&ctx);
int username_len = request->username->length;
SHA1_Init(&ctx);
- SHA1_Update(&ctx, resp_vp->
vp_
strvalue + 2, 16);
- SHA1_Update(&ctx, chal_vp->
vp_
strvalue, 16);
+ SHA1_Update(&ctx, resp_vp->strvalue + 2, 16);
+ SHA1_Update(&ctx, chal_vp->strvalue, 16);
SHA1_Update(&ctx, username, username_len);
SHA1_Final(md, &ctx);
SHA1_Update(&ctx, username, username_len);
SHA1_Final(md, &ctx);
@@
-436,7
+436,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
ks, DES_ENCRYPT);
}
ks, DES_ENCRYPT);
}
- nmatch = memcmp(output, resp_vp->
vp_
strvalue + 26, 24);
+ nmatch = memcmp(output, resp_vp->strvalue + 26, 24);
if (nmatch || !vps)
break;
if (nmatch || !vps)
break;
@@
-466,7
+466,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
/* 0x (ID) ( ASCII("S="ASCII(auth_md))) */
char auth_octet_string[2 + 2 + (2 * sizeof(auth_md_string))];
/* 0x (ID) ( ASCII("S="ASCII(auth_md))) */
char auth_octet_string[2 + 2 + (2 * sizeof(auth_md_string))];
- char *username = request->username->
vp_
strvalue;
+ char *username = request->username->strvalue;
int username_len = request->username->length;
/* "Magic server to client signing constant" */
int username_len = request->username->length;
/* "Magic server to client signing constant" */
@@
-487,14
+487,14
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
(void) MD4(nt_keys, MD4_DIGEST_LENGTH, password_md_md);
SHA1_Init(&ctx);
SHA1_Update(&ctx, password_md_md, MD4_DIGEST_LENGTH);
(void) MD4(nt_keys, MD4_DIGEST_LENGTH, password_md_md);
SHA1_Init(&ctx);
SHA1_Update(&ctx, password_md_md, MD4_DIGEST_LENGTH);
- SHA1_Update(&ctx, resp_vp->
vp_
strvalue + 26, 24);
+ SHA1_Update(&ctx, resp_vp->strvalue + 26, 24);
SHA1_Update(&ctx, magic1, sizeof(magic1));
SHA1_Final(md1, &ctx);
/* MD2 */
SHA1_Init(&ctx);
SHA1_Update(&ctx, magic1, sizeof(magic1));
SHA1_Final(md1, &ctx);
/* MD2 */
SHA1_Init(&ctx);
- SHA1_Update(&ctx, resp_vp->
vp_
strvalue + 2, 16);
- SHA1_Update(&ctx, chal_vp->
vp_
strvalue, 16);
+ SHA1_Update(&ctx, resp_vp->strvalue + 2, 16);
+ SHA1_Update(&ctx, chal_vp->strvalue, 16);
SHA1_Update(&ctx, username, username_len);
SHA1_Final(md2, &ctx);
SHA1_Update(&ctx, username, username_len);
SHA1_Final(md2, &ctx);
@@
-514,7
+514,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
/* And then octet conversion. Ugh! */
auth_octet_string[0] = '0';
auth_octet_string[1] = 'x';
/* And then octet conversion. Ugh! */
auth_octet_string[0] = '0';
auth_octet_string[1] = 'x';
- (void) sprintf(&auth_octet_string[2], "%02X", resp_vp->
vp_
strvalue[0]);
+ (void) sprintf(&auth_octet_string[2], "%02X", resp_vp->strvalue[0]);
for (i = 0; i < sizeof(auth_md_string) - 1; ++i)
(void) sprintf(&auth_octet_string[i * 2 +4], "%02X", auth_md_string[i]);
for (i = 0; i < sizeof(auth_md_string) - 1; ++i)
(void) sprintf(&auth_octet_string[i * 2 +4], "%02X", auth_md_string[i]);
@@
-624,7
+624,7
@@
otp_pwe_cmp(struct otp_pwe_cmp_t *data, const char *password,
/* Generate the master session key. */
SHA1_Init(&ctx);
SHA1_Update(&ctx, password_md_md, MD4_DIGEST_LENGTH);
/* Generate the master session key. */
SHA1_Init(&ctx);
SHA1_Update(&ctx, password_md_md, MD4_DIGEST_LENGTH);
- SHA1_Update(&ctx, resp_vp->
vp_
strvalue + 26, 24);
+ SHA1_Update(&ctx, resp_vp->strvalue + 26, 24);
SHA1_Update(&ctx, Magic1, sizeof(Magic1));
SHA1_Final(sha_md, &ctx);
(void) memcpy(MasterKey, sha_md, 16);
SHA1_Update(&ctx, Magic1, sizeof(Magic1));
SHA1_Final(sha_md, &ctx);
(void) memcpy(MasterKey, sha_md, 16);