aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/openssl.c18
1 files changed, 9 insertions, 9 deletions
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() */