tls: check capath is directory
MODIFY
src/tls/openssl/tls.c
src/tls/openssl/tls.c
@@ -268,12 +268,15 @@ int tls_add_cafile_path(struct tls *tls, const char *cafile,
if (!tls || (!cafile && !capath) || !tls->ctx)
return EINVAL;
+ if (capath && !fs_isdir(capath)) {
+ DEBUG_WARNING("capath is not a directory\n");
+ return ENOENT;
+ }
+
/* Load the CAs we trust */
if (!(SSL_CTX_load_verify_locations(tls->ctx, cafile, capath))) {
if (str_isset(cafile))
DEBUG_WARNING("Can't read CA file: %s\n", cafile);
- if (str_isset(capath))
- DEBUG_WARNING("Can't read CA path: %s\n", capath);
ERR_clear_error();
return ENOENT;

tls: check capath is directory