]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lda: Don't fail with "mail_uid/mail_gid not set" error when running without -u.
authorTimo Sirainen <tss@iki.fi>
Tue, 24 Aug 2010 16:18:01 +0000 (17:18 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 24 Aug 2010 16:18:01 +0000 (17:18 +0100)
src/lib-storage/mail-storage-service.c

index fd34b7d2d64f6617ab55286021deb48ffb7268b8..bfa784d75e8bd35f02a13f7bd7863a34b5cd8887 100644 (file)
@@ -317,7 +317,8 @@ service_drop_privileges(const struct mail_user_settings *set,
                                dec2str(rset.uid));
                        return -1;
                }
-       } else if (rset.uid == (uid_t)-1 && disallow_root) {
+       } else if (rset.uid == (uid_t)-1 &&
+                  disallow_root && current_euid == 0) {
                *error_r = "User is missing UID (see mail_uid setting)";
                return -1;
        }
@@ -336,7 +337,8 @@ service_drop_privileges(const struct mail_user_settings *set,
                                dec2str(rset.gid));
                        return -1;
                }
-       } else if (rset.gid == (gid_t)-1 && disallow_root) {
+       } else if (rset.gid == (gid_t)-1 && disallow_root &&
+                  set->first_valid_gid > 0 && getegid() == 0) {
                *error_r = "User is missing GID (see mail_gid setting)";
                return -1;
        }