From: Amos Jeffries Date: Fri, 21 Mar 2008 06:01:58 +0000 (+1200) Subject: Strip domain from username for squid 3 and delay_pools class4 X-Git-Tag: BASIC_TPROXY4~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0ec376ab3df0738191df4165a20b3d2a99ff55f;p=thirdparty%2Fsquid.git Strip domain from username for squid 3 and delay_pools class4 Usage in squid.conf: auth_param ntlm program /usr/local/libexec/squid/fakeauth_auth -S And i nave username without domain from ntlm_auth. --- diff --git a/helpers/ntlm_auth/fakeauth/fakeauth_auth.c b/helpers/ntlm_auth/fakeauth/fakeauth_auth.c index eb4cb51838..6834a17ce7 100644 --- a/helpers/ntlm_auth/fakeauth/fakeauth_auth.c +++ b/helpers/ntlm_auth/fakeauth/fakeauth_auth.c @@ -55,6 +55,7 @@ const char *authenticate_ntlm_domain = "WORKGROUP"; int debug_enabled = 0; +int strip_domain_enabled = 0; int NTLM_packet_debug_enabled = 0; /* NTLM authentication by ad@interlude.eu.org - 07/1999 */ @@ -327,6 +328,7 @@ usage(void) fprintf(stderr, "Usage: %s [-d] [-v] [-h]\n" " -d enable debugging.\n" + " -S strip domain from username.\n" " -v enable verbose NTLM packet debugging.\n" " -h this message\n\n", my_program_name); @@ -339,7 +341,7 @@ process_options(int argc, char *argv[]) int opt, had_error = 0; opterr = 0; - while (-1 != (opt = getopt(argc, argv, "hdv"))) { + while (-1 != (opt = getopt(argc, argv, "hdvS"))) { switch (opt) { case 'd': debug_enabled = 1; @@ -348,6 +350,9 @@ process_options(int argc, char *argv[]) debug_enabled = 1; NTLM_packet_debug_enabled = 1; break; + case 'S': + strip_domain_enabled = 1; + break; case 'h': usage(); exit(0); @@ -423,7 +428,12 @@ main(int argc, char *argv[]) if (!ntlmCheckHeader((ntlmhdr *) decoded, NTLM_AUTHENTICATE)) { if (!ntlmDecodeAuth((struct ntlm_authenticate *) decoded, user, 256)) { lc(user); + if (strip_domain_enabled) { + strtok_r(user, "\\", &p); + SEND2("AF %s", p); + } else { SEND2("AF %s", user); + } } else { lc(user); SEND2("NA invalid credentials, user=%s", user);