threads / discuss / 29683

Allow NTLM-Authentication against a http-proxy server

Subject: Allow NTLM-Authentication against a http-proxy server

## tl;dr

One message between Feb 21, 2012 and Feb 21, 2012.

replies: 0people: 1as markdown or json

Schmidt, Marco· Feb 21, 2012, 14:31 UTC · lore

After some back and forward - here is my patch to support NTLM-authentication against a http-proxy server again.

Big thanks are going to Thomas Rast for helping to fiddle the patch to a more correct form and his commit message ;).

Marco Schmidt
 
From f4e112e41aef75f08532fda53a1b9021208a3774 Mon Sep 17 00:00:00 2001
From: Marco Schmidt <Marco.Schmidt@cassidian.com>
Date: Tue, 21 Feb 2012 12:30:29 +0100
Subject: [PATCH] http/curl: let user configure "any" proxy authentication
  Normally, curl uses only the "basic" authentication scheme when
  talking to proxies, which may not be desirable (it sends the password
  in cleartext) or sufficient (the author needs NTLM authentication for
  his proxy).
  Introduce the config setting http.proxyAuthAny.  When enabled, we tell
  curl to use any authentication scheme supported by the proxy
---
 http.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index 0ffd79c..5c55efd 100644
--- a/http.c
+++ b/http.c
@@ -41,6 +41,7 @@ static long curl_low_speed_limit = -1;
 static long curl_low_speed_time = -1;
 static int curl_ftp_no_epsv;
 static const char *curl_http_proxy;
+static int curl_http_proxyauthany = 0;
 static const char *curl_cookie_file;
 static struct credential http_auth = CREDENTIAL_INIT;
 static int http_proactive_auth;
@@ -190,6 +191,11 @@ static int http_options(const char *var, const char *value, void *cb)
 	}
 	if (!strcmp("http.proxy", var))
 		return git_config_string(&curl_http_proxy, var, value);
+	
+	if (!strcmp("http.proxyauthany", var)) {
+		curl_http_proxyauthany = git_config_bool(var, value);
+		return 0;
+	}
 
 	if (!strcmp("http.cookiefile", var))
 		return git_config_string(&curl_cookie_file, var, value);
@@ -297,6 +303,12 @@ static CURL *get_curl_handle(void)
 
 	if (curl_http_proxy)
 		curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
+	
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY	
+	if (curl_http_proxyauthany) {
+		curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
+	}
+#endif
 
 	return result;
 }
-- 
1.7.7.1.msysgit.0

← back to recent threads