dovecot: If dovecot-shared file has setgid bit set, the group is...

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 27 22:13:01 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/0dd9b91fd52c
changeset: 6631:0dd9b91fd52c
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 27 22:12:57 2007 +0300
description:
If dovecot-shared file has setgid bit set, the group is ignored.

diffstat:

1 file changed, 5 insertions(+), 2 deletions(-)
src/lib-storage/index/maildir/maildir-storage.c |    7 +++++--

diffs (17 lines):

diff -r 427eeded8078 -r 0dd9b91fd52c src/lib-storage/index/maildir/maildir-storage.c
--- 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 @@ maildir_open(struct maildir_storage *sto
 	/* 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);


More information about the dovecot-cvs mailing list