1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

remove last parts of sasl digest stuff here

This commit is contained in:
Philipp Hancke 2010-03-28 15:29:12 +02:00
parent 024c0514de
commit d5d2dac621

View file

@ -429,51 +429,6 @@ jabberMsg(XMLNode node) {
authenticated = 1;
}
break;
case "challenge":
PT(("%O got a sasl challenge\n", ME))
if (node["@xmlns"] == NS_XMPP "xmpp-sasl") {
unless(t = node[Cdata]) {
// none given
} else unless (t = to_string(decode_base64(t))) {
// base64 decode error?
} else {
// this one is shared across all those digest md5's
mixed data;
string secret;
string response;
PT(("decoded challenge: %O\n", t))
data = sasl_parse(t);
PT(("extracted %O\n", data))
data["username"] = _host_XMPP;
secret = config(XMPP + hostname, "_secret_shared");
unless(secret) {
// mh... this is a problem!
// we only started doing this if we have a secret,
// so this cant be empty
}
data["cnonce"] = RANDHEXSTRING;
data["nc"] = "00000001";
data["digest-uri"] = "xmpp/" _host_XMPP;
response = sasl_calculate_digestMD5(data, secret, 0);
// ok, the username is our hostname
// note: qop must not be quoted, as we are 'client'
t = "username=\"" _host_XMPP "\","
"realm=\"" + data["realm"] + "\","
"nonce=\"" + data["nonce"] + "\","
"cnonce=\"" + data["cnonce"] + "\","
"nc=" + data["nc"] + ",qop=auth,"
"digest-uri=\"" + data["digest-uri"] + "\","
"response=" + response + ",charset=utf-8";
PT(("%O sent rspauth %O\n", ME, response))
emit("<response xmlns='" NS_XMPP "xmpp-sasl'>"
+ encode_base64(t) +
"</response>");
}
}
break;
case "failure":
// the other side has to close the stream
monitor_report("_error_invalid_authentication_XMPP", sprintf("%O got a failure with xml namespace %O\n", ME, node["@xmlns"]));