summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/openssl.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 61185cf..a8829ab 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -6871,6 +6871,18 @@ static int xs_add(lua_State *L) {
6871} /* xs_add() */ 6871} /* xs_add() */
6872 6872
6873 6873
6874static int xs_addDefaults(lua_State *L) {
6875 X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS);
6876
6877 if (!X509_STORE_set_default_paths(store))
6878 return auxL_error(L, auxL_EOPENSSL, "x509.store:addDefaults");
6879
6880 lua_pushvalue(L, 1);
6881
6882 return 1;
6883} /* xs_addDefaults() */
6884
6885
6874static int xs_verify(lua_State *L) { 6886static int xs_verify(lua_State *L) {
6875 X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); 6887 X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS);
6876 X509 *crt = checksimple(L, 2, X509_CERT_CLASS); 6888 X509 *crt = checksimple(L, 2, X509_CERT_CLASS);
@@ -6953,9 +6965,10 @@ static int xs__gc(lua_State *L) {
6953 6965
6954 6966
6955static const auxL_Reg xs_methods[] = { 6967static const auxL_Reg xs_methods[] = {
6956 { "add", &xs_add }, 6968 { "add", &xs_add },
6957 { "verify", &xs_verify }, 6969 { "addDefaults", &xs_addDefaults },
6958 { NULL, NULL }, 6970 { "verify", &xs_verify },
6971 { NULL, NULL },
6959}; 6972};
6960 6973
6961static const auxL_Reg xs_metatable[] = { 6974static const auxL_Reg xs_metatable[] = {
@@ -6974,6 +6987,15 @@ int luaopen__openssl_x509_store(lua_State *L) {
6974 6987
6975 auxL_newlib(L, xs_globals, 0); 6988 auxL_newlib(L, xs_globals, 0);
6976 6989
6990 lua_pushstring(L, X509_get_default_cert_dir());
6991 lua_setfield(L, -2, "CERT_DIR");
6992 lua_pushstring(L, X509_get_default_cert_file());
6993 lua_setfield(L, -2, "CERT_FILE");
6994 lua_pushstring(L, X509_get_default_cert_dir_env());
6995 lua_setfield(L, -2, "CERT_DIR_EVP");
6996 lua_pushstring(L, X509_get_default_cert_file_env());
6997 lua_setfield(L, -2, "CERT_FILE_EVP");
6998
6977 return 1; 6999 return 1;
6978} /* luaopen__openssl_x509_store() */ 7000} /* luaopen__openssl_x509_store() */
6979 7001