mod_tls: Respond with proper error when TLS cannot be negotiated.
authorWaqas Hussain <waqas20@gmail.com>
Thu, 11 Feb 2010 21:39:50 +0000 (02:39 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Thu, 11 Feb 2010 21:39:50 +0000 (02:39 +0500)
plugins/mod_tls.lua

index 15cdb3e3806bb39b9405295ffaa9e3e9e6805d08..9214dd1206fd3e38a78e824cd6ce8bc93af30215 100644 (file)
@@ -27,8 +27,9 @@ module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event)
                origin.log("info", "TLS negotiation started for %s...", origin.type);
                origin.secure = false;
        else
-               -- FIXME: What reply?
                origin.log("warn", "Attempt to start TLS, but TLS is not available on this %s connection", origin.type);
+               (origin.sends2s or origin.send)(st.stanza("failure", { xmlns = xmlns_starttls }));
+               origin:close();
        end
        return true;
 end);