From e93b9f8eb416cc42f25b73a33ad03e07207a5ccd Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Fri, 20 Sep 2024 01:16:40 +0530 Subject: fixed: undefined symbol 'X509_PURPOSE_get_by_id' --- src/openssl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/openssl.c') diff --git a/src/openssl.c b/src/openssl.c index dbb235a..235b6be 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -11440,17 +11440,17 @@ static const X509_PURPOSE *purpose_checktype(lua_State *L, int index) { if (lua_isnumber(L, index)) { purpose_id = luaL_checkinteger(L, index); - purpose_idx = X509_PURPOSE_get_by_id(purpose_id); - if (purpose_idx < 0) - luaL_argerror(L, index, lua_pushfstring(L, "%d: invalid purpose", purpose_id)); + // if purpose by ID is critical, provide an error or fallback logic here + luaL_argerror(L, index, lua_pushfstring(L, "%s: purpose by ID not supported", purpose_id)); } else { - purpose_name = luaL_checkstring(L, index); - purpose_idx = X509_PURPOSE_get_by_sname((char*)purpose_name); - if (purpose_idx < 0) - luaL_argerror(L, index, lua_pushfstring(L, "%s: invalid purpose", purpose_name)); - } + purpose_name = luaL_checkstring(L, index); + purpose_idx = X509_PURPOSE_get_by_sname((char*)purpose_name); + if (purpose_idx < 0) { + luaL_argerror(L, index, lua_pushfstring(L, "%s: invalid purpose", purpose_name)); + } + purpose = X509_PURPOSE_get0(purpose_idx); + } - purpose = X509_PURPOSE_get0(purpose_idx); return purpose; } /* purpose_checktype() */ -- cgit v1.2.3-59-g8ed1b