X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Frlm_eap%2Ftypes%2Frlm_eap_leap%2Feap_leap.c;h=edf46c0f4e2bf4afa20b94636f266b6dea56de9e;hb=94dc4bb60ec649ce899c1d5e32b575d9523a48f2;hp=a85e0d1bc92606b36ca964d4987463ed3fcee272;hpb=ff326bc1396d674a84152c8748a590071a2a5797;p=freeradius.git diff --git a/src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c b/src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c index a85e0d1..edf46c0 100644 --- a/src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c +++ b/src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c @@ -201,8 +201,9 @@ LEAP_PACKET *eapleap_extract(EAP_DS *eap_ds) */ static int eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password) { - if (password->attribute == PW_PASSWORD) { - int i; + if ((password->attribute == PW_USER_PASSWORD) || + (password->attribute == PW_CLEARTEXT_PASSWORD)) { + size_t i; unsigned char unicode[512]; /* @@ -220,12 +221,12 @@ static int eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password) /* * Get the NT Password hash. */ - md4_calc(ntpwdhash, unicode, password->length * 2); + fr_md4_calc(ntpwdhash, unicode, password->length * 2); } else { /* MUST be NT-Password */ if (password->length == 32) { - password->length = lrad_hex2bin(password->vp_strvalue, - password->vp_strvalue, + password->length = fr_hex2bin(password->vp_strvalue, + password->vp_octets, 16); } if (password->length != 16) { @@ -281,11 +282,11 @@ LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request, VALUE_PAIR *user_name, VALUE_PAIR* password, leap_session_t *session, VALUE_PAIR **reply_vps) { - int i; + size_t i; unsigned char ntpwdhash[16], ntpwdhashhash[16]; unsigned char buffer[256]; LEAP_PACKET *reply; - char *p; + unsigned char *p; VALUE_PAIR *vp; /* @@ -333,7 +334,7 @@ LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request, eapleap_free(&reply); return NULL; } - md4_calc(ntpwdhashhash, ntpwdhash, 16); + fr_md4_calc(ntpwdhashhash, ntpwdhash, 16); /* * Calculate our response, to authenticate ourselves @@ -364,12 +365,11 @@ LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request, memcpy(p, session->peer_challenge, 8); /* PC */ p += 8; memcpy(p, session->peer_response, 24); /* PR */ - p += 24; /* * These 16 bytes are the session key to use. */ - librad_md5_calc(ntpwdhash, buffer, 16 + 8 + 24 + 8 + 24); + fr_md5_calc(ntpwdhash, buffer, 16 + 8 + 24 + 8 + 24); memcpy(vp->vp_strvalue + vp->length, ntpwdhash, 16); memset(vp->vp_strvalue + vp->length + 16, 0, @@ -377,7 +377,7 @@ LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request, i = 16; rad_tunnel_pwencode(vp->vp_strvalue + vp->length, &i, - request->secret, request->packet->vector); + request->client->secret, request->packet->vector); vp->length += i; pairadd(reply_vps, vp); @@ -414,7 +414,7 @@ LEAP_PACKET *eapleap_initiate(UNUSED EAP_DS *eap_ds, VALUE_PAIR *user_name) * Fill the challenge with random bytes. */ for (i = 0; i < reply->count; i++) { - reply->challenge[i] = lrad_rand(); + reply->challenge[i] = fr_rand(); } DEBUG2(" rlm_eap_leap: Issuing AP Challenge");