]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3442: assertion failed: external_acl.cc:908: ch->auth_user_request != NULL
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 8 Dec 2011 11:13:29 +0000 (04:13 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 8 Dec 2011 11:13:29 +0000 (04:13 -0700)
External ACL sometimes cannot find the credentials in ACL Checklist even
if they are attached to the HTTPRequest object.

This seems to happen when the checklist is created and the line match
started before the credentials are known. The credentials validation
updates the HTTP request state but is not aware of ACL checklists needing
to be updated so it never happens.

This patch:
* locate the %LOGIN value from either place where credentials can be found,
* updates the checklist if it was unset,
* passes '-' to the helper if no credentials at all were given.

Although the earlier logics forcing a lookup means this '-' case should
not happen it might if the external ACL were processed in 'fast' check.

src/external_acl.cc

index c91339f8a444de9ce077bcc414b4b3e6ba501261..37d0d60a3767a703f9bfbec822ebda94ebf0a2f1 100644 (file)
@@ -838,8 +838,13 @@ makeExternalAclKey(ACLFilledChecklist * ch, external_acl_data * acl_data)
         switch (format->type) {
 
         case _external_acl_format::EXT_ACL_LOGIN:
-            assert (ch->auth_user_request);
-            str = ch->auth_user_request->username();
+            // if this ACL line was the cause of credentials fetch
+            // they may not already be in the checklist
+            if (ch->auth_user_request == NULL && ch->request)
+                ch->auth_user_request = ch->request->auth_user_request;
+
+            if (ch->auth_user_request != NULL)
+                str = ch->auth_user_request->username();
             break;
 #if USE_IDENT