Commit 5625892b2c0e3767eccda6cb5ad38fabce3647e0

Jonathan Turcotte 2019-09-20T12:06:11

gssapi: delete half-built security context so auth can continue

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/transports/auth_negotiate.c b/src/transports/auth_negotiate.c
index d06bf74..e1fa803 100644
--- a/src/transports/auth_negotiate.c
+++ b/src/transports/auth_negotiate.c
@@ -128,9 +128,9 @@ static int negotiate_next_token(
 		input_token.length = input_buf.size;
 		input_token_ptr = &input_token;
 	} else if (ctx->gss_context != GSS_C_NO_CONTEXT) {
-		git_error_set(GIT_ERROR_NET, "could not restart authentication");
-		error = -1;
-		goto done;
+		/* If we're given a half-built security context, delete it so auth can continue. */
+		gss_delete_sec_context(&status_minor, &ctx->gss_context, GSS_C_NO_BUFFER);
+		ctx->gss_context = GSS_C_NO_CONTEXT;
 	}
 
 	mech = &negotiate_oid_spnego;