Comparison

plugins/mod_saslauth.lua @ 8518:0de0018bdf91

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 04 Feb 2018 01:40:11 +0100
parent 8513:c6be9bbd0a1a
child 9738:f5aa6fdc935e
child 11212:1bfd238e05ad
comparison
equal deleted inserted replaced
8507:71ef6d509105 8518:0de0018bdf91
108 condition = condition .. ": " .. text; 108 condition = condition .. ": " .. text;
109 end 109 end
110 module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); 110 module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition);
111 111
112 session.external_auth = "failed" 112 session.external_auth = "failed"
113 session:close(); 113 session.external_auth_failure_reason = condition;
114 return true;
115 end, 500) 114 end, 500)
115
116 module:hook_tag(xmlns_sasl, "failure", function (session, stanza) -- luacheck: ignore 212/stanza
117 session.log("debug", "No fallback from SASL EXTERNAL failure, giving up");
118 session:close(nil, session.external_auth_failure_reason);
119 return true;
120 end, 90)
116 121
117 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) 122 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza)
118 if session.type ~= "s2sout_unauthed" or not session.secure then return; end 123 if session.type ~= "s2sout_unauthed" or not session.secure then return; end
119 124
120 local mechanisms = stanza:get_child("mechanisms", xmlns_sasl) 125 local mechanisms = stanza:get_child("mechanisms", xmlns_sasl)