Changeset

6299:a1da78658a82

hostmanager, mod_dialback: Move generation of dialback secret out of core
author Kim Alvefur <zash@zash.se>
date Thu, 22 May 2014 15:21:22 +0200
parents 6298:6ddd7913913b
children 6300:4b0172dc5e3a
files core/hostmanager.lua plugins/mod_dialback.lua
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/hostmanager.lua	Fri Jul 04 15:54:37 2014 +0200
+++ b/core/hostmanager.lua	Thu May 22 15:21:22 2014 +0200
@@ -74,7 +74,6 @@
 		host = host;
 		s2sout = {};
 		events = events_new();
-		dialback_secret = configmanager.get(host, "dialback_secret") or uuid_gen();
 		send = host_send;
 		modules = {};
 	};
--- a/plugins/mod_dialback.lua	Fri Jul 04 15:54:37 2014 +0200
+++ b/plugins/mod_dialback.lua	Thu May 22 15:21:22 2014 +0200
@@ -13,13 +13,16 @@
 local st = require "util.stanza";
 local sha256_hash = require "util.hashes".sha256;
 local nameprep = require "util.encodings".stringprep.nameprep;
+local uuid_gen = require"util.uuid".generate;
 
 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());
+
 function generate_dialback(id, to, from)
-	return sha256_hash(id..to..from..hosts[from].dialback_secret, true);
+	return sha256_hash(id..to..dialback_secret, true);
 end
 
 function initiate_dialback(session)