From 2456152069a8f471c63fb2de07322bdd0c29e533 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 6 Dec 2018 17:18:43 +0100 Subject: 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 --- lib/vtls/vtls.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 || -- cgit v1.2.3