pass base64-decoded message on continuation to callback as error for xoauth2

fork
mscdex 12 years ago
parent acbe2913f3
commit ce87915fb0

@ -661,13 +661,18 @@ ImapConnection.prototype.connect = function(loginCb) {
var args = requests[0].cbargs,
cmdstr = requests[0].cmdstr;
if (!m) {
if (requests[0].cmd !== 'APPEND') {
err = new Error('Unexpected continuation');
if (requests[0].cmd === 'APPEND')
return requests[0].callback();
else {
var isXOAuth2 = (cmdstr.indexOf('AUTHENTICATE XOAUTH2') === 0),
msg = (isXOAuth2
? new Buffer(line.substr(2), 'base64').toString('utf8')
: 'Unexpected continuation');
err = new Error(msg);
err.level = 'protocol';
err.type = 'continuation';
err.type = (isXOAuth2 ? 'failure' : 'continuation');
err.request = cmdstr;
} else
return requests[0].callback();
}
} else if (m[1] !== 'OK') {
// m[1]: error type
// m[2]: resp-text-code

Loading…
Cancel
Save