mirror of
https://github.com/ChronosX88/psyced.git
synced 2024-11-08 19:41:00 +00:00
remove last parts of sasl digest stuff here
This commit is contained in:
parent
024c0514de
commit
d5d2dac621
@ -429,51 +429,6 @@ jabberMsg(XMLNode node) {
|
|||||||
authenticated = 1;
|
authenticated = 1;
|
||||||
}
|
}
|
||||||
break;
|
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":
|
case "failure":
|
||||||
// the other side has to close the stream
|
// 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"]));
|
monitor_report("_error_invalid_authentication_XMPP", sprintf("%O got a failure with xml namespace %O\n", ME, node["@xmlns"]));
|
||||||
|
Loading…
Reference in New Issue
Block a user