mirror of
https://github.com/brunoos/luasec.git
synced 2025-02-13 23:42:49 +01:00
Add __close metamethod
This commit is contained in:
parent
7898bd2043
commit
87e51d99ea
@ -846,6 +846,7 @@ static int meth_set_verify_ext(lua_State *L)
|
|||||||
* Context metamethods.
|
* Context metamethods.
|
||||||
*/
|
*/
|
||||||
static luaL_Reg meta[] = {
|
static luaL_Reg meta[] = {
|
||||||
|
{"__close", meth_destroy},
|
||||||
{"__gc", meth_destroy},
|
{"__gc", meth_destroy},
|
||||||
{"__tostring", meth_tostring},
|
{"__tostring", meth_tostring},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
|
@ -890,6 +890,7 @@ static luaL_Reg methods[] = {
|
|||||||
* SSL metamethods.
|
* SSL metamethods.
|
||||||
*/
|
*/
|
||||||
static luaL_Reg meta[] = {
|
static luaL_Reg meta[] = {
|
||||||
|
{"__close", meth_destroy},
|
||||||
{"__gc", meth_destroy},
|
{"__gc", meth_destroy},
|
||||||
{"__tostring", meth_tostring},
|
{"__tostring", meth_tostring},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
|
@ -618,7 +618,11 @@ cleanup:
|
|||||||
*/
|
*/
|
||||||
static int meth_destroy(lua_State* L)
|
static int meth_destroy(lua_State* L)
|
||||||
{
|
{
|
||||||
X509_free(lsec_checkx509(L, 1));
|
p_x509 px = lsec_checkp_x509(L, 1);
|
||||||
|
if (px->cert) {
|
||||||
|
X509_free(px->cert);
|
||||||
|
px->cert = NULL;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,6 +696,7 @@ static luaL_Reg methods[] = {
|
|||||||
* X509 metamethods.
|
* X509 metamethods.
|
||||||
*/
|
*/
|
||||||
static luaL_Reg meta[] = {
|
static luaL_Reg meta[] = {
|
||||||
|
{"__close", meth_destroy},
|
||||||
{"__gc", meth_destroy},
|
{"__gc", meth_destroy},
|
||||||
{"__tostring", meth_tostring},
|
{"__tostring", meth_tostring},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user