From 09933da8abfcf952f71b5e496c1bf7e8ef502f4e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 11 Jun 2004 06:21:46 +0300 Subject: [PATCH] Some of recent dotlock changes weren't committed.. --HG-- branch : HEAD --- src/master/mail-process.c | 5 ++-- src/master/master-settings.c | 45 ++++-------------------------------- src/master/master-settings.h | 4 ++-- 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/src/master/mail-process.c b/src/master/mail-process.c index 4b2b6a6a05..0831e720ae 100644 --- a/src/master/mail-process.c +++ b/src/master/mail-process.c @@ -342,13 +342,12 @@ int create_mail_process(struct login_group *group, int socket, env_put("POP3_MAILS_KEEP_RECENT=1"); (void)umask(set->umask); - env_put(t_strconcat("MBOX_LOCKS=", set->mbox_locks, NULL)); + env_put(t_strconcat("MBOX_READ_LOCKS=", set->mbox_read_locks, NULL)); + env_put(t_strconcat("MBOX_WRITE_LOCKS=", set->mbox_write_locks, NULL)); env_put(t_strdup_printf("MBOX_LOCK_TIMEOUT=%u", set->mbox_lock_timeout)); env_put(t_strdup_printf("MBOX_DOTLOCK_CHANGE_TIMEOUT=%u", set->mbox_dotlock_change_timeout)); - if (set->mbox_read_dotlock) - env_put("MBOX_READ_DOTLOCK=1"); if (group->set->mail_use_modules && group->set->mail_modules != NULL && diff --git a/src/master/master-settings.c b/src/master/master-settings.c index bf3eda9f87..9445b6417c 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -96,8 +96,8 @@ static struct setting_def setting_defs[] = { DEF(SET_BOOL, maildir_stat_dirs), DEF(SET_BOOL, maildir_copy_with_hardlinks), DEF(SET_BOOL, maildir_check_content_changes), - DEF(SET_STR, mbox_locks), - DEF(SET_BOOL, mbox_read_dotlock), + DEF(SET_STR, mbox_read_locks), + DEF(SET_STR, mbox_write_locks), DEF(SET_INT, mbox_lock_timeout), DEF(SET_INT, mbox_dotlock_change_timeout), DEF(SET_INT, umask), @@ -231,8 +231,8 @@ struct settings default_settings = { MEMBER(maildir_stat_dirs) FALSE, MEMBER(maildir_copy_with_hardlinks) FALSE, MEMBER(maildir_check_content_changes) FALSE, - MEMBER(mbox_locks) "dotlock fcntl", - MEMBER(mbox_read_dotlock) FALSE, + MEMBER(mbox_read_locks) "fcntl", + MEMBER(mbox_write_locks) "dotlock fcntl", MEMBER(mbox_lock_timeout) 300, MEMBER(mbox_dotlock_change_timeout) 30, MEMBER(umask) 0077, @@ -406,9 +406,7 @@ static int settings_is_active(struct settings *set) static int settings_verify(struct settings *set) { - const char *const *str; const char *dir; - int dotlock_got, fcntl_got, flock_got; if (!get_login_uid(set)) return FALSE; @@ -512,41 +510,6 @@ static int settings_verify(struct settings *set) return FALSE; } - dotlock_got = fcntl_got = flock_got = FALSE; - str = t_strsplit_spaces(set->mbox_locks, " "); - for (; *str != NULL; str++) { - if (strcasecmp(*str, "dotlock") == 0) - dotlock_got = TRUE; - else if (strcasecmp(*str, "fcntl") == 0) - fcntl_got = TRUE; - else if (strcasecmp(*str, "flock") == 0) - flock_got = TRUE; - else { - i_error("mbox_locks: Invalid value %s", *str); - return FALSE; - } - } - -#ifndef HAVE_FLOCK - if (flock_got) { - i_error("mbox_locks: flock is not supported in this system"); - return FALSE; - } - flock_got = FALSE; -#endif - - if (!dotlock_got && !fcntl_got && !flock_got) { - i_error("mbox_locks: No mbox locking methods selected"); - return FALSE; - } - - if (dotlock_got && !set->mbox_read_dotlock && - !fcntl_got && !flock_got) { - i_warning("mbox_locks: Only dotlock selected, forcing " - "mbox_read_dotlock = yes to avoid corruption."); - set->mbox_read_dotlock = TRUE; - } - if (access(set->login_executable, X_OK) < 0) { i_error("Can't use login executable %s: %m", set->login_executable); diff --git a/src/master/master-settings.h b/src/master/master-settings.h index ce5bb02d9e..2dfa36d22f 100644 --- a/src/master/master-settings.h +++ b/src/master/master-settings.h @@ -71,8 +71,8 @@ struct settings { int maildir_stat_dirs; int maildir_copy_with_hardlinks; int maildir_check_content_changes; - const char *mbox_locks; - int mbox_read_dotlock; + const char *mbox_read_locks; + const char *mbox_write_locks; unsigned int mbox_lock_timeout; unsigned int mbox_dotlock_change_timeout; unsigned int umask; -- 2.47.3