[jdev] Session request/Resource bind after Digest MD5 auth ..
JD Conley
jconley at winfessor.com
Fri Nov 12 20:57:12 CST 2004
You're sending a "Start IM Session" request instead of a resource bind
request. You need to bind your resource first then you can start your
session. You need another round trip. :)
XMPP-IM states this is required but doesn't show you the XML in an
example. Perhaps this should be annotated more clearly. See XMPP-Core
[1] for how to do resource binding.
JD
[1] http://www.xmpp.org/specs/rfc3920.html#bind
> -----Original Message-----
> From: Scott Mikolaitis [mailto:smikolai at gmail.com]
> Sent: Friday, November 12, 2004 3:36 PM
> To: jdev at jabber.org
> Subject: [jdev] Session request/Resource bind after Digest MD5 auth ..
>
> I'm currently home growing a client in Java and have somehow managed
to
> connect,
> authenticate using DIGEST-MD5. In reading RFC's 3921 and 3920 the
XMPP
> Core
> draft I have ( page 36 ) says "Client must send a new stream header to
> the server,
> to which the server must respond with.. a list of available stream
> features..." and so on..
>
> It is at this point my client sends:
>
> <stream:stream to='localhost' xmlns='jabber:client'
> xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
>
> To which the server responds with:
>
> <?xml version='1.0'?><stream:stream
> xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'
> from='localhost' version='1.0'
> id='8rtzkzdf7wt99kz94okrr5fwpdwny8v60o5lni0v'>
> <stream:features xmlns:stream='http://etherx.jabber.org/streams'><bind
> xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session
> xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features>
>
> While the jabberd debug output shows:
>
> C2S : sx (io.c:191) decoded read data (114 bytes): <stream:stream
> to='localhost' xmlns='jabber:client'
> xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
> C2S : sx (server.c:118) stream request: to localhost from (null)
version
> 1.0
> C2S : sx (server.c:133) 10 state change from 0 to 1
> C2S : sx (server.c:149) stream id is
> hv3y4duh5gfn8vv5lns2tj0vnumo0m6ih9gmnb3s
> C2S : sx (server.c:179) prepared stream response: <?xml
> version='1.0'?><stream:stream
> xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'
> from='localhost' version='1.0'
> id='hv3y4duh5gfn8vv5lns2tj0vnumo0m6ih9gmnb3s'>
> C2S : sx (io.c:207) tag 10 event 1 data 0x0
> C2S : Fri Nov 12 03:17:19 2004 c2s.c:38 want write
> C2S : Fri Nov 12 03:17:19 2004 c2s.c:398 write action on fd 10
> C2S : sx (io.c:279) 10 ready for writing
> C2S : sx (io.c:237) encoding 183 bytes for writing: <?xml
> version='1.0'?><stream:stream
> xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'
> from='localhost' version='1.0'
> id='hv3y4duh5gfn8vv5lns2tj0vnumo0m6ih9gmnb3s'>
> C2S : sx (chain.c:79) calling io write chain
> C2S : sx (ssl.c:220) in _sx_ssl_wio
> C2S : sx (ssl.c:224) queueing buffer for write
> C2S : sx (ssl.c:240) preparing queued buffer for write
> C2S : sx (ssl.c:302) prepared 204 ssl bytes for write
> C2S : sx (io.c:298) handing app 204 bytes to write
> C2S : sx (io.c:299) tag 10 event 3 data 0x818f6a0
> C2S : Fri Nov 12 03:17:19 2004 c2s.c:104 writing to 10
> C2S : Fri Nov 12 03:17:19 2004 c2s.c:108 204 bytes written
> C2S : sx (server.c:29) stream established
> C2S : sx (sx.c:134) authenticating stream (method=SASL/DIGEST-MD5;
> id=nugget at localhost)
> C2S : sx (sx.c:139) 10 state change from 1 to 4
> C2S : sx (sx.c:140) tag 10 event 5 data 0x0
> C2S : sx (server.c:45) building features nad
> C2S : sx (sasl.c:77) already auth'd, not offering sasl mechanisms
> C2S : Fri Nov 12 03:17:19 2004 bind.c:40 offering resource bind and
> session
> C2S : sx (io.c:332) tag 10 event 0 data 0x0
> C2S : Fri Nov 12 03:17:19 2004 c2s.c:33 want read
> C2S : Fri Nov 12 03:17:19 2004 c2s.c:398 write action on fd 10
> C2S : sx (io.c:279) 10 ready for writing
> C2S : sx (io.c:237) encoding 185 bytes for writing: <stream:features
> xmlns:stream='http://etherx.jabber.org/streams'><bind
> xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session
> xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features>
>
> Continued from the 3920 RFC "..Upon being so informed that resource
> binding is
> required, the client MUST bind a resource to the stream by sending to
the
> server
> an IQ stanza of the type "set".."
>
> So, my client sends:
>
> <iq to='localhost' type='set' id='sess_1'><session
> xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>
>
> Which shows up in jabberd's debug output:
>
> C2S : sx (ssl.c:326) loading 122 bytes into ssl read buffer
> C2S : sx (io.c:191) decoded read data (101 bytes): <iq to='localhost'
> type='set' id='sess_1'><session
> xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>
> C2S : sx (io.c:67) completed nad: <iq xmlns='jabber:client'
> id='sess_1' type='set' to='localhost'><session
> xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>
> C2S : sx (chain.c:119) calling nad read chain
> C2S : sx (io.c:110) tag 10 event 6 data 0x8170578
> C2S : Fri Nov 12 04:33:52 2004 c2s.c:283 unrecognised pre-session
packet,
> bye
> C2S : sx (error.c:79) prepared error: <stream:error
> xmlns:stream='http://etherx.jabber.org/streams'><not-authorized
> xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
>
> And I'm subsequently booted by </stream:stream>
>
> I've investigated c2s.c a bit, but I'm finding the C a little cryptic
> and I'm a bit puzzled
> as to why this either doesn't work as advertised - or I'm doing
> something stupid..
> any advice?
>
> Scott
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mail.jabber.org/mailman/listinfo/jdev
More information about the JDev
mailing list