]> xenbits.xensource.com Git - libvirt.git/commitdiff
Test handling of non-existent x509 certs
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 21 Aug 2013 11:48:58 +0000 (12:48 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 21 Aug 2013 12:51:25 +0000 (13:51 +0100)
In commit f905cc998449c89339d0e2894a71d9a9e45293e5 a use of
uninitialized data was fixed based on a coverity report. It
turns out it was possible to trigger this issue by pointing
libvirt at non-existent certificate files, typically causing
a crash.

This adds a test case for that scenario. With the above
commit reverted, this new test case will crash with a SEGV.
With the fix applied, it passes, reporting a normal libvirt
error to the caller.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tests/virnettlscontexttest.c

index 2c7d400aff9cfd5d1a86183cd3993755dfec35fc..33f239c7d91b0bd6f26208655fa19f6423b75e96 100644 (file)
@@ -563,6 +563,8 @@ mymain(void)
     DO_CTX_TEST(true, "cacertchain-ctx.pem", servercertlevel3areq.filename, false);
     DO_CTX_TEST(false, "cacertchain-ctx.pem", clientcertlevel2breq.filename, false);
 
+    DO_CTX_TEST(false, "cacertdoesnotexist.pem", "servercertdoesnotexist.pem", true);
+
     testTLSDiscardCert(&cacertreq);
     testTLSDiscardCert(&cacert1req);
     testTLSDiscardCert(&cacert2req);