aboutsummaryrefslogtreecommitdiff
path: root/lib/http_negotiate.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-11-20 23:17:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-11-20 23:17:08 +0000
commitb6575ce0b0fa74626c136a96b411f7baaca9c55b (patch)
tree1e1da11dde59e3302899b26569785921bf0ed21d /lib/http_negotiate.c
parente2b2a84497ca8a4460397e69be2c7fa1a37d6453 (diff)
While inspecting the Negotiate code, I noticed how the proxy auth was using
the same state struct as the host auth, so both could never be used at the same time! I fixed it (without being able to check) to use two separate structs to allow authentication using Negotiate on host and proxy simultanouesly.
Diffstat (limited to 'lib/http_negotiate.c')
-rw-r--r--lib/http_negotiate.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index 5e88dc0a0..c584e28a6 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -51,7 +51,8 @@
static int
get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server)
{
- struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
+ struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:
+ &conn->data->state.negotiate;
OM_uint32 major_status, minor_status;
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
char name[2048];
@@ -98,12 +99,12 @@ log_gss_error(struct connectdata *conn, OM_uint32 error_status, char *prefix)
snprintf(buf, sizeof(buf), "%s", prefix);
len = strlen(buf);
do {
- maj_stat = gss_display_status (&min_stat,
- error_status,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
+ maj_stat = gss_display_status(&min_stat,
+ error_status,
+ GSS_C_MECH_CODE,
+ GSS_C_NO_OID,
+ &msg_ctx,
+ &status_string);
if(sizeof(buf) > len + status_string.length + 1) {
snprintf(buf + len, sizeof(buf) - len,
": %s", (char*) status_string.value);
@@ -118,7 +119,8 @@ log_gss_error(struct connectdata *conn, OM_uint32 error_status, char *prefix)
int Curl_input_negotiate(struct connectdata *conn, bool proxy,
const char *header)
{
- struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
+ struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:
+ &conn->data->state.negotiate;
OM_uint32 major_status, minor_status, minor_status2;
gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;
gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;
@@ -251,13 +253,14 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
{
- struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
+ struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:
+ &conn->data->state.negotiate;
OM_uint32 minor_status;
char *encoded = NULL;
int len;
#ifdef HAVE_SPNEGO /* Handle SPNEGO */
- if(checkprefix("Negotiate",neg_ctx->protocol)) {
+ if(checkprefix("Negotiate", neg_ctx->protocol)) {
ASN1_OBJECT * object = NULL;
int rc = 1;
unsigned char * spnegoToken = NULL;
@@ -310,11 +313,9 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
return (conn->allocptr.userpwd == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;
}
-void Curl_cleanup_negotiate(struct SessionHandle *data)
+static void cleanup(struct negotiatedata *neg_ctx)
{
OM_uint32 minor_status;
- struct negotiatedata *neg_ctx = &data->state.negotiate;
-
if(neg_ctx->context != GSS_C_NO_CONTEXT)
gss_delete_sec_context(&minor_status, &neg_ctx->context, GSS_C_NO_BUFFER);
@@ -327,6 +328,12 @@ void Curl_cleanup_negotiate(struct SessionHandle *data)
memset(neg_ctx, 0, sizeof(*neg_ctx));
}
+void Curl_cleanup_negotiate(struct SessionHandle *data)
+{
+ cleanup(&data->state.negotiate);
+ cleanup(&data->state.proxyneg);
+}
+
#endif
#endif