From: Timo Sirainen Date: Sun, 28 Feb 2010 22:34:43 +0000 (+0200) Subject: eacces_error_get*(): Mention if euid is parent directory's owner. X-Git-Tag: 2.0.beta4~149 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=49dc101839b5f37a1a3c000421796f162e0017d9;p=thirdparty%2Fdovecot%2Fcore.git eacces_error_get*(): Mention if euid is parent directory's owner. --HG-- branch : HEAD --- diff --git a/src/lib/eacces-error.c b/src/lib/eacces-error.c index 8ca3796567..0086b73fcf 100644 --- a/src/lib/eacces-error.c +++ b/src/lib/eacces-error.c @@ -158,18 +158,22 @@ eacces_error_get_full(const char *func, const char *path, bool creating) str_printfa(errmsg, " UNIX perms appear ok, " "some security policy wrong?"); } - /* check and warn if another uid has the same name */ - if (pw_name != NULL && dir_st.st_uid != geteuid()) { - pw = getpwuid(dir_st.st_uid); - if (pw != NULL && strcmp(pw->pw_name, pw_name) == 0) { - str_printfa(errmsg, ", dir uid=%s(%s)", + if (dir_st.st_uid != geteuid()) { + if (pw_name != NULL && + (pw = getpwuid(dir_st.st_uid)) != NULL && + strcmp(pw->pw_name, pw_name) == 0) { + str_printfa(errmsg, ", conflicting dir uid=%s(%s)", dec2str(dir_st.st_uid), pw_name); + } else { + str_append(errmsg, ", euid is not dir owner"); } + } else { + str_append(errmsg, ", euid is dir owner"); } if (gr_name != NULL && dir_st.st_gid != getegid()) { group = getgrgid(dir_st.st_gid); if (group != NULL && strcmp(group->gr_name, gr_name) == 0) { - str_printfa(errmsg, ", dir gid=%s(%s)", + str_printfa(errmsg, ", conflicting dir gid=%s(%s)", dec2str(dir_st.st_gid), gr_name); } }