Diff

plugins/mod_admin_telnet.lua @ 7069:eae5d2f1311d

mod_admin_telnet: Show unauthenticated clients identified by local/remote IP and port
author Kim Alvefur <zash@zash.se>
date Sat, 09 Jan 2016 23:59:31 +0100
parent 7068:0c494bca43cb
child 7070:aab022cb8e29
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sat Jan 09 23:58:43 2016 +0100
+++ b/plugins/mod_admin_telnet.lua	Sat Jan 09 23:59:31 2016 +0100
@@ -543,7 +543,13 @@
 	if session.username then
 		return session.full_jid or jid_join(session.username, session.host, session.resource);
 	end
-	return "(unknown)";
+
+	local conn = session.conn;
+	local ip = session.ip or "?";
+	local clientport = conn and conn:clientport() or "?";
+	local serverip = conn and conn.server and conn:server():ip() or "?";
+	local serverport = conn and conn:serverport() or "?"
+	return jid_join("["..ip.."]:"..clientport, session.host or "["..serverip.."]:"..serverport);
 end
 
 local function show_c2s(callback)