diff --git a/dovecot/CHANGELOG b/dovecot/CHANGELOG index 0ffdd4355..1c6e41d2e 100644 --- a/dovecot/CHANGELOG +++ b/dovecot/CHANGELOG @@ -12,3 +12,5 @@ Fixed a bug that causes config file corruption in the userdb section with the de Added fields for editing the UIDL format and number of login processes. ---- Changes since 1.360 ---- Supported newer versions of Dovecot which use mail_location instead of default_mail_env. +---- Changes since 1.410 ---- +The locking methods for mailboxes and index files can be configured on the Mail Files page. diff --git a/dovecot/dovecot-lib.pl b/dovecot/dovecot-lib.pl index f88af1823..b9d536b68 100644 --- a/dovecot/dovecot-lib.pl +++ b/dovecot/dovecot-lib.pl @@ -319,5 +319,11 @@ local $out = `$config{'dovecot'} --version 2>&1`; return $out =~ /([0-9\.]+)/ ? $1 : undef; } +sub list_lock_methods +{ +local ($forindex) = @_; +return ( "dotlock", "fcntl", "flock", $forindex ? ( ) : ( "lockf" ) ); +} + 1; diff --git a/dovecot/edit_mail.cgi b/dovecot/edit_mail.cgi index 779cc7821..620034815 100755 --- a/dovecot/edit_mail.cgi +++ b/dovecot/edit_mail.cgi @@ -100,8 +100,42 @@ if (&find("pop3_enable_last", $conf, 2)) { @opts = ( [ 'yes', $text{'yes'} ], [ 'no', $text{'no'} ] ); print &ui_table_row($text{'mail_last'}, &ui_radio("pop3_enable_last", $last, - [ @opts, - [ '', &getdef("pop3_enable_last", \@opts) ] ]), 3); + [ [ '', &getdef("pop3_enable_last", \@opts) ], + @opts ]), 3); + } + +# Index lock method +if (&find("lock_method", $conf, 2)) { + $method = &find_value("lock_method", $conf); + @opts = map { [ $_, $text{'mail_'.$_} ] } &list_lock_methods(1); + print &ui_table_row($text{'mail_lock'}, + &ui_select("lock_method", $method, + [ @opts, + [ '', &getdef("lock_method", \@opts) ] ], + 1, 0, 1), 3); + } + +# Mailbox lock methods +@opts = map { [ $_, $text{'mail_'.$_} ] } &list_lock_methods(0); +foreach $l ("mbox_read_locks", "mbox_write_locks") { + next if (!&find($l, $conf, 2)); + $def = &find_value($l, $conf, 1); + $defmsg = join(", ", map { $text{'mail_'.$_} || $_ } + split(/\s+/, $def)); + $defmsg = " ($defmsg)" if ($defmsg); + $method = &find_value($l, $conf); + $defsel = &ui_radio($l."_def", $method ? 0 : 1, + [ [ 1, $text{'default'}.$defmsg ], + [ 0, $text{'mail_sel'} ] ]); + $methsel = ""; + @methods = split(/\s+/, $method); + for(my $i=0; $i<@opts; $i++) { + $methsel .= &ui_select($l."_".$i, $methods[$i], + [ [ '', "<$text{'mail_none'}>" ], + @opts ], 1, 0, 1); + } + print &ui_table_row($text{'mail_'.$l}, + $defsel."
\n".$methsel, 3); } print &ui_table_end(); diff --git a/dovecot/lang/en b/dovecot/lang/en index 8dacffbef..f6d132c21 100644 --- a/dovecot/lang/en +++ b/dovecot/lang/en @@ -151,6 +151,17 @@ mail_uidl_courier2=Courier verion 2 mail_uidl_tpop3d=tpop3d mail_euidl=Missing or invalid UIDL format mail_last=Allow use of POP3 LAST command? +mail_lock=Index files locking method +mail_fcntl=fcntl function +mail_flock=flock function +mail_dotlock=.lock files +mail_lockf=lockf function +mail_mbox_read_locks=Mailbox read locking method +mail_mbox_write_locks=Mailbox write locking method +mail_none=None +mail_sel=Selected below, in order .. +mail_embox_read_locks=No read locking methods selected +mail_embox_write_locks=No write locking methods selected log_net=Changed Networking and Protocols log_login=Changed User and Login Options diff --git a/dovecot/save_mail.cgi b/dovecot/save_mail.cgi index 83102ebbe..dc7a0a6b6 100755 --- a/dovecot/save_mail.cgi +++ b/dovecot/save_mail.cgi @@ -61,6 +61,28 @@ if (&find("pop3_uidl_format", $conf, 2)) { &save_directive($conf, "pop3_enable_last", $in{'last'} ? $in{'last'} : undef); +# Index lock method +if (&find("lock_method", $conf, 2)) { + &save_directive($conf, "lock_method", + $in{'lock_method'} ? $in{'lock_method'} : undef); + } + +# Mailbox lock method +foreach $l ("mbox_read_locks", "mbox_write_locks") { + next if (!&find($l, $conf, 2)); + if ($in{$l."_def"}) { + &save_directive($conf, $l, undef); + } + else { + @methods = ( ); + for(my $i=0; defined($m = $in{$l."_".$i}); $i++) { + push(@methods, $m) if ($m); + } + @methods || &error($text{'mail_e'.$l}); + &save_directive($conf, $l, join(" ", @methods)); + } + } + &flush_file_lines(); &unlock_file($config{'dovecot_config'}); &webmin_log("mail");