Commit d35b3ff7 authored by sikeda's avatar sikeda
Browse files

[-bug] Small fix. Hardcoded listmaster addresses were saved.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12553 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 11276871
......@@ -1088,13 +1088,18 @@ These are accessors derived from configuration parameters.
=item get_address ( $that, [ $type ] )
# Get address bound for super listmaster(s).
Sympa::get_address('*', 'listmaster'); # <listmaster@DEFAULT_HOST>
# Get address for command robot.
Sympa::get_address($robot); # <sympa@HOST>
Sympa::get_address($robot, 'sympa'); # ditto.
# Get address bound for the list and its owner(s).
Sympa::get_address($list); # <NAME@HOST>
Sympa::get_address($list, 'owner'); # <NAME-request@HOST>
Sympa::get_address('*', 'listmaster'); # <listmaster@DEFAULT_HOST>
# Get address for command robot and robot listmaster(s).
Sympa::get_address($robot, 'sympa'); # <sympa@HOST>
Sympa::get_address($robot, 'listmaster'); # <listmaster@HOST>
# Get address for command robot and robot listmaster(s).
Sympa::get_address($family, 'sympa'); # <sympa@HOST>
Sympa::get_address($family, 'listmaster'); # listmaster@HOST>
# Get address bound for the list and its owner(s) etc.
Sympa::get_address($list); # <NAME@HOST>
Sympa::get_address($list, 'owner'); # <NAME-request@HOST>
Sympa::get_address($list, 'editor'); # <NAME-editor@HOST>
Sympa::get_address($list, 'return_path'); # <NAME-owner@HOST>
Site or robot:
Returns the site or robot email address of type $type: email command address
......@@ -1151,6 +1156,9 @@ sub get_address {
# robot address, for convenience.
return Sympa::get_address($that->{'domain'}, $type);
}
} elsif (ref $that eq 'Sympa::Family') {
# robot address, for convenience.
return Sympa::get_address($that->{'robot'}, $type);
} else {
unless ($type) {
return Conf::get_robot_conf($that, 'email') . '@'
......
......@@ -261,15 +261,13 @@ sub create_list_old {
}
}
## Creation of the config file
my $host = Conf::get_robot_conf($robot, 'host');
##FIXME:should be unneccessary
# Creation of the config file.
#FIXME:should be unneccessary
$param->{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$param->{'creation'}{'date_epoch'} = time;
$param->{'creation_email'} = "listmaster\@$host"
unless ($param->{'creation_email'});
$param->{'status'} = 'open' unless ($param->{'status'});
$param->{'creation_email'} ||= Sympa::get_address($robot, 'listmaster');
$param->{'status'} ||= 'open';
## Lock config before openning the config file
my $lock_fh = Sympa::LockedFile->new($list_dir . '/config', 5, '>');
......@@ -585,17 +583,9 @@ sub create_list {
$list->{'admin'}{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'creation'}{'date_epoch'} = time;
if ($param->{'creation_email'}) {
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'};
} else {
my $host = Conf::get_robot_conf($robot, 'host');
$list->{'admin'}{'creation'}{'email'} = "listmaster\@$host";
}
if ($param->{'status'}) {
$list->{'admin'}{'status'} = $param->{'status'};
} else {
$list->{'admin'}{'status'} = 'open';
}
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'}
|| Sympa::get_address($robot, 'listmaster');
$list->{'admin'}{'status'} = $param->{'status'} || 'open';
$list->{'admin'}{'family_name'} = $family->{'name'};
my $return = {};
......@@ -693,18 +683,9 @@ sub update_list {
$list->{'admin'}{'creation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'creation'}{'date_epoch'} = time;
if ($param->{'creation_email'}) {
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'};
} else {
my $host = Conf::get_robot_conf($robot, 'host');
$list->{'admin'}{'creation'}{'email'} = "listmaster\@$host";
}
if ($param->{'status'}) {
$list->{'admin'}{'status'} = $param->{'status'};
} else {
$list->{'admin'}{'status'} = 'open';
}
$list->{'admin'}{'creation'}{'email'} = $param->{'creation_email'}
|| Sympa::get_address($robot, 'listmaster');
$list->{'admin'}{'status'} = $param->{'status'} || 'open';
$list->{'admin'}{'family_name'} = $family->{'name'};
## Create associated files if a template was given.
......@@ -1369,14 +1350,14 @@ sub check_owner_defined {
# check if the requested list exists already using
# smtp 'rcpt to'
#
# IN : - $list : name of the list
# IN : - $name : name of the list
# - $robot : list's robot
# OUT : - Net::SMTP object or 0
#####################################################
sub list_check_smtp {
my $list = shift;
$log->syslog('debug2', '(%s, %s)', @_);
my $name = shift;
my $robot = shift;
$log->syslog('debug2', '(%s, %s)', $list, $robot);
my $conf = '';
my $smtp;
......@@ -1388,16 +1369,16 @@ sub list_check_smtp {
$smtp_helo =~ s/:[-\w]+$// if $smtp_helo;
my $suffixes = Conf::get_robot_conf($robot, 'list_check_suffixes');
return 0
unless ($smtp_relay && $suffixes);
my $domain = Conf::get_robot_conf($robot, 'host');
$log->syslog('debug2', '(%s, %s)', $list, $robot);
@suf = split(/,/, $suffixes);
return 0 if !@suf;
unless $smtp_relay and $suffixes;
my $host = Conf::get_robot_conf($robot, 'host');
$log->syslog('debug2', '(%s, %s)', $name, $robot);
@suf = split /\s*,\s*/, $suffixes;
return 0 unless @suf;
for (@suf) {
push @addresses, $list . "-$_\@" . $domain;
foreach my $suffix (@suf) {
push @addresses, $name . '-' . $suffix . '@' . $host;
}
push @addresses, "$list\@" . $domain;
push @addresses, $name . '@' . $host;
eval { require Net::SMTP; };
if ($EVAL_ERROR) {
......
......@@ -390,15 +390,14 @@ sub add_list {
}
close FILE;
my $host = Conf::get_robot_conf($self->{'robot'}, 'host');
# info parameters
$list->{'admin'}{'latest_instantiation'}{'email'} = "listmaster\@$host";
$list->{'admin'}{'latest_instantiation'}{'email'} =
Sympa::get_address($self, 'listmaster');
##FIXME:should be unneccessary
$list->{'admin'}{'latest_instantiation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'latest_instantiation'}{'date_epoch'} = time;
$list->save_config("listmaster\@$host");
$list->save_config(Sympa::get_address($self, 'listmaster'));
$list->{'family'} = $self;
## check param_constraint.conf
......@@ -664,14 +663,13 @@ sub modify_list {
my @kept_files = keys %{$config_changes->{'file'}};
$list->update_config_changes('file', \@kept_files);
my $host = Conf::get_robot_conf($self->{'robot'}, 'host');
$list->{'admin'}{'latest_instantiation'}{'email'} = "listmaster\@$host";
$list->{'admin'}{'latest_instantiation'}{'email'} =
Sympa::get_address($self, 'listmaster');
##FIXME:should be unneccessary
$list->{'admin'}{'latest_instantiation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'latest_instantiation'}{'date_epoch'} = time;
$list->save_config("listmaster\@$host");
$list->save_config(Sympa::get_address($self, 'listmaster'));
$list->{'family'} = $self;
## check param_constraint.conf
......@@ -2493,13 +2491,13 @@ sub _end_update_list {
my ($self, $list, $xml_file) = @_;
$log->syslog('debug3', '(%s, %s)', $self->{'name'}, $list->{'name'});
my $host = Conf::get_robot_conf($self->{'robot'}, 'host');
$list->{'admin'}{'latest_instantiation'}{'email'} = "listmaster\@$host";
$list->{'admin'}{'latest_instantiation'}{'email'} =
Sympa::get_address($self, 'listmaster');
##FIXME:should be unneccessary
$list->{'admin'}{'latest_instantiation'}{'date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S", localtime time);
$list->{'admin'}{'latest_instantiation'}{'date_epoch'} = time;
$list->save_config("listmaster\@$host");
$list->save_config(Sympa::get_address($self, 'listmaster'));
$list->{'family'} = $self;
## check param_constraint.conf
......
Markdown is supported
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