Send Jingle errors to the right JID

This commit is contained in:
hrxi 2019-08-06 20:30:18 +02:00
parent 4e0adcd2b4
commit 2327dc783c

View file

@ -35,7 +35,7 @@ void send_iq_error(IqError iq_error, XmppStream stream, Iq.Stanza iq) {
} else { } else {
assert_not_reached(); assert_not_reached();
} }
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, error)); stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, error) { to=iq.from });
} }
public errordomain Error { public errordomain Error {
@ -274,7 +274,7 @@ public class Module : XmppStreamModule, Iq.Handler {
if (action == "session-initiate") { if (action == "session-initiate") {
if (session != null) { if (session != null) {
// TODO(hrxi): Info leak if other clients use predictable session IDs? // TODO(hrxi): Info leak if other clients use predictable session IDs?
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.build(ErrorStanza.TYPE_MODIFY, ErrorStanza.CONDITION_CONFLICT, "session ID already in use", null))); stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.build(ErrorStanza.TYPE_MODIFY, ErrorStanza.CONDITION_CONFLICT, "session ID already in use", null)) { to=iq.from });
return; return;
} }
handle_session_initiate(stream, sid, jingle, iq); handle_session_initiate(stream, sid, jingle, iq);
@ -282,7 +282,7 @@ public class Module : XmppStreamModule, Iq.Handler {
} }
if (session == null) { if (session == null) {
StanzaNode unknown_session = new StanzaNode.build("unknown-session", ERROR_NS_URI).add_self_xmlns(); StanzaNode unknown_session = new StanzaNode.build("unknown-session", ERROR_NS_URI).add_self_xmlns();
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.item_not_found(unknown_session))); stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.error(iq, new ErrorStanza.item_not_found(unknown_session)) { to=iq.from });
return; return;
} }
session.handle_iq_set(stream, action, jingle, iq); session.handle_iq_set(stream, action, jingle, iq);