[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-save.c,1.28,1.29 maildir-storage.c,1.59,1.60

cras at procontrol.fi cras at procontrol.fi
Mon Oct 20 10:01:11 EEST 2003


Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory danu:/tmp/cvs-serv29749/lib-storage/index/maildir

Modified Files:
	maildir-save.c maildir-storage.c 
Log Message:
If maildir contains dovecot-shared file Dovecot does two things differently:
it allows some flags to be private and stored only in index file (currently
hardcoded to \Seen flag only) and new mails are created with dovecot-shared
file's mode & 0666. So if you set filesystem permissions correctly, you
should have fully functioning shared mailboxes.



Index: maildir-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-save.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- maildir-save.c	21 Sep 2003 16:21:38 -0000	1.28
+++ maildir-save.c	20 Oct 2003 06:01:09 -0000	1.29
@@ -37,7 +37,8 @@
 	struct ostream *output;
 	int fd;
 
-	fd = maildir_create_tmp(ibox->index, dir, &path);
+	fd = maildir_create_tmp(ibox->index, dir,
+				ibox->mail_create_mode, &path);
 	if (fd == -1)
 		return NULL;
 

Index: maildir-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- maildir-storage.c	5 Oct 2003 19:41:16 -0000	1.59
+++ maildir-storage.c	20 Oct 2003 06:01:09 -0000	1.60
@@ -398,6 +398,7 @@
 	struct index_mailbox *ibox;
 	struct mail_index *index;
 	const char *path, *index_dir, *control_dir;
+	struct stat st;
 
 	path = maildir_get_path(storage, name);
 	index_dir = maildir_get_index_path(storage, name);
@@ -413,6 +414,16 @@
 					  index, name, flags);
 	if (ibox != NULL)
 		ibox->mail_init = maildir_mail_init;
+
+	/* for shared mailboxes get the create mode from the
+	   permissions of dovecot-shared file */
+	if (stat(t_strconcat(path, "/dovecot-shared", NULL), &st) < 0)
+		ibox->mail_create_mode = 0600;
+	else {
+		ibox->mail_create_mode = st.st_mode & 0666;
+		index->private_flags_mask = MAIL_SEEN;
+	}
+
 	return (struct mailbox *) ibox;
 }
 



More information about the dovecot-cvs mailing list