mail_lock_notify_callback_t *lock_notify_cb;
void *lock_notify_context;
+ mode_t mail_create_mode;
unsigned int private_flags_mask;
/* these fields are OR'ed to the fields in index header once we
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0
#endif
/* defaults - same as above but prefixed with mail_index_. */
int maildir_uidlist_try_lock(struct mail_index *index)
{
const char *path;
+ mode_t old_mask;
int fd;
if (INDEX_IS_UIDLIST_LOCKED(index))
return 1;
path = t_strconcat(index->control_dir, "/" MAILDIR_UIDLIST_NAME, NULL);
+ old_mask = umask(0777 & ~index->mail_create_mode);
fd = file_dotlock_open(path, NULL, 0, 0, UIDLIST_LOCK_STALE_TIMEOUT,
NULL, NULL);
+ umask(old_mask);
if (fd == -1) {
if (errno == EAGAIN)
return 0;
enum mailbox_lock_type lock_type;
struct mail_cache_transaction_ctx *trans_ctx;
- mode_t mail_create_mode; /* for maildir */
-
struct timeout *autosync_to;
struct index_autosync_file *autosync_files;
struct index_autosync_io *autosync_ios;
/* 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;
+ index->mail_create_mode = 0600;
else {
- ibox->mail_create_mode = st.st_mode & 0666;
+ index->mail_create_mode = st.st_mode & 0666;
index->private_flags_mask = MAIL_SEEN;
}