106-debian_stripMSdomain.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. pppd: Implement option to strip domain part from MS CHAP response
  2. This patch implements a new boolean option "chapms-strip-domain" which
  3. strips the leading domain part of the username in a received MS Chap
  4. response.
  5. When the option is set, all leading chars up to and including the last
  6. backslash in the username are stripped. The option defaults to false.
  7. The patch originated from the Debian project.
  8. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
  9. --- a/pppd/chap-new.c
  10. +++ b/pppd/chap-new.c
  11. @@ -58,6 +58,7 @@ int (*chap_verify_hook)(char *name, char
  12. int chap_timeout_time = 3;
  13. int chap_max_transmits = 10;
  14. int chap_rechallenge_time = 0;
  15. +int chapms_strip_domain = 0;
  16. /*
  17. * Command-line options.
  18. @@ -69,6 +70,8 @@ static option_t chap_option_list[] = {
  19. "Set max #xmits for challenge", OPT_PRIO },
  20. { "chap-interval", o_int, &chap_rechallenge_time,
  21. "Set interval for rechallenge", OPT_PRIO },
  22. + { "chapms-strip-domain", o_bool, &chapms_strip_domain,
  23. + "Strip the domain prefix before the Username", 1 },
  24. { NULL }
  25. };
  26. @@ -336,6 +339,14 @@ chap_handle_response(struct chap_server_
  27. /* Null terminate and clean remote name. */
  28. slprintf(rname, sizeof(rname), "%.*v", len, name);
  29. name = rname;
  30. +
  31. + /* strip the MS domain name */
  32. + if (chapms_strip_domain && strrchr(rname, '\\')) {
  33. + char tmp[MAXNAMELEN+1];
  34. +
  35. + strcpy(tmp, strrchr(rname, '\\') + 1);
  36. + strcpy(rname, tmp);
  37. + }
  38. }
  39. if (chap_verify_hook)