Skip to content

Commit 5f14c80

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 ec6aa85 commit 5f14c80

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

http.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,17 @@ static int handle_curl_result(struct slot_results *results)
19601960
credential_reject(the_repository, &http_auth);
19611961
if (always_auth_proactively())
19621962
http_proactive_auth = PROACTIVE_AUTH_NONE;
1963+
if ((results->auth_avail & CURLAUTH_NTLM) &&
1964+
!(http_auth_any & CURLAUTH_NTLM)) {
1965+
warning(_("Due to its cryptographic weaknesses, "
1966+
"NTLM authentication has been\n"
1967+
"disabled in Git by default. You can "
1968+
"re-enable it for trusted servers\n"
1969+
"by running:\n\n"
1970+
"git config set "
1971+
"http.%s://%s.allowNTLMAuth true"),
1972+
http_auth.protocol, http_auth.host);
1973+
}
19631974
return HTTP_NOAUTH;
19641975
} else {
19651976
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
@@ -731,7 +731,8 @@ test_expect_success NTLM 'access using NTLM auth' '
731731
732732
test_config_global credential.helper test-helper &&
733733
test_must_fail env GIT_TRACE_CURL=1 git \
734-
ls-remote "$HTTPD_URL/ntlm_auth/repo.git" &&
734+
ls-remote "$HTTPD_URL/ntlm_auth/repo.git" 2>err &&
735+
test_grep "allowNTLMAuth" err &&
735736
GIT_TRACE_CURL=1 git -c http.$HTTPD_URL.allowNTLMAuth=true \
736737
ls-remote "$HTTPD_URL/ntlm_auth/repo.git"
737738
'

0 commit comments

Comments
 (0)