changeset 6648:b2c14c07dcb2 HEAD

Fix to handling setgid-bit-ignores-gid.
author Timo Sirainen <tss@iki.fi>
date Sun, 28 Oct 2007 16:53:21 +0200
parents 6dd5df1c1ec9
children 96e4aff1be38
files src/lib-storage/index/maildir/maildir-storage.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-storage.c	Sun Oct 28 14:47:10 2007 +0200
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Sun Oct 28 16:53:21 2007 +0200
@@ -408,9 +408,11 @@
 	   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_mode & S_ISGID) != 0 ?
-					   (gid_t)-1 : st.st_gid);
+		if ((st.st_mode & S_ISGID) != 0) {
+			/* Ignore GID */
+			st.st_gid = (gid_t)-1;
+		}
+		mail_index_set_permissions(index, st.st_mode & 0666, st.st_gid);
 	}
 
 	pool = pool_alloconly_create("maildir mailbox", 1024+512);