comparison mod_smacks/mod_smacks.lua @ 2417:5e7badecf7fe

mod_smacks: Check if a session is an authenticated c2s session by looking for a username (fix for change in 0.10 9f70d35a1602)
author Kim Alvefur <zash@zash.se>
date Thu, 15 Dec 2016 02:57:03 +0100
parents 4c27ebcf4cbd
children 5fbca7de2088
comparison
equal deleted inserted replaced
2416:ade918cd9ca7 2417:5e7badecf7fe
51 51
52 local function can_do_smacks(session, advertise_only) 52 local function can_do_smacks(session, advertise_only)
53 if session.smacks then return false, "unexpected-request", "Stream management is already enabled"; end 53 if session.smacks then return false, "unexpected-request", "Stream management is already enabled"; end
54 54
55 local session_type = session.type; 55 local session_type = session.type;
56 if session_type == "c2s" then 56 if session.username then
57 if not(advertise_only) and not(session.resource) then -- Fail unless we're only advertising sm 57 if not(advertise_only) and not(session.resource) then -- Fail unless we're only advertising sm
58 return false, "unexpected-request", "Client must bind a resource before enabling stream management"; 58 return false, "unexpected-request", "Client must bind a resource before enabling stream management";
59 end 59 end
60 return true; 60 return true;
61 elseif s2s_smacks and (session_type == "s2sin" or session_type == "s2sout") then 61 elseif s2s_smacks and (session_type == "s2sin" or session_type == "s2sout") then