]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Kill final traces of UserRequest circular references.
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 24 Apr 2010 03:42:16 +0000 (15:42 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 24 Apr 2010 03:42:16 +0000 (15:42 +1200)
12 files changed:
src/Makefile.am
src/auth/User.cc
src/auth/User.cci
src/auth/User.h
src/auth/UserRequest.cc
src/auth/basic/auth_basic.cc
src/auth/digest/auth_digest.cc
src/auth/digest/digestUserRequest.cc
src/auth/negotiate/auth_negotiate.cc
src/auth/ntlm/auth_ntlm.cc
src/ip/stubQosConfig.cc
src/tests/testAuth.cc

index 5f7981ff0de7dd9cbcac7b5f730622e1458db1ff..a7072e92b364650f857377263153d59e6893814a 100644 (file)
@@ -981,7 +981,6 @@ tests_testAuth_SOURCES = \
        ConfigParser.cc \
        HelperChildConfig.h \
        HelperChildConfig.cc \
-       ip/stubQosConfig.cc \
        tests/stub_acl.cc tests/stub_cache_cf.cc \
        tests/stub_helper.cc cbdata.cc String.cc \
        tests/stub_store.cc HttpHeaderTools.cc HttpHeader.cc mem.cc ClientInfo.h \
index 65caa3d5cbd7a9db999a6323a5371a2f233d918d..a6c9e248d9d2a6f114647553d3e38b730df2aba0 100644 (file)
@@ -62,9 +62,6 @@ AuthUser::AuthUser(AuthConfig *aConfig) :
     proxy_auth_list.head = proxy_auth_list.tail = NULL;
     proxy_match_cache.head = proxy_match_cache.tail = NULL;
     ip_list.head = ip_list.tail = NULL;
-#if USER_REQUEST_LOOP_DEAD
-    requests.head = requests.tail = NULL;
-#endif
     debugs(29, 5, "AuthUser::AuthUser: Initialised auth_user '" << this << "'.");
 }
 
@@ -94,21 +91,6 @@ AuthUser::absorb(AuthUser::Pointer from)
      */
 
     debugs(29, 5, "authenticateAuthUserMerge auth_user '" << from << "' into auth_user '" << this << "'.");
-#if USER_REQUEST_LOOP_DEAD
-    dlink_node *link = from->requests.head;
-
-    while (link) {
-        AuthUserRequest::Pointer *auth_user_request = static_cast<AuthUserRequest::Pointer*>(link->data);
-        /* add to our list. replace if already present. */
-        addRequest(*auth_user_request);
-        AuthUserRequest::Pointer aur = *(auth_user_request);
-        aur->user(this);
-        /* remove from other list */
-        dlink_node *tmplink = link;
-        link = link->next;
-        dlinkDelete(tmplink, &from->requests);
-    }
-#endif /* USER_REQUEST_LOOP_DEAD */
 
     /* absorb the list of IP address sources (for max_user_ip controls) */
     AuthUserIP *new_ipdata;
@@ -173,22 +155,6 @@ AuthUser::~AuthUser()
         delete usernamehash;
     }
 
-#if USER_REQUEST_LOOP_DEAD
-    /* remove any outstanding requests */
-    dlink_node *link = requests.head;
-
-    while (link) {
-        debugs(29, 5, "AuthUser::~AuthUser: removing request entry '" << link->data << "'");
-        AuthUserRequest::Pointer *auth_user_request = static_cast<AuthUserRequest::Pointer*>(link->data);
-        dlink_node *tmplink = link;
-        link = link->next;
-        dlinkDelete(tmplink, &requests);
-        tmplink->data = NULL;
-        dlinkNodeDelete(tmplink);
-        *auth_user_request = NULL;
-    }
-#endif /* USER_REQUEST_LOOP_DEAD */
-
     /* free cached acl results */
     aclCacheMatchFlush(&proxy_match_cache);
 
index 35e4074a8bd339e5b6d403a6e885f38542097122..f7d31b38450c70a3dfca460cd41490542b2d7d10 100644 (file)
@@ -56,37 +56,3 @@ AuthUser::username(char const *aString)
         safe_free(username_);
     }
 }
-
-#if USER_REQUEST_LOOP_DEAD
-void
-AuthUser::addRequest(AuthUserRequest::Pointer request)
-{
-    /* lock for the request link (AKA lock because the request links to us) */
-    lock();
-
-    dlink_node *node = dlinkNodeNew();
-
-    dlinkAdd(&request, node, &requests);
-}
-
-void
-AuthUser::doneRequest(AuthUserRequest::Pointer request)
-{
-    /* unlink from the auth_user struct */
-    dlink_node *link = requests.head;
-    AuthUserRequest::Pointer *auth_user_request = NULL;
-
-    while (link) {
-        auth_user_request = static_cast<AuthUserRequest::Pointer*>(link->data);
-        if (*auth_user_request == request) {
-            dlink_node *tmplink = link;
-            link = link->next;
-            dlinkDelete(tmplink, &requests);
-            tmplink->data = NULL;
-            dlinkNodeDelete(tmplink);
-            *auth_user_request = NULL;
-        }
-        link = link->next;
-    }
-}
-#endif /* USER_REQUEST_LOOP_DEAD */
index 47e4654d1de54996b696e42221a550992ccd8db2..67a777095e24f98b5d2c94eb602329e18f7e2d8e 100644 (file)
 #ifndef SQUID_AUTHUSER_H
 #define SQUID_AUTHUSER_H
 
