Projects tigase _server server-core Issues #356
when user modified roster's name to empty,the response of tigase server is not consistent with RFC6121#roster-update (#356)
Rick Zhang opened 1 decade ago
Due Date
2015-05-21

Hi:

I am not very sure if it is a problem.Below is test case:

Precondition:

There are two user:user1 and user2.

Test step:

1.user1 add roster:user1 add user2 as his contact:

request:

  <iq from="user1@zk.hs.com" type="set" id="b926ca31-0751-4970-91a4-b7c265185d85" xmlns="jabber:client">
    <query xmlns="jabber:iq:roster">
        <item jid="user2@zk.hs.com" name="" subscription="both">
            <group>External</group>
        </item>
    </query>
  </iq>

response:

  <iq type="set" to="user1@zk.hs.com/hf22" id="rsttig6">
    <query xmlns="jabber:iq:roster" ver="">
      <item subscription="none" ask="subscribe" name="user2" jid="user2@zk.hs.com">
        <group>External</group>
      </item>
    </query>
  </iq>

2.user1 update roster:change the name of user2 to empty:

request:

  <iq from="user1@zk.hs.com" type="set" id="b926ca31-0751-4970-91a4-b7c265185d85" xmlns="jabber:client">
    <query xmlns="jabber:iq:roster">
        <item jid="user2@zk.hs.com" *name=""* subscription="both">
            <group>External</group>
        </item>
    </query>
  </iq>

response:

  <iq type="set" to="user1@zk.hs.com/hf22" id="rsttig8">
    <query xmlns="jabber:iq:roster" ver="">
      <item subscription="none" ask="subscribe" *name="user2"* jid="user2@zk.hs.com">
        <group>External</group>
      </item>
    </query>
  </iq>

See,the contact's name is still "user2" other than expeced empty.

There are this sentence in RFC6121(http://xmpp.org/rfcs/rfc6121.html#roster-update):_Implementation Note: Including an empty 'name' attribute is equivalent to including no 'name' attribute; both actions set the name to the empty string._

So I think if user want to modify his contact name to empty,tigase server should also push empty name rather than "previous name".

I also have found the reason of this issue(if it is):In RosterFlat#addBuddy(XMPPResourceConnection, JID, String, String[], String) about line 191:

 if ((name != null) &&!name.isEmpty()) {
				relem.setName(name);
			}

The relem is cached in memory of session scope.It's retrived in RosterFlat#getUserRoster(XMPPResourceConnection):roster = (Map<BareJID, RosterElement>) session.getCommonSessionData(ROSTER) and updated in RosterFlat#saveUserRoster(XMPPResourceConnection):session.setData(null, ROSTER, sb.toString());

If name in request of updating roster is empty,relem won't set the name to empty and previous name would be sent to client.

Artur Hefczyc commented 1 decade ago

Rick, thank you for reporting the problem, You are correct. Tigase intentionally makes sure the name attribute is not empty. This is because historically, many XMPP/Jabber client did not handle well empty or non-existed name attribute of the roster item.

I am not sure what is the current state of this problem on current XMPP clients but I would prefer to keep current implementation as default for time being, however we will change behavior to have an option to allow for empty roster element names.

wojciech.kapcia@tigase.net commented 9 years ago

Implemented, it can be enabled with the following option:

sess-man/plugins-conf/jabber\:iq\:roster/empty_name_enabled=true

and it's disabled by default;

issue 1 of 1
Type
Bug
Priority
Minor
Assignee
RedmineID
2118
Version
tigase-server-7.1.0
Spent time
6h
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#356
Please wait...
Page is in error, reload to recover