]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2127: delay pools class 4 crashes with ntlm auth
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 28 Jun 2009 12:03:25 +0000 (00:03 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 28 Jun 2009 12:03:25 +0000 (00:03 +1200)
pt 2: prevent NTLM handshake requests from being delayed prior to the
authentication credentials being confirmed.

Also adds a few more descriptive asserts to catch this bug if still live.

src/DelayUser.cc

index 9ddbe4d1dd9b4b5593cd9a71f21ee0e87fa85516..543a297c5a4f5e6e60ce521e50c43c773bc939e9 100644 (file)
@@ -77,6 +77,10 @@ static SplayNode<DelayUserBucket::Pointer>::SPLAYCMP DelayUserCmp;
 int
 DelayUserCmp(DelayUserBucket::Pointer const &left, DelayUserBucket::Pointer const &right)
 {
+    /* Verify for re-currance of Bug 2127. either of these missing will crash strcasecmp() */
+    assert(left->authUser->username() != NULL);
+    assert(right->authUser->username() != NULL);
+
     /* for rate limiting, case insensitive */
     return strcasecmp(left->authUser->username(), right->authUser->username());
 }
@@ -147,9 +151,10 @@ DelayUser::parse()
 DelayIdComposite::Pointer
 DelayUser::id(CompositePoolNode::CompositeSelectionDetails &details)
 {
-    if (!details.user)
+    if (!details.user || !details.user->user() || !details.user->user()->username())
         return new NullDelayId;
 
+    debugs(77, 3, HERE << "Adding a slow-down for User '" << details.user->user()->username() << "'");
     return new Id(this, details.user->user());
 }