X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Fssl_lib.c;h=a31d2dd2ff4c7426d7106381c1b2823359659b17;hp=871606cfc1e07b53d0f596c83b8b58c72cb3c045;hb=c832840e899091948bb7f5e9af63f929e6a18f95;hpb=a677190779705d243cca88ae04f2105dee52672d diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 871606cfc1..a31d2dd2ff 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -955,11 +955,21 @@ int SSL_set_trust(SSL *s, int trust) int SSL_set1_host(SSL *s, const char *hostname) { + /* If a hostname is provided and parses as an IP address, + * treat it as such. */ + if (hostname && X509_VERIFY_PARAM_set1_ip_asc(s->param, hostname) == 1) + return 1; + return X509_VERIFY_PARAM_set1_host(s->param, hostname, 0); } int SSL_add1_host(SSL *s, const char *hostname) { + /* If a hostname is provided and parses as an IP address, + * treat it as such. */ + if (hostname && X509_VERIFY_PARAM_set1_ip_asc(s->param, hostname) == 1) + return 1; + return X509_VERIFY_PARAM_add1_host(s->param, hostname, 0); }