From: Vsevolod Stakhov Date: Mon, 14 Aug 2017 20:59:44 +0000 (+0100) Subject: [Minor] Randomize Lua PRNG at startup X-Git-Tag: 1.7.0~720 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=42ab1ad43b330c7849f593406b36a8945fafe71a;p=thirdparty%2Frspamd.git [Minor] Randomize Lua PRNG at startup --- diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 6c640eec38..baab272264 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -374,6 +374,14 @@ rspamd_lua_init () lua_newtable (L); lua_setglobal (L, "rspamd_plugins"); + /* Set PRNG */ + lua_getglobal (L, "math"); + lua_pushstring (L, "randomseed"); + lua_gettable (L, -2); + lua_pushnumber (L, ottery_rand_uint64 ()); + lua_pcall (L, 1, 0, 0); + lua_pop (L, 1); /* math table */ + return L; }