Fixed
Details
Assignee
Tom EvansTom EvansReporter
Daryl HerzmannDaryl HerzmannComponents
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Tom Evans
Tom EvansReporter
Daryl Herzmann
Daryl HerzmannComponents
Fix versions
Affects versions
Priority
Created April 30, 2012 at 1:34 AM
Updated October 28, 2020 at 1:26 PM
Resolved April 28, 2014 at 4:55 PM
Hello Openfire development:
There seems to be a bug in Openfire (v3.7.1) when processing affiliation/role change. When a room administrator sends the following IQ affiliation/role change stanza, with multiple items, the server returns a BAD_REQUEST 400 response.
<iq from='admin@mydomain/myresource' to='myroom@mydomain' type='set' id='affil_1' xmlns='jabber:client'>
<query xmlns='jabber.org/protocol/muc#admin''>
<item jid='user@mydomain/myresource' affiliation='none'/>
<item nick='mynick' role='participant'>
<query/>
<iq/>
The code which causes this to happen is on line 213 in IQAdminHandler class's handleItemsElement method:
boolean hasAffiliation = ((Element) itemsList.get(0)).attributeValue("affiliation") != null;
The handleItemsElement method loops through each item and checks for role affiliation changes, but the code only checks the first item for an affiliation attribute (above) and in turn falsely reports that the second item has an affiliation (hasAffiliation == true) causing a 400 response.
If the hasAffiliation assignment is moved inside the loop to line 223 and changed to below the error is fixed:
boolean hasAffiliation = item.attributeValue("affiliation") != null;