Presence subcription request containing a Moved element is delivered without it once user goes online
Environment
- ejabberd version: 24.07
Bug description
- Alice sends a presence subscription request including a Moved element in the presence stanza to Bob while he is offline:
<presence to="[email protected]" type="subscribe">
<moved xmlns="urn:xmpp:moved:1">
<old-jid>[email protected]</old-jid>
<moved>
</presence>
- Bob goes online and receives the presence subscription request without the Moved element in the presence stanza.
It works as expected if Bob is online when the subscription request is sent.
RFC 6121 specifies the following:
- Otherwise, if the contact has no available resources when the subscription request is received by the contact's server, then the contact's server MUST keep a record of the complete presence stanza comprising the subscription request, including any extended content contained therein (see Section 8.4 of [[XMPP-CORE]), and then deliver the request when the contact next has an available resource. The contact's server MUST continue to deliver the subscription request whenever the contact creates an available resource, until the contact either approves or denies the request.
@weiss This is the outcome of our discussion.
Strange, I cannot reproduce that problem. I've tried with ejabberd 24.07 (compiled from git branch), and git master.
This is how I tried it, what's the difference with your test to explain the different result?
-
Register accounts user1@localhost and admin@localhost
-
user1@localhost logins and sends this stanza
<presence type='subscribe' to='admin@localhost' id='sub1'>
<moved xmlns='urn:xmpp:moved:1'>
<old-jid>userold@localhost</old-jid>
</moved>
</presence>
- I can view in the roster mnesia table in webadmin that it contains this element:
[{roster,{<<"admin">>,<<"localhost">>,{<<"user1">>,<<"localhost">>,<<>>}},
{<<"admin">>,<<"localhost">>},
{<<"user1">>,<<"localhost">>,<<>>},
<<>>,none,in,[],<<>>,
[{xmlel,<<"moved">>,
[{<<"xmlns">>,<<"urn:xmpp:moved:1">>}],
[{xmlcdata,<<"\n ">>},
{xmlel,<<"old-jid">>,[],
[{xmlcdata,<<"userold@localhost">>}]},
{xmlcdata,<<"\n ">>}]}]},
- when admin@localhost logins, receives this stanza
<presence to='admin@localhost'
from='user1@localhost'
type='subscribe'>
<moved xmlns='urn:xmpp:moved:1'>
<old-jid>userold@localhost</old-jid>
</moved>
</presence>
@badlop
what's the difference with your test to explain the different result?
I think the difference is that @melvo was using SQL while you tested with Mnesia: Our SQL code drops the #roster.xs field (which holds child elements) while our Mnesia code stores the #roster item as-is.
@badlop Is there any chance for this issues to be fixed? It would improve moving to another account a lot!