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
This commit is contained in:
Martin Bonnin 2014-04-16 17:25:20 +02:00
parent 8da045a9e5
commit e71f933d7c

View File

@ -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, "<response xmlns='%s'>%s</response>\n", nsSASL, base64.StdEncoding.EncodeToString([]byte(message)))
var rspauth saslRspAuth