[JDEV] Question about xdb_auth_cpile
Joe Breeden
jbreeden at ena.com
Tue Sep 17 12:52:13 CDT 2002
Chris,
I figured out the problem - which mean I may have a Perl based equal to xdb_sql in the next week or two, when I get it I'll set up a project on JabberStudio or wherever is appropriate. The story of the solution is a long story so hold with me. I was trying to come up with own version of xdb using perl so I could modify it to allow us to do some special stuff here and thought the best way would be to do an implementation that emulated xdb_sql then modify it to account for my special needs. Simple enough, I have xdb_auth_cpile to start with all I need to do is implement all the name spaces and what not. 2 days later and I'm stuck on jabber:iq:register requests. To debug I fired up ethereal and sure enough the stream looked as I would expect - one jabber:iq:auth get request to check to see if the JID in question is available followed by one jabber:iq:register set request to add the new user. Unfortunately, my xdb component was never seeing the jabber:iq:register request.
I started jabberd with the -D option for debug stuff and was overwhelmed with the output (it's very interesting sometime - I recommend everyone try it to see what really goes on). After looking at it for several hours I gave up and went home. On the 3rd day (today) I came back to it and noticed that jabberd was in reality sending the following requests to my xdb component:
jabber:iq:auth - get -> I assume used to check for the existence of the JID
jabber:iq:auth - set -> with no action - I don't know where this came from. It looks like the Session manager was generating it. I didn't see it in the ethereal trace so I'm sure my client was not generating it and sending it on
jabber:iq:register - set ->only happened if the previous jabber:iq:auth passed.
My problem was that I wasn't trapping for a jabber:iq:auth - set just yet so I returned an IQ_ERROR result so the jabber:iq:request was not being sent to my xdb component. Once I saw this and modified my code, all seemed to work. I would like to know why this extra request was generated. It seems, to me at least, that this call is unnecessary and only adds to the load of the server. Of course, like many times in the past, I could be wrong.
I am now off to implement the rest of the xdb name space (other than transports - which I do not need to support at this time). Once I get everything done I release it to the group or back to you so other can benefit.
Thanks for the help,
--Joe Breeden
I remember, not too long ago, when a man could work hard clubbing baby seals all day long and then go home and have a tall, cold one with a clear conscience.
> -----Original Message-----
> From: Chris Pile [mailto:cpile at snoogans.co.uk]
> Sent: Tuesday, September 17, 2002 11:23 AM
> To: jdev at jabber.org
> Subject: Re: [JDEV] Question about xdb_auth_cpile
>
>
> Hi Joe,
>
> I haven't had chance to check, but I'm not sure if you can use the
> xdb_auth check mechanism for register requests. Most ppl have been
> using the mechanism for authenticating against pre-populated user
> databases.
>
> If you look at the code for "/jabber/jsm/modules/mod_auth_plain.c" you
> can see the xdb "check" section. This mechanism is built into
> jabber-1.4.2 mod_auth_plain and bypasses the usual authentication
> mechanism. It uses "xdb" instead of the usual "iq".
>
> I will try and have a look tomorrow and follow up with more detail.
>
> http://jabberd.jabberstudio.org/1.4/142changelog.html
>
>
> Thanks,
> Chris Pile
>
> Joe Breeden wrote:
> >
> > I am testing by using GAIM to login to my server that has
> the modification listed below. I have attached the debug
> output from a session with jabberd started with the -D
> option. I don't really understand all of the output, but from
> what I can gather the jabber:iq:register messages are not
> being routed to my routine.
> >
> > If anyone can help I would really appreciate it. Thanks in
> advance for the help.
> >
> > --Joe Breeden
> >
> > We don't do Extreme Programming here - we prefer Ludicrous
> Programming
> >
> > > -----Original Message-----
> > > From: Joe Breeden
> > > Sent: Monday, September 16, 2002 12:46 PM
> > > To: jdev at jabber.org
> > > Subject: [JDEV] Question about xdb_auth_cpile
> > >
> > >
> > > I am in the process of modifying xdb_auth_cpile.pl to work
> > > with some special in-house stuff we need and wanted to add
> > > support for jabber:iq:register name space to allow users to
> > > register with database. For some reason, my modified version
> > > of the code is not seeing the jabber:iq:register requests.
> > >
> > > Here is the xdb tag from my jabber.xml:
> > >
> > > <xdb id="xdb_ena">
> > > <host>xdb_ena.shrieker.ena.com</host>
> > > <ns>jabber:iq:roster</ns>
> > > <ns>jabber:x:offline</ns>
> > > <ns>jabber:iq:filter</ns>
> > > <ns>jabber:iq:last</ns>
> > > <ns>jabber:iq:auth</ns>
> > > <ns>jabber:iq:auth:0k</ns>
> > > <ns>jabber:iq:register</ns>
> > > <accept>
> > > <ip>localhost</ip>
> > > <port>5999</port>
> > > <secret>g00g0ne</secret>
> > > </accept>
> > > </xdb>
> > >
> > > Here is a snippet of my perl code that creates a
> > > Jabber::Connection object and registers a handler sub routine:
> > >
> > > ###create jabber object
> > > my $j = new Jabber::Connection (
> > > server => $jserver->{ip} . ':' . $jserver->{port},
> > > localname => $jserver->{id},
> > > ns => 'jabber:component:accept',
> > > );
> > >
> > > ###connect to the server
> > > log_msg ( MSG => 'Connecting to the server [' .
> > > $jserver->{ip} . ':' . $jserver->{port} . '] [' .
> > > $jserver->{id} . ']' ) if $debug;
> > > log_msg ( MSG => "Failed to connect to the server - [" .
> > > $j->lastError . "]", DIE => 1) unless $j->connect();
> > >
> > > ###register the handlers
> > > log_msg ( MSG => 'Registering handlers.') if $debug;
> > > $j->register_handler( 'xdb', \&xdb_handler );
> > >
> > > Looking at the POD for Jabber::Connection and the example
> > > code in xdb_auth_cpile.pl is a little confusing. The POD for
> > > Jabber::Connection says that the first argument to
> > > register_handler should be a node type - 'message',
> > > 'presence', or 'iq' - but the example code has 'xdb'. Using
> > > 'xdb' as a node type seems to work for most of the namespaces
> > > in the <xdb> tag of my jabber.xml, for some reason or other I
> > > am not seeing jabber:iq:register requests.
> > >
> > > Any help would be appreciated and if more information is
> > > needed, please let me know what and I'll pass it on.
> > >
> > > Thanks in advance,
> > >
> > > --Joe Breeden
> > >
> > > From Murphy's Laws of Computing:
> > > 9. A complex system that does not work is invariably found to
> > > have evolved from a simpler system that worked just fine.
> > >
> > > _______________________________________________
> > > jdev mailing list
> > > jdev at jabber.org
> > > http://mailman.jabber.org/listinfo/jdev
> > >
> >
> >
> --------------------------------------------------------------
> ----------
> > Name: jabberd-trace.txt
> > jabberd-trace.txt Type: Plain Text (text/plain)
> > Encoding: base64
> > Description: jabberd-trace.txt
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mailman.jabber.org/listinfo/jdev
>
More information about the JDev
mailing list