summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-17 14:50:10 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-23 11:38:37 +0100
commita3015b09bb2c05916628a40e36342dbf5158a305 (patch)
treef6e5dcf4b8d06c9c94f0e6e6f7ea503a87a6ae18
parent452704e91fe2f56d8acb6da057cba21580c2e327 (diff)
downloadgnutls-a3015b09bb2c05916628a40e36342dbf5158a305.tar.gz
tests: added unit test of GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--tests/hostname-check.c13
1 files changed, 13 insertions, 0 deletions
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;