mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Handle preceding whitespace in DIGEST-MD5
implementation from smack-sasl-provided. Fixes SMACK-649.
This commit is contained in:
parent
54cbd9a50a
commit
5597b1ffc0
1 changed files with 7 additions and 0 deletions
|
@ -104,6 +104,13 @@ public class SASLDigestMD5Mechanism extends SASLMechanism {
|
||||||
String[] keyValue = part.split("=");
|
String[] keyValue = part.split("=");
|
||||||
assert (keyValue.length == 2);
|
assert (keyValue.length == 2);
|
||||||
String key = keyValue[0];
|
String key = keyValue[0];
|
||||||
|
// RFC 2831 § 7.1 about the formating of the digest-challenge:
|
||||||
|
// "The full form is "<n>#<m>element" indicating at least <n> and
|
||||||
|
// at most <m> elements, each separated by one or more commas
|
||||||
|
// (",") and OPTIONAL linear white space (LWS)."
|
||||||
|
// Which means the key value may be preceded by whitespace,
|
||||||
|
// which is what we remove: *Only the preceding whitespace*.
|
||||||
|
key = key.replaceFirst("^\\s+", "");
|
||||||
String value = keyValue[1];
|
String value = keyValue[1];
|
||||||
if ("nonce".equals(key)) {
|
if ("nonce".equals(key)) {
|
||||||
if (nonce != null) {
|
if (nonce != null) {
|
||||||
|
|
Loading…
Reference in a new issue