[ejabberd] Bugs in roster handling.

Etan Reisner deryni at eden.rutgers.edu
Mon Mar 14 21:47:06 MSK 2005


I believe I have run into a bug in ejabberd roster subscription handling
code which is messing up some of our clients. When ejabberd sees that
someone has requested to subscribe to someones presence it forwards the
<presence from='user' to='contact' type='subscribe'/> stanza to the
contact however it also sends to contact an <iq from='user' to='user'
type='set'><query xmlns='jabber:iq:roster'><item subscription='none'
jid='contact'/></query>/iq> stanza along. This second stanza I believe
to be in error, given my reading of rfc3921 sections 7, 8, and 9 and
what I watched jabber.org do for the same situation.

I think I tracked the problem down to process_subscription calling
push_item when it shouldn't (that is on subscription='none' and
ask='in').

I have a patch which 'fixes' the problem, I put fixes in quotes because
I'm not sure if it breaks anything else. Basically I added code to check
if subscription='none' and ask='in' in mod_roster:process_subscription.
That didn't work as expected though because then the subscription
request itself wasn't forwarded. So I short-circuited the "if Pass"
check in ejabberd_sm:do_route. Doing this caused it to work correctly,
but I'm not at all confident that changing the Pass check won't break
other scenarios.

I apologize for the long email, but I was hoping to explain this
thoroughly so that I could ask for guidance/a correct fix from the
people who know the code better than I do. So any advice on how to
correctly fix this, or (even better) a fix in CVS (and a patch to the
list if CVS isn't updated on jabberstudio) would be most appreciated.

	-Etan


More information about the ejabberd mailing list