cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] polarssl: support CURLOPT_CAPATH / --capath

From: Catalin Patulea <cat_at_vv.carleton.ca>
Date: Sat, 6 Sep 2014 21:31:01 -0400

Signed-off-by: Catalin Patulea <cat_at_vv.carleton.ca>

---
 lib/vtls/polarssl.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c
index 2d1b7ee..f7438e8 100644
--- a/lib/vtls/polarssl.c
+++ b/lib/vtls/polarssl.c
@@ -201,6 +201,22 @@ polarssl_connect_step1(struct connectdata *conn,
     }
   }
 
+  if (data->set.str[STRING_SSL_CAPATH]) {
+    ret = x509_crt_parse_path(&connssl->cacert,
+                              data->set.str[STRING_SSL_CAPATH]);
+
+    if(ret<0) {
+#ifdef POLARSSL_ERROR_C
+      error_strerror(ret, errorbuf, sizeof(errorbuf));
+#endif /* POLARSSL_ERROR_C */
+      failf(data, "Error reading ca cert path %s - PolarSSL: (-0x%04X) %s",
+            data->set.str[STRING_SSL_CAPATH], -ret, errorbuf);
+
+      if(data->set.ssl.verifypeer)
+        return CURLE_SSL_CACERT_BADFILE;
+    }
+  }
+
   /* Load the client certificate */
   memset(&connssl->clicert, 0, sizeof(x509_crt));
 
-- 
1.7.9.5
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-09-07