mod_c2s: Remove connection object from session object when connection disconnected...
[prosody.git] / plugins / mod_saslauth.lua
index b75b1844b448e6114744ea5e6909573926e59ffc..c5d3dc917bd847b00869efc563ccc0640f75aca6 100644 (file)
@@ -87,7 +87,7 @@ module:hook_stanza(xmlns_sasl, "success", function (session, stanza)
        module:log("debug", "SASL EXTERNAL with %s succeeded", session.to_host);
        session.external_auth = "succeeded"
        session:reset_stream();
-       session:open_stream();
+       session:open_stream(session.from_host, session.to_host);
 
        module:fire_event("s2s-authenticated", { session = session, host = session.to_host });
        return true;
@@ -197,7 +197,7 @@ module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event)
                return s2s_external_auth(session, stanza)
        end
 
-       if session.type ~= "c2s_unauthed" then return; end
+       if session.type ~= "c2s_unauthed" or module:get_host_type() ~= "local" then return; end
 
        if session.sasl_handler and session.sasl_handler.selected then
                session.sasl_handler = nil; -- allow starting a new SASL negotiation before completing an old one