/*
- * $Id: client_side.cc,v 1.60 1996/11/06 23:14:24 wessels Exp $
+ * $Id: client_side.cc,v 1.61 1996/11/08 00:46:42 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
clientAccessCheck(icpState, icpState->aclHandler);
}
-#ifdef UNUSED_CODE
static void
clientLookupIdentDone(void *data)
{
+ icpStateData *icpState = data;
+ clientAccessCheck(icpState, icpState->aclHandler);
}
-#endif
-
#if USE_PROXY_AUTH
/* return 1 if allowed, 0 if denied */
static int
aclCheck_t *ch = NULL;
char *browser = NULL;
+ if (Config.identLookup && icpState->ident.state == IDENT_NONE) {
+ identStart(-1, icpState, clientLookupIdentDone);
+ return;
+ }
if (icpState->aclChecklist == NULL) {
icpState->aclChecklist = xcalloc(1, sizeof(aclCheck_t));
icpState->aclChecklist->src_addr = icpState->peer.sin_addr;
/*
- * $Id: ident.cc,v 1.20 1996/11/06 23:14:43 wessels Exp $
+ * $Id: ident.cc,v 1.21 1996/11/08 00:46:45 wessels Exp $
*
* DEBUG: section 30 Ident (RFC 931)
* AUTHOR: Duane Wessels
static void identReadReply _PARAMS((int, icpStateData *));
static void identClose _PARAMS((int, icpStateData *));
static void identConnectDone _PARAMS((int fd, int status, void *data));
+static void identCallback _PARAMS((icpStateData *icpState));
static void
identClose(int fd, icpStateData * icpState)
{
- icpState->ident_fd = -1;
+ icpState->ident.fd = -1;
}
/* start a TCP connection to the peer host on port 113 */
void
-identStart(int fd, icpStateData * icpState)
+identStart(int fd, icpStateData * icpState, void (*callback) _PARAMS((void *)))
{
+ icpState->ident.callback = callback;
+ icpState->ident.state = IDENT_PENDING;
if (fd < 0) {
fd = comm_open(SOCK_STREAM,
0,
0,
COMM_NONBLOCKING,
"ident");
- if (fd == COMM_ERROR)
+ if (fd == COMM_ERROR) {
+ identCallback(icpState);
return;
+ }
}
- icpState->ident_fd = fd;
+ icpState->ident.fd = fd;
comm_add_close_handler(fd,
(PF) identClose,
(void *) icpState);
LOCAL_ARRAY(char, reqbuf, BUFSIZ);
if (status == COMM_ERROR) {
comm_close(fd);
- return; /* die silently */
+ identCallback(icpState);
+ return;
}
sprintf(reqbuf, "%d, %d\r\n",
ntohs(icpState->peer.sin_port),
if (strstr(buf, "USERID")) {
if ((t = strrchr(buf, ':'))) {
while (isspace(*++t));
- strncpy(icpState->ident, t, ICP_IDENT_SZ);
+ strncpy(icpState->ident.ident, t, ICP_IDENT_SZ);
}
}
}
comm_close(fd);
+ identCallback(icpState);
+}
+
+static void
+identCallback(icpStateData * icpState)
+{
+ icpState->ident.state = IDENT_DONE;
+ if (icpState->ident.callback)
+ icpState->ident.callback(icpState);
}
/*
- * $Id: redirect.cc,v 1.28 1996/11/06 23:14:52 wessels Exp $
+ * $Id: redirect.cc,v 1.29 1996/11/08 00:46:46 wessels Exp $
*
* DEBUG: section 29 Redirector
* AUTHOR: Duane Wessels
r->fd = cfd;
r->orig_url = icpState->url;
r->client_addr = icpState->log_addr;
- if (icpState->ident == NULL || *icpState->ident == '\0') {
+ if (icpState->ident.ident == NULL || *icpState->ident.ident == '\0') {
r->client_ident = dash_str;
} else {
- r->client_ident = icpState->ident;
+ r->client_ident = icpState->ident.ident;
}
r->method_s = RequestMethodStr[icpState->request->method];
r->handler = handler;
/*
- * $Id: squid.h,v 1.72 1996/11/08 00:02:22 wessels Exp $
+ * $Id: squid.h,v 1.73 1996/11/08 00:46:46 wessels Exp $
*
* AUTHOR: Duane Wessels
*
extern void timestampsSet _PARAMS((StoreEntry *));
extern int waisStart _PARAMS((int, const char *, method_t, char *, StoreEntry *));
extern void storeDirClean _PARAMS((void));
-int
-passStart _PARAMS((int fd,
+extern int passStart _PARAMS((int fd,
const char *url,
request_t * request,
char *buf,
int buflen,
int *size_ptr));
+extern void identStart _PARAMS((int, icpStateData *,
+ void (*callback) _PARAMS((void *))));
extern const char *const dash_str;
extern const char *const null_string;