14 local jid_split = jid.split; |
14 local jid_split = jid.split; |
15 |
15 |
16 function core_process_stanza(origin, stanza) |
16 function core_process_stanza(origin, stanza) |
17 log("debug", "Received: "..tostring(stanza)) |
17 log("debug", "Received: "..tostring(stanza)) |
18 -- TODO verify validity of stanza (as well as JID validity) |
18 -- TODO verify validity of stanza (as well as JID validity) |
|
19 |
|
20 if origin.type == "c2s" and not origin.full_jid |
|
21 and not(stanza.name == "iq" and stanza.tags[1] and stanza.tags[1].name == "bind" |
|
22 and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then |
|
23 error("Client MUST bind resource after auth"); |
|
24 end |
|
25 |
19 |
26 |
20 local to = stanza.attr.to; |
27 local to = stanza.attr.to; |
21 stanza.attr.from = origin.full_jid -- quick fix to prevent impersonation |
28 stanza.attr.from = origin.full_jid -- quick fix to prevent impersonation |
22 |
29 |
23 if not to or (hosts[to] and hosts[to].type == "local") then |
30 if not to or (hosts[to] and hosts[to].type == "local") then |