]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: added check for gnutls_credentials_get
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 22 Apr 2015 11:54:18 +0000 (13:54 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 22 Apr 2015 11:54:18 +0000 (13:54 +0200)
tests/x509self.c

index a3f4e4cb3ae3ef172b5fa3de7ecb02a90670a68a..0a2703b10911e9d3d369eb318e9328b02e48c235 100644 (file)
@@ -124,6 +124,7 @@ static void client(int sd)
        gnutls_session_t session;
        char buffer[MAX_BUF + 1];
        gnutls_certificate_credentials_t xcred;
+       gnutls_certificate_credentials_t tst_cred;
 
        global_init();
 
@@ -174,6 +175,14 @@ static void client(int sd)
        if (debug)
                print_info(session);
 
+       ret = gnutls_credentials_get(session, GNUTLS_CRD_CERTIFICATE, (void**)&tst_cred);
+       if (ret < 0) {
+               fail("client: gnutls_credentials_get failed: %s\n", gnutls_strerror(ret));
+       }
+       if (tst_cred != xcred) {
+               fail("client: gnutls_credentials_get returned invalid value\n");
+       }
+
        ret = gnutls_record_send(session, MSG, strlen(MSG));
 
        if (ret == strlen(MSG)) {