summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-03 08:35:33 -0700
committerJunio C Hamano <gitster@pobox.com>2013-04-03 08:35:33 -0700
commitd7df695d85c28cc21680947b822bcc3bcbddd48d (patch)
tree881f0e69afab0a1c0cff429fbb861d9eb274578f
parentf4254d1fb209b1955394ec4a74d1a8a5935ad7c3 (diff)
parent698a1ec4d52e90d611c233a12147daf261168bc6 (diff)
downloadgit-d7df695d85c28cc21680947b822bcc3bcbddd48d.tar.gz
Merge branch 'ob/imap-send-ssl-verify' into maint-1.8.1
* ob/imap-send-ssl-verify: imap-send: support Server Name Indication (RFC4366)
-rw-r--r--imap-send.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/imap-send.c b/imap-send.c
index ef500111ec..49ba841cba 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -370,6 +370,17 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
return -1;
}
+#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
+ /*
+ * SNI (RFC4366)
+ * OpenSSL does not document this function, but the implementation
+ * returns 1 on success, 0 on failure after calling SSLerr().
+ */
+ ret = SSL_set_tlsext_host_name(sock->ssl, server.host);
+ if (ret != 1)
+ warning("SSL_set_tlsext_host_name(%s) failed.", server.host);
+#endif
+
ret = SSL_connect(sock->ssl);
if (ret <= 0) {
socket_perror("SSL_connect", sock, ret);