diff options
author | daurnimator <quae@daurnimator.com> | 2016-11-07 23:04:57 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2016-11-07 23:04:57 +1100 |
commit | 938ffdf8c30cb88e4ece27031a2c18cedf9da722 (patch) | |
tree | a44f0a7e16a5ff13fe66e131d2c0366d203cbe8e | |
parent | cb727f97f2e00512c70631210de2d8b951e81587 (diff) | |
download | luaossl-938ffdf8c30cb88e4ece27031a2c18cedf9da722.tar.gz luaossl-938ffdf8c30cb88e4ece27031a2c18cedf9da722.tar.bz2 luaossl-938ffdf8c30cb88e4ece27031a2c18cedf9da722.zip |
openssl_x509_store: add :addDefault() method to add OS default certificates
-rw-r--r-- | src/openssl.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/openssl.c b/src/openssl.c index 4564061..7c3f32f 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
@@ -6789,6 +6789,18 @@ static int xs_add(lua_State *L) { | |||
6789 | } /* xs_add() */ | 6789 | } /* xs_add() */ |
6790 | 6790 | ||
6791 | 6791 | ||
6792 | static int xs_addDefaults(lua_State *L) { | ||
6793 | X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); | ||
6794 | |||
6795 | if (!X509_STORE_set_default_paths(store)) | ||
6796 | return auxL_error(L, auxL_EOPENSSL, "x509.store:addDefaults"); | ||
6797 | |||
6798 | lua_pushvalue(L, 1); | ||
6799 | |||
6800 | return 1; | ||
6801 | } /* xs_addDefaults() */ | ||
6802 | |||
6803 | |||
6792 | static int xs_verify(lua_State *L) { | 6804 | static int xs_verify(lua_State *L) { |
6793 | X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); | 6805 | X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); |
6794 | X509 *crt = checksimple(L, 2, X509_CERT_CLASS); | 6806 | X509 *crt = checksimple(L, 2, X509_CERT_CLASS); |
@@ -6871,9 +6883,10 @@ static int xs__gc(lua_State *L) { | |||
6871 | 6883 | ||
6872 | 6884 | ||
6873 | static const auxL_Reg xs_methods[] = { | 6885 | static const auxL_Reg xs_methods[] = { |
6874 | { "add", &xs_add }, | 6886 | { "add", &xs_add }, |
6875 | { "verify", &xs_verify }, | 6887 | { "addDefaults", &xs_addDefaults }, |
6876 | { NULL, NULL }, | 6888 | { "verify", &xs_verify }, |
6889 | { NULL, NULL }, | ||
6877 | }; | 6890 | }; |
6878 | 6891 | ||
6879 | static const auxL_Reg xs_metatable[] = { | 6892 | static const auxL_Reg xs_metatable[] = { |