diff --git a/dovecot/CHANGELOG b/dovecot/CHANGELOG index dc620d5aa..4516fa7ac 100644 --- a/dovecot/CHANGELOG +++ b/dovecot/CHANGELOG @@ -21,3 +21,5 @@ Added fields to the SSL page for an optional CA certificate file and private key Added support for Dovecot 2.0, which renames many configuration directives and splits up the config using include files. ---- Changes since 1.550 ---- The Edit Config Files page can now be used to edit any of the Dovecot configuration files, for the case where there are many included configs. +---- Changes since 1.560 ---- +Fixed support for CentOS 6 and related distributions, which move the Dovecot config to /etc/dovecot/dovecot.conf. diff --git a/dovecot/config-redhat-linux-11.0-* b/dovecot/config-redhat-linux-11.0-* index 25b7c7c08..2396a1797 100644 --- a/dovecot/config-redhat-linux-11.0-* +++ b/dovecot/config-redhat-linux-11.0-* @@ -1,4 +1,4 @@ dovecot=/usr/sbin/dovecot -dovecot_config=/etc/dovecot.conf +dovecot_config=/etc/dovecot/dovecot.conf /etc/dovecot.conf init_script=dovecot pid_file=/var/run/dovecot/master.pid diff --git a/dovecot/dovecot-lib.pl b/dovecot/dovecot-lib.pl index 81fc860f2..e04d607e8 100755 --- a/dovecot/dovecot-lib.pl +++ b/dovecot/dovecot-lib.pl @@ -9,12 +9,22 @@ use WebminCore; @mail_envs = ( undef, "maildir:~/Maildir", "mbox:~/mail/:INBOX=/var/mail/%u", "maildir:~/Maildir:mbox:~/mail/" ); +# get_config_file() +# Returns the full path to the first valid config file +sub get_config_file +{ +foreach my $f (split(/\s+/, $config{'dovecot_config'})) { + return $f if (-r $f); + } +return undef; +} + # get_config() # Returns a list of dovecot config entries sub get_config { if (!scalar(@get_config_cache)) { - @get_config_cache = &read_config_file($config{'dovecot_config'}); + @get_config_cache = &read_config_file(&get_config_file()); } return \@get_config_cache; } @@ -201,7 +211,7 @@ elsif (!$dir && defined($value)) { } else { # Need to put at end of main config - local $lref = &read_file_lines($config{'dovecot_config'}); + local $lref = &read_file_lines(&get_config_file()); push(@$lref, $newline); push(@$conf, { 'name' => $name, 'value' => $value, diff --git a/dovecot/edit_manual.cgi b/dovecot/edit_manual.cgi index b1d3f9f35..65654b4b3 100755 --- a/dovecot/edit_manual.cgi +++ b/dovecot/edit_manual.cgi @@ -4,7 +4,7 @@ require './dovecot-lib.pl'; &ui_print_header(undef, $text{'manual_title'}, ""); &ReadParse(); -$file = $in{'file'} || $config{'dovecot_config'}; +$file = $in{'file'} || &get_config_file(); $conf = &get_config(); @files = &unique(map { $_->{'file'} } @$conf); &indexof($file, @files) >= 0 || &error($text{'manual_efile'}); diff --git a/dovecot/index.cgi b/dovecot/index.cgi index 491fcec7e..78e5cd524 100755 --- a/dovecot/index.cgi +++ b/dovecot/index.cgi @@ -24,7 +24,7 @@ if (!&has_command($config{'dovecot'})) { } # Check for config file -if (!-r $config{'dovecot_config'}) { +if (!&get_config_file()) { print &ui_config_link('index_econf', [ "$config{'dovecot_config'}", undef ]),"

\n"; &ui_print_footer("/", $text{'index'}); diff --git a/dovecot/install_check.pl b/dovecot/install_check.pl index a8f028975..a77ed336a 100755 --- a/dovecot/install_check.pl +++ b/dovecot/install_check.pl @@ -9,7 +9,7 @@ do 'dovecot-lib.pl'; sub is_installed { return 0 if (!&has_command($config{'dovecot'}) || - !-r $config{'dovecot_config'}); + !&get_config_file()); return $_[0] ? 2 : 1; }