dovecot-2.1-pigeonhole: managesieve-login: Include hostname and ...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Thu Jan 12 19:43:21 EET 2012


details:   http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/523eae0118b1
changeset: 1594:523eae0118b1
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Thu Jan 12 18:43:13 2012 +0100
description:
managesieve-login: Include hostname and timestamp in "temporary auth failure" message.

diffstat:

 src/managesieve-login/client-authenticate.c |  38 +++++++++---------
 1 files changed, 19 insertions(+), 19 deletions(-)

diffs (70 lines):

diff -r c2e3b2c93c8c -r 523eae0118b1 src/managesieve-login/client-authenticate.c
--- a/src/managesieve-login/client-authenticate.c	Sat Jan 07 16:35:56 2012 +0100
+++ b/src/managesieve-login/client-authenticate.c	Thu Jan 12 18:43:13 2012 +0100
@@ -4,12 +4,14 @@
 #include "login-common.h"
 #include "base64.h"
 #include "buffer.h"
+#include "hostpid.h"
 #include "ioloop.h"
 #include "istream.h"
 #include "ostream.h"
 #include "safe-memset.h"
 #include "str.h"
 #include "str-sanitize.h"
+#include "time-util.h"
 #include "auth-client.h"
 
 #include "managesieve-parser.h"
@@ -52,6 +54,7 @@
 {
 	struct managesieve_client *msieve_client =
 		(struct managesieve_client *) client;
+	const char *timestamp, *msg;
 
 	if ( reply->host != NULL ) {
 		string_t *resp_code;
@@ -88,27 +91,24 @@
 			return TRUE;
  		}
 		client_send_noresp(client, str_c(resp_code), reason);
-	} else if ( reply->nologin ) {
-		/* Authentication went ok, but for some reason user isn't
-		   allowed to log in. Shouldn't probably happen. */
-		if (reply->reason != NULL) {
-			client_send_line(client,
-					 CLIENT_CMD_REPLY_AUTH_FAIL_REASON,
-					 reply->reason);
-		} else if (reply->temp) {
-			client_send_line(client,
-					 CLIENT_CMD_REPLY_AUTH_FAIL_TEMP,
-					 AUTH_TEMP_FAILED_MSG);
-		} else if (reply->authz_failure) {
-			client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED,
-					 "Authorization failed");
-		} else {
-			client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED,
-					 AUTH_FAILED_MSG);
-		}
-	} else {
+	} else if (!reply->nologin) {
 		/* normal login/failure */
 		return FALSE;
+	} else if (reply->reason != NULL) {
+		client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_REASON,
+			reply->reason);
+	} else if (reply->temp) {
+		timestamp = t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_time);
+		msg = t_strdup_printf(AUTH_TEMP_FAILED_MSG" [%s:%s]",
+				      my_hostname, timestamp);
+		client_send_line(client,
+				 CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, msg);
+	} else if (reply->authz_failure) {
+		client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED,
+				 "Authorization failed");
+	} else {
+		client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED,
+				 AUTH_FAILED_MSG);
 	}
 
 	i_assert(reply->nologin);


More information about the dovecot-cvs mailing list