diff options
author | daurnimator <quae@daurnimator.com> | 2016-11-07 23:30:24 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2016-11-07 23:34:00 +1100 |
commit | 0362804658c4b7eb4abc2c4c9a64e154855c24ee (patch) | |
tree | 8cd1297e17630450e2728427839503060846282f /src | |
parent | f603c7ac366b90649d8635b600dd646f40dac25a (diff) | |
download | luaossl-0362804658c4b7eb4abc2c4c9a64e154855c24ee.tar.gz luaossl-0362804658c4b7eb4abc2c4c9a64e154855c24ee.tar.bz2 luaossl-0362804658c4b7eb4abc2c4c9a64e154855c24ee.zip |
openssl.ssl.context: Add :getStore() that returns the ssl context's internal x509 store
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c index d7b572e..d4f75aa 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -7263,6 +7263,20 @@ static int sx_setStore(lua_State *L) { } /* sx_setStore() */ +static int sx_getStore(lua_State *L) { + SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS); + X509_STORE *store; + + if((store = SSL_CTX_get_cert_store(ctx))) { + xs_push(L, store); + } else { + lua_pushnil(L); + } + + return 1; +} /* sx_getStore() */ + + static int sx_setVerify(lua_State *L) { SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS); int mode = luaL_optint(L, 2, -1); @@ -7529,6 +7543,7 @@ static const auxL_Reg sx_methods[] = { { "getOptions", &sx_getOptions }, { "clearOptions", &sx_clearOptions }, { "setStore", &sx_setStore }, + { "getStore", &sx_getStore }, { "setVerify", &sx_setVerify }, { "getVerify", &sx_getVerify }, { "setCertificate", &sx_setCertificate }, |