Skip to content

Commit 8df426e

Browse files
committed
Clear the whitelist when module closes
1 parent 3fc74e5 commit 8df426e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

source/socket.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
extern "C" int luaopen_socket_core( lua_State *state );
44

55
int parseWhitelist();
6+
void clearWhitelist();
67
enum : int
78
{
89
PARSE_SUCCESS = 0,
@@ -39,6 +40,10 @@ GMOD_MODULE_OPEN( )
3940

4041
GMOD_MODULE_CLOSE( )
4142
{
43+
#ifdef USE_WHITELIST
44+
clearWhitelist();
45+
#endif
46+
4247
LUA->PushNil( );
4348
LUA->SetField( GarrysMod::Lua::INDEX_GLOBAL, "socket" );
4449
return 0;

source/whitelist.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ int parseWhitelist()
4343
return PARSE_SUCCESS;
4444
}
4545

46+
void clearWhitelist()
47+
{
48+
whitelist.clear();
49+
}
50+
4651
bool isSafe(const char* pNodeName, const char* pServiceName)
4752
{
4853
std::map<std::string, std::set<std::string> >::iterator domain = whitelist.find(pNodeName);

0 commit comments

Comments
 (0)