From: Amos Jeffries Date: Sat, 22 Sep 2012 12:19:01 +0000 (+1200) Subject: Fix AF code handling X-Git-Tag: SQUID_3_4_0_1~471^2~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b7a812f60769caa53afc685b12cf5296558525a;p=thirdparty%2Fsquid.git Fix AF code handling Syntax is not "blob" [username]" but "[blob] username" --- diff --git a/src/HelperReply.cc b/src/HelperReply.cc index cfd7015627..90721f99b7 100644 --- a/src/HelperReply.cc +++ b/src/HelperReply.cc @@ -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