Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence subcription request containing a Moved element is delivered without it once user goes online #4295

Open
melvo opened this issue Oct 19, 2024 · 4 comments

Comments

@melvo
Copy link
Contributor

melvo commented Oct 19, 2024

Environment

  • ejabberd version: 24.07

Bug description

  1. 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>
  1. 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:

  1. 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.
@melvo
Copy link
Contributor Author

melvo commented Oct 19, 2024

@weiss This is the outcome of our discussion.

@processone processone deleted a comment from Neustradamus Oct 21, 2024
@badlop
Copy link
Member

badlop commented Oct 21, 2024

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?

  1. Register accounts user1@localhost and admin@localhost

  2. 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>
  1. 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  ">>}]}]},
  1. 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>

@weiss
Copy link
Member

weiss commented Oct 22, 2024

@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.

@melvo
Copy link
Contributor Author

melvo commented Dec 16, 2024

@badlop Is there any chance for this issues to be fixed? It would improve moving to another account a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants