]> granicus.if.org Git - curl/commitdiff
curl_global_sslset(): id == -1 is not necessarily an error
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 6 Dec 2018 16:18:43 +0000 (17:18 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 7 Dec 2018 10:38:22 +0000 (11:38 +0100)
It is allowed to call that function with id set to -1, specifying the
backend by the name instead. We should imitate what is done further down
in that function to allow for that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Closes #3346

lib/vtls/vtls.c

index fc4384b2f614fc20baaabf440e3538b5973d924c..5e75f92e9954359081e5e2a83feb5ca62714f477 100644 (file)
@@ -1313,7 +1313,14 @@ CURLsslset curl_global_sslset(curl_sslbackend id, const char *name,
     *avail = (const curl_ssl_backend **)&available_backends;
 
   if(Curl_ssl != &Curl_ssl_multi)
-    return id == Curl_ssl->info.id ? CURLSSLSET_OK : CURLSSLSET_TOO_LATE;
+    return id == Curl_ssl->info.id ||
+           (name && strcasecompare(name, Curl_ssl->info.name)) ?
+           CURLSSLSET_OK :
+#if defined(CURL_WITH_MULTI_SSL)
+           CURLSSLSET_TOO_LATE;
+#else
+           CURLSSLSET_UNKNOWN_BACKEND;
+#endif
 
   for(i = 0; available_backends[i]; i++) {
     if(available_backends[i]->info.id == id ||