mod_s2s_auth_dane/mod_s2s_auth_dane.lua
changeset 2189 2cbd7876ba14
parent 2188 7155ed1fb540
child 2201 90a444ccaa8e
equal deleted inserted replaced
2188:7155ed1fb540 2189:2cbd7876ba14
   196 		end, ("_%d._tcp.%s."):format(srv_choice.port, srv_choice.target), "TLSA");
   196 		end, ("_%d._tcp.%s."):format(srv_choice.port, srv_choice.target), "TLSA");
   197 		return true;
   197 		return true;
   198 	end
   198 	end
   199 end
   199 end
   200 
   200 
       
   201 local function pause(host_session)
       
   202 	host_session.log("debug", "Pausing connection until DANE lookup is completed");
       
   203 	host_session.conn:pause()
       
   204 end
       
   205 
   201 local function resume(host_session)
   206 local function resume(host_session)
   202 	host_session.log("debug", "DANE lookup completed, resuming connection");
   207 	host_session.log("debug", "DANE lookup completed, resuming connection");
   203 	host_session.conn:resume()
   208 	host_session.conn:resume()
   204 end
   209 end
   205 
   210 
   211 		end
   216 		end
   212 		if host_session.dane ~= nil then
   217 		if host_session.dane ~= nil then
   213 			return; -- Already done DANE lookup
   218 			return; -- Already done DANE lookup
   214 		end
   219 		end
   215 		if dane_lookup(host_session, resume) then
   220 		if dane_lookup(host_session, resume) then
   216 			host_session.log("debug", "Pausing connection until DANE lookup is completed");
   221 			pause(host_session);
   217 			host_session.conn:pause()
       
   218 		end
   222 		end
   219 	end
   223 	end
   220 
   224 
   221 	-- New outgoing connections
   225 	-- New outgoing connections
   222 	module:hook("stanza/http://etherx.jabber.org/streams:features", on_new_s2s, 501);
   226 	module:hook("stanza/http://etherx.jabber.org/streams:features", on_new_s2s, 501);