changeset 18893:86b75d360241

imap/pop3-login: If auth failure reason already begins with [resp-code], don't prefix it with another one.
author Timo Sirainen <tss@iki.fi>
date Mon, 29 Jun 2015 20:25:15 +0300
parents b268e186d029
children 5631687b52ef
files src/imap-login/client-authenticate.c src/pop3-login/client.c
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c	Mon Jun 29 13:36:38 2015 +0300
+++ b/src/imap-login/client-authenticate.c	Mon Jun 29 20:25:15 2015 +0300
@@ -81,8 +81,12 @@
 		client_send_reply(client, IMAP_CMD_REPLY_BAD, text);
 		break;
 	case CLIENT_AUTH_RESULT_AUTHFAILED_REASON:
-		client_send_reply_code(client, IMAP_CMD_REPLY_NO,
-				       "ALERT", text);
+		if (text[0] == '[')
+			client_send_reply(client, IMAP_CMD_REPLY_NO, text);
+		else {
+			client_send_reply_code(client, IMAP_CMD_REPLY_NO,
+					       "ALERT", text);
+		}
 		break;
 	case CLIENT_AUTH_RESULT_AUTHZFAILED:
 		client_send_reply_code(client, IMAP_CMD_REPLY_NO,
--- a/src/pop3-login/client.c	Mon Jun 29 13:36:38 2015 +0300
+++ b/src/pop3-login/client.c	Mon Jun 29 20:25:15 2015 +0300
@@ -243,7 +243,10 @@
 		prefix = "-ERR [SYS/TEMP]";
 		break;
 	case POP3_CMD_REPLY_AUTH_ERROR:
-		prefix = "-ERR [AUTH]";
+		if (text[0] == '[')
+			prefix = "-ERR";
+		else
+			prefix = "-ERR [AUTH]";
 		break;
 	case POP3_CMD_REPLY_ERROR:
 		break;