summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-08-14 21:59:44 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-08-14 22:00:10 +0100
commit42ab1ad43b330c7849f593406b36a8945fafe71a (patch)
tree51849eb21b882a1f34723591eab5200a0f7e581f
parent4343e13026a35f10a7597f06703ba4c8e8c3b33c (diff)
downloadrspamd-42ab1ad43b330c7849f593406b36a8945fafe71a.tar.gz
rspamd-42ab1ad43b330c7849f593406b36a8945fafe71a.zip
[Minor] Randomize Lua PRNG at startup
-rw-r--r--src/lua/lua_common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 6c640eec3..baab27226 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;
}