-#if USER_REQUEST_LOOP_DEAD
-#include "auth/UserRequest.h"
-#endif
-
 #include "auth/AuthType.h"
 #include "dlink.h"
 #include "ip/IpAddress.h"
@@ -95,20 +91,6 @@ public:
     void removeIp(Ip::Address);
     void addIp(Ip::Address);
 
-#if USER_REQUEST_LOOP_DEAD
-protected:
-    /* manage list of active authentication requests for this username */
-    /** the auth_user_request structures that link to this. Yes it could be a splaytree
-     * but how many requests will a single username have in parallel? */
-    dlink_list requests;
-
-    /* AYJ: why? do we need this here? it forms the core of a circular refcount. */
-
-public:
-    _SQUID_INLINE_ void addRequest(AuthUserRequest::Pointer);
-    _SQUID_INLINE_ void doneRequest(AuthUserRequest::Pointer);
-#endif /* USER_REQUEST_LOOP_DEAD */
-
     void addToNameCache();
     static void UsernameCacheStats(StoreEntry * output);
 
index 830ed008c270d06abdba04e1ed394eea5f6fda36..7ca5e31c879e67bbc1dfad55b0e17a28e37f5f33 100644 (file)
@@ -140,14 +140,6 @@ AuthUserRequest::~AuthUserRequest()
     debugs(29, 5, "AuthUserRequest::~AuthUserRequest: freeing request " << this);
 
     if (user() != NULL) {
-#if USER_REQUEST_LOOP_DEAD
-        /* AYJ: something strange: in order to be deleted this object must not be
-         * referenced anywhere. Including the AuthUser list of requests.
-         * I expect the following loop to NEVER find a pointer to this request object.
-         */
-        user()->doneRequest(this);
-#endif /* USER_REQUEST_LOOP_DEAD */
-
         /* release our references to the user credentials */
         user(NULL);
     }
index a16f3fa7ea0157a7af16a4fa1be5f9eada6e90ef..21e55619fdb79e280e25841ca5c2beaf7c1a4216 100644 (file)
@@ -417,10 +417,6 @@ BasicUser::makeLoggingInstance(AuthUserRequest::Pointer auth_user_request)
         username(NULL);
         /* set the auth_user type */
         basic_auth->auth_type = AUTH_BROKEN;
-#if USER_REQUEST_LOOP_DEAD
-        /* link the request to the user */
-        basic_auth->addRequest(auth_user_request);
-#endif /* USER_REQUEST_LOOP_DEAD */
     }
 }
 
@@ -533,9 +529,6 @@ AuthBasicConfig::decode(char const *proxy_auth)
 
     /* link the request to the in-cache user */
     auth_user_request->user(auth_user);
-#if USER_REQUEST_LOOP_DEAD
-    basic_auth->addRequest(auth_user_request);
-#endif /* USER_REQUEST_LOOP_DEAD */
     return auth_user_request;
 }
 
index 4c0c8d8fe6813e5dc8ef8d5e654b654cfb0aacfc..da650fc1bdebb59ac4d038da5d7631bb5425d9e0 100644 (file)
@@ -830,9 +830,6 @@ authDigestLogUsername(char *username, AuthUserRequest::Pointer auth_user_request
     digest_user->auth_type = AUTH_BROKEN;
     /* link the request to the user */
     auth_user_request->user(digest_user);
-#if USER_REQUEST_LOOP_DEAD
-    digest_user->addRequest(auth_user_request);
-#endif
     return auth_user_request;
 }
 
@@ -1114,10 +1111,6 @@ AuthDigestConfig::decode(char const *proxy_auth)
     assert(digest_request != NULL);
 
     digest_request->user(digest_user);
