mod_dialback.lua: Only check certificates on secure connections
authorKim Alvefur <zash@zash.se>
Fri, 4 Jul 2014 21:04:56 +0000 (23:04 +0200)
committerKim Alvefur <zash@zash.se>
Fri, 4 Jul 2014 21:04:56 +0000 (23:04 +0200)
plugins/mod_dialback.lua

index fa6b6dbca2b636c37a9a654dd271d70522a122fd..15e2428164c03c64cdb30d683c636bd13b5e754b 100644 (file)
@@ -82,12 +82,14 @@ module:hook("stanza/jabber:server:dialback:result", function(event)
                local attr = stanza.attr;
                local to, from = nameprep(attr.to), nameprep(attr.from);
 
-               if check_cert_status(origin, from) == false then
-                       return
-               elseif origin.cert_chain_status == "valid" and origin.cert_identity_status == "valid" then
-                       origin.sends2s(st.stanza("db:result", { to = from, from = to, id = attr.id, type = "valid" }));
-                       module:fire_event("s2s-authenticated", { session = origin, host = from });
-                       return true;
+               if origin.secure then
+                       if check_cert_status(origin, from) == false then
+                               return
+                       elseif origin.cert_chain_status == "valid" and origin.cert_identity_status == "valid" then
+                               origin.sends2s(st.stanza("db:result", { to = from, from = to, id = attr.id, type = "valid" }));
+                               module:fire_event("s2s-authenticated", { session = origin, host = from });
+                               return true;
+                       end
                end
 
                if not hosts[to] then