Sharp.Xmpp icon indicating copy to clipboard operation
Sharp.Xmpp copied to clipboard

MultiUserChat.SubmitRoomConfigForm bug

Open cimframe opened this issue 8 years ago • 0 comments

I'm not sure of how to submit a bug fix, but I have pulled out almost all of my hair trying to figure this one out!

I am running ejabberd v16.12 as the server and the stanza submitted by the method in this report actually crashed the server... When I ran ejabberd in debug mode and looked at the dump it told me there was no type in the <x/> element.

The old code:

// Construct the response element.
var query = Xml.Element ("query", MucNs.NsOwner);
var xml = Xml.Element ("x", MucNs.NsXData);
xml.Child (configForm.ToXmlElement ());
query.Child (configForm);

added two <x/> elements:

<query xmlns="http://jabber.org/protocol/muc#owner">
	<x xmlns="jabber:x:data">       <------------
		<x type="submit"
		   xmlns="jabber:x:data">
			<field type="text-single"
				   var="muc#roomconfig_roomname"
				   xmlns="">
				<value>Testing</value>
			</field>
		</x>
	</x>
</query>

The extra <x/> element crashes the server. By changing the above lines to:

// Construct the response element.
var query = Xml.Element ("query", MucNs.NsOwner);
query.Child (configForm.ToXmlElement());

the correct stanza is produced as:

<query xmlns="http://jabber.org/protocol/muc#owner">
	<x xmlns="jabber:x:data">
		<x type="submit"
		   xmlns="jabber:x:data">
			<field type="text-single"
				   var="muc#roomconfig_roomname"
				   xmlns="">
				<value>Testing</value>
			</field>
		</x>
	</x>
</query>

and the world continues to revolve and I get to keep the rest of my hair...

If someone would email me directly with any scolding on the correct way to submit changes, you can reach me, Steve, at [email protected]. Cheers.

cimframe avatar Feb 09 '17 18:02 cimframe