From: Tijs Van Buggenhout Date: Wed, 6 Jan 2021 13:59:04 +0000 (+0100) Subject: pppd: Support strip MS domain name for EAP MSCHAPv2 X-Git-Tag: ppp-2.5.0~88^2 X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=d5009960b362f79a77755540780f63d3b13e9007;p=ppp.git pppd: Support strip MS domain name for EAP MSCHAPv2 Missing feature in preparation for validating the MSCHAPv2 response, as it was introduced in [1] later on. 1. https://github.com/paulusmack/ppp/commit/7f7ea8967e3b02234811a4b9bb893fc21544319c Signed-off-by: Tijs Van Buggenhout --- diff --git a/pppd/eap.c b/pppd/eap.c index 4daada7..342d91f 100644 --- a/pppd/eap.c +++ b/pppd/eap.c @@ -82,6 +82,8 @@ #ifdef CHAPMS #include "chap_ms.h" #include "chap-new.h" + +extern int chapms_strip_domain; #endif /* CHAPMS */ eap_state eap_states[NUM_PPP]; /* EAP state; one for each unit */ @@ -2545,6 +2547,14 @@ eap_response(eap_state *esp, u_char *inp, int id, int len) (remote_name[0] != '\0' && vallen == len)) strlcpy(rhostname, remote_name, sizeof (rhostname)); + /* strip the MS domain name */ + if (chapms_strip_domain && strrchr(rhostname, '\\')) { + char tmp[MAXNAMELEN+1]; + + strcpy(tmp, strrchr(rhostname, '\\') + 1); + strcpy(rhostname, tmp); + } + if (chap_verify_hook) chap_verifier = chap_verify_hook; else