Permalink
Browse files

curl_global_sslset(): fix wrong return value

When compiled with a single SSL backend, Curl_ssl is never set to
Curl_ssl_multi, but to that single backend from the beginning.

When the caller tries to set the SSL backend to a different backend than
the one that was compiled in, in this scenario we should not say that it
is too late to set the SSL backend, but that it is an unknown backend to
begin with.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information...
dscho committed Dec 6, 2018
1 parent 231a328 commit 639f6f7bfbfcf3de1e467877be31d9790b864f19
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/vtls/vtls.c
@@ -1315,7 +1315,12 @@ CURLsslset curl_global_sslset(curl_sslbackend id, const char *name,
if(Curl_ssl != &Curl_ssl_multi)
return id == Curl_ssl->info.id ||
(name && strcasecompare(name, Curl_ssl->info.name)) ?
CURLSSLSET_OK : CURLSSLSET_TOO_LATE;
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 ||

0 comments on commit 639f6f7

Please sign in to comment.