Dovecot locking method

This commit is contained in:
Jamie Cameron
2008-04-20 20:13:05 +00:00
parent a2dab195c7
commit b2cc6c818b
5 changed files with 77 additions and 2 deletions

View File

@ -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. Added fields for editing the UIDL format and number of login processes.
---- Changes since 1.360 ---- ---- Changes since 1.360 ----
Supported newer versions of Dovecot which use mail_location instead of default_mail_env. 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.

View File

@ -319,5 +319,11 @@ local $out = `$config{'dovecot'} --version 2>&1`;
return $out =~ /([0-9\.]+)/ ? $1 : undef; return $out =~ /([0-9\.]+)/ ? $1 : undef;
} }
sub list_lock_methods
{
local ($forindex) = @_;
return ( "dotlock", "fcntl", "flock", $forindex ? ( ) : ( "lockf" ) );
}
1; 1;

View File

@ -100,8 +100,42 @@ if (&find("pop3_enable_last", $conf, 2)) {
@opts = ( [ 'yes', $text{'yes'} ], [ 'no', $text{'no'} ] ); @opts = ( [ 'yes', $text{'yes'} ], [ 'no', $text{'no'} ] );
print &ui_table_row($text{'mail_last'}, print &ui_table_row($text{'mail_last'},
&ui_radio("pop3_enable_last", $last, &ui_radio("pop3_enable_last", $last,
[ @opts, [ [ '', &getdef("pop3_enable_last", \@opts) ],
[ '', &getdef("pop3_enable_last", \@opts) ] ]), 3); @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],
[ [ '', "&lt;$text{'mail_none'}&gt;" ],
@opts ], 1, 0, 1);
}
print &ui_table_row($text{'mail_'.$l},
$defsel."<br>\n".$methsel, 3);
} }
print &ui_table_end(); print &ui_table_end();

View File

@ -151,6 +151,17 @@ mail_uidl_courier2=Courier verion 2
mail_uidl_tpop3d=tpop3d mail_uidl_tpop3d=tpop3d
mail_euidl=Missing or invalid UIDL format mail_euidl=Missing or invalid UIDL format
mail_last=Allow use of POP3 LAST command? 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_net=Changed Networking and Protocols
log_login=Changed User and Login Options log_login=Changed User and Login Options

View File

@ -61,6 +61,28 @@ if (&find("pop3_uidl_format", $conf, 2)) {
&save_directive($conf, "pop3_enable_last", &save_directive($conf, "pop3_enable_last",
$in{'last'} ? $in{'last'} : undef); $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(); &flush_file_lines();
&unlock_file($config{'dovecot_config'}); &unlock_file($config{'dovecot_config'});
&webmin_log("mail"); &webmin_log("mail");