From: Vsevolod Stakhov Date: Mon, 14 Aug 2017 20:59:44 +0000 (+0100) Subject: [Minor] Randomize Lua PRNG at startup X-Git-Tag: 1.6.4~22^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f16ae613599b3af2df3b3773e06d1025e7623db;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 2af506f13c..ebdd472911 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -330,6 +330,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; }