3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

mschaputil: use util_get_username

This commit is contained in:
James Prestwood 2019-04-08 11:15:20 -07:00 committed by Denis Kenzior
parent 86ce4a8b09
commit 1e337259ce
2 changed files with 3 additions and 15 deletions

View File

@ -422,6 +422,7 @@ unit_test_wsc_LDADD = $(ell_ldadd)
unit_test_eap_mschapv2_SOURCES = src/eap-mschapv2.h src/eap-mschapv2.c \ unit_test_eap_mschapv2_SOURCES = src/eap-mschapv2.h src/eap-mschapv2.c \
src/eap.c src/eap.h src/eap-private.h \ src/eap.c src/eap.h src/eap-private.h \
src/mschaputil.h src/mschaputil.c \ src/mschaputil.h src/mschaputil.c \
src/util.h src/util.c \
unit/test-eap-mschapv2.c unit/test-eap-mschapv2.c
unit_test_eap_mschapv2_LDADD = $(ell_ldadd) unit_test_eap_mschapv2_LDADD = $(ell_ldadd)

View File

@ -28,6 +28,7 @@
#include "src/missing.h" #include "src/missing.h"
#include "src/mschaputil.h" #include "src/mschaputil.h"
#include "src/util.h"
/** /**
* Internal function for generate_nt_response. * Internal function for generate_nt_response.
@ -125,20 +126,6 @@ cleanup:
return r; return r;
} }
static const char *mschapv2_exlude_domain_name(const char *username)
{
const char *c;
for (c = username; *c; c++) {
if (*c != '\\')
continue;
return c + 1;
}
return username;
}
/** /**
* Internal function to generate the challenge used in nt_response * Internal function to generate the challenge used in nt_response
* https://tools.ietf.org/html/rfc2759 * https://tools.ietf.org/html/rfc2759
@ -161,7 +148,7 @@ static bool mschapv2_challenge_hash(const uint8_t *peer_challenge,
if (!check) if (!check)
return false; return false;
username = mschapv2_exlude_domain_name(username); username = util_get_username(username);
l_checksum_update(check, peer_challenge, 16); l_checksum_update(check, peer_challenge, 16);
l_checksum_update(check, server_challenge, 16); l_checksum_update(check, server_challenge, 16);