Mercurial > dovecot > core-2.2
diff src/lib/eacces-error.c @ 10819:6a8ee83cbc8c HEAD
eacces_error_get*(): Mention if euid is parent directory's owner.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 01 Mar 2010 00:34:43 +0200 |
parents | 615eef3139c2 |
children | 4f90b4114450 |
line wrap: on
line diff
--- a/src/lib/eacces-error.c Sun Feb 28 21:22:53 2010 +0200 +++ b/src/lib/eacces-error.c Mon Mar 01 00:34:43 2010 +0200 @@ -158,18 +158,22 @@ 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); } }