dovecot-2.0: access_get_error(): Fixed to give better error mess...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 31 22:04:28 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/8db227a70bec
changeset: 12050:8db227a70bec
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 31 20:04:10 2010 +0100
description:
access_get_error(): Fixed to give better error messages with relative paths.

diffstat:

 src/lib/eacces-error.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r f90590836165 -r 8db227a70bec src/lib/eacces-error.c
--- a/src/lib/eacces-error.c	Tue Aug 31 19:33:21 2010 +0100
+++ b/src/lib/eacces-error.c	Tue Aug 31 20:04:10 2010 +0100
@@ -95,9 +95,14 @@
 	orig_errno = errno;
 	errmsg = t_str_new(256);
 	str_printfa(errmsg, "%s(%s)", func, path);
+	dir = "/";
 	if (*path != '/') {
 		if (t_get_current_dir(&dir) == 0)
 			str_printfa(errmsg, " in directory %s", dir);
+		if (strchr(path, '/') == NULL) {
+			/* we have no path. do the file access checks anyway. */
+			ret = 0;
+		}
 	}
 	str_printfa(errmsg, " failed: Permission denied (euid=%s",
 		    dec2str(geteuid()));
@@ -119,7 +124,7 @@
 		str_append(errmsg, "(<unknown>)");
 	}
 
-	dir = "/"; memset(&dir_st, 0, sizeof(dir_st));
+	memset(&dir_st, 0, sizeof(dir_st));
 	while ((p = strrchr(prev_path, '/')) != NULL) {
 		dir = t_strdup_until(prev_path, p);
 		ret = stat(dir, &st);


More information about the dovecot-cvs mailing list