summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2009-08-18 13:50:29 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2009-08-18 13:50:29 +0000
commit9ecf5fc3c83b27eec78e761caaa6658cfb7b2384 (patch)
tree079d9c172e51b057c88a0fb4560780ea8a6ff3c5 /test
parentfed1940e9136c0a799420e56e3ceefe0f3ab7f58 (diff)
downloadneon-9ecf5fc3c83b27eec78e761caaa6658cfb7b2384.tar.gz
* test/ssl.c (fail_nul_*): Fix for VPATH builds.
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1686 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'test')
-rw-r--r--test/ssl.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/test/ssl.c b/test/ssl.c
index a112a4f..13010b5 100644
--- a/test/ssl.c
+++ b/test/ssl.c
@@ -63,6 +63,8 @@ static char *server_key = NULL;
static ne_ssl_certificate *def_ca_cert = NULL, *def_server_cert;
static ne_ssl_client_cert *def_cli_cert;
+static char *nul_cn_fn;
+
static int check_dname(const ne_ssl_dname *dn, const char *expected,
const char *which);
@@ -275,6 +277,8 @@ static int init(void)
return FAIL;
}
+ nul_cn_fn = ne_concat(srcdir, "/nulcn.pem", NULL);
+
return OK;
}
@@ -839,22 +843,34 @@ static int fail_wrongCN(void)
}
+#define SRCDIR(s) ne_concat(srcdir, "/" s, NULL)
+
static int fail_nul_cn(void)
{
- return fail_ssl_request_with_error2("nulcn.pem", "nulsrv.key", "nulca.pem",
- "www.bank.com", "localhost",
- "certificate with incorrect CN was accepted",
- NE_SSL_IDMISMATCH,
- "certificate issued for a different hostname");
+ char *key = SRCDIR("nulsrv.key"), *ca = SRCDIR("nulca.pem");
+ CALL(fail_ssl_request_with_error2(nul_cn_fn, key, ca,
+ "www.bank.com", "localhost",
+ "certificate with incorrect CN was accepted",
+ NE_SSL_IDMISMATCH,
+ "certificate issued for a different hostname"));
+ ne_free(key);
+ ne_free(ca);
+ return OK;
}
static int fail_nul_san(void)
{
- return fail_ssl_request_with_error2("nulsan.pem", "nulsrv.key", "nulca.pem",
- "www.bank.com", "localhost",
- "certificate with incorrect CN was accepted",
- NE_SSL_IDMISMATCH,
- "certificate issued for a different hostname");
+ char *cert = SRCDIR("nulsan.pem"), *key = SRCDIR("nulsrv.key"),
+ *ca = SRCDIR("nulca.pem");
+ CALL(fail_ssl_request_with_error2(cert, key, ca,
+ "www.bank.com", "localhost",
+ "certificate with incorrect CN was accepted",
+ NE_SSL_IDMISMATCH,
+ "certificate issued for a different hostname"));
+ ne_free(cert);
+ ne_free(key);
+ ne_free(ca);
+ return OK;
}
/* Check that an expired certificate is flagged as such. */
@@ -1415,7 +1431,7 @@ static int cert_identities(void)
static int nulcn_identity(void)
{
- ne_ssl_certificate *cert = ne_ssl_cert_read("nulcn.pem");
+ ne_ssl_certificate *cert = ne_ssl_cert_read(nul_cn_fn);
const char *id, *expected = "www.bank.com\\x00.badguy.com";
ONN("could not read nulcn.pem", cert == NULL);