Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6366:1c90552923ba HEAD
When creating mailboxes, set cur/new/tmp directories' group to
dovecot-shared file's group.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 09 Sep 2007 06:26:01 +0300 |
parents | dee75c83d6f4 |
children | b5dd8d64b4ae |
files | src/lib-storage/index/maildir/maildir-storage.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-storage.c Sun Sep 09 06:10:48 2007 +0300 +++ b/src/lib-storage/index/maildir/maildir-storage.c Sun Sep 09 06:26:01 2007 +0300 @@ -39,6 +39,7 @@ static MODULE_CONTEXT_DEFINE_INIT(maildir_mailbox_list_module, &mailbox_list_module_register); +static const char *maildir_subdirs[] = { "cur", "new", "tmp" }; static int verify_inbox(struct mail_storage *storage); static int @@ -550,6 +551,7 @@ { const char *path; mode_t old_mask; + unsigned int i; int fd; /* add the execute bit if either read or write bit is set */ @@ -562,8 +564,12 @@ umask(old_mask); return -1; } - if (chown(dir, (uid_t)-1, gid) < 0) { - mail_storage_set_critical(storage, "chown(%s) failed: %m", dir); + for (i = 0; i < N_ELEMENTS(maildir_subdirs); i++) { + path = t_strconcat(dir, "/", maildir_subdirs[i], NULL); + if (chown(path, (uid_t)-1, gid) < 0) { + mail_storage_set_critical(storage, + "chown(%s) failed: %m", path); + } } path = t_strconcat(dir, "/dovecot-shared", NULL);