Thursday 28 October 2010

SleekXMPP problems with DIGEST-MD5

I was trying to connect to facebook XMPP server using the sleekxmpp port that suports the SASL.

But was unable to connect....

1 2
    if not challenge['realm'] or not challenge['qop'] or not challenge['nonce']: KeyError: u'realm' 

Looking at protocol http://xmpp.org/rfcs/rfc3920.html#sasl the function handler_sasl_digest_md5_auth was not handling 2 essential steps:

"Step 7: Server sends another [BASE64] encoded challenge to client:"
and
"Step 8: Client responds to the challenge:"




Solution:
1
2
3
4
5
   self.sendPriorityRaw("""<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>""" %base64.encodestring(response)[:-1])
self.digest_auth_started = True
else:
logging.warn("handler_sasl_digest_md5_auth called while digest_auth_started is True (has already begun)")
self.sendPriorityRaw("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />")

No comments:

Post a Comment