--- ./src/acl.c	Fri Mar 28 13:56:20 2003
+++ ./new/acl.c	Fri Mar 28 13:55:13 2003
@@ -1277,6 +1277,7 @@
 	/* remove _this_ ip, as it is the culprit for going over the limit */
 	authenticateAuthUserRequestRemoveIp(auth_user_request, src_addr);
 	debug(28, 4) ("aclMatchUserMaxIP: Denying access in strict mode\n");
+        return -1;
     } else {
 	/*
 	 * non-strict - remove some/all of the cached entries 
@@ -1415,6 +1416,10 @@
     /* get authed here */
     /* Note: this fills in checklist->auth_user_request when applicable */
     switch (authenticateTryToAuthenticateAndSetAuthUser(&checklist->auth_user_request, headertype, checklist->request, checklist->conn, checklist->src_addr)) {
+    case AUTH_ACL_USER_ALREADY_IN_USE:
+       debug(28, 4) ("aclMatchAcl: user already in use.\n");
+        checklist->state[ACL_PROXY_AUTH] = ACL_USER_ALREADY_IN_USE;
+        return 0;
     case AUTH_ACL_CANNOT_AUTHENTICATE:
 	debug(28, 4) ("aclMatchAcl: returning  0 user authenticated but not authorised.\n");
 	return 0;
@@ -1629,6 +1634,8 @@
 	ti = aclMatchUserMaxIP(ae->data, checklist->auth_user_request,
 	    checklist->src_addr);
 	checklist->auth_user_request = NULL;
+        if(ti == -1)
+            checklist->state[ACL_PROXY_AUTH] = ACL_USER_ALREADY_IN_USE;
 	return ti;
 	/* NOTREACHED */
 #if SQUID_SNMP
@@ -1786,6 +1793,10 @@
 	    aclLookupProxyAuthStart(checklist);
 	    checklist->state[ACL_PROXY_AUTH] = ACL_LOOKUP_PENDING;
 	    return;
+        } else if (checklist->state[ACL_PROXY_AUTH] == ACL_USER_ALREADY_IN_USE) {
+            debug(28, 3) ("aclCheck: user already in use.\n");
+            allow = ACCESS_USER_ALREADY_IN_USE;
+            match = AUTH_ACL_USER_ALREADY_IN_USE;
 	} else if (checklist->state[ACL_PROXY_AUTH] == ACL_PROXY_AUTH_NEEDED) {
 	    /* Client is required to resend the request with correct authentication
 	     * credentials. (This may be part of a stateful auth protocol.
--- ./src/client_side.c	Fri Mar 28 13:56:27 2003
+++ ./new/client_side.c	Fri Mar 28 13:55:21 2003
@@ -259,16 +259,25 @@
 	http->log_type = LOG_TCP_DENIED;
 	http->entry = clientCreateStoreEntry(http, http->request->method,
 	    null_request_flags);
-	if (answer == ACCESS_REQ_PROXY_AUTH || aclIsProxyAuth(AclMatchedName)) {
-	    if (!http->flags.accel) {
-		/* Proxy authorisation needed */
-		status = HTTP_PROXY_AUTHENTICATION_REQUIRED;
+        if (answer == ACCESS_REQ_PROXY_AUTH || 		\
+            answer == ACCESS_USER_ALREADY_IN_USE ||	\
+             aclIsProxyAuth(AclMatchedName)) {
+            if (!http->flags.accel) {
+                 if (answer == ACCESS_USER_ALREADY_IN_USE)
+                     status = HTTP_FORBIDDEN;
+                 else
+                   /* Proxy authorisation needed */
+		   status = HTTP_PROXY_AUTHENTICATION_REQUIRED;
 	    } else {
-		/* WWW authorisation needed */
-		status = HTTP_UNAUTHORIZED;
+	     	 /* WWW authorisation needed */
+		 status = HTTP_UNAUTHORIZED;
 	    }
-	    if (page_id == ERR_NONE)
-		page_id = ERR_CACHE_ACCESS_DENIED;
+            if (page_id <= 0) {
+                 if (answer == ACCESS_USER_ALREADY_IN_USE)
+                      page_id = ERR_USER_ALREADY_IN_USE;
+                 else
+                     page_id = ERR_CACHE_ACCESS_DENIED;
+            }
 	} else {
 	    status = HTTP_FORBIDDEN;
 	    if (page_id == ERR_NONE)
--- ./src/enums.h	Fri Mar 28 13:56:34 2003
+++ ./new/enums.h	Fri Mar 28 13:55:26 2003
@@ -93,6 +93,7 @@
     ERR_ONLY_IF_CACHED_MISS,	/* failure to satisfy only-if-cached request */
     ERR_TOO_BIG,
     TCP_RESET,
+    ERR_USER_ALREADY_IN_USE,
     ERR_MAX
 } err_type;
 
@@ -144,7 +145,8 @@
     ACL_LOOKUP_NEEDED,
     ACL_LOOKUP_PENDING,
     ACL_LOOKUP_DONE,
-    ACL_PROXY_AUTH_NEEDED
+    ACL_PROXY_AUTH_NEEDED,
+    ACL_USER_ALREADY_IN_USE
 } acl_lookup_state;
 
 enum {
@@ -510,10 +512,12 @@
 typedef enum {
     ACCESS_DENIED,
     ACCESS_ALLOWED,
-    ACCESS_REQ_PROXY_AUTH
+    ACCESS_REQ_PROXY_AUTH,
+    ACCESS_USER_ALREADY_IN_USE
 } allow_t;
 
 typedef enum {
+    AUTH_ACL_USER_ALREADY_IN_USE = -5,
     AUTH_ACL_CHALLENGE = -2,
     AUTH_ACL_HELPER = -1,
     AUTH_ACL_CANNOT_AUTHENTICATE = 0,
--- ./errors/English/ERR_USER_ALREADY_IN_USE	Wed Dec 31 21:00:00 1969
+++ ./new/ERR_USER_ALREADY_IN_USE	Fri Mar 28 14:14:32 2003
@@ -0,0 +1,10 @@
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>User already in use.</H2>
+<HR>
+<P>
+<P>
+User already in use. Please try again later
+<P>
+<P>
+</HTML>
