diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-02-04 14:01:36 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-02-04 14:13:52 +0100 |
commit | 5a244a28ae6da0901bd8a2cb0b58b7bc1b5c0a99 (patch) | |
tree | 1873d3cb3735136d81d831ad58844431293d919a | |
parent | 35bb9d4bc9f66293cd75cb405d5af3b291054e1f (diff) | |
download | gnutls-5a244a28ae6da0901bd8a2cb0b58b7bc1b5c0a99.tar.gz |
tests: enable all IDNA tests when compiled with libidn2
Keep IDNA2003-only tests on the ifdef HAVE_LIBIDN.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/cert_verify_inv_utf8.c | 2 | ||||
-rw-r--r-- | tests/crq_apis.c | 2 | ||||
-rw-r--r-- | tests/hostname-check-utf8.c | 8 | ||||
-rw-r--r-- | tests/mini-server-name.c | 2 | ||||
-rw-r--r-- | tests/set_key_utf8.c | 4 | ||||
-rw-r--r-- | tests/set_x509_key_utf8.c | 2 |
6 files changed, 12 insertions, 8 deletions
diff --git a/tests/cert_verify_inv_utf8.c b/tests/cert_verify_inv_utf8.c index d43dfe80cc..a2b1e5b965 100644 --- a/tests/cert_verify_inv_utf8.c +++ b/tests/cert_verify_inv_utf8.c @@ -150,7 +150,7 @@ static void auto_parse(void) void doit(void) { -#ifndef HAVE_LIBIDN +#if !defined(HAVE_LIBIDN) && !defined(HAVE_LIBIDN2) exit(77); #endif auto_parse(); diff --git a/tests/crq_apis.c b/tests/crq_apis.c index 7ad717ff13..0d7c8a018b 100644 --- a/tests/crq_apis.c +++ b/tests/crq_apis.c @@ -448,7 +448,7 @@ void doit(void) assert(gnutls_x509_crq_export2(crq, GNUTLS_X509_FMT_PEM, &out) >= 0); -#ifdef HAVE_LIBIDN +#if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2) assert(out.size == saved_crq.size); assert(memcmp(out.data, saved_crq.data, out.size)==0); #endif diff --git a/tests/hostname-check-utf8.c b/tests/hostname-check-utf8.c index 4f521c5690..10128bc774 100644 --- a/tests/hostname-check-utf8.c +++ b/tests/hostname-check-utf8.c @@ -188,7 +188,7 @@ void doit(void) if (ret) fail("%d: Hostname incorrectly matches (%d)\n", __LINE__, ret); -#ifdef HAVE_LIBIDN +#if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2) ret = gnutls_x509_crt_check_hostname(x509, "www.teχ.gr"); if (!ret) fail("%d: Hostname incorrectly does not match (%d)\n", __LINE__, ret); @@ -197,11 +197,12 @@ void doit(void) if (!ret) fail("%d: Hostname incorrectly does not match (%d)\n", __LINE__, ret); - ret = gnutls_x509_crt_check_hostname(x509, "γΓγ.τόΣτ.gr"); + ret = gnutls_x509_crt_check_hostname(x509, "τέστ.gr"); if (!ret) fail("%d: Hostname incorrectly does not match (%d)\n", __LINE__, ret); - ret = gnutls_x509_crt_check_hostname(x509, "τέστ.gr"); +#if defined(HAVE_LIBIDN) /* There are IDNA2003 */ + ret = gnutls_x509_crt_check_hostname(x509, "γΓγ.τόΣτ.gr"); if (!ret) fail("%d: Hostname incorrectly does not match (%d)\n", __LINE__, ret); @@ -209,6 +210,7 @@ void doit(void) if (!ret) fail("%d: Hostname incorrectly does not match (%d)\n", __LINE__, ret); #endif +#endif gnutls_x509_crt_deinit(x509); diff --git a/tests/mini-server-name.c b/tests/mini-server-name.c index 8f8ed0b905..ae7bb185a5 100644 --- a/tests/mini-server-name.c +++ b/tests/mini-server-name.c @@ -341,7 +341,7 @@ void doit(void) start("empty", 0, "", 0, "", 0); start("test.example.com", 0, "test.example.com", strlen("test.example.com"), "test.example.com", strlen("test.example.com")); start("longtest.example.com", 0, "longtest.example.com.", strlen("longtest.example.com"), "longtest.example.com.", strlen("longtest.example.com")); -#ifdef HAVE_LIBIDN +#if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2) /* test invalid UTF8 */ start("invalid-utf8", 1, "invalid\xff.example.com.", sizeof("invalid\xff.example.com")-1, NULL, 0); #endif diff --git a/tests/set_key_utf8.c b/tests/set_key_utf8.c index adbb16aeaf..17d031d67d 100644 --- a/tests/set_key_utf8.c +++ b/tests/set_key_utf8.c @@ -135,9 +135,11 @@ static void auto_parse(void) } test_cli_serv(x509_cred, clicred, "NORMAL", "localhost", NULL, NULL, NULL); /* the DNS name of the first cert */ +#ifdef HAVE_LIBIDN /* IDNA2003-only */ test_cli_serv(x509_cred, clicred, "NORMAL", "www.νίκος.com", NULL, NULL, NULL); /* the DNS name of second cert */ test_cli_serv(x509_cred, clicred, "NORMAL", "raw:www.νίκος.com", NULL, NULL, NULL); /* the DNS name of second cert */ test_cli_serv(x509_cred, clicred, "NORMAL", "www.xn--kxawhku.com", NULL, NULL, NULL); /* the previous name in IDNA format */ +#endif test_cli_serv(x509_cred, clicred, "NORMAL", "简体中文.εξτρα.com", NULL, NULL, NULL); /* the second DNS name of cert */ test_cli_serv(x509_cred, clicred, "NORMAL", "raw:简体中文.εξτρα.com", NULL, NULL, NULL); /* the second DNS name of cert */ test_cli_serv(x509_cred, clicred, "NORMAL", "xn--fiqu1az03c18t.xn--mxah1amo.com", NULL, NULL, NULL); /* its IDNA equivalent */ @@ -153,7 +155,7 @@ static void auto_parse(void) void doit(void) { -#ifndef HAVE_LIBIDN +#if !defined(HAVE_LIBIDN) && !defined(HAVE_LIBIDN2) exit(77); #endif auto_parse(); diff --git a/tests/set_x509_key_utf8.c b/tests/set_x509_key_utf8.c index 838ec84028..bee5985a89 100644 --- a/tests/set_x509_key_utf8.c +++ b/tests/set_x509_key_utf8.c @@ -143,7 +143,7 @@ void doit(void) int ret; unsigned idx; -#ifndef HAVE_LIBIDN +#if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2) exit(77); #endif |