Comparison

core/stanza_router.lua @ 7785:cdffbda59b03

core.stanza_router: Remove hack for allowing resource binding IQ before resource binding
author Kim Alvefur <zash@zash.se>
date Tue, 13 Dec 2016 18:16:20 +0100
parent 7740:26a7186a40c6
child 7802:802dc0691177
comparison
equal deleted inserted replaced
7784:9f70d35a1602 7785:cdffbda59b03
77 origin.send(st.error_reply(stanza, "modify", "bad-request", "Incorrect number of children for IQ stanz")); 77 origin.send(st.error_reply(stanza, "modify", "bad-request", "Incorrect number of children for IQ stanz"));
78 return; 78 return;
79 end 79 end
80 end 80 end
81 81
82 if not origin.full_jid
83 and not(name == "iq" and st_type == "set" and stanza.tags[1] and stanza.tags[1].name == "bind"
84 and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then
85 -- authenticated client isn't bound and current stanza is not a bind request
86 if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then
87 origin.send(st.error_reply(stanza, "auth", "not-authorized")); -- FIXME maybe allow stanzas to account or server
88 end
89 return;
90 end
91
92 -- TODO also, stanzas should be returned to their original state before the function ends 82 -- TODO also, stanzas should be returned to their original state before the function ends
93 stanza.attr.from = origin.full_jid; 83 stanza.attr.from = origin.full_jid;
94 end 84 end
95 local to, xmlns = stanza.attr.to, stanza.attr.xmlns; 85 local to, xmlns = stanza.attr.to, stanza.attr.xmlns;
96 local from = stanza.attr.from; 86 local from = stanza.attr.from;