[jdev] iq:private routing in j2

Craig Hollabaugh craig at hollabaugh.com
Fri Jun 4 11:35:43 CDT 2004

On Fri, 2004-06-04 at 02:07, Craig Hollabaugh wrote:
> On Fri, 2004-06-04 at 01:10, Jacek Konieczny wrote:
> > On Fri, Jun 04, 2004 at 08:16:05AM +1000, Robert Norris wrote:
> > > On Thu, Jun 03, 2004 at 02:36:37PM -0600, Craig Hollabaugh wrote:
> > > > I'm trying to send an iq with <query xnlns='jabber:iq:private'>
> > > > between my custom non-IM clients. I noticed that jabberd v1.4.3
> > > > intercepts and bounces the message.  I see in jsm/modules/mod_xml.c
> > > > that the server returns a TERROR_NOTACCEPTABLE message. 
> > > 
> > > You can't do that. jabber:iq:private is a namespace that has special
> > > meaning to a server (at least servers that support it), which is why
> > > you're getting an error when you try to route around the server.
> > 
> > And that is a bug. If the stanza is not directed to the server (it is
> > a full client JID (with node and resource)) it should be routed to the
> > client unless some explicit client-defined rules forbid that (e.g.
> > privacy rules).
> I agree.
> I'm investigating this in more detail in jabberd v2.0. I'll work with
> Rob on what I found.

I found the jabberd v2 make and install went flawlessly using the quick
install doc at jabberdoc.org. Thanks guys for excellent documentation.

I then found that jabberd v2.0s2 doesn't route iq stanzas with full client 
JIDs when the query namespace is jabber:iq:private. The function 
_iq_private_in_sess in sm/mod_iq_private.c makes the decision to 
handle iq:private or pass that packet on. 

Here's a diff that shows what to change.

diff /tmp/jabberd-2.0s2/sm/mod_iq_private.c mod_iq_private.c
<     if(pkt->to != NULL && jid_compare_user(sess->jid, pkt->to) != 0 &&
strcmp(sess->jid->domain, pkt->to->domain) != 0)
>     if(pkt->to != NULL && jid_compare_user(sess->jid, pkt->to) != 0 &&
strcmp(sess->jid->domain, jid_user(pkt->to)) != 0)

With this change, iqs with no to, to=server, or to=user are handled by
the server and other tos are routed to their destination. I sent mail to
Rob Norris last night but haven't heard back. (He must be out having
fun, after all it is Friday).

I can see both sides of the current implementation, one as a feature and
the other as a bug. The feature allows for improperly addressed iq
stanzas access to private storage.  I'm leaning towards the bug. I think
if clients want to use private storage on the server, then they should
address their iq stanzas to the server (not to themselves, not to nobody
but to the server). Also, when the server replies, it should make the
from address the server not the user, see example 2 in JEP-0049. I know
that JEP-0049 is not standards-track and could be replaced. If it is
replaced, please consider not treating the jabber:iq:private as a
special case. Make it function like all the other JEPs, ie routable with
actual source and destination addresses. 

Don't get me wrong, I love using Jabber and will continue to do so. I've
determined its perfect for my non-IM instrumentation project. I see
asynchronous messaging unifying data acquisition and control systems, a
multi-billion dollar industry. I'm happy to see all the JEP changes this
year to extend XMPP beyond IM, keep up the great work!! 

Thanks for your time.


Dr. Craig Hollabaugh, craig at hollabaugh.com
Author of Embedded Linux: Hardware, Software and Interfacing

More information about the JDev mailing list