Comparison

core/hostmanager.lua @ 2420:6ccd36a95a81

s2smanager, hostmanager: Make dialback secrets per-host
author Matthew Wild <mwild1@gmail.com>
date Sun, 03 Jan 2010 18:55:42 +0000
parent 2321:7e7484a4e821
child 2536:922e6e84d0bf
comparison
equal deleted inserted replaced
2419:00d985639a06 2420:6ccd36a95a81
11 local hosts = hosts; 11 local hosts = hosts;
12 local configmanager = require "core.configmanager"; 12 local configmanager = require "core.configmanager";
13 local eventmanager = require "core.eventmanager"; 13 local eventmanager = require "core.eventmanager";
14 local modulemanager = require "core.modulemanager"; 14 local modulemanager = require "core.modulemanager";
15 local events_new = require "util.events".new; 15 local events_new = require "util.events".new;
16
17 local uuid_gen = require "util.uuid".generate;
16 18
17 if not _G.prosody.incoming_s2s then 19 if not _G.prosody.incoming_s2s then
18 require "core.s2smanager"; 20 require "core.s2smanager";
19 end 21 end
20 local incoming_s2s = _G.prosody.incoming_s2s; 22 local incoming_s2s = _G.prosody.incoming_s2s;
45 47
46 eventmanager.add_event_hook("server-starting", load_enabled_hosts); 48 eventmanager.add_event_hook("server-starting", load_enabled_hosts);
47 49
48 function activate(host, host_config) 50 function activate(host, host_config)
49 hosts[host] = {type = "local", connected = true, sessions = {}, 51 hosts[host] = {type = "local", connected = true, sessions = {},
50 host = host, s2sout = {}, events = events_new(), 52 host = host, s2sout = {}, events = events_new(),
51 disallow_s2s = configmanager.get(host, "core", "disallow_s2s") 53 disallow_s2s = configmanager.get(host, "core", "disallow_s2s")
52 or (configmanager.get(host, "core", "anonymous_login") 54 or (configmanager.get(host, "core", "anonymous_login")
53 and (configmanager.get(host, "core", "disallow_s2s") ~= false)) 55 and (configmanager.get(host, "core", "disallow_s2s") ~= false));
56 dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen();
54 }; 57 };
55 for option_name in pairs(host_config.core) do 58 for option_name in pairs(host_config.core) do
56 if option_name:match("_ports$") then 59 if option_name:match("_ports$") then
57 log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in global Host \"*\" instead", host, option_name); 60 log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in global Host \"*\" instead", host, option_name);
58 end 61 end