Commit 914860d9 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

perltidy'ing.

parent a2799441
...@@ -184,62 +184,59 @@ sub load { ...@@ -184,62 +184,59 @@ sub load {
my $config_err = 0; my $config_err = 0;
my %line_numbered_config; my %line_numbered_config;
$log->syslog('debug3', $log->syslog('debug3',
'File %s has changed since the last cache. Loading file', 'File %s has changed since the last cache. Loading file',
$config_file); $config_file);
# Will force the robot.conf reloading, as sympa.conf is the default. # Will force the robot.conf reloading, as sympa.conf is the default.
$force_reload = 1; $force_reload = 1;
## Loading the Sympa main config file. ## Loading the Sympa main config file.
if (my $config_loading_result = _load_config_file_to_hash( if (my $config_loading_result =
{'path_to_config_file' => $config_file} _load_config_file_to_hash({'path_to_config_file' => $config_file})) {
) %line_numbered_config =
) { %{$config_loading_result->{'numbered_config'}};
%line_numbered_config = %Conf = %{$config_loading_result->{'config'}};
%{$config_loading_result->{'numbered_config'}}; $config_err = $config_loading_result->{'errors'};
%Conf = %{$config_loading_result->{'config'}}; } else {
$config_err = $config_loading_result->{'errors'}; return undef;
} else { }
return undef; # Returning the config file content if this is what has been asked.
return (\%line_numbered_config) if ($return_result);
# Users may define parameters with a typo or other errors. Check that
# the parameters
# we found in the config file are all well defined Sympa parameters.
$config_err += _detect_unknown_parameters_in_config(
{ 'config_hash' => \%Conf,
'config_file_line_numbering_reference' => \%line_numbered_config,
} }
# Returning the config file content if this is what has been asked. );
return (\%line_numbered_config) if ($return_result);
# Users may define parameters with a typo or other errors. Check that
# the parameters
# we found in the config file are all well defined Sympa parameters.
$config_err += _detect_unknown_parameters_in_config(
{ 'config_hash' => \%Conf,
'config_file_line_numbering_reference' =>
\%line_numbered_config,
}
);
# Some parameter values are hardcoded. In that case, ignore what was # Some parameter values are hardcoded. In that case, ignore what was
# set in the config file and simply use the hardcoded value. # set in the config file and simply use the hardcoded value.
%Ignored_Conf = %Ignored_Conf =
%{_set_hardcoded_parameter_values({'config_hash' => \%Conf,})}; %{_set_hardcoded_parameter_values({'config_hash' => \%Conf,})};
_set_listmasters_entry({'config_hash' => \%Conf, 'main_config' => 1}); _set_listmasters_entry({'config_hash' => \%Conf, 'main_config' => 1});
## Some parameters must have a value specifically defined in the ## Some parameters must have a value specifically defined in the
## config. If not, it is an error. ## config. If not, it is an error.
$config_err += _detect_missing_mandatory_parameters( $config_err += _detect_missing_mandatory_parameters(
{'config_hash' => \%Conf, 'file_to_check' => $config_file}); {'config_hash' => \%Conf, 'file_to_check' => $config_file});
# Some parameters need special treatments to get their final values. # Some parameters need special treatments to get their final values.
_infer_server_specific_parameter_values({'config_hash' => \%Conf,}); _infer_server_specific_parameter_values({'config_hash' => \%Conf,});
_infer_robot_parameter_values({'config_hash' => \%Conf}); _infer_robot_parameter_values({'config_hash' => \%Conf});
if ($config_err) { if ($config_err) {
$log->syslog('err', 'Errors while parsing main config file %s', $log->syslog('err', 'Errors while parsing main config file %s',
$config_file); $config_file);
return undef; return undef;
} }
_store_source_file_name( _store_source_file_name(
{'config_hash' => \%Conf, 'config_file' => $config_file}); {'config_hash' => \%Conf, 'config_file' => $config_file});
#XXX_save_config_hash_to_binary({'config_hash' => \%Conf,}); #XXX_save_config_hash_to_binary({'config_hash' => \%Conf,});
if (my $missing_modules_count = if (my $missing_modules_count =
_check_cpan_modules_required_by_config({'config_hash' => \%Conf,})) { _check_cpan_modules_required_by_config({'config_hash' => \%Conf,})) {
...@@ -827,7 +824,7 @@ sub checkfiles { ...@@ -827,7 +824,7 @@ sub checkfiles {
$pictures_dir); $pictures_dir);
$config_err++; $config_err++;
} else { } else {
chmod 0775, $pictures_dir; # set masked bits. chmod 0775, $pictures_dir; # set masked bits.
my $index_path = $pictures_dir . '/index.html'; my $index_path = $pictures_dir . '/index.html';
my $fh; my $fh;
...@@ -942,11 +939,11 @@ sub _load_auth { ...@@ -942,11 +939,11 @@ sub _load_auth {
'alternative_email_attribute' => Sympa::Regexps::ldap_attrdesc() 'alternative_email_attribute' => Sympa::Regexps::ldap_attrdesc()
. '(\s*,\s*' . '(\s*,\s*'
. Sympa::Regexps::ldap_attrdesc() . ')*', . Sympa::Regexps::ldap_attrdesc() . ')*',
'scope' => 'base|one|sub', 'scope' => 'base|one|sub',
'authentication_info_url' => 'http(s)?:/.*', 'authentication_info_url' => 'http(s)?:/.*',
'use_tls' => 'starttls|ldaps|none', 'use_tls' => 'starttls|ldaps|none',
'use_ssl' => '1', # Obsoleted 'use_ssl' => '1', # Obsoleted
'use_start_tls' => '1', # Obsoleted 'use_start_tls' => '1', # Obsoleted
'ssl_version' => 'sslv2/3|sslv2|sslv3|tlsv1|tlsv1_1|tlsv1_2', 'ssl_version' => 'sslv2/3|sslv2|sslv3|tlsv1|tlsv1_1|tlsv1_2',
'ssl_ciphers' => '[\w:]+', 'ssl_ciphers' => '[\w:]+',
'ssl_cert' => '.+', 'ssl_cert' => '.+',
...@@ -981,8 +978,8 @@ sub _load_auth { ...@@ -981,8 +978,8 @@ sub _load_auth {
'get_email_by_uid_filter' => '.+', 'get_email_by_uid_filter' => '.+',
'email_attribute' => Sympa::Regexps::ldap_attrdesc(), 'email_attribute' => Sympa::Regexps::ldap_attrdesc(),
'use_tls' => 'starttls|ldaps|none', 'use_tls' => 'starttls|ldaps|none',
'use_ssl' => '1', # Obsoleted 'use_ssl' => '1', # Obsoleted
'use_start_tls' => '1', # Obsoleted 'use_start_tls' => '1', # Obsoleted
'ssl_version' => 'sslv2/3|sslv2|sslv3|tlsv1|tlsv1_1|tlsv1_2', 'ssl_version' => 'sslv2/3|sslv2|sslv3|tlsv1|tlsv1_1|tlsv1_2',
'ssl_ciphers' => '[\w:]+', 'ssl_ciphers' => '[\w:]+',
'ssl_cert' => '.+', 'ssl_cert' => '.+',
...@@ -1008,8 +1005,8 @@ sub _load_auth { ...@@ -1008,8 +1005,8 @@ sub _load_auth {
'get_email_by_uid_filter' => '.+', 'get_email_by_uid_filter' => '.+',
'email_attribute' => Sympa::Regexps::ldap_attrdesc(), 'email_attribute' => Sympa::Regexps::ldap_attrdesc(),
'use_tls' => 'starttls|ldaps|none', 'use_tls' => 'starttls|ldaps|none',
'use_ssl' => '1', # Obsoleted 'use_ssl' => '1', # Obsoleted
'use_start_tls' => '1', # Obsoleted 'use_start_tls' => '1', # Obsoleted
'ssl_version' => 'sslv2/3|sslv2|sslv3|tlsv1|tlsv1_1|tlsv1_2', 'ssl_version' => 'sslv2/3|sslv2|sslv3|tlsv1|tlsv1_1|tlsv1_2',
'ssl_ciphers' => '[\w:]+', 'ssl_ciphers' => '[\w:]+',
'ssl_cert' => '.+', 'ssl_cert' => '.+',
...@@ -1368,8 +1365,11 @@ sub load_automatic_lists_description { ...@@ -1368,8 +1365,11 @@ sub load_automatic_lists_description {
}, },
); );
# find appropriate automatic_lists_description.conf file # find appropriate automatic_lists_description.conf file
my $config = Sympa::search_fullpath($robot, my $config = Sympa::search_fullpath(
'automatic_lists_description.conf', subdir => ('families/' . $family)); $robot,
'automatic_lists_description.conf',
subdir => ('families/' . $family)
);
return undef unless $config; return undef unless $config;
my $description = my $description =
load_generic_conf_file($config, \%automatic_lists_params); load_generic_conf_file($config, \%automatic_lists_params);
...@@ -1969,10 +1969,10 @@ sub _infer_robot_parameter_values { ...@@ -1969,10 +1969,10 @@ sub _infer_robot_parameter_values {
# even if the doc requires domain. # even if the doc requires domain.
$param->{'config_hash'}{'domain'} = $param->{'config_hash'}{'host'} $param->{'config_hash'}{'domain'} = $param->{'config_hash'}{'host'}
if not defined $param->{'config_hash'}{'domain'} if not defined $param->{'config_hash'}{'domain'}
and defined $param->{'config_hash'}{'host'}; and defined $param->{'config_hash'}{'host'};
$param->{'config_hash'}{'wwsympa_url'} ||= $param->{'config_hash'}{'wwsympa_url'} ||= sprintf 'http://%s/sympa',
sprintf 'http://%s/sympa', $param->{'config_hash'}{'domain'}; $param->{'config_hash'}{'domain'};
$param->{'config_hash'}{'static_content_url'} ||= $param->{'config_hash'}{'static_content_url'} ||=
$Conf{'static_content_url'}; $Conf{'static_content_url'};
...@@ -2139,49 +2139,47 @@ sub _load_single_robot_config { ...@@ -2139,49 +2139,47 @@ sub _load_single_robot_config {
my $robot_conf; my $robot_conf;
my $config_err; my $config_err;
my $config_file = "$Conf{'etc'}/$robot/robot.conf"; my $config_file = "$Conf{'etc'}/$robot/robot.conf";
if (my $config_loading_result = _load_config_file_to_hash( if (my $config_loading_result =
{'path_to_config_file' => $config_file} _load_config_file_to_hash({'path_to_config_file' => $config_file})) {
) $robot_conf = $config_loading_result->{'config'};
) { $config_err = $config_loading_result->{'errors'};
$robot_conf = $config_loading_result->{'config'}; } else {
$config_err = $config_loading_result->{'errors'}; $log->syslog('err', 'Unable to load %s. Aborting', $config_file);
} else { return undef;
$log->syslog('err', 'Unable to load %s. Aborting', $config_file); }
return undef;
}
# Remove entries which are not supposed to be defined at the robot # Remove entries which are not supposed to be defined at the robot
# level. # level.
_dump_non_robot_parameters( _dump_non_robot_parameters(
{'config_hash' => $robot_conf, 'robot' => $robot}); {'config_hash' => $robot_conf, 'robot' => $robot});
#FIXME: They may be no longer used. Kept for possible compatibility. #FIXME: They may be no longer used. Kept for possible compatibility.
$robot_conf->{'host'} ||= $robot; $robot_conf->{'host'} ||= $robot;
$robot_conf->{'robot_name'} ||= $robot; $robot_conf->{'robot_name'} ||= $robot;
unless ($robot_conf->{'dkim_signer_domain'}) { unless ($robot_conf->{'dkim_signer_domain'}) {
$robot_conf->{'dkim_signer_domain'} = $robot; $robot_conf->{'dkim_signer_domain'} = $robot;
} }
my @dmarc = split /[,\s]+/, my @dmarc = split /[,\s]+/,
($robot_conf->{'dmarc_protection_mode'} || ''); ($robot_conf->{'dmarc_protection_mode'} || '');
if (@dmarc) { if (@dmarc) {
$robot_conf->{'dmarc_protection_mode'} = \@dmarc; $robot_conf->{'dmarc_protection_mode'} = \@dmarc;
} else { } else {
delete $robot_conf->{'dmarc_protection_mode'}; delete $robot_conf->{'dmarc_protection_mode'};
} }
_set_listmasters_entry({'config_hash' => $robot_conf}); _set_listmasters_entry({'config_hash' => $robot_conf});
_infer_robot_parameter_values({'config_hash' => $robot_conf}); _infer_robot_parameter_values({'config_hash' => $robot_conf});
_store_source_file_name( _store_source_file_name(
{'config_hash' => $robot_conf, 'config_file' => $config_file}); {'config_hash' => $robot_conf, 'config_file' => $config_file});
#XXX_save_config_hash_to_binary( #XXX_save_config_hash_to_binary(
#XXX {'config_hash' => $robot_conf, 'source_file' => $config_file}); #XXX {'config_hash' => $robot_conf, 'source_file' => $config_file});
return undef if ($config_err); return undef if ($config_err);
_replace_file_value_by_db_value({'config_hash' => $robot_conf}) _replace_file_value_by_db_value({'config_hash' => $robot_conf})
unless $param->{'no_db'}; unless $param->{'no_db'};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment