Comparison

plugins/mod_saslauth.lua @ 7944:36a9a4af1873

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 02 Mar 2017 23:03:02 +0100
parent 7940:e520dc0c3af4
child 7960:9a938b785bc5
comparison
equal deleted inserted replaced
7923:81f3068fc30c 7944:36a9a4af1873
94 end) 94 end)
95 95
96 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) 96 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza)
97 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end 97 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end
98 98
99 module:log("info", "SASL EXTERNAL with %s failed", session.to_host) 99 local text = stanza:get_child_text("text");
100 -- TODO: Log the failure reason 100 local condition = "unknown-condition";
101 for child in stanza:childtags() do
102 if child.name ~= "text" then
103 condition = child.name;
104 break;
105 end
106 end
107 if text and condition then
108 condition = connection .. ": " .. text;
109 end
110 module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition);
111
101 session.external_auth = "failed" 112 session.external_auth = "failed"
102 session:close(); 113 session:close();
103 return true; 114 return true;
104 end, 500) 115 end, 500)
105 116