]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Support strip MS domain name for EAP MSCHAPv2
authorTijs Van Buggenhout <tvbuggen@gmail.com>
Wed, 6 Jan 2021 13:59:04 +0000 (14:59 +0100)
committerTijs Van Buggenhout <tvbuggen@gmail.com>
Wed, 6 Jan 2021 14:21:59 +0000 (15:21 +0100)
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 <tvbuggen@gmail.com>
pppd/eap.c

index 4daada7bb56cd67dea305ba30cf46f5f1bc18370..342d91f0897d341c4ddf6132c507cac2f67b1d97 100644 (file)
@@ -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