@matheusbsbs / matheus-bagliano / commits / 754ae192a4
Fork 0

http.c: add http.sslCertPasswordProtected option

Add a configuration option, http.sslCertPasswordProtected, and associated environment variable, GIT_SSL_CERT_PASSWORD_PROTECTED, to enable SSL client certificate password prompt from within git. If this option is false and if the environment variable does not exist, git falls back to OpenSSL's prompts (as in earlier versions of git). The environment variable may only be used to enable, not to disable git's password prompt. This behavior mimics GIT_NO_VERIFY; the mere existence of the variable is all that is checked. Signed-off-by: Mark Lodato <lodatom@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mark Lodato committed May 27, 2009 at 23:16 UTC 754ae192a4390baeb4d00b96e72c69023efb22ee
2 files changed +14 -1
Documentation/config.txt
+6
@@ -1043,6 +1043,12 @@ http.sslKey::
1043 over HTTPS. Can be overridden by the 'GIT_SSL_KEY' environment
1044 variable.
1045
1046 +http.sslCertPasswordProtected::
1047 + Enable git's password prompt for the SSL certificate. Otherwise
1048 + OpenSSL will prompt the user, possibly many times, if the
1049 + certificate or private key is encrypted. Can be overridden by the
1050 + 'GIT_SSL_CERT_PASSWORD_PROTECTED' environment variable.
1051 +
1052 http.sslCAInfo::
1053 File containing the certificates to verify the peer with when
1054 fetching or pushing over HTTPS. Can be overridden by the
http.c
+8 -1
@@ -140,6 +140,11 @@ static int http_options(const char *var, const char *value, void *cb)
140 #endif
141 if (!strcmp("http.sslcainfo", var))
142 return git_config_string(&ssl_cainfo, var, value);
143 + if (!strcmp("http.sslcertpasswordprotected", var)) {
144 + if (git_config_bool(var, value))
145 + ssl_cert_password_required = 1;
146 + return 0;
147 + }
148 #ifdef USE_CURL_MULTI
149 if (!strcmp("http.maxrequests", var)) {
150 max_requests = git_config_int(var, value);
@@ -360,7 +365,9 @@ void http_init(struct remote *remote)
365
366 if (remote && remote->url && remote->url[0]) {
367 http_auth_init(remote->url[0]);
363 - if (!prefixcmp(remote->url[0], "https://"))
368 + if (!ssl_cert_password_required &&
369 + getenv("GIT_SSL_CERT_PASSWORD_PROTECTED") &&
370 + !prefixcmp(remote->url[0], "https://"))
371 ssl_cert_password_required = 1;
372 }
373