]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix AF code handling
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 22 Sep 2012 12:19:01 +0000 (00:19 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 22 Sep 2012 12:19:01 +0000 (00:19 +1200)
Syntax is not "blob" [username]" but "[blob] username"

src/HelperReply.cc

index cfd7015627d4d26c5ff21207ce909af7324f4be0..90721f99b7dcee9809b2d9e9e72c1daacc431975 100644 (file)
@@ -42,16 +42,19 @@ HelperReply::HelperReply(const char *buf, size_t len, bool urlQuoting) :
             // NTLM/Negotate OK response
             result = HelperReply::OK;
             p+=3;
-            // followed by an auth token
-            char *token = strwordtok(NULL, &p);
-            authToken.init();
-            authToken.append(token, strlen(token));
-            // ... and an optional username field
-            for(;xisspace(*p);p++); // skip whitespace
-            if (*p) {
-                 user.init();
-                 user.append(p,strlen(p));
-                 p += user.size();
+            // followed by:
+            //  an auth token and user field
+            // or, an optional username field
+            char *blob = strwordtok(NULL, &p);
+            char *arg = strwordtok(NULL, &p);
+            if (arg != NULL) {
+                authToken.init();
+                authToken.append(blob, strlen(blob));
+                user.init();
+                user.append(arg,strlen(arg));
+            } else if (blob != NULL) {
+                user.init();
+                user.append(blob, strlen(blob));
             }
         } else if (!strncmp(p,"NA ",3)) {
             // NTLM fail-closed ERR response