diff options
author | Kim Alvefur <zash@zash.se> | 2014-07-03 15:38:53 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-07-03 15:38:53 +0200 |
commit | 59ef50532cbedbf9ddd883f5817c09463eef5d12 (patch) | |
tree | 442e552f62e9a15c5e8d05683d90f4e60ce65494 | |
parent | 105ceb9cffa82a84a2f1df4cb0659772f6930526 (diff) | |
download | prosody-59ef50532cbedbf9ddd883f5817c09463eef5d12.tar.gz prosody-59ef50532cbedbf9ddd883f5817c09463eef5d12.zip |
mod_dialback: Keep the same dialback secret across module reloads
-rw-r--r-- | plugins/mod_dialback.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index b32160c4..2959358b 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -19,7 +19,15 @@ local xmlns_stream = "http://etherx.jabber.org/streams"; local dialback_requests = setmetatable({}, { __mode = 'v' }); -local dialback_secret = module.host .. (module:get_option_string("dialback_secret") or uuid_gen()); +local dialback_secret = module.host .. module:get_option_string("dialback_secret", uuid_gen()); + +function module.save() + return { dialback_secret = dialback_secret }; +end + +function module.restore(state) + dialback_secret = state.dialback_secret; +end function generate_dialback(id, to, from) return sha256_hash(id..to..dialback_secret, true); |