]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Revert Auth changes from b9814
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 15 Jul 2009 11:35:00 +0000 (23:35 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 15 Jul 2009 11:35:00 +0000 (23:35 +1200)
src/auth/Acl.cc
src/auth/UserRequest.cc

index affaffafae82a97474bf075b7e40f9eced84bae9..dddea7d0d4868363a03acef56623206bc58a7dd6 100644 (file)
@@ -6,11 +6,9 @@
 #include "auth/AclProxyAuth.h"
 #include "HttpRequest.h"
 
-/**
- * \retval -1 user not authenticated (authentication error?)
- * \retval  0 user not authorized OR user authentication is in progress
- * \retval +1 user authenticated and authorized
- */
+/** retval -1 user not authenticated (authentication error?)
+    retval  0 user not authorized OR user authentication is in pgrogress
+    retval +1 user authenticated and authorized */
 int
 AuthenticateAcl(ACLChecklist *ch)
 {
@@ -40,16 +38,19 @@ AuthenticateAcl(ACLChecklist *ch)
      * unlock auth_user_request on our behalf, but it was too
      * ugly and hard to follow.  Now we do our own locking here.
      *
-     * AYJ 2009-07-15:
-     * tryToAuthenticateAndSetAuthUser now only produces the auth_user_request object
-     * for use here. Will try to authenticate if missing. And fix-up request pointer if unset.
+     * I'm not sure what tryToAuthenticateAndSetAuthUser does when
+     * auth_user_request is set before calling.  I'm tempted to
+     * unlock and set it to NULL, but it seems safer to save the
+     * pointer before calling and unlock it afterwards.  If the
+     * pointer doesn't change then its a no-op.
      */
+    AuthUserRequest *old_auth_user_request = checklist->auth_user_request;
     const auth_acl_t result = AuthUserRequest::tryToAuthenticateAndSetAuthUser(
                                   &checklist->auth_user_request, headertype, request,
                                   checklist->conn(), checklist->src_addr);
     if (checklist->auth_user_request)
         AUTHUSERREQUESTLOCK(checklist->auth_user_request, "ACLAuth::authenticated");
-
+    AUTHUSERREQUESTUNLOCK(old_auth_user_request, "old ACLAuth");
     switch (result) {
 
     case AUTH_ACL_CANNOT_AUTHENTICATE:
index 6aa57f2e0165c82841915cef769a085a87c49783..285e19c70677b6be02800319b4a806f43a3a40fe 100644 (file)
@@ -502,10 +502,11 @@ AuthUserRequest::authenticate(AuthUserRequest ** auth_user_request, http_hdr_typ
 }
 
 auth_acl_t
+
 AuthUserRequest::tryToAuthenticateAndSetAuthUser(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IpAddress &src_addr)
 {
     /* If we have already been called, return the cached value */
-    AuthUserRequest *t = authTryGetUser(auth_user_request, conn, request);
+    AuthUserRequest *t = authTryGetUser (auth_user_request, conn, request);
 
     if (t && t->lastReply != AUTH_ACL_CANNOT_AUTHENTICATE
             && t->lastReply != AUTH_ACL_HELPER) {
@@ -522,14 +523,11 @@ AuthUserRequest::tryToAuthenticateAndSetAuthUser(AuthUserRequest ** auth_user_re
     /* ok, call the actual authenticator routine. */
     auth_acl_t result = authenticate(auth_user_request, headertype, request, conn, src_addr);
 
-    t = authTryGetUser(auth_user_request, conn, request);
+    t = authTryGetUser (auth_user_request, conn, request);
 
     if (t && result != AUTH_ACL_CANNOT_AUTHENTICATE &&
-            result != AUTH_ACL_HELPER) {
+            result != AUTH_ACL_HELPER)
         t->lastReply = result;
-        if (!*auth_user_request)
-            *auth_user_request = t;
-    }
 
     return result;
 }