powered by Jive Software

Bad Request when trying to change another user's MUC affiliation


#1

Situation:
When I am the owner of a MUC and try to grant owner-status to someone else, while not being an occupant of the room at that moment, the IQ results in a bad request.

Example IQ Format:

<iq from='crone1@shakespeare.lit/desktop'
    id='owner1'
    to='coven@chat.shakespeare.lit'
    type='set'>
  <query xmlns='http://jabber.org/protocol/muc#admin'>
    <item affiliation='owner'
          jid='hecate@shakespeare.lit'/>
  </query>
</iq>

A little bit of debugging shows, that org.jivesoftware.openfire.muc.spi.LocalMUCUser just ignores any IQ when the sender did not join the room first. More precisely, these lines of code:

// Packets to a specific node/group/room
MUCRole role = roles.get(group);
if (role == null) {
    Log.debug( "Ignoring stanza received from a non-occupant of '{}': {}", group, packet.toXML() );
    if ( packet.isRequest() )
    {
      // If a non-occupant sends a disco to an address of the form <room@service/nick>,
      // a MUC service MUST return a <bad-request/> error.
      // http://xmpp.org/extensions/xep-0045.html#disco-occupant
      sendErrorPacket( packet, PacketError.Condition.bad_request );
    }
}

Besides that that comment there does not seem quite correct imho, this should not happen at all with any IQ directed to a Chatroom. Of course you could just join that room to bypass this check, but XEP-0045 does not state that you have to join the room in order to change affiliations. So Openfire should not demand it, too.