[JDEV] PATCH: make jud-0.4 module work with Psi

Aleksander Adamowski olo at altkom.com.pl
Mon Dec 9 10:53:24 CST 2002


Hi!
Recently I've set up a jabberd 1.4.2 server.

I've discovered that with jabberd-1.4.2 and jud-0.4, JUD searches sent from 
the Psi client don't work while searches from the Exodus client work fine.

I've decided to investigate the problem and found out that Psi sends its 
query in a form similar to this:

<iq type="set" id="aabca" to="jud.office.altkom.com.pl" >
<query xmlns="jabber:iq:search" >
<name></name>
   <first></first>
   <last></last>
   <nick>d</nick>
   <email></email> </query></iq>

While Exodus sends its queries with all search terms on one line:

<iq id="jcl_10" to="jud.office.altkom.com.pl" type="set"><query 
xmlns="jabber:iq:search"><nick>d</nick></qu
ery></iq>

The Psi searches always return 0 results, probably due to a bug in XML 
parser used in jabber 1.4.2.
Look at jud_search.c from jud-0.4: for empty query elements, the data that 
jud_search_walk()  receives from xmlnode_get_data() function contain a 
newline and 2 spaces when Psi is the source of a query!

Indeed, the query from Psi contains a newline and 2 spaces, but not inside 
search term elements, but before them!

I've made a workaround patch that causes the jud module to skip any leading 
spaces, newlines or tabs in the data string received from xmlnode_get_data() 
function. I've tested my patch - now searching from Psi works fine on my 
server :)

I'm attaching the patch to this message.

Best Regards,
-- 
     Olo
         GG#: 274614
         ICQ UIN: 19780575
	http://olo.office.altkom.com.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jud_0.4_expat_workaround.patch
URL: <https://www.jabber.org/jdev/attachments/20021209/4f410385/attachment-0002.txt>


More information about the JDev mailing list