/*
- * $Id: AuthUserRequest.cc,v 1.16 2007/05/09 09:07:38 wessels Exp $
+ * $Id: AuthUserRequest.cc,v 1.17 2007/08/28 22:35:29 hno Exp $
*
* DO NOT MODIFY NEXT 2 LINES:
* arch-tag: 6803fde1-d5a2-4c29-9034-1c0c9f650eb4
/* this is a authenticate-needed response */
{
- if ((auth_user_request != NULL) && !authenticateUserAuthenticated(auth_user_request))
+ if ((auth_user_request != NULL) && authenticateDirection(auth_user_request) == 1)
/* scheme specific */
auth_user_request->user()->config->fixHeader(auth_user_request, rep, type, request);
else
/*
- * $Id: auth_negotiate.cc,v 1.25 2007/08/27 12:50:46 hno Exp $
+ * $Id: auth_negotiate.cc,v 1.26 2007/08/28 22:35:29 hno Exp $
*
* DEBUG: section 29 Negotiate Authenticator
* AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli
/* we're waiting for a response from the client. Pass it the blob */
debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate " << negotiate_request->server_blob << "'");
httpHeaderPutStrf(&rep->header, type, "Negotiate %s", negotiate_request->server_blob);
- request->flags.must_keepalive = 1;
safe_free(negotiate_request->server_blob);
break;
if (strncasecmp(reply, "TT ", 3) == 0) {
/* we have been given a blob to send to the client */
-
if (arg)
*arg++ = '\0';
-
safe_free(negotiate_request->server_blob);
-
- negotiate_request->server_blob = xstrdup(blob);
-
- negotiate_request->auth_state = AUTHENTICATE_STATE_IN_PROGRESS;
-
- auth_user_request->denyMessage("Authentication in progress");
-
- debugs(29, 4, "authenticateNegotiateHandleReply: Need to challenge the client with a server blob '" << blob << "'");
-
- result = S_HELPER_RESERVE;
+ negotiate_request->request->flags.must_keepalive = 1;
+ if (negotiate_request->request->flags.proxy_keepalive) {
+ negotiate_request->server_blob = xstrdup(blob);
+ negotiate_request->auth_state = AUTHENTICATE_STATE_IN_PROGRESS;
+ auth_user_request->denyMessage("Authentication in progress");
+ debugs(29, 4, "authenticateNegotiateHandleReply: Need to challenge the client with a server blob '" << blob << "'");
+ result = S_HELPER_RESERVE;
+ } else {
+ negotiate_request->auth_state = AUTHENTICATE_STATE_FAILED;
+ auth_user_request->denyMessage("NTLM authentication requires a persistent connection");
+ result = S_HELPER_RELEASE;
+ }
} else if (strncasecmp(reply, "AF ", 3) == 0 && arg != NULL) {
/* we're finished, release the helper */
fatalf("authenticateNegotiateHandleReply: *** Unsupported helper response ***, '%s'\n", reply);
}
+ if (negotiate_request->request) {
+ HTTPMSGUNLOCK(negotiate_request->request);
+ negotiate_request->request = NULL;
+ }
r->handler(r->data, NULL);
cbdataReferenceDone(r->data);
authenticateStateFree(r);
return;
}
- if (!request->flags.proxy_keepalive) {
- debugs(29, 2, "AuthNegotiateUserRequest::authenticate: attempt to perform authentication without a persistent connection!");
- auth_state = AUTHENTICATE_STATE_FAILED;
- request->flags.must_keepalive = 1;
- return;
- }
-
if (waiting) {
debugs(29, 1, "AuthNegotiateUserRequest::authenticate: waiting for helper reply!");
return;
assert(conn->auth_user_request == NULL);
conn->auth_user_request = this;
AUTHUSERREQUESTLOCK(conn->auth_user_request, "conn");
+ this->request = request;
+ HTTPMSGLOCK(this->request);
return;
break;
client_blob = xstrdup (blob);
+ if (this->request)
+ HTTPMSGUNLOCK(this->request);
+ this->request = request;
+ HTTPMSGLOCK(this->request);
return;
break;
helperStatefulReleaseServer(authserver);
authserver = NULL;
}
+ if (request) {
+ HTTPMSGUNLOCK(request);
+ request = NULL;
+ }
}
void
/* currently waiting for helper response */
unsigned char waiting;
+ /* need access to the request flags to mess around on pconn failure */
+ HttpRequest *request;
+
private:
/* the user */
NegotiateUser * _theUser;
/*
- * $Id: auth_ntlm.cc,v 1.75 2007/08/27 12:50:47 hno Exp $
+ * $Id: auth_ntlm.cc,v 1.76 2007/08/28 22:35:29 hno Exp $
*
* DEBUG: section 29 NTLM Authenticator
* AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli
/* we're waiting for a response from the client. Pass it the blob */
debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM " << ntlm_request->server_blob << "'");
httpHeaderPutStrf(&rep->header, type, "NTLM %s", ntlm_request->server_blob);
- request->flags.must_keepalive = 1;
safe_free(ntlm_request->server_blob);
break;
if (strncasecmp(reply, "TT ", 3) == 0) {
/* we have been given a blob to send to the client */
safe_free(ntlm_request->server_blob);
- ntlm_request->server_blob = xstrdup(blob);
- ntlm_request->auth_state = AUTHENTICATE_STATE_IN_PROGRESS;
- auth_user_request->denyMessage("Authentication in progress");
- debugs(29, 4, "authenticateNTLMHandleReply: Need to challenge the client with a server blob '" << blob << "'");
- result = S_HELPER_RESERVE;
+ ntlm_request->request->flags.must_keepalive = 1;
+ if (ntlm_request->request->flags.proxy_keepalive) {
+ ntlm_request->server_blob = xstrdup(blob);
+ ntlm_request->auth_state = AUTHENTICATE_STATE_IN_PROGRESS;
+ auth_user_request->denyMessage("Authentication in progress");
+ debugs(29, 4, "authenticateNTLMHandleReply: Need to challenge the client with a server blob '" << blob << "'");
+ result = S_HELPER_RESERVE;
+ } else {
+ ntlm_request->auth_state = AUTHENTICATE_STATE_FAILED;
+ auth_user_request->denyMessage("NTLM authentication requires a persistent connection");
+ result = S_HELPER_RELEASE;
+ }
} else if (strncasecmp(reply, "AF ", 3) == 0) {
/* we're finished, release the helper */
ntlm_user->username(blob);
fatalf("authenticateNTLMHandleReply: *** Unsupported helper response ***, '%s'\n", reply);
}
+ if (ntlm_request->request) {
+ HTTPMSGUNLOCK(ntlm_request->request);
+ ntlm_request->request = NULL;
+ }
r->handler(r->data, NULL);
cbdataReferenceDone(r->data);
authenticateStateFree(r);
return;
}
- if (!request->flags.proxy_keepalive) {
- debugs(29, 2, "AuthNTLMUserRequest::authenticate: attempt to perform authentication without a persistent connection!");
- auth_state = AUTHENTICATE_STATE_FAILED;
- request->flags.must_keepalive = 1;
- return;
- }
-
if (waiting) {
debugs(29, 1, "AuthNTLMUserRequest::authenticate: waiting for helper reply!");
return;
assert(conn->auth_user_request == NULL);
conn->auth_user_request = this;
AUTHUSERREQUESTLOCK(conn->auth_user_request, "conn");
+ this->request = request;
+ HTTPMSGLOCK(this->request);
return;
break;
client_blob = xstrdup (blob);
+ if (this->request)
+ HTTPMSGUNLOCK(this->request);
+ this->request = request;
+ HTTPMSGLOCK(this->request);
return;
break;
helperStatefulReleaseServer(authserver);
authserver = NULL;
}
+ if (request) {
+ HTTPMSGUNLOCK(request);
+ request = NULL;
+ }
}
void
/* currently waiting for helper response */
unsigned char waiting;
+ /* need access to the request flags to mess around on pconn failure */
+ HttpRequest *request;
+
private:
/* the user */
NTLMUser * _theUser;