From 8cda4f05f71ad41176d7bba52ce58b702fab59b8 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Tue, 18 Apr 2006 23:22:30 +0000 Subject: [PATCH] Handle Exchange's bogus short challenge in AUTH NTLM (problem debugged by Alexander Gattin). --- imap/auth_sasl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index f3d20389..38a801a9 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -130,7 +130,14 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method) if (irc == IMAP_CMD_RESPOND) { - if (sasl_decode64 (idata->buf+2, strlen (idata->buf+2), buf, LONG_STRING-1, &len) != SASL_OK) + /* Exchange incorrectly returns +\r\n instead of + \r\n */ + if (idata->buf[1] == '\0') + { + buf[0] = '\0'; + len = 0; + } + else if (sasl_decode64 (idata->buf+2, strlen (idata->buf+2), buf, + LONG_STRING-1, &len) != SASL_OK) { dprint (1, (debugfile, "imap_auth_sasl: error base64-decoding server response.\n")); goto bail; -- 2.40.0