From: Nikos Mavrogiannopoulos Date: Fri, 17 Mar 2017 13:50:10 +0000 (+0100) Subject: tests: added unit test of GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES X-Git-Tag: gnutls_3_6_0~754 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a3015b09bb2c05916628a40e36342dbf5158a305;p=thirdparty%2Fgnutls.git tests: added unit test of GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/tests/hostname-check.c b/tests/hostname-check.c index 2a79915704..84b60cb3b7 100644 --- a/tests/hostname-check.c +++ b/tests/hostname-check.c @@ -1067,6 +1067,19 @@ void doit(void) if (!ret) fail("%d: Hostname incorrectly does not match (%d)\n", __LINE__, ret); + /* test flag GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES */ + ret = gnutls_x509_crt_check_hostname2(x509, "127.0.0.1", GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES); + if (ret) + fail("%d: Hostname incorrectly matches (%d)\n", __LINE__, ret); + + ret = gnutls_x509_crt_check_hostname2(x509, "::1", GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES); + if (ret) + fail("%d: Hostname incorrectly matches (%d)\n", __LINE__, ret); + + ret = gnutls_x509_crt_check_hostname2(x509, "127.0.0.2", GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES); + if (ret) + fail("%d: Hostname incorrectly matches (%d)\n", __LINE__, ret); + if (debug) success("Testing multi-cns...\n"); data.data = (unsigned char *) multi_cns;