[JDEV] Invalid handshake in component written with Jabber::Component

DJ Adams dj.adams at pobox.com
Mon Nov 5 10:21:00 CST 2001


On Mon, Nov 05, 2001 at 07:22:23PM +0800, Migs Paraz wrote:
> I'm trying to write my own JUD transport in Perl using Jabber::Connection.
> I think the problem is the Perl script's "localname."  Thanks in advance!
> 
> Here's the script output:

Hi Migs

Here are a few observations / tips / questions...

> SEND: <?xml version='1.0'?><stream:stream xmlns='jabber:component:accept' xmlns:stream='http://etherx.jabber.org/streams' to='localhost'>
> RECV: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='3BE66CA0' xmlns='jabber:component:accept' from='jud'>
> SEND: <handshake id='1'>a4e308bfb34c7bade5130d882ad71599bb4bca89</handshake>
> RECV: <stream:error>Invalid handshake</stream:error><handshake/>
> stream error: Invalid handshake at /usr/lib/perl5/site_perl/5.6.0/i386-linux/XML/Parser/Expat.pm line 614
> 

Ok, this shows us that the handshake sent, containing the secret, which
wasn't correct...but as we'll see below, you don't show the snippet of
code where the secret is sent.

> 
> Here's the jabberd output:
> 
> Mon Nov  5 18:40:32 2001  mio.c:750 MIO read from socket 11: <handshake id='1'>a4e308bfb34c7bade5130d882ad71599bb4bca89</handshake>
> Mon Nov  5 18:40:32 2001  base_accept.c:105 process XML: m:8140B40 state:3, arg:8108AA8, x:81F2BA0
> Mon Nov  5 18:40:32 2001  mio.c:1032 mio_write called on x: 0 buffer: <stream:error>Invalid handshake</stream:error>
> Mon Nov  5 18:40:32 2001  mio.c:1032 mio_write called on x: 0 buffer: <handshake/>
> Mon Nov  5 18:40:32 2001  mio.c:275 write_dump writing data: <stream:error>Invalid handshake</stream:error>
> Mon Nov  5 18:40:32 2001  mio.c:275 write_dump writing data: <handshake/>
> Mon Nov  5 18:40:32 2001  base_accept.c:105 process XML: m:8140B40 state:4, arg:8108AA8, x:8050ADC

I don't think this log output matches the run of the script with the log
output shown above, because here, we can see that the secret must have been
correct, as the "correct" handshake reply - <handshake/> - was sent, rather
than a stream error.

> Here's the relevant part of the script:
> 
> use Jabber::Connection;
> use Jabber::NodeFactory;
> use Jabber::NS qw(:all);
> 
> my $c = new Jabber::Connection(
>   ns => "jabber:component:accept",                             
>   server => 'localhost:1234',
>   localname => "jud.localhost",
>   log    => 1,
> );
> 
> $c->connect or die "oops: ".$c->lastError;
> 

THis is all fine as far as it goes, but the crucial bit is missing - 
the call to auth(). You should have something here (after the call
to connect()) like this:

  $c->auth('test');

where the word 'test' matches that in the <secret/> tag in the 
XML stanza below.

> 
> <service id="jud">
>   <host>jud.localhost</host>
>   <accept>
>     <ip>127.0.0.1</ip>
>     <port>1234</port>
>     <secret>test</secret>
>   </accept>
> </service>

So basically, everything you've shown us here is correct, but what
you haven't shown us is perhaps the thing that is tripping you up, 
namely the specification of the secret in the call to auth(). 

Hope that helps
dj



More information about the JDev mailing list