-#if USER_REQUEST_LOOP_DEAD
-    digest_user->addRequest(digest_request);
-#endif
-
     debugs(29, 9, "username = '" << digest_user->username() << "'\nrealm = '" <<
            digest_request->realm << "'\nqop = '" << digest_request->qop <<
            "'\nalgorithm = '" << digest_request->algorithm << "'\nuri = '" <<
index 3c953b427b87addccb504b54788a52ba61c911fe..21480ee307d177288080cbbf893be2c9dee76946 100644 (file)
@@ -134,7 +134,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData * conn,
             } else {
                 const char *useragent = request->header.getStr(HDR_USER_AGENT);
 
-                static IpAddress last_broken_addr;
+                static Ip::Address last_broken_addr;
                 static int seen_broken_client = 0;
 
                 if (!seen_broken_client) {
index a1bbaf47aaa939639d6b406d7e86f3365db0845c..9b9b6f97b2bacb921f447f2ee4c2736fcd5d80bc 100644 (file)
@@ -319,9 +319,6 @@ AuthNegotiateConfig::decode(char const *proxy_auth)
 
     auth_user_request->user(newUser);
     auth_user_request->user()->auth_type = AUTH_NEGOTIATE;
-#if USER_REQUEST_LOOP_DEAD
-    auth_user_request->user()->addRequest(auth_user_request);
-#endif
 
     /* all we have to do is identify that it's Negotiate - the helper does the rest */
     debugs(29, 9, "AuthNegotiateConfig::decode: Negotiate authentication");
index 333942403d521ad8b7829eae6b0650c1e819d660..5d149fdc1a88bd3a96fb10a4df1f65615e2f75c3 100644 (file)
@@ -290,9 +290,6 @@ AuthNTLMConfig::decode(char const *proxy_auth)
 
     auth_user_request->user(newUser);
     auth_user_request->user()->auth_type = AUTH_NTLM;
-#if USER_REQUEST_LOOP_DEAD
-    auth_user_request->user()->addRequest(auth_user_request);
-#endif
 
     /* all we have to do is identify that it's NTLM - the helper does the rest */
     debugs(29, 9, "AuthNTLMConfig::decode: NTLM authentication");
index 458f655734870c5b00fbb3aaa1c9d2e05c8bafec..3af90bf1e1c12c3a6febf7b9927767b96735b4c6 100644 (file)
@@ -2,10 +2,10 @@
 
 #if USE_ZPH_QOS
 
-#include "QosConfig.h"
+#include "ip/QosConfig.h"
 #include "Store.h"
 
-QosConfig::QosConfig() :
+Ip::QosConfig::QosConfig() :
         tos_local_hit(0),
         tos_sibling_hit(0),
         tos_parent_hit(0),
@@ -16,7 +16,7 @@ QosConfig::QosConfig() :
 }
 
 void
-QosConfig::parseConfigLine()
+Ip::QosConfig::parseConfigLine()
 {
     // %i honors 0 and 0x prefixes, which are important for things like umask
     /* parse options ... */
@@ -39,7 +39,7 @@ QosConfig::parseConfigLine()
 }
 
 void
-QosConfig::dumpConfigLine(char *entry, const char *name) const
+Ip::QosConfig::dumpConfigLine(char *entry, const char *name) const
 {
     ; /* Not needed in stub */
 }
index 449cb689c58023de6faf8259ba08c8d4f034f65f..056bc14ba0f8a4d21d114ec670ac52bf23d2f072 100644 (file)
@@ -202,9 +202,6 @@ testAuthBasicUserRequest::username()
     BasicUser *basic_auth=new BasicUser(AuthConfig::Find("basic"));
     basic_auth->username("John");
     temp->user(basic_auth);
-#if USER_REQUEST_LOOP_DEAD
-    basic_auth->addRequest(temp);
-#endif
     CPPUNIT_ASSERT_EQUAL(0, strcmp("John", temp->username()));
 }
 #endif /* HAVE_AUTH_MODULE_BASIC */
@@ -228,9 +225,6 @@ testAuthDigestUserRequest::username()
     DigestUser *duser=new DigestUser(AuthConfig::Find("digest"));
     duser->username("John");
     temp->user(duser);
-#if USER_REQUEST_LOOP_DEAD
-    duser->addRequest(temp);
-#endif
     CPPUNIT_ASSERT_EQUAL(0, strcmp("John", temp->username()));
 }
 #endif /* HAVE_AUTH_MODULE_DIGEST */
@@ -254,9 +248,6 @@ testAuthNTLMUserRequest::username()
     NTLMUser *nuser=new NTLMUser(AuthConfig::Find("ntlm"));
     nuser->username("John");
     temp->user(nuser);
-#if USER_REQUEST_LOOP_DEAD
-    nuser->addRequest(temp);
-#endif
     CPPUNIT_ASSERT_EQUAL(0, strcmp("John", temp->username()));
 }
 #endif /* HAVE_AUTH_MODULE_NTLM */
@@ -280,9 +271,6 @@ testAuthNegotiateUserRequest::username()
     NegotiateUser *nuser=new NegotiateUser(AuthConfig::Find("negotiate"));
     nuser->username("John");
     temp->user(nuser);
-#if USER_REQUEST_LOOP_DEAD
-    nuser->addRequest(temp);
-#endif
     CPPUNIT_ASSERT_EQUAL(0, strcmp("John", temp->username()));
 }