changeset 3059:08c640bdf749 HEAD

If authentication failed because of temporary failure, show different error message to clients.
author Timo Sirainen <tss@iki.fi>
date Fri, 07 Jan 2005 19:29:25 +0200
parents 052f3a5743af
children 4242c19c8617
files src/imap-login/client-authenticate.c src/login-common/common.h src/pop3-login/client-authenticate.c
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c	Fri Jan 07 19:27:20 2005 +0200
+++ b/src/imap-login/client-authenticate.c	Fri Jan 07 19:29:25 2005 +0200
@@ -85,13 +85,15 @@
 	const char *reason = NULL, *host = NULL, *destuser = NULL, *pass = NULL;
 	string_t *reply;
 	unsigned int port = 143;
-	int proxy = FALSE;
+	int proxy = FALSE, temp = FALSE;
 
 	for (; *args != NULL; args++) {
 		if (strcmp(*args, "nologin") == 0)
 			nologin = TRUE;
 		else if (strcmp(*args, "proxy") == 0)
 			proxy = TRUE;
+		else if (strcmp(*args, "temp") == 0)
+			temp = TRUE;
 		else if (strncmp(*args, "reason=", 7) == 0)
 			reason = *args + 7;
 		else if (strncmp(*args, "host=", 5) == 0)
@@ -146,6 +148,8 @@
 		reply = t_str_new(128);
 		if (reason != NULL)
 			str_printfa(reply, "NO %s", reason);
+		else if (temp)
+			str_append(reply, "NO "AUTH_TEMP_FAILED_MSG);
 		else
 			str_append(reply, "NO "AUTH_FAILED_MSG);
 		client_send_tagline(client, str_c(reply));
--- a/src/login-common/common.h	Fri Jan 07 19:27:20 2005 +0200
+++ b/src/login-common/common.h	Fri Jan 07 19:29:25 2005 +0200
@@ -4,6 +4,7 @@
 #include "lib.h"
 
 #define AUTH_FAILED_MSG "Authentication failed."
+#define AUTH_TEMP_FAILED_MSG "Temporary authentication failure."
 
 extern int disable_plaintext_auth, process_per_connection, greeting_capability;
 extern int verbose_proctitle, verbose_ssl, verbose_auth;
--- a/src/pop3-login/client-authenticate.c	Fri Jan 07 19:27:20 2005 +0200
+++ b/src/pop3-login/client-authenticate.c	Fri Jan 07 19:29:25 2005 +0200
@@ -86,13 +86,15 @@
 	const char *reason = NULL, *host = NULL, *destuser = NULL, *pass = NULL;
 	string_t *reply;
 	unsigned int port = 110;
-	int proxy = FALSE;
+	int proxy = FALSE, temp = FALSE;
 
 	for (; *args != NULL; args++) {
 		if (strcmp(*args, "nologin") == 0)
 			nologin = TRUE;
 		else if (strcmp(*args, "proxy") == 0)
 			proxy = TRUE;
+		else if (strcmp(*args, "temp") == 0)
+			temp = TRUE;
 		else if (strncmp(*args, "reason=", 7) == 0)
 			reason = *args + 7;
 		else if (strncmp(*args, "host=", 5) == 0)
@@ -124,6 +126,8 @@
 	str_append(reply, "-ERR ");
 	if (reason != NULL)
 		str_append(reply, reason);
+	else if (temp)
+		str_append(reply, AUTH_TEMP_FAILED_MSG);
 	else
 		str_append(reply, AUTH_FAILED_MSG);