Return nil instead boolean

This commit is contained in:
Bruno Silvestre 2021-06-25 19:59:22 -03:00
parent a3e74db781
commit 7ce63ad392

View File

@ -828,18 +828,18 @@ static int ocsp_build_request(lua_State *L)
req = OCSP_REQUEST_new(); req = OCSP_REQUEST_new();
if (req == NULL) { if (req == NULL) {
lua_pushboolean(L, 0); lua_pushnil(L);
return 1; return 1;
} }
cid = OCSP_cert_to_id(NULL, cert, issuer); cid = OCSP_cert_to_id(NULL, cert, issuer);
if (cid == NULL) { if (cid == NULL) {
lua_pushboolean(L, 0); lua_pushnil(L);
return 1; return 1;
} }
if (OCSP_request_add0_id(req, cid) == NULL) { if (OCSP_request_add0_id(req, cid) == NULL) {
lua_pushboolean(L, 0); lua_pushnil(L);
return 1; return 1;
} }
@ -870,14 +870,16 @@ static int ocsp_response_time(lua_State *L)
res = d2i_OCSP_RESPONSE(NULL, (const unsigned char**)&buf, (int)len); res = d2i_OCSP_RESPONSE(NULL, (const unsigned char**)&buf, (int)len);
if (res == NULL) { if (res == NULL) {
lua_pushboolean(L, 0); lua_pushnil(L);
return 1; lua_pushnil(L);
return 2;
} }
bs = OCSP_response_get1_basic(res); bs = OCSP_response_get1_basic(res);
if (bs == NULL) { if (bs == NULL) {
lua_pushboolean(L, 0); lua_pushnil(L);
return 1; lua_pushnil(L);
return 2;
} }
sr = OCSP_resp_get0(bs, 0); sr = OCSP_resp_get0(bs, 0);