]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1327: NTLM authentication fails when low on filedescriptors or
authorserassio <>
Wed, 14 Sep 2005 23:10:38 +0000 (23:10 +0000)
committerserassio <>
Wed, 14 Sep 2005 23:10:38 +0000 (23:10 +0000)
client side persistent connections disabled

Forward port of 2.5 patch.

src/auth/ntlm/auth_ntlm.cc
src/client_side.cc
src/client_side_reply.cc
src/structs.h

index 91d61d9c6c3e9ebda781bb84c66e19539a5d1dd3..bed1e82435cd1c3c46b64a628ba2864df371fe83 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_ntlm.cc,v 1.47 2005/04/24 14:00:52 serassio Exp $
+ * $Id: auth_ntlm.cc,v 1.48 2005/09/14 17:10:39 serassio Exp $
  *
  * DEBUG: section 29    NTLM Authenticator
  * AUTHOR: Robert Collins
@@ -319,6 +319,9 @@ AuthNTLMConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *rep
 {
     AuthNTLMUserRequest *ntlm_request;
 
+    if (!request->flags.proxy_keepalive)
+        return;
+
     if (authenticate) {
         /* New request, no user details */
 
@@ -353,6 +356,7 @@ AuthNTLMConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *rep
                 /* pass the challenge to the client */
                 debug(29, 9) ("authenticateNTLMFixErrorHeader: Sending type:%d header: 'NTLM %s'\n", type, ntlm_request->authchallenge);
                 httpHeaderPutStrf(&rep->header, type, "NTLM %s", ntlm_request->authchallenge);
+                request->flags.must_keepalive = 1;
                 break;
 
             default:
index 758364030877d9ce8c6cbdd8c8b07880cfd0ca5c..1ef357d98e1a97a22e75dd51ae43330df9dd2300 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.693 2005/09/12 22:26:39 wessels Exp $
+ * $Id: client_side.cc,v 1.694 2005/09/14 17:10:38 serassio Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -643,15 +643,11 @@ clientSetKeepaliveFlag(ClientHttpRequest * http)
     debug(33, 3) ("clientSetKeepaliveFlag: method = %s\n",
                   RequestMethodStr[request->method]);
 
-    if (!Config.onoff.client_pconns)
-        request->flags.proxy_keepalive = 0;
-    else {
-        HttpVersion http_ver(1,0);
-        /* we are HTTP/1.0, no matter what the client requests... */
+    HttpVersion http_ver(1,0);
+    /* we are HTTP/1.0, no matter what the client requests... */
 
-        if (httpMsgIsPersistent(http_ver, req_hdr))
-            request->flags.proxy_keepalive = 1;
-    }
+    if (httpMsgIsPersistent(http_ver, req_hdr))
+        request->flags.proxy_keepalive = 1;
 }
 
 static int
index 84fcb1e6d54e361e5c4f43881254a7092975788e..80dcf11011909bfbdcc489520cfb6b4063c15012 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_reply.cc,v 1.86 2005/09/09 17:31:33 wessels Exp $
+ * $Id: client_side_reply.cc,v 1.87 2005/09/14 17:10:38 serassio Exp $
  *
  * DEBUG: section 88    Client-side Reply Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -1417,11 +1417,14 @@ clientReplyContext::buildReplyHeader()
         request->flags.proxy_keepalive = 0;
     }
 
-    if (fdUsageHigh()) {
+    if (fdUsageHigh()&& !request->flags.must_keepalive) {
         debug(88, 3) ("clientBuildReplyHeader: Not many unused FDs, can't keep-alive\n");
         request->flags.proxy_keepalive = 0;
     }
 
+    if (!Config.onoff.client_pconns && !request->flags.must_keepalive)
+        request->flags.proxy_keepalive = 0;
+
     /* Append VIA */
     {
         LOCAL_ARRAY(char, bbuf, MAX_URL + 32);
index 990a479645f35075273593824e6341c362e97cbb..19c6490a02cddd0cb59bff00acdd400a24f19708 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.526 2005/09/03 13:46:46 serassio Exp $
+ * $Id: structs.h,v 1.527 2005/09/14 17:10:38 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -1444,7 +1444,7 @@ struct _RemovalPurgeWalker
 
 struct request_flags
 {
-    request_flags():range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),transparent(0),internal(0),internalclient(0),body_sent(0),destinationIPLookedUp_(0)
+    request_flags():range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),transparent(0),internal(0),internalclient(0),body_sent(0),must_keepalive(0),destinationIPLookedUp_(0)
     {
 #if HTTP_VIOLATIONS
         nocache_hack = 0;
@@ -1507,6 +1507,9 @@ unsigned int internalclient:
 
 unsigned int body_sent:
     1;
+
+unsigned int must_keepalive:
+    1;
     bool resetTCP() const;
     void setResetTCP();
     void clearResetTCP();