|
|
3de368 |
From 26a7b2342980f2eb46b47122d1d6dfbf13ed4ccb Mon Sep 17 00:00:00 2001
|
|
|
3de368 |
From: Petr Stodulka <pstodulk@redhat.com>
|
|
|
3de368 |
Date: Wed, 28 Sep 2016 20:01:34 +0200
|
|
|
3de368 |
Subject: [PATCH] http: control GSSAPI credential delegation
|
|
|
3de368 |
|
|
|
3de368 |
Delegation of credentials is disabled by default in libcurl since
|
|
|
3de368 |
version 7.21.7 due to security vulnerability CVE-2011-2192. Which
|
|
|
3de368 |
makes troubles with GSS/kerberos authentication when delegation
|
|
|
3de368 |
of credentials is required. This can be changed with option
|
|
|
3de368 |
CURLOPT_GSSAPI_DELEGATION in libcurl with set expected parameter
|
|
|
3de368 |
since libcurl version 7.22.0.
|
|
|
3de368 |
|
|
|
3de368 |
This patch provides new configuration variable http.delegation
|
|
|
3de368 |
which corresponds to curl parameter "--delegation" (see man 1 curl).
|
|
|
3de368 |
|
|
|
3de368 |
The following values are supported:
|
|
|
3de368 |
|
|
|
3de368 |
* none (default).
|
|
|
3de368 |
* policy
|
|
|
3de368 |
* always
|
|
|
3de368 |
|
|
|
3de368 |
Signed-off-by: Petr Stodulka <pstodulk@redhat.com>
|
|
|
3de368 |
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
|
3de368 |
---
|
|
|
3de368 |
Documentation/config.txt | 14 ++++++++++++++
|
|
|
3de368 |
http.c | 37 +++++++++++++++++++++++++++++++++++++
|
|
|
3de368 |
2 files changed, 51 insertions(+)
|
|
|
3de368 |
|
|
|
3de368 |
diff --git a/Documentation/config.txt b/Documentation/config.txt
|
|
|
3de368 |
index 0bcb679..c588168 100644
|
|
|
3de368 |
--- a/Documentation/config.txt
|
|
|
3de368 |
+++ b/Documentation/config.txt
|
|
|
3de368 |
@@ -1730,6 +1730,20 @@ http.emptyAuth::
|
|
|
3de368 |
a username in the URL, as libcurl normally requires a username for
|
|
|
3de368 |
authentication.
|
|
|
3de368 |
|
|
|
3de368 |
+http.delegation::
|
|
|
3de368 |
+ Control GSSAPI credential delegation. The delegation is disabled
|
|
|
3de368 |
+ by default in libcurl since version 7.21.7. Set parameter to tell
|
|
|
3de368 |
+ the server what it is allowed to delegate when it comes to user
|
|
|
3de368 |
+ credentials. Used with GSS/kerberos. Possible values are:
|
|
|
3de368 |
++
|
|
|
3de368 |
+--
|
|
|
3de368 |
+* `none` - Don't allow any delegation.
|
|
|
3de368 |
+* `policy` - Delegates if and only if the OK-AS-DELEGATE flag is set in the
|
|
|
3de368 |
+ Kerberos service ticket, which is a matter of realm policy.
|
|
|
3de368 |
+* `always` - Unconditionally allow the server to delegate.
|
|
|
3de368 |
+--
|
|
|
3de368 |
+
|
|
|
3de368 |
+
|
|
|
3de368 |
http.extraHeader::
|
|
|
3de368 |
Pass an additional HTTP header when communicating with a server. If
|
|
|
3de368 |
more than one such entry exists, all of them are added as extra
|
|
|
3de368 |
diff --git a/http.c b/http.c
|
|
|
3de368 |
index cd40b01..624f0ce 100644
|
|
|
3de368 |
--- a/http.c
|
|
|
3de368 |
+++ b/http.c
|
|
|
3de368 |
@@ -90,6 +90,18 @@ static struct {
|
|
|
3de368 |
* here, too
|
|
|
3de368 |
*/
|
|
|
3de368 |
};
|
|
|
3de368 |
+#if LIBCURL_VERSION_NUM >= 0x071600
|
|
|
3de368 |
+static const char *curl_deleg;
|
|
|
3de368 |
+static struct {
|
|
|
3de368 |
+ const char *name;
|
|
|
3de368 |
+ long curl_deleg_param;
|
|
|
3de368 |
+} curl_deleg_levels[] = {
|
|
|
3de368 |
+ { "none", CURLGSSAPI_DELEGATION_NONE },
|
|
|
3de368 |
+ { "policy", CURLGSSAPI_DELEGATION_POLICY_FLAG },
|
|
|
3de368 |
+ { "always", CURLGSSAPI_DELEGATION_FLAG },
|
|
|
3de368 |
+};
|
|
|
3de368 |
+#endif
|
|
|
3de368 |
+
|
|
|
3de368 |
static struct credential proxy_auth = CREDENTIAL_INIT;
|
|
|
3de368 |
static const char *curl_proxyuserpwd;
|
|
|
3de368 |
static const char *curl_cookie_file;
|
|
|
3de368 |
@@ -316,6 +328,15 @@ static int http_options(const char *var, const char *value, void *cb)
|
|
|
3de368 |
return 0;
|
|
|
3de368 |
}
|
|
|
3de368 |
|
|
|
3de368 |
+ if (!strcmp("http.delegation", var)) {
|
|
|
3de368 |
+#if LIBCURL_VERSION_NUM >= 0x071600
|
|
|
3de368 |
+ return git_config_string(&curl_deleg, var, value);
|
|
|
3de368 |
+#else
|
|
|
3de368 |
+ warning(_("Delegation control is not supported with cURL < 7.22.0"));
|
|
|
3de368 |
+ return 0;
|
|
|
3de368 |
+#endif
|
|
|
3de368 |
+ }
|
|
|
3de368 |
+
|
|
|
3de368 |
if (!strcmp("http.pinnedpubkey", var)) {
|
|
|
3de368 |
#if LIBCURL_VERSION_NUM >= 0x072c00
|
|
|
3de368 |
return git_config_pathname(&ssl_pinnedkey, var, value);
|
|
|
3de368 |
@@ -622,6 +643,22 @@ static CURL *get_curl_handle(void)
|
|
|
3de368 |
curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
|
|
3de368 |
#endif
|
|
|
3de368 |
|
|
|
3de368 |
+#if LIBCURL_VERSION_NUM >= 0x071600
|
|
|
3de368 |
+ if (curl_deleg) {
|
|
|
3de368 |
+ int i;
|
|
|
3de368 |
+ for (i = 0; i < ARRAY_SIZE(curl_deleg_levels); i++) {
|
|
|
3de368 |
+ if (!strcmp(curl_deleg, curl_deleg_levels[i].name)) {
|
|
|
3de368 |
+ curl_easy_setopt(result, CURLOPT_GSSAPI_DELEGATION,
|
|
|
3de368 |
+ curl_deleg_levels[i].curl_deleg_param);
|
|
|
3de368 |
+ break;
|
|
|
3de368 |
+ }
|
|
|
3de368 |
+ }
|
|
|
3de368 |
+ if (i == ARRAY_SIZE(curl_deleg_levels))
|
|
|
3de368 |
+ warning("Unknown delegation method '%s': using default",
|
|
|
3de368 |
+ curl_deleg);
|
|
|
3de368 |
+ }
|
|
|
3de368 |
+#endif
|
|
|
3de368 |
+
|
|
|
3de368 |
if (http_proactive_auth)
|
|
|
3de368 |
init_curl_http_auth(result);
|
|
|
3de368 |
|
|
|
3de368 |
--
|
|
|
3de368 |
2.5.5
|
|
|
3de368 |
|