From: Timo Sirainen Date: Mon, 31 May 2010 15:42:23 +0000 (+0100) Subject: auth: Improved passwd-file's EACCES error messages. X-Git-Tag: 2.0.beta6~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5540effe4ea041f060f7ea88d2c71192a890274;p=thirdparty%2Fdovecot%2Fcore.git auth: Improved passwd-file's EACCES error messages. --HG-- branch : HEAD --- diff --git a/src/auth/db-passwd-file.c b/src/auth/db-passwd-file.c index 15327b8009..8305b6d598 100644 --- a/src/auth/db-passwd-file.c +++ b/src/auth/db-passwd-file.c @@ -11,6 +11,7 @@ #include "istream.h" #include "hash.h" #include "str.h" +#include "eacces-error.h" #include "var-expand.h" #include @@ -164,7 +165,13 @@ static bool passwd_file_open(struct passwd_file *pw) 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 @@ static bool passwd_file_sync(struct passwd_file *pw) 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);