diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-08-24 13:59:21 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-08-24 13:59:21 +0200 |
commit | d16b5c405e133e1b09bfb7b5c4d4b3687c1cd0e2 (patch) | |
tree | 63d9b0a04434854ec5e6fc8f4e0fd2b1349d1656 /lib/auto-verify.c | |
parent | df278c0b7e77d80edd8ac9424f71490e521952cd (diff) | |
download | gnutls-d16b5c405e133e1b09bfb7b5c4d4b3687c1cd0e2.tar.gz |
Allow overriding the verification flags from the auto-verification functions
Diffstat (limited to 'lib/auto-verify.c')
-rw-r--r-- | lib/auto-verify.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/auto-verify.c b/lib/auto-verify.c index f2dae0d6df..eb818b0b53 100644 --- a/lib/auto-verify.c +++ b/lib/auto-verify.c @@ -57,7 +57,7 @@ static int auto_verify_cb(gnutls_session_t session) * gnutls_session_auto_verify_cert: * @session: is a gnutls session * @hostname: is the expected name of the peer; may be %NULL - * @flags: should be zero + * @flags: flags for certificate verification -- #gnutls_certificate_verify_flags * * This function instructs GnuTLS to verify the peer's certificate * using the provided hostname. If the verification fails the handshake @@ -86,6 +86,9 @@ void gnutls_session_auto_verify_cert(gnutls_session_t session, session->internals.vc_elements = 0; } + if (flags) + session->internals.additional_verify_flags |= flags; + gnutls_session_set_verify_function(session, auto_verify_cb); } @@ -94,7 +97,7 @@ void gnutls_session_auto_verify_cert(gnutls_session_t session, * @session: is a gnutls session * @data: an array of typed data * @elements: the number of data elements - * @flags: should be zero + * @flags: flags for certificate verification -- #gnutls_certificate_verify_flags * * This function instructs GnuTLS to verify the peer's certificate * using the provided typed data information. If the verification fails the handshake @@ -113,6 +116,10 @@ void gnutls_session_auto_verify_cert2(gnutls_session_t session, { session->internals.vc_data = data; session->internals.vc_elements = elements; + + if (flags) + session->internals.additional_verify_flags |= flags; + gnutls_session_set_verify_function(session, auto_verify_cb); } |