diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-11 19:07:39 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-11 19:07:39 +0100 |
commit | e146798cb567e3a2f74d824b042c9911364b404c (patch) | |
tree | 77ba8e040ba6a9811d642ab20ec2261542f68a4a /doc/examples | |
parent | 34fcb3496a7b713514f28dddf728db3e7fc2f08d (diff) | |
download | gnutls-e146798cb567e3a2f74d824b042c9911364b404c.tar.gz |
corrected verification examples
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/ex-client-x509.c | 3 | ||||
-rw-r--r-- | doc/examples/ex-verify-ssh.c | 3 | ||||
-rw-r--r-- | doc/examples/verify.c | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/doc/examples/ex-client-x509.c b/doc/examples/ex-client-x509.c index 6e38a15615..e4a5293abc 100644 --- a/doc/examples/ex-client-x509.c +++ b/doc/examples/ex-client-x509.c @@ -172,6 +172,9 @@ _verify_certificate_callback (gnutls_session_t session) gnutls_free(out.data); + if (status != 0) /* Certificate is not trusted */ + return GNUTLS_E_CERTIFICATE_ERROR; + /* notify gnutls to continue handshake normally */ return 0; } diff --git a/doc/examples/ex-verify-ssh.c b/doc/examples/ex-verify-ssh.c index 9251b78b23..474a3e6d1f 100644 --- a/doc/examples/ex-verify-ssh.c +++ b/doc/examples/ex-verify-ssh.c @@ -52,6 +52,9 @@ _ssh_verify_certificate_callback (gnutls_session_t session) gnutls_free(out.data); + if (status != 0) /* Certificate is not trusted */ + return GNUTLS_E_CERTIFICATE_ERROR; + /* Do SSH verification */ cert_list = gnutls_certificate_get_peers (session, &cert_list_size); if (cert_list == NULL) diff --git a/doc/examples/verify.c b/doc/examples/verify.c index 8fd593136c..bee8e6bdf4 100644 --- a/doc/examples/verify.c +++ b/doc/examples/verify.c @@ -43,6 +43,9 @@ int verify_certificate_callback (gnutls_session_t session) gnutls_free(out.data); + if (status != 0) /* Certificate is not trusted */ + return GNUTLS_E_CERTIFICATE_ERROR; + /* notify gnutls to continue handshake normally */ return 0; } |