]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
eacces_error_get*(): Mention if euid is parent directory's owner.
authorTimo Sirainen <tss@iki.fi>
Sun, 28 Feb 2010 22:34:43 +0000 (00:34 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 28 Feb 2010 22:34:43 +0000 (00:34 +0200)
--HG--
branch : HEAD

src/lib/eacces-error.c

index 8ca379656799ec0bb150fb5796a0a8f7fdd0db3c..0086b73fcf4f482983a6033db1aff6036d54e42e 100644 (file)
@@ -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);
                }
        }