Changeset

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
parents 10245:88efdfb0a126
children 10247:5de65f30fe5e
files plugins/mod_s2s/mod_s2s.lua
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Sat Sep 07 17:34:56 2019 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Sat Sep 07 17:44:57 2019 +0200
@@ -249,15 +249,13 @@
 		session.type = "s2sout";
 	elseif session.type == "s2sin_unauthed" then
 		session.type = "s2sin";
-		if host then
-			if not session.hosts[host] then session.hosts[host] = {}; end
-			session.hosts[host].authed = true;
-		end
-	elseif session.type == "s2sin" and host then
+	elseif session.type ~= "s2sin" and session.type ~= "s2sout" then
+		return false;
+	end
+
+	if session.incoming and host then
 		if not session.hosts[host] then session.hosts[host] = {}; end
 		session.hosts[host].authed = true;
-	else
-		return false;
 	end
 	session.log("debug", "connection %s->%s is now authenticated for %s", session.from_host, session.to_host, host);