Comparison

plugins/mod_saslauth.lua @ 7940:e520dc0c3af4

Merge 0.9->0.10
author Kim Alvefur <zash@zash.se>
date Thu, 02 Mar 2017 15:21:07 +0100
parent 7899:2b3d0ab67f7d
parent 7939:6940d6db970b
child 7960:9a938b785bc5
comparison
equal deleted inserted replaced
7938:3629f03817f8 7940:e520dc0c3af4
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