From d5b9ca273924e220a6b5a9c78e7fddfe9400ac53 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Fri, 20 Aug 2010 12:34:50 +0000 Subject: replace Digest MD5 parsing code, the current code chokes on non-quoted parameters --- src/QXmppStream.cpp | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) (limited to 'src/QXmppStream.cpp') diff --git a/src/QXmppStream.cpp b/src/QXmppStream.cpp index b17a314d..033e404e 100644 --- a/src/QXmppStream.cpp +++ b/src/QXmppStream.cpp @@ -828,47 +828,7 @@ void QXmppStream::sendAuthDigestMD5ResponseStep1(const QString& challenge) { QByteArray ba = QByteArray::fromBase64(challenge.toUtf8()); - QMap map; - - QByteArray key; - QByteArray value; - bool parsingValue = false; - int startindex = 0; - for(int i = 0; i < ba.length(); i++) - { - char next = ba.at(i); - switch (next) { - case '=': - if (!parsingValue) - { - // Trim the key, but do not trim the value as it is in delimiters - key = ba.mid(startindex, i - startindex).trimmed(); - // Skip the equals and delimiter - startindex = i + 2; - } - break; - case '"': - // Ignore the opening delimiter - if (startindex != (i + 1)) - { - value = ba.mid(startindex, i - startindex); - map[key] = value; - debug(key + ":" + value); - // Skip the comma - i += 2; - startindex = i; - parsingValue = false; - } - else { - parsingValue = true; - } - - break; - - default: - break; - } - } + QMap map = parseDigestMd5(ba); if (!map.contains("nonce")) { -- cgit v1.2.3