Software /
code /
prosody
Comparison
plugins/mod_s2s/mod_s2s.lua @ 10246:19d7a2e7b9c4
mod_s2s: Handle authentication of s2sin and s2sout the same way
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 07 Sep 2019 17:44:57 +0200 |
parent | 10240:a17f47d5e119 |
child | 10247:5de65f30fe5e |
comparison
equal
deleted
inserted
replaced
10245:88efdfb0a126 | 10246:19d7a2e7b9c4 |
---|---|
247 end | 247 end |
248 if session.type == "s2sout_unauthed" then | 248 if session.type == "s2sout_unauthed" then |
249 session.type = "s2sout"; | 249 session.type = "s2sout"; |
250 elseif session.type == "s2sin_unauthed" then | 250 elseif session.type == "s2sin_unauthed" then |
251 session.type = "s2sin"; | 251 session.type = "s2sin"; |
252 if host then | 252 elseif session.type ~= "s2sin" and session.type ~= "s2sout" then |
253 if not session.hosts[host] then session.hosts[host] = {}; end | 253 return false; |
254 session.hosts[host].authed = true; | 254 end |
255 end | 255 |
256 elseif session.type == "s2sin" and host then | 256 if session.incoming and host then |
257 if not session.hosts[host] then session.hosts[host] = {}; end | 257 if not session.hosts[host] then session.hosts[host] = {}; end |
258 session.hosts[host].authed = true; | 258 session.hosts[host].authed = true; |
259 else | |
260 return false; | |
261 end | 259 end |
262 session.log("debug", "connection %s->%s is now authenticated for %s", session.from_host, session.to_host, host); | 260 session.log("debug", "connection %s->%s is now authenticated for %s", session.from_host, session.to_host, host); |
263 | 261 |
264 if (session.type == "s2sout" and session.external_auth ~= "succeeded") or session.type == "s2sin" then | 262 if (session.type == "s2sout" and session.external_auth ~= "succeeded") or session.type == "s2sin" then |
265 -- Stream either used dialback for authentication or is an incoming stream. | 263 -- Stream either used dialback for authentication or is an incoming stream. |