From: Timo Sirainen Date: Thu, 26 Feb 2009 22:44:17 +0000 (-0500) Subject: mbox: Improve dotlock error logging more. X-Git-Tag: 1.2.beta2~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dcf49e7ccf042982fde41ce256723f925fb9f1e4;p=thirdparty%2Fdovecot%2Fcore.git mbox: Improve dotlock error logging more. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/mbox/mbox-lock.c b/src/lib-storage/index/mbox/mbox-lock.c index 972df6ac9a..83de109ab5 100644 --- a/src/lib-storage/index/mbox/mbox-lock.c +++ b/src/lib-storage/index/mbox/mbox-lock.c @@ -370,16 +370,22 @@ mbox_dotlock_log_eacces_error(struct mbox_mailbox *mbox, const char *path) errmsg = eacces_error_get_creating("file_dotlock_create", path); dir = strrchr(path, '/'); dir = dir == NULL ? "." : t_strdup_until(path, dir); - if (stat(dir, &st) == 0 && - (st.st_mode & 02) == 0 && /* not world-writable */ - (st.st_mode & 020) != 0) { /* group-writable */ + if (!mbox->mbox_privileged_locking) { + dir = mailbox_list_get_path(mbox->storage->storage.list, NULL, + MAILBOX_LIST_PATH_TYPE_DIR); + mail_storage_set_critical(&mbox->storage->storage, + "%s (under root dir %s -> no privileged locking)", + errmsg, dir); + } else if (stat(dir, &st) == 0 && + (st.st_mode & 02) == 0 && /* not world-writable */ + (st.st_mode & 020) != 0) { /* group-writable */ group = getgrgid(st.st_gid); mail_storage_set_critical(&mbox->storage->storage, "%s (set mail_privileged_group=%s)", errmsg, group == NULL ? dec2str(st.st_gid) : group->gr_name); } else { mail_storage_set_critical(&mbox->storage->storage, - "%s (nonstandard permissions in %s)", errmsg, path); + "%s (nonstandard permissions in %s)", errmsg, dir); } errno = orig_errno; }