Software / code / prosody
Comparison
plugins/mod_dialback.lua @ 8518:0de0018bdf91
Merge 0.10->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 04 Feb 2018 01:40:11 +0100 |
| parent | 8458:e9c7ac97cb52 |
| parent | 8517:980d2daf3ed4 |
| child | 10376:b337df192a10 |
| child | 11556:6f56170ea986 |
comparison
equal
deleted
inserted
replaced
| 8507:71ef6d509105 | 8518:0de0018bdf91 |
|---|---|
| 151 -- Warn the original connection that is was not verified successfully | 151 -- Warn the original connection that is was not verified successfully |
| 152 log("warn", "authoritative server for %s denied the key", attr.from or "(unknown)"); | 152 log("warn", "authoritative server for %s denied the key", attr.from or "(unknown)"); |
| 153 valid = "invalid"; | 153 valid = "invalid"; |
| 154 end | 154 end |
| 155 if dialback_verifying.destroyed then | 155 if dialback_verifying.destroyed then |
| 156 log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the db result", | 156 log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the dialback result", |
| 157 tostring(dialback_verifying):match("%w+$")); | 157 tostring(dialback_verifying):match("%w+$")); |
| 158 else | 158 else |
| 159 dialback_verifying.sends2s( | 159 dialback_verifying.sends2s( |
| 160 st.stanza("db:result", { from = attr.to, to = attr.from, id = attr.id, type = valid }) | 160 st.stanza("db:result", { from = attr.to, to = attr.from, id = attr.id, type = valid }) |
| 161 :text(dialback_verifying.hosts[attr.from].dialback_key)); | 161 :text(dialback_verifying.hosts[attr.from].dialback_key)); |
| 188 end | 188 end |
| 189 return true; | 189 return true; |
| 190 end | 190 end |
| 191 end); | 191 end); |
| 192 | 192 |
| 193 module:hook_tag("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, stanza) -- luacheck: ignore 212/stanza | |
| 194 if origin.external_auth == "failed" then | |
| 195 module:log("debug", "SASL EXTERNAL failed, falling back to dialback"); | |
| 196 initiate_dialback(origin); | |
| 197 return true; | |
| 198 end | |
| 199 end, 100); | |
| 200 | |
| 193 module:hook_tag(xmlns_stream, "features", function (origin, stanza) -- luacheck: ignore 212/stanza | 201 module:hook_tag(xmlns_stream, "features", function (origin, stanza) -- luacheck: ignore 212/stanza |
| 194 if not origin.external_auth or origin.external_auth == "failed" then | 202 if not origin.external_auth or origin.external_auth == "failed" then |
| 195 module:log("debug", "Initiating dialback..."); | 203 module:log("debug", "Initiating dialback..."); |
| 196 initiate_dialback(origin); | 204 initiate_dialback(origin); |
| 197 return true; | 205 return true; |