From 5e42a7bb99188bc6a54b7f0de8c2eb55845c5b13 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 29 May 2018 16:24:45 +1000 Subject: src/openssl.c: Only throw if X509_STORE_load_locations set an error --- src/openssl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/openssl.c b/src/openssl.c index 2601077..973a659 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -7870,8 +7870,13 @@ static int xs_add(lua_State *L) { if (S_ISDIR(st.st_mode)) ok = X509_STORE_load_locations(store, NULL, path); - else + else { + /* X509_STORE_load_locations on a file returns 0 if no certs were found */ + ERR_clear_error(); ok = X509_STORE_load_locations(store, path, NULL); + if (ok == 0 && !ERR_peek_error()) + ok = 1; + } if (!ok) return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); -- cgit v1.2.3-59-g8ed1b