]> granicus.if.org Git - curl/commitdiff
cyassl: Fix certificate load check
authorJay Satiro <raysatiro@yahoo.com>
Thu, 2 Apr 2015 05:51:07 +0000 (01:51 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 2 Apr 2015 15:18:42 +0000 (17:18 +0200)
SSL_CTX_load_verify_locations can return negative values on fail,
therefore to check for failure we check if load is != 1 (success)
instead of if load is == 0 (failure), the latter being incorrect given
that behavior.

lib/vtls/cyassl.c

index 583930cf46d185cd0f96847bcda9becd066a55dc..ba4ef2f3b2817dddf7ffa5d8eb12fad848df803f 100644 (file)
@@ -140,9 +140,9 @@ cyassl_connect_step1(struct connectdata *conn,
 #ifndef NO_FILESYSTEM
   /* load trusted cacert */
   if(data->set.str[STRING_SSL_CAFILE]) {
-    if(!SSL_CTX_load_verify_locations(conssl->ctx,
-                                      data->set.str[STRING_SSL_CAFILE],
-                                      data->set.str[STRING_SSL_CAPATH])) {
+    if(1 != SSL_CTX_load_verify_locations(conssl->ctx,
+                                          data->set.str[STRING_SSL_CAFILE],
+                                          data->set.str[STRING_SSL_CAPATH])) {
       if(data->set.ssl.verifypeer) {
         /* Fail if we insist on successfully verifying the server. */
         failf(data, "error setting certificate verify locations:\n"