]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added username caches to all authentication mechanisms
authorFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 3 Sep 2015 07:41:33 +0000 (09:41 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 3 Sep 2015 07:41:33 +0000 (09:41 +0200)
src/auth/basic/User.cc
src/auth/basic/User.h
src/auth/digest/User.cc
src/auth/digest/User.h
src/auth/ntlm/User.cc
src/auth/ntlm/User.h

index d2a48fd1f3f6226bb323626ba5ab08f3742a4cf6..c8189132b9bbed9a48555cda017d42861ff95690 100644 (file)
@@ -9,6 +9,7 @@
 #include "squid.h"
 #include "auth/basic/Config.h"
 #include "auth/basic/User.h"
+#include "auth/UserNameCache.h"
 #include "Debug.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
@@ -79,3 +80,11 @@ Auth::Basic::User::updateCached(Auth::Basic::User *from)
     }
 }
 
+CbcPointer<Auth::UserNameCache>
+Auth::Basic::User::Cache()
+{
+    static Auth::UserNameCache cache("basic");
+    static CbcPointer<Auth::UserNameCache> p(&cache);
+    return p;
+}
+
index 471e040c7de661c498ccfc224d7e6d6211092672..949ff11386875f9383d057446bb2a020ec59300e 100644 (file)
@@ -36,6 +36,9 @@ public:
     void updateCached(User *from);
     virtual int32_t ttl() const;
 
+    // userKey ->Auth::User::Pointer cache
+    static CbcPointer<Auth::UserNameCache> Cache();
+
     char *passwd;
 
     QueueNode *queue;
index 46d9006b947d70a706ff17c94174ee2ea857bc6b..805aacddb2a7537d18c7cd16188dd2006033dea8 100644 (file)
@@ -9,6 +9,7 @@
 #include "squid.h"
 #include "auth/digest/Config.h"
 #include "auth/digest/User.h"
+#include "auth/UserNameCache.h"
 #include "Debug.h"
 #include "dlink.h"
 #include "SquidConfig.h"
@@ -72,3 +73,10 @@ Auth::Digest::User::currentNonce()
     return nonce;
 }
 
+CbcPointer<Auth::UserNameCache>
+Auth::Digest::User::Cache()
+{
+    static Auth::UserNameCache cache("digest");
+    static CbcPointer<Auth::UserNameCache> p(&cache);
+    return p;
+}
index 3ee7e877ab926393a591d931c81011b306367b13..e1257f75c003554fd937c1b1dabb561efa883ddc 100644 (file)
@@ -28,6 +28,8 @@ public:
 
     virtual int32_t ttl() const;
 
+    static CbcPointer<Auth::UserNameCache> Cache();
+
     HASH HA1;
     int HA1created;
 
index 451de76bd59b85c5984589fde2f3f249c5edead5..47f1758790bb8a64d4a594294afe659e704a31a4 100644 (file)
@@ -9,6 +9,7 @@
 #include "squid.h"
 #include "auth/Config.h"
 #include "auth/ntlm/User.h"
+#include "auth/UserNameCache.h"
 #include "Debug.h"
 
 Auth::Ntlm::User::User(Auth::Config *aConfig, const char *aRequestRealm) :
@@ -27,3 +28,10 @@ Auth::Ntlm::User::ttl() const
     return -1; // NTLM credentials cannot be cached.
 }
 
+CbcPointer<Auth::UserNameCache>
+Auth::Ntlm::User::Cache()
+{
+    static Auth::UserNameCache cache("ntlm");
+    static CbcPointer<Auth::UserNameCache> p(&cache);
+    return p;
+}
index 60050a223277f77158c48eaf6e3a4ce9708c4e4d..8ed6fbdd93466335306e1dfc81a36ceb5737518b 100644 (file)
@@ -30,6 +30,8 @@ public:
 
     virtual int32_t ttl() const;
 
+    static CbcPointer<Auth::UserNameCache> Cache();
+
     dlink_list proxy_auth_list;
 };