Skip to content

Commit 6328cd0

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 b2858a4 commit 6328cd0

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
@@ -1900,6 +1900,17 @@ static int handle_curl_result(struct slot_results *results)
19001900
credential_reject(the_repository, &http_auth);
19011901
if (always_auth_proactively())
19021902
http_proactive_auth = PROACTIVE_AUTH_NONE;
1903+
if ((results->auth_avail & CURLAUTH_NTLM) &&
1904+
!(http_auth_any & CURLAUTH_NTLM)) {
1905+
warning(_("Due to its cryptographic weaknesses, "
1906+
"NTLM authentication has been\n"
1907+
"disabled in Git by default. You can "
1908+
"re-enable it for trusted servers\n"
1909+
"by running:\n\n"
1910+
"git config set "
1911+
"http.%s://%s.allowNTLMAuth true"),
1912+
http_auth.protocol, http_auth.host);
1913+
}
19031914
return HTTP_NOAUTH;
19041915
} else {
19051916
http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;

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)