Skip to content

Commit 2d6a61b

Browse files
committed
gssapi: validate that we were requested Negotiate
1 parent e761df5 commit 2d6a61b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/transports/auth_negotiate.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,13 @@ static int negotiate_next_token(
128128

129129
challenge_len = ctx->challenge ? strlen(ctx->challenge) : 0;
130130

131-
if (challenge_len < 9) {
132-
git_error_set(GIT_ERROR_NET, "no negotiate challenge sent from server");
131+
if (challenge_len < 9 || memcmp(ctx->challenge, "Negotiate", 9) != 0) {
132+
git_error_set(GIT_ERROR_NET, "server did not request negotiate");
133133
error = -1;
134134
goto done;
135-
} else if (challenge_len > 9) {
135+
}
136+
137+
if (challenge_len > 9) {
136138
if (git_buf_decode_base64(&input_buf,
137139
ctx->challenge + 10, challenge_len - 10) < 0) {
138140
git_error_set(GIT_ERROR_NET, "invalid negotiate challenge from server");

0 commit comments

Comments
 (0)