mirror of
https://github.com/brunoos/luasec.git
synced 2025-07-19 07:19:50 +02:00
Don't set globals from C.
This commit is contained in:
34
src/ssl.c
34
src/ssl.c
@ -816,7 +816,6 @@ static luaL_Reg funcs[] = {
|
||||
/**
|
||||
* Initialize modules.
|
||||
*/
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
LSEC_API int luaopen_ssl_core(lua_State *L)
|
||||
{
|
||||
/* Initialize SSL */
|
||||
@ -836,37 +835,7 @@ LSEC_API int luaopen_ssl_core(lua_State *L)
|
||||
|
||||
/* Register the functions and tables */
|
||||
luaL_newmetatable(L, "SSL:Connection");
|
||||
luaL_register(L, NULL, meta);
|
||||
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, methods);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
luaL_register(L, "ssl.core", funcs);
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
LSEC_API int luaopen_ssl_core(lua_State *L)
|
||||
{
|
||||
/* Initialize SSL */
|
||||
if (!SSL_library_init()) {
|
||||
lua_pushstring(L, "unable to initialize SSL library");
|
||||
lua_error(L);
|
||||
}
|
||||
OpenSSL_add_all_algorithms();
|
||||
SSL_load_error_strings();
|
||||
|
||||
#if defined(WITH_LUASOCKET)
|
||||
/* Initialize internal library */
|
||||
socket_open();
|
||||
#endif
|
||||
|
||||
luaL_newmetatable(L, "SSL:SNI:Registry");
|
||||
|
||||
/* Register the functions and tables */
|
||||
luaL_newmetatable(L, "SSL:Connection");
|
||||
luaL_setfuncs(L, meta, 0);
|
||||
setfuncs(L, meta);
|
||||
|
||||
luaL_newlib(L, methods);
|
||||
lua_setfield(L, -2, "__index");
|
||||
@ -875,4 +844,3 @@ LSEC_API int luaopen_ssl_core(lua_State *L)
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user