From: Mark Lodato <lodatom@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Cc: Mark Lodato <lodatom@gmail.com>
Subject: [PATCH 2/2] http.c: add http.sslCertType and http.sslKeyType
Date: Sun, 14 Jun 2009 22:39:01 -0400 [thread overview]
Message-ID: <1245033541-15558-2-git-send-email-lodatom@gmail.com> (raw)
In-Reply-To: <1245033541-15558-1-git-send-email-lodatom@gmail.com>
Add two new configuration variables, http.sslCertType and
http.sslKeyType, which tell libcurl the filetype for the SSL client
certificate and private key, respectively. The main benefit is to allow
PKCS12 certificates for users with libcurl >= 7.13.0.
Signed-off-by: Mark Lodato <lodatom@gmail.com>
---
Unfortunately, P12 support in libcurl is not great, so encrypted P12
certificates do not work at all. At least now unencrypted certificates
are possible. Hopefully, my password prompting patch series (once I
finish it) will resolve this issue.
As always, any feedback on this patch is appreciated. In particular, I
welcome suggestions for improving the documentation phrasing.
Documentation/config.txt | 10 ++++++++++
http.c | 12 ++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 2fecbe3..b19a923 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1038,11 +1038,21 @@ http.sslCert::
over HTTPS. Can be overridden by the 'GIT_SSL_CERT' environment
variable.
+http.sslCertType::
+ Filetype for SSL certificate. Must be "PEM" (default), "DER", or
+ (if libcurl >= 7.13.0) "P12". Can be overridden by the
+ 'GIT_SSL_CERT_TYPE' environment variable.
+
http.sslKey::
File containing the SSL private key when fetching or pushing
over HTTPS. Can be overridden by the 'GIT_SSL_KEY' environment
variable.
+http.sslKeyType::
+ Filetype for SSL private key. Must be "PEM" (default), "DER", or
+ (if libcurl >= 7.13.0) "P12". Can be overridden by the
+ 'GIT_SSL_CERT_TYPE' environment variable.
+
http.sslCAInfo::
File containing the certificates to verify the peer with when
fetching or pushing over HTTPS. Can be overridden by the
diff --git a/http.c b/http.c
index b049948..5716e4e 100644
--- a/http.c
+++ b/http.c
@@ -22,6 +22,8 @@ static int curl_ssl_verify = -1;
static const char *ssl_cert;
#if LIBCURL_VERSION_NUM >= 0x070903
static const char *ssl_key;
+static const char *ssl_cert_type;
+static const char *ssl_key_type;
#endif
#if LIBCURL_VERSION_NUM >= 0x070908
static const char *ssl_capath;
@@ -129,6 +131,10 @@ static int http_options(const char *var, const char *value, void *cb)
#if LIBCURL_VERSION_NUM >= 0x070903
if (!strcmp("http.sslkey", var))
return git_config_string(&ssl_key, var, value);
+ if (!strcmp("http.sslcerttype", var))
+ return git_config_string(&ssl_cert_type, var, value);
+ if (!strcmp("http.sslkeytype", var))
+ return git_config_string(&ssl_key_type, var, value);
#endif
#if LIBCURL_VERSION_NUM >= 0x070908
if (!strcmp("http.sslcapath", var))
@@ -199,6 +205,10 @@ static CURL *get_curl_handle(void)
#if LIBCURL_VERSION_NUM >= 0x070903
if (ssl_key != NULL)
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
+ if (ssl_cert_type != NULL)
+ curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);
+ if (ssl_key_type != NULL)
+ curl_easy_setopt(result, CURLOPT_SSLKEYTYPE, ssl_key_type);
#endif
#if LIBCURL_VERSION_NUM >= 0x070908
if (ssl_capath != NULL)
@@ -315,6 +325,8 @@ void http_init(struct remote *remote)
set_from_env(&ssl_cert, "GIT_SSL_CERT");
#if LIBCURL_VERSION_NUM >= 0x070903
set_from_env(&ssl_key, "GIT_SSL_KEY");
+ set_from_env(&ssl_cert, "GIT_SSL_CERT_TYPE");
+ set_from_env(&ssl_key, "GIT_SSL_KEY_TYPE");
#endif
#if LIBCURL_VERSION_NUM >= 0x070908
set_from_env(&ssl_capath, "GIT_SSL_CAPATH");
--
1.6.3.2
next prev parent reply other threads:[~2009-06-15 2:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 2:39 [PATCH 1/2] http.c: fix compiling with libcurl 7.9.2 Mark Lodato
2009-06-15 2:39 ` Mark Lodato [this message]
2009-06-15 17:43 ` [PATCH 2/2] http.c: add http.sslCertType and http.sslKeyType Karsten Weiss
2009-06-16 0:55 ` Mark Lodato
2009-06-16 5:56 ` Junio C Hamano
2009-06-16 6:47 ` Junio C Hamano
2009-06-16 20:07 ` Karsten Weiss
2009-06-16 0:56 ` Mark Lodato
2009-06-15 4:35 ` [PATCH 1/2] http.c: fix compiling with libcurl 7.9.2 Junio C Hamano
2009-06-15 12:55 ` Tay Ray Chuan
2009-06-18 16:26 ` Mike Ralphson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245033541-15558-2-git-send-email-lodatom@gmail.com \
--to=lodatom@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).