]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixes to proxy-auth stuff, mostly to get the user name logged in
authorwessels <>
Wed, 15 Jul 1998 04:28:08 +0000 (04:28 +0000)
committerwessels <>
Wed, 15 Jul 1998 04:28:08 +0000 (04:28 +0000)
access.log.

src/acl.cc
src/client_side.cc
src/defines.h
src/ident.cc
src/structs.h

index 0aa138ef3bb2a448b9f354ea4ac055418023e90c..09c120e1bb7f9961e3acb44f6870a41f8ad0a51a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.cc,v 1.168 1998/07/14 21:29:54 wessels Exp $
+ * $Id: acl.cc,v 1.169 1998/07/14 22:28:08 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -1116,7 +1116,7 @@ aclMatchIdent(wordlist * data, const char *ident)
 static int
 aclMatchProxyAuth(acl_proxy_auth * p, aclCheck_t * checklist)
 {
-    LOCAL_ARRAY(char, sent_user, ICP_IDENT_SZ);
+    LOCAL_ARRAY(char, sent_user, USER_IDENT_SZ);
     const char *s;
     char *cleartext;
     char *sent_auth;
@@ -1134,7 +1134,7 @@ aclMatchProxyAuth(acl_proxy_auth * p, aclCheck_t * checklist)
     cleartext = uudecode(sent_auth);
     xfree(sent_auth);
     debug(28, 3) ("aclMatchProxyAuth: cleartext = '%s'\n", cleartext);
-    xstrncpy(sent_user, cleartext, ICP_IDENT_SZ);
+    xstrncpy(sent_user, cleartext, USER_IDENT_SZ);
     xfree(cleartext);
     if ((passwd = strchr(sent_user, ':')) != NULL)
        *passwd++ = '\0';
@@ -1143,6 +1143,8 @@ aclMatchProxyAuth(acl_proxy_auth * p, aclCheck_t * checklist)
        return 0;
     }
     debug(28, 5) ("aclMatchProxyAuth: checking user %s\n", sent_user);
+    /* copy username to checklist for logging on client-side */
+    xstrncpy(checklist->request->user_ident, sent_user, USER_IDENT_SZ);
     /* reread password file if necessary */
     aclReadProxyAuth(p);
     u = hash_lookup(p->hash, sent_user);
@@ -1576,7 +1578,7 @@ aclChecklistCreate(const acl_access * A,
     if (user_agent)
        xstrncpy(checklist->browser, user_agent, BROWSERNAMELEN);
     if (ident)
-       xstrncpy(checklist->ident, ident, ICP_IDENT_SZ);
+       xstrncpy(checklist->ident, ident, USER_IDENT_SZ);
     return checklist;
 }
 
index f758411a647365bc385fbb8050ba462ce8ff4103..68fbed66f1e845cc7a6176007fd66c3b0c6993ed 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.348 1998/07/14 22:18:20 wessels Exp $
+ * $Id: client_side.cc,v 1.349 1998/07/14 22:28:10 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -162,7 +162,6 @@ clientAccessCheckDone(int answer, void *data)
     clientHttpRequest *http = data;
     int page_id = -1;
     ErrorState *err = NULL;
-    HttpReply *rep;
     debug(33, 5) ("clientAccessCheckDone: '%s' answer=%d\n", http->uri, answer);
     http->acl_checklist = NULL;
     if (answer == ACCESS_ALLOWED) {
@@ -171,14 +170,11 @@ clientAccessCheckDone(int answer, void *data)
        http->redirect_state = REDIRECT_PENDING;
        redirectStart(http, clientRedirectDone, http);
     } else if (answer == ACCESS_REQ_PROXY_AUTH) {
-       http->al.http.code = HTTP_PROXY_AUTHENTICATION_REQUIRED;
        http->log_type = LOG_TCP_DENIED;
        http->entry = clientCreateStoreEntry(http, http->request->method, 0);
-       /* create appropreate response */
-       rep = clientConstructProxyAuthReply(http);
-       httpReplySwapOut(rep, http->entry);
-       /* do not need it anymore */
-       httpReplyDestroy(rep);
+       /* create appropriate response */
+       http->entry->mem_obj->reply = clientConstructProxyAuthReply(http);
+       httpReplySwapOut(http->entry->mem_obj->reply, http->entry);
        storeComplete(http->entry);
     } else {
        debug(33, 5) ("Access Denied: %s\n", http->uri);
@@ -619,7 +615,10 @@ httpRequestFree(void *data)
        http->al.cache.size = http->out.size;
        http->al.cache.code = http->log_type;
        http->al.cache.msec = tvSubMsec(http->start, current_time);
-       http->al.cache.ident = conn->ident.ident;
+       if (request->user_ident[0])
+           http->al.cache.ident = request->user_ident;
+       else
+           http->al.cache.ident = conn->ident.ident;
        if (request) {
            Packer p;
            MemBuf mb;
index 82e3b09a0dd21dea26b89e91bebe0174995ddeae..9b92828e05d05b0feba6465b003a02e2295792a8 100644 (file)
@@ -88,7 +88,7 @@
 #define ANONYMIZER_STANDARD    1
 #define ANONYMIZER_PARANOID    2
 
-#define ICP_IDENT_SZ 64
+#define USER_IDENT_SZ 64
 #define IDENT_NONE 0
 #define IDENT_PENDING 1
 #define IDENT_DONE 2
index 74fe1b281a8cfe927b747d043d05bed34b84f309..787e0fcd302cec4951c70829c406df030f8eb5a0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ident.cc,v 1.41 1998/05/30 19:43:11 rousskov Exp $
+ * $Id: ident.cc,v 1.42 1998/07/14 22:28:12 wessels Exp $
  *
  * DEBUG: section 30    Ident (RFC 931)
  * AUTHOR: Duane Wessels
@@ -124,7 +124,7 @@ identReadReply(int fd, void *data)
        if (strstr(buf, "USERID")) {
            if ((t = strrchr(buf, ':'))) {
                while (isspace(*++t));
-               xstrncpy(connState->ident.ident, t, ICP_IDENT_SZ);
+               xstrncpy(connState->ident.ident, t, USER_IDENT_SZ);
            }
        }
     }
index 3cea6a859c25cc4fb0c1c8cb9fbe5eb56433b243..15154fdf175371f5dbdc2607ca8260010269efb2 100644 (file)
@@ -139,7 +139,7 @@ struct _aclCheck_t {
     struct in_addr src_addr;
     struct in_addr dst_addr;
     request_t *request;
-    char ident[ICP_IDENT_SZ];
+    char ident[USER_IDENT_SZ];
     char browser[BROWSERNAMELEN];
     acl_lookup_state state[ACL_ENUM_MAX];
     PF *callback;
@@ -754,7 +754,7 @@ struct _ConnStateData {
     struct in_addr log_addr;
     struct {
        int fd;
-       char ident[ICP_IDENT_SZ];
+       char ident[USER_IDENT_SZ];
        IDCB *callback;
        int state;
        void *callback_data;
@@ -1123,6 +1123,7 @@ struct _request_t {
     protocol_t protocol;
     char login[MAX_LOGIN_SZ];
     char host[SQUIDHOSTNAMELEN + 1];
+    char user_ident[USER_IDENT_SZ];    /* from proxy auth or ident server */
     u_short port;
     String urlpath;
     int link_count;            /* free when zero */