From: Nikos Date: Sat, 15 Dec 2007 14:41:12 +0000 (+0200) Subject: Fix for certificate selection in servers with certificate callbacks. X-Git-Tag: gnutls_2_3_0~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fb66b3738da50cbecd7327cd354765ff2a123cb;p=thirdparty%2Fgnutls.git Fix for certificate selection in servers with certificate callbacks. --- diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index c95f723d7a..4058dbcf9d 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -135,20 +135,23 @@ _gnutls_session_cert_type_supported (gnutls_session_t session, if (cred == NULL) return GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE; - for (i = 0; i < cred->ncerts; i++) - { - if (cred->cert_list[i][0].cert_type == cert_type) - { - cert_found = 1; - break; - } - } - if (cert_found == 0) - /* no certificate is of that type. - */ - return GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE; - } - + if( cred->server_get_cert_callback == NULL) + { + for (i = 0; i < cred->ncerts; i++) + { + if (cred->cert_list[i][0].cert_type == cert_type) + { + cert_found = 1; + break; + } + } + + if (cert_found == 0) + /* no certificate is of that type. + */ + return GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE; + } + } if (session->internals.priorities.cert_type.algorithms == 0 && cert_type == DEFAULT_CERT_TYPE)