From 4760ebee141cf44a0b07cd238a24cb676cd3da2f Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 13 Jul 2018 15:43:14 +1000 Subject: src/openssl.c: Allow inheriting verify params from defaults --- src/openssl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3-59-g8ed1b