changeset 6631:0dd9b91fd52c HEAD

If dovecot-shared file has setgid bit set, the group is ignored.
author Timo Sirainen <tss@iki.fi>
date Sat, 27 Oct 2007 22:12:57 +0300
parents 427eeded8078
children 80419a82081f
files src/lib-storage/index/maildir/maildir-storage.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-storage.c	Sat Oct 27 20:37:35 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Sat Oct 27 22:12:57 2007 +0300
@@ -407,8 +407,11 @@
 	/* for shared mailboxes get the create mode from the
 	   permissions of dovecot-shared file. */
 	shared = stat(t_strconcat(path, "/dovecot-shared", NULL), &st) == 0;
-	if (shared)
-		mail_index_set_permissions(index, st.st_mode & 0666, st.st_gid);
+	if (shared) {
+		mail_index_set_permissions(index, st.st_mode & 0666,
+					   (st.st_mode & S_ISGID) != 0 ?
+					   (gid_t)-1 : st.st_gid);
+	}
 
 	pool = pool_alloconly_create("maildir mailbox", 1024+512);
 	mbox = p_new(pool, struct maildir_mailbox, 1);