From: Johannes Schindelin Date: Thu, 6 Dec 2018 16:18:43 +0000 (+0100) Subject: curl_global_sslset(): id == -1 is not necessarily an error X-Git-Tag: curl-7_63_0~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2456152069a8f471c63fb2de07322bdd0c29e533;p=curl curl_global_sslset(): id == -1 is not necessarily an error 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 Closes #3346 --- diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index fc4384b2f..5e75f92e9 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -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 ||