summaryrefslogtreecommitdiff
path: root/tests/nul-in-x509-names.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-03-20 14:57:26 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-03-20 14:57:26 +0100
commit57d407aba226740d7e5f830155c260199461bb6d (patch)
tree0b3d4f5c1e52d98f13273c9a4d22d03a10e6c98c /tests/nul-in-x509-names.c
parent5bf4daf8d5ebc79058bdafe8167da04abc5c5582 (diff)
downloadgnutls-57d407aba226740d7e5f830155c260199461bb6d.tar.gz
Reduced several unneeded messages during the make check procedure.
Verbose messages can be obtained with --verbose.
Diffstat (limited to 'tests/nul-in-x509-names.c')
-rw-r--r--tests/nul-in-x509-names.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/tests/nul-in-x509-names.c b/tests/nul-in-x509-names.c
index 1b31bb8028..c4b85f7a6b 100644
--- a/tests/nul-in-x509-names.c
+++ b/tests/nul-in-x509-names.c
@@ -30,6 +30,8 @@
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
+#include "utils.h"
+
/* Thanks to Tomas Hoger <thoger@redhat.com> for generating the two
certs that trigger this bug. */
@@ -88,66 +90,61 @@ const gnutls_datum_t badguy_nul_san = {
badguy_nul_san_data, sizeof (badguy_nul_san_data)
};
-int
-main (void)
+void doit(void)
{
gnutls_x509_crt_t crt;
int ret;
- int exit_code = 0;
ret = gnutls_global_init ();
if (ret < 0)
{
- puts ("gnutls_global_init");
- return 1;
+ fail ("gnutls_global_init");
+ exit(1);
}
ret = gnutls_x509_crt_init (&crt);
if (ret != 0)
{
- puts ("gnutls_x509_crt_init");
- return 1;
+ fail("gnutls_x509_crt_init");
+ exit(1);
}
ret = gnutls_x509_crt_import (crt, &badguy_nul_cn, GNUTLS_X509_FMT_PEM);
if (ret < 0)
{
- puts ("gnutls_x509_crt_import");
- return 1;
+ fail("gnutls_x509_crt_import");
+ exit(1);
}
ret = gnutls_x509_crt_check_hostname (crt, "www.bank.com");
if (ret == 0)
{
- puts ("gnutls_x509_crt_check_hostname OK (NUL-IN-CN)");
+ if (debug) success("gnutls_x509_crt_check_hostname OK (NUL-IN-CN)");
}
else
{
- puts ("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-CN)");
- exit_code = 1;
+ fail("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-CN)");
}
ret = gnutls_x509_crt_import (crt, &badguy_nul_san, GNUTLS_X509_FMT_PEM);
if (ret < 0)
{
- puts ("gnutls_x509_crt_import");
- return 1;
+ fail ("gnutls_x509_crt_import");
+ exit(1);
}
ret = gnutls_x509_crt_check_hostname (crt, "www.bank.com");
if (ret == 0)
{
- puts ("gnutls_x509_crt_check_hostname OK (NUL-IN-SAN)");
+ if (debug) success("gnutls_x509_crt_check_hostname OK (NUL-IN-SAN)");
}
else
{
- puts ("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-SAN)");
- exit_code = 1;
+ fail("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-SAN)");
}
gnutls_x509_crt_deinit (crt);
gnutls_global_deinit ();
- return exit_code;
}