Fix bug in s_client. Previously default verify locations would only be loaded
authorMatt Caswell <matt@openssl.org>
Wed, 25 Feb 2015 11:30:43 +0000 (11:30 +0000)
committerMatt Caswell <matt@openssl.org>
Wed, 25 Mar 2015 13:07:31 +0000 (13:07 +0000)
if CAfile or CApath were also supplied and successfully loaded first.

Reviewed-by: Richard Levitte <levitte@openssl.org>
apps/s_client.c

index 8fa2b737aa7fe1d7ef2c087b080212c8591fc132..6c244acfadc09eea18f93a126a4a1dbb613bf144 100644 (file)
@@ -1336,13 +1336,12 @@ int MAIN(int argc, char **argv)
 
     SSL_CTX_set_verify(ctx, verify, verify_callback);
 
-    if ((!SSL_CTX_load_verify_locations(ctx, CAfile, CApath)) ||
-        (!SSL_CTX_set_default_verify_paths(ctx))) {
-        /*
-         * BIO_printf(bio_err,"error setting default verify locations\n");
-         */
+    if ((CAfile || CApath)
+        && !SSL_CTX_load_verify_locations(ctx, CAfile, CApath)) {
+        ERR_print_errors(bio_err);
+    }
+    if (!SSL_CTX_set_default_verify_paths(ctx)) {
         ERR_print_errors(bio_err);
-        /* goto end; */
     }
 
     ssl_ctx_add_crls(ctx, crls, crl_download);