From 0760144a7b1a023fb402bf7a19dcda5dcfadda3c Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 3 Jul 2009 12:48:56 +1200 Subject: [PATCH] Bug 2127: delay pools class 4 crashes with ntlm auth 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/DelayUser.cc b/src/DelayUser.cc index 9ddbe4d1dd..543a297c5a 100644 --- a/src/DelayUser.cc +++ b/src/DelayUser.cc @@ -77,6 +77,10 @@ static SplayNode::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()); } -- 2.47.3