]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Strip domain from username for squid 3 and delay_pools class4
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 21 Mar 2008 06:01:58 +0000 (18:01 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 21 Mar 2008 06:01:58 +0000 (18:01 +1200)
Usage in squid.conf:
  auth_param ntlm program /usr/local/libexec/squid/fakeauth_auth -S

And i nave username without domain from ntlm_auth.

helpers/ntlm_auth/fakeauth/fakeauth_auth.c

index eb4cb5183825fdc904fcd69221ff1d8275271a83..6834a17ce7586c61d81caf9236fbc881d7f01335 100644 (file)
@@ -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);