From e71f933d7c7642c5bac14ff9b164aaa30ab6b681 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Wed, 16 Apr 2014 17:25:20 +0200 Subject: [PATCH] fix digest-md5 with some ejabberd server * it looke like some response parameters need to be quoted * so quote username, realm, nonce, etc, ... as in http://tools.ietf.org/html/rfc3920#ref-SASL --- xmpp.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xmpp.go b/xmpp.go index 6786432..65f0841 100644 --- a/xmpp.go +++ b/xmpp.go @@ -292,7 +292,8 @@ func (c *Client) init(o *Options) error { digestUri := "xmpp/" + domain nonceCount := fmt.Sprintf("%08x", 1) digest := saslDigestResponse(user, realm, o.Password, nonce, cnonceStr, "AUTHENTICATE", digestUri, nonceCount) - message := "username=" + user + ", realm=" + realm + ", nonce=" + nonce + ", cnonce=" + cnonceStr + ", nc=" + nonceCount + ", qop=" + qop + ", digest-uri=" + digestUri + ", response=" + digest + ", charset=" + charset + message := "username=\"" + user + "\", realm=\"" + realm + "\", nonce=\"" + nonce + "\", cnonce=\"" + cnonceStr + "\", nc=" + nonceCount + ", qop=" + qop + ", digest-uri=\"" + digestUri + "\", response=" + digest + ", charset=" + charset + fmt.Fprintf(c.conn, "%s\n", nsSASL, base64.StdEncoding.EncodeToString([]byte(message))) var rspauth saslRspAuth