]> git.ipfire.org Git - thirdparty/git.git/blobdiff - imap-send.c
GIT-VERSION-GEN: support non-standard $GIT_DIR path
[thirdparty/git.git] / imap-send.c
index ef500111ec0bca6514e519d39e7a269a7342cddf..49ba841cbaabb6da9bfab1bf54f63a50c3069dd9 100644 (file)
@@ -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);