aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-07-13 15:43:14 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-07-20 15:14:43 +1000
commit4760ebee141cf44a0b07cd238a24cb676cd3da2f (patch)
tree9e3de2d78cd09cff0ca3bba5e5f12d636f4e62c0 /src
parent357a7f6da9e6ae442b3c3b9e43396b3cf2e1a91d (diff)
downloadluaossl-4760ebee141cf44a0b07cd238a24cb676cd3da2f.tar.gz
luaossl-4760ebee141cf44a0b07cd238a24cb676cd3da2f.tar.bz2
luaossl-4760ebee141cf44a0b07cd238a24cb676cd3da2f.zip
src/openssl.c: Allow inheriting verify params from defaults
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 81c95de..6ada254 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -9882,9 +9882,15 @@ static int xp_interpose(lua_State *L) {
*/
static int xp_inherit(lua_State *L) {
X509_VERIFY_PARAM *dest = checksimple(L, 1, X509_VERIFY_PARAM_CLASS);
- X509_VERIFY_PARAM *src = checksimple(L, 2, X509_VERIFY_PARAM_CLASS);
+ X509_VERIFY_PARAM *src = testsimple(L, 2, X509_VERIFY_PARAM_CLASS);
int ret;
+ if (!src) {
+ luaL_argcheck(L, lua_isstring(L, 2), 2, "expected " X509_VERIFY_PARAM_CLASS " or string");
+ src = (X509_VERIFY_PARAM*)X509_VERIFY_PARAM_lookup(lua_tostring(L, 2));
+ luaL_argcheck(L, src != NULL, 2, "unknown param preset");
+ }
+
ret = X509_VERIFY_PARAM_inherit(dest, src);
if (!ret)
/* Note: openssl doesn't set an error as it should for some cases */