From 0f343e7716fbc0401663dc37ecc94874c23ff68e Mon Sep 17 00:00:00 2001 From: Ken Hornstein Date: Wed, 16 Oct 2019 21:37:19 -0400 Subject: [PATCH] Improve POP SASL error handling Handle the case where we get an -ERR message during the SASL exchange. --- uip/popsbr.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; } -- 2.56.0