[JDEV] phew

Dennis Noordsij dennis.noordsij at wiral.com
Thu Nov 30 10:03:16 CST 2000


Hi,

I just spent half a day trying to get a new xdb component (in Perl) to work 
and there are some strange things I wouldn't mind hearing a Jabber person 
explain :)

First, I have a custom LDAP auth checker, it is it's own service, and it 
works.

But now I want to use my own backend for user data, so I started my own xdb 
section. The xdb_mysql program for example only defines 4 namespaces 
(jabber:iq:auth, jabber:iq:roster, jabber:x:offline and jabber:x:register) 
and that seems to be enough for things to work.

My new xdb section (commenting out the normal xdb section with the spool 
files)

<xdb id="xdbperl">
 <host/>
 <accept>
  ...
 </accept>
</xdb>

Run jabberd, and it works.

Now, someone tries to authenticate. For some reason a simple 

<xdb id="1" from="..." to="... at ...../jabber:iq:auth" type="get"> 

is sent to my xdb module. It expects me to send for example

<xdb id="1" from="... at ...../jabber:iq:auth" to="...." type="result">
  <password/>
</xdb>

Next my LDAP authentication script receives the proper 

<route...<xdb...<query...<iq

tag with the necessary info to perform the authentication.

Question 1
Why is that one xdb tag w.r.t. jabber:iq:auth sent to the xdb module? To 
fetch the information necessary for authentication (password) from the 
backend for use in the proper authentication module? Or to simply check if 
the user exists at all?


After a succesfull login my xdb script receives 

<xdb id="4" to="... at ...../jabber:iq:roster" from="....." type="get">

I answer with for example

<xdb id="4" type="result" from="... at ...../jabber:iq:roster" to="....">
 <iq xmlns="jabber:iq:roster">
  <item jid="dennis" name="Dennis" subscription="none">
    <group>Friends</group>
  </item>
</xdb>


2 things can happen now.

Firstly, if I have <mod_presence> support loaded in the JSM, the following 
happens:

>From the xdb script point of view:
 single auth request for the login, as above
 single roster request, as above
 connection to jabberd lost

>From the gabber point of view
 logged in .. ok
 received roster data .. in <iq..<query..<item tags, xml is correct.
 sent <presence/>
 transmitter error, disconnected: 4

>From the jabberd -D point of view:
 logging in went fine
 received the roster information from xdbperl, sent it to jabber
 received the <presence/> tag from gabber
 delivering to instance xdbperl
 base_load.c:323 xdb_get() waiting for dennis at domain jabber:iq:roster 
 at this point jabberd has died. No segfault, no error, just gone


MAYBE I am wrong about my assumption the mod_presence data is simply the part 
of the JSM that handles it, I don't know if it is in any way related to 
wether the information comes from xdb_file spool files or somewhere else.


If I do not have <mod_presence> enabled, this happens:

Same as above, except for the crash
deliver.c:84 incoming packet, the <presence/> tag from jabber 
I am not sure what happens with it, but it seems to be ok. I do not know if 
presence would now actually work.
jabber:x:offline is deliverd to my xdbperl module next
All is fine and dandy, until

I use gabber to send a message to a user that is not logged in (well it 
doesn't even exist, but how would jabber now? unless that is what the one 
line <xdb type="get".....> tag with jabber:iq:auth is for?

Now, if I do nothing, the xdbperl script will receive three jabber:x:offline 
requests, and then jabberd will die.

If I however in the mean time try to send a message to anyone else, jabber 
will claim to deliver an xdb auth tag to xdbperl, but in reality jabber dies 
before xdbperl has ever seen anything.


All the time the "crash" sequence (according to the -D output) is

delivering to instance xdbperl
xdb_set() waiting for dennis at domain jabber:[iq|x]:[offline|auth|roster]

Then jabberd is gone.



My goal is to control the backend jabber uses for all it's user info, that 
means I want it to come to me (my script :) to ask anything, to authenticate, 
add and delete users from roster lists, vcards, etc. I want to define what 
happens with offline messages and how they are retrieved. If possible I would 
even like to control the presence list (so I can "fake" a user being 
available when in fact he is not logged in to jabber but has an agent 
forwarding his messages to sms and receiving his messages and putting them 
back on the wire on his behalf. ie the other party thinks he is using jabber 
when in fact he is not).


What exactly do the mod_.... references do? Do they simply define features 
that are on or off?

And why does jabber die on me like that? Btw I use the Net::Jabber module, 
but even if it was flakey it shouldn't cause jabberd to die right?


Regards,
Dennis :-)








More information about the JDev mailing list