From d5009960b362f79a77755540780f63d3b13e9007 Mon Sep 17 00:00:00 2001 From: Tijs Van Buggenhout Date: Wed, 6 Jan 2021 14:59:04 +0100 Subject: [PATCH] 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 --- pppd/eap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- 2.39.2