Revert "mschaputil: use util_get_username"

This reverts commit 1e337259ce.

Using util_get_username was wrong in this context.  MSCHAPv2 expects us
to only strip the domain name from identities of the form
domain\identity.  util_get_username would also strip identities of the
form username@domain.com.
This commit is contained in:
Denis Kenzior 2019-04-18 10:46:37 -05:00
parent 349acf292f
commit b768e26f1d
2 changed files with 15 additions and 3 deletions

View File

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

View File

@ -28,7 +28,6 @@
#include "src/missing.h"
#include "src/mschaputil.h"
#include "src/util.h"
/**
* Internal function for generate_nt_response.
@ -126,6 +125,20 @@ cleanup:
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
* https://tools.ietf.org/html/rfc2759
@ -148,7 +161,7 @@ static bool mschapv2_challenge_hash(const uint8_t *peer_challenge,
if (!check)
return false;
username = util_get_username(username);
username = mschapv2_exlude_domain_name(username);
l_checksum_update(check, peer_challenge, 16);
l_checksum_update(check, server_challenge, 16);