Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/openssl.c: add pushlightuserdata functions #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 37 additions & 9 deletions src/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9138,6 +9138,19 @@ static void sx_push(lua_State *L, SSL_CTX *ctx) {
} /* sx_push() */


static int sx_pushlightuserdata(lua_State *L) {
SSL_CTX *ptr;

luaL_checktype(L, 1, LUA_TLIGHTUSERDATA);
ptr = lua_touserdata(L, 1);
luaL_argcheck(L, ptr, 1, "SSL_CTX* pointer must be non-null");

sx_push(L, ptr);

return 1;
} /* sx_pushlightuserdata() */


static int sx_pushffi(lua_State *L) {
SSL_CTX *ptr;

Expand All @@ -9152,7 +9165,7 @@ static int sx_pushffi(lua_State *L) {
sx_push(L, ptr);

return 1;
} /* ssl_pushffi() */
} /* sx_pushffi() */


static int sx_new(lua_State *L) {
Expand Down Expand Up @@ -10340,10 +10353,11 @@ static const auxL_Reg sx_metatable[] = {
};

static const auxL_Reg sx_globals[] = {
{ "new", &sx_new },
{ "pushffi", &sx_pushffi, 1 },
{ "interpose", &sx_interpose },
{ NULL, NULL },
{ "new", &sx_new },
{ "pushlightuserdata", &sx_pushlightuserdata },
{ "pushffi", &sx_pushffi, 1 },
{ "interpose", &sx_interpose },
{ NULL, NULL },
};

static const auxL_IntegerReg sx_verify[] = {
Expand Down Expand Up @@ -10545,6 +10559,19 @@ static void ssl_push(lua_State *L, SSL *ssl) {
} /* ssl_push() */


static int ssl_pushlightuserdata(lua_State *L) {
SSL *ptr;

luaL_checktype(L, 1, LUA_TLIGHTUSERDATA);
ptr = lua_touserdata(L, 1);
luaL_argcheck(L, ptr, 1, "SSL* pointer must be non-null");

ssl_push(L, ptr);

return 1;
} /* ssl_pushlightuserdata() */


static int ssl_pushffi(lua_State *L) {
SSL *ptr;

Expand Down Expand Up @@ -11262,10 +11289,11 @@ static const auxL_Reg ssl_metatable[] = {
};

static const auxL_Reg ssl_globals[] = {
{ "new", &ssl_new },
{ "pushffi", &ssl_pushffi, 1 },
{ "interpose", &ssl_interpose },
{ NULL, NULL },
{ "new", &ssl_new },
{ "pushlightuserdata", &ssl_pushlightuserdata },
{ "pushffi", &ssl_pushffi, 1 },
{ "interpose", &ssl_interpose },
{ NULL, NULL },
};

static const auxL_IntegerReg ssl_version[] = {
Expand Down