mod_s2s_auth_dane/mod_s2s_auth_dane.lua
changeset 4494 cf2bdb2aaa57
parent 2873 77498ea07795
child 4495 35381608d323
equal deleted inserted replaced
4493:725768d83830 4494:cf2bdb2aaa57
   229 			module:add_timer(0, _resume, host_session);
   229 			module:add_timer(0, _resume, host_session);
   230 		end
   230 		end
   231 	end
   231 	end
   232 end
   232 end
   233 
   233 
       
   234 local new_dane = module:get_option_boolean("use_dane", false);
       
   235 
   234 function module.add_host(module)
   236 function module.add_host(module)
   235 	local function on_new_s2s(event)
   237 	local function on_new_s2s(event)
   236 		local host_session = event.origin;
   238 		local host_session = event.origin;
   237 		if host_session.type == "s2sout" or host_session.type == "s2sin" then
   239 		if host_session.type == "s2sout" or host_session.type == "s2sin" then
   238 			return; -- Already authenticated
   240 			return; -- Already authenticated
   242 		end
   244 		end
   243 		dane_lookup(host_session, resume);
   245 		dane_lookup(host_session, resume);
   244 		-- Let it run in parallel until we need to check the cert
   246 		-- Let it run in parallel until we need to check the cert
   245 	end
   247 	end
   246 
   248 
   247 	-- New outgoing connections
   249 	if not new_dane then
   248 	module:hook("stanza/http://etherx.jabber.org/streams:features", on_new_s2s, 501);
   250 		-- New outgoing connections
   249 	module:hook("s2sout-authenticate-legacy", on_new_s2s, 200);
   251 		module:hook("stanza/http://etherx.jabber.org/streams:features", on_new_s2s, 501);
       
   252 		module:hook("s2sout-authenticate-legacy", on_new_s2s, 200);
       
   253 	end
   250 
   254 
   251 	-- New incoming connections
   255 	-- New incoming connections
   252 	module:hook("s2s-stream-features", on_new_s2s, 10);
   256 	module:hook("s2s-stream-features", on_new_s2s, 10);
   253 
   257 
   254 	module:hook("s2s-authenticated", function(event)
   258 	module:hook("s2s-authenticated", function(event)