mod_s2s_auth_dane/mod_s2s_auth_dane.lua
changeset 1435 cdc8f226a284
parent 1434 1caf971a2f0f
child 1436 3944e364ba88
equal deleted inserted replaced
1434:1caf971a2f0f 1435:cdc8f226a284
   110 
   110 
   111 function module.add_host(module)
   111 function module.add_host(module)
   112 	local function on_new_s2s(event)
   112 	local function on_new_s2s(event)
   113 		local host_session = event.origin;
   113 		local host_session = event.origin;
   114 		if host_session.type == "s2sout" or host_session.type == "s2sin" or host_session.dane ~= nil then return end -- Already authenticated
   114 		if host_session.type == "s2sout" or host_session.type == "s2sin" or host_session.dane ~= nil then return end -- Already authenticated
   115 		host_session.log("debug", "Pausing connection until DANE lookup is completed");
       
   116 		host_session.conn:pause()
       
   117 		local function resume()
   115 		local function resume()
   118 			host_session.log("debug", "DANE lookup completed, resuming connection");
   116 			host_session.log("debug", "DANE lookup completed, resuming connection");
   119 			host_session.conn:resume()
   117 			host_session.conn:resume()
   120 		end
   118 		end
   121 		if not dane_lookup(host_session, resume) then
   119 		if dane_lookup(host_session, resume) then
   122 			resume();
   120 			host_session.log("debug", "Pausing connection until DANE lookup is completed");
       
   121 			host_session.conn:pause()
   123 		end
   122 		end
   124 	end
   123 	end
   125 
   124 
   126 	-- New outgoing connections
   125 	-- New outgoing connections
   127 	module:hook("stanza/http://etherx.jabber.org/streams:features", on_new_s2s, 501);
   126 	module:hook("stanza/http://etherx.jabber.org/streams:features", on_new_s2s, 501);