Skip to content

Commit d9b8fcb

Browse files
dschoGit for Windows Build Agent
authored andcommitted
http: warn if might have failed because of NTLM
The new default of Git is to disable NTLM authentication by default. To help users find the escape hatch of that config setting, should they need it, suggest it when the authentication failed and the server had offered NTLM, i.e. if re-enabling it would fix the problem. Helped-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 15374a1 commit d9b8fcb

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

http.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,17 @@ static int handle_curl_result(struct slot_results *results)
19171917
credential_reject(the_repository, &http_auth);
19181918
if (always_auth_proactively())
19191919
http_proactive_auth = PROACTIVE_AUTH_NONE;
1920+
if ((results->auth_avail & CURLAUTH_NTLM) &&
1921+
!(http_auth_any & CURLAUTH_NTLM)) {
1922+
warning(_("Due to its cryptographic weaknesses, "
1923+
"NTLM authentication has been\n"
1924+
"disabled in Git by default. You can "
1925+
"re-enable it for trusted servers\n"
1926+
"by running:\n\n"
1927+
"git config set "
1928+
"http.%s://%s.allowNTLMAuth true"),
1929+
http_auth.protocol, http_auth.host);
1930+
}
19201931
return HTTP_NOAUTH;
19211932
} else {
19221933
if (curl_empty_auth == -1 &&

t/t5563-simple-http-auth.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,8 @@ test_expect_success NTLM 'access using NTLM auth' '
805805
806806
test_config_global credential.helper test-helper &&
807807
test_must_fail env GIT_TRACE_CURL=1 git \
808-
ls-remote "$HTTPD_URL/ntlm_auth/repo.git" &&
808+
ls-remote "$HTTPD_URL/ntlm_auth/repo.git" 2>err &&
809+
test_grep "allowNTLMAuth" err &&
809810
GIT_TRACE_CURL=1 git -c http.$HTTPD_URL.allowNTLMAuth=true \
810811
ls-remote "$HTTPD_URL/ntlm_auth/repo.git"
811812
'

0 commit comments

Comments
 (0)