dovecot-2.1: lib-storage: When index mkdir() fails with EPERM, c...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Oct 2 23:24:15 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/3ce50c0bb782
changeset: 14745:3ce50c0bb782
user: Timo Sirainen <tss at iki.fi>
date: Tue Oct 02 23:24:10 2012 +0300
description:
lib-storage: When index mkdir() fails with EPERM, create the dir anyway with 0700 mode.
This avoids failing entirely when /var/mail/user has 0660 permissions and we
don't have access to the group. The error message is still logged.
diffstat:
src/lib-storage/mailbox-list.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diffs (19 lines):
diff -r e29b627219b3 -r 3ce50c0bb782 src/lib-storage/mailbox-list.c
--- a/src/lib-storage/mailbox-list.c Tue Oct 02 23:12:07 2012 +0300
+++ b/src/lib-storage/mailbox-list.c Tue Oct 02 23:24:10 2012 +0300
@@ -1461,7 +1461,14 @@
if (errno != ENOENT || p == NULL || ++n == 2) {
mailbox_list_set_critical(list,
"mkdir(%s) failed: %m", index_dir);
- return -1;
+ if (p == NULL || errno != EPERM ||
+ perm.dir_create_mode == 0700)
+ return -1;
+ /* we can't use the GID. allow it anyway with more
+ restricted permissions. */
+ perm.file_create_gid = (gid_t)-1;
+ perm.dir_create_mode = 0700;
+ continue;
}
/* create the parent directory first */
parent_dir = t_strdup_until(index_dir, p);
More information about the dovecot-cvs
mailing list