dovecot-2.1: auth: When complaining about auth-userdb permission...

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 7 22:44:18 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/08afc14abc21
changeset: 13669:08afc14abc21
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 07 22:54:32 2011 +0200
description:
auth: When complaining about auth-userdb permission errors, log also the wanted UID's name.

diffstat:

 src/auth/auth-master-connection.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r d0a071b6847c -r 08afc14abc21 src/auth/auth-master-connection.c
--- a/src/auth/auth-master-connection.c	Mon Nov 07 22:17:15 2011 +0200
+++ b/src/auth/auth-master-connection.c	Mon Nov 07 22:54:32 2011 +0200
@@ -12,6 +12,7 @@
 #include "network.h"
 #include "istream.h"
 #include "ostream.h"
+#include "ipwd.h"
 #include "master-service.h"
 #include "userdb.h"
 #include "userdb-blocking.h"
@@ -331,9 +332,17 @@
 
 static const char *auth_restricted_reason(struct auth_master_connection *conn)
 {
-	return t_strdup_printf("%s mode=0666, but not owned by UID %lu",
+	struct passwd pw;
+	const char *namestr;
+
+	if (i_getpwuid(conn->userdb_restricted_uid, &pw) <= 0)
+		namestr = "";
+	else
+		namestr = t_strdup_printf("(%s)", pw.pw_name);
+	return t_strdup_printf("%s mode=0666, but not owned by UID %lu%s",
 			       conn->path,
-			       (unsigned long)conn->userdb_restricted_uid);
+			       (unsigned long)conn->userdb_restricted_uid,
+			       namestr);
 }
 
 static bool


More information about the dovecot-cvs mailing list