commit 1e337259ceb9de011f188e4376f1171a4c9cc43c
parent 86ce4a8b09af3765147a0f454b82741eb1f2c377
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Mon, 8 Apr 2019 11:15:20 -0700
mschaputil: use util_get_username
Diffstat:
2 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/Makefile.am b/Makefile.am
@@ -422,6 +422,7 @@ 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)
diff --git a/src/mschaputil.c b/src/mschaputil.c
@@ -28,6 +28,7 @@
#include "src/missing.h"
#include "src/mschaputil.h"
+#include "src/util.h"
/**
* Internal function for generate_nt_response.
@@ -125,20 +126,6 @@ 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
@@ -161,7 +148,7 @@ static bool mschapv2_challenge_hash(const uint8_t *peer_challenge,
if (!check)
return false;
- username = mschapv2_exlude_domain_name(username);
+ username = util_get_username(username);
l_checksum_update(check, peer_challenge, 16);
l_checksum_update(check, server_challenge, 16);