dovecot-2.0: auth: Improved passwd-file's EACCES error messages.

dovecot at dovecot.org dovecot at dovecot.org
Mon May 31 18:42:27 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/dcfabc2e2143
changeset: 11432:dcfabc2e2143
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 31 16:42:23 2010 +0100
description:
auth: Improved passwd-file's EACCES error messages.

diffstat:

 src/auth/db-passwd-file.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r eac68d311ce3 -r dcfabc2e2143 src/auth/db-passwd-file.c
--- a/src/auth/db-passwd-file.c	Mon May 31 16:01:09 2010 +0100
+++ b/src/auth/db-passwd-file.c	Mon May 31 16:42:23 2010 +0100
@@ -11,6 +11,7 @@
 #include "istream.h"
 #include "hash.h"
 #include "str.h"
+#include "eacces-error.h"
 #include "var-expand.h"
 
 #include <stdlib.h>
@@ -164,7 +165,13 @@
 
 	fd = open(pw->path, O_RDONLY);
 	if (fd == -1) {
-		i_error("passwd-file %s: Can't open file: %m", pw->path);
+		if (errno == EACCES) {
+			i_error("passwd-file %s: %s", pw->path,
+				eacces_error_get("open", pw->path));
+		} else {
+			i_error("passwd-file %s: Can't open file: %m",
+				pw->path);
+		}
 		return FALSE;
 	}
 
@@ -239,8 +246,12 @@
 	if (stat(pw->path, &st) < 0) {
 		/* with variables don't give hard errors, or errors about
 		   nonexisting files */
-		if (errno != ENOENT)
+		if (errno == EACCES) {
+			i_error("passwd-file %s: %s", pw->path,
+				eacces_error_get("stat", pw->path));
+		} else if (errno != ENOENT) {
 			i_error("passwd-file %s: stat() failed: %m", pw->path);
+		}
 
 		if (pw->db->default_file != pw)
 			passwd_file_free(pw);


More information about the dovecot-cvs mailing list