Comparison

core/stanza_router.lua @ 1269:b06d6674477b

stanza_router: Proper error for clients sending stanzas after auth but before resource binding
author Waqas Hussain <waqas20@gmail.com>
date Mon, 01 Jun 2009 15:09:42 +0500
parent 1263:7797354dc9b5
child 1270:0e700e2041ef
comparison
equal deleted inserted replaced
1268:dc1f95b37024 1269:b06d6674477b
60 return; 60 return;
61 end 61 end
62 end 62 end
63 63
64 if origin.type == "c2s" and not origin.full_jid 64 if origin.type == "c2s" and not origin.full_jid
65 and not(stanza.name == "iq" and stanza.tags[1].name == "bind" 65 and not(stanza.name == "iq" and stanza.attr.type == "set" and stanza.tags[1] and stanza.tags[1].name == "bind"
66 and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then 66 and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then
67 error("Client MUST bind resource after auth"); 67 -- authenticated client isn't bound and current stanza is not a bind request
68 origin.send(st.error_reply(stanza, "auth", "not-authorized")); -- FIXME maybe allow stanzas to account or server
68 end 69 end
69 70
70 -- TODO also, stanzas should be returned to their original state before the function ends 71 -- TODO also, stanzas should be returned to their original state before the function ends
71 if origin.type == "c2s" then 72 if origin.type == "c2s" then
72 stanza.attr.from = origin.full_jid; 73 stanza.attr.from = origin.full_jid;