Comparison

plugins/mod_admin_telnet.lua @ 5706:896094da72e4

mod_admin_telnet: Refactor s2s:showcert()
author Kim Alvefur <zash@zash.se>
date Wed, 19 Jun 2013 16:20:33 +0200
parent 5674:ebdbf4cf0b2f
child 5708:667cf4e45356
comparison
equal deleted inserted replaced
5705:6eebd5808fbc 5706:896094da72e4
681 end 681 end
682 682
683 function def_env.s2s:showcert(domain) 683 function def_env.s2s:showcert(domain)
684 local ser = require "util.serialization".serialize; 684 local ser = require "util.serialization".serialize;
685 local print = self.session.print; 685 local print = self.session.print;
686 local domain_sessions = set.new(array.collect(keys(incoming_s2s))) 686 local s2s_sessions = module:shared"/*/s2s/sessions";
687 /function(session) return session.from_host == domain and session or nil; end; 687 local domain_sessions = set.new(array.collect(values(s2s_sessions)))
688 for local_host in values(prosody.hosts) do 688 /function(session) return (session.to_host == domain or session.from_host == domain) and session or nil; end;
689 local s2sout = local_host.s2sout;
690 if s2sout and s2sout[domain] then
691 domain_sessions:add(s2sout[domain]);
692 end
693 end
694 local cert_set = {}; 689 local cert_set = {};
695 for session in domain_sessions do 690 for session in domain_sessions do
696 local conn = session.conn; 691 local conn = session.conn;
697 conn = conn and conn:socket(); 692 conn = conn and conn:socket();
698 if not conn.getpeerchain then 693 if not conn.getpeerchain then