Changeset

5346:b8fbb9d07efc

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Mar 2013 12:30:35 +0000
parents 5342:4c8c8285bf88 (current diff) 5345:9b85976c873f (diff)
children 5352:e10f701c2082 5355:11eff33f60d3
files
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Sun Mar 10 11:29:47 2013 +0000
+++ b/plugins/mod_s2s/mod_s2s.lua	Tue Mar 12 12:30:35 2013 +0000
@@ -136,6 +136,7 @@
 
 --- Helper to check that a session peer's certificate is valid
 local function check_cert_status(session)
+	local host = session.direction == "incoming" and session.from_host or session.to_host
 	local conn = session.conn:socket()
 	local cert
 	if conn.getpeercertificate then
@@ -155,8 +156,6 @@
 			(session.log or log)("debug", "certificate chain validation result: valid");
 			session.cert_chain_status = "valid";
 
-			local host = session.direction == "incoming" and session.from_host or session.to_host
-
 			-- We'll go ahead and verify the asserted identity if the
 			-- connecting server specified one.
 			if host then
@@ -168,6 +167,7 @@
 			end
 		end
 	end
+	module:fire_event("s2s-check-certificate", { host = host, session = session, cert = cert });
 end
 
 --- XMPP stream event handlers
@@ -249,7 +249,8 @@
 		if session.secure and not session.cert_chain_status then check_cert_status(session); end
 
 		send("<?xml version='1.0'?>");
-		send(st.stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback',
+		send(st.stanza("stream:stream", { xmlns='jabber:server',
+				["xmlns:db"]= hosts[to].modules.dialback and 'jabber:server:dialback' or nil,
 				["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=to, to=from, version=(session.version > 0 and "1.0" or nil) }):top_tag());
 		if session.version >= 1.0 then
 			local features = st.stanza("stream:features");