From: Ken Hornstein Date: Thu, 17 Oct 2019 01:37:19 +0000 (-0400) Subject: Improve POP SASL error handling X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/0f343e7716fbc0401663dc37ecc94874c23ff68e Improve POP SASL error handling Handle the case where we get an -ERR message during the SASL exchange. --- diff --git a/uip/popsbr.c b/uip/popsbr.c index ced55606..3df93bd9 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -445,7 +445,21 @@ pop_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata, if (line == NULL) return NOTOK; - if (len < 2 || (len == 2 && strcmp(line, "+ ") != 0)) { + + /* + * If we get an -ERR reply, bubble that back up + */ + + if (has_prefix(line, "-ERR")) { + netsec_err(errstr, "%s", line); + return NOTOK; + } + + /* + * Make sure we get someting back a valid response + */ + + if (!has_prefix(line, "+ ")) { netsec_err(errstr, "Invalid format for SASL response"); return NOTOK; }