]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Fix for certificate selection in servers with certificate callbacks.
authorNikos <nmav@crystal.(none)>
Sat, 15 Dec 2007 14:41:12 +0000 (16:41 +0200)
committerNikos <nmav@crystal.(none)>
Sun, 16 Dec 2007 09:43:01 +0000 (11:43 +0200)
lib/gnutls_state.c

index c95f723d7a4c61e89f1cc3f3e69286e20e7d3fe5..4058dbcf9ddcee3ecdedafb4df9007927af675f7 100644 (file)
@@ -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)