Unverified Commit 9e8fbe66 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #1116 from ikedas/replace_blacklist_with_blocklist by ikedas

Replace "blacklist" with "blocklist" (#1111)
parents 006af324 cc32e7ce
...@@ -187,7 +187,7 @@ nobase_default_DATA = \ ...@@ -187,7 +187,7 @@ nobase_default_DATA = \
web_tt2/arcsearch.tt2 \ web_tt2/arcsearch.tt2 \
web_tt2/arc.tt2 \ web_tt2/arc.tt2 \
web_tt2/aside_menu.tt2 \ web_tt2/aside_menu.tt2 \
web_tt2/blacklist.tt2 \ web_tt2/blocklist.tt2 \
web_tt2/button_footer.tt2 \ web_tt2/button_footer.tt2 \
web_tt2/button_header.tt2 \ web_tt2/button_header.tt2 \
web_tt2/ca.tt2 \ web_tt2/ca.tt2 \
......
...@@ -651,7 +651,7 @@ Warning: this message may already have been sent by one of the list's moderators ...@@ -651,7 +651,7 @@ Warning: this message may already have been sent by one of the list's moderators
[%~ ELSIF report_entry == 'incorrect_email' ~%] [%~ ELSIF report_entry == 'incorrect_email' ~%]
[%|loc(report_param.email || report_param.value)%]Address "%1" is incorrect[%END%] [%|loc(report_param.email || report_param.value)%]Address "%1" is incorrect[%END%]
[%~ ELSIF report_entry == 'blacklisted_domain' ~%] [%~ ELSIF report_entry == 'blocklisted_domain' ~%]
[%|loc(report_param.email || report_param.value)%]Address "%1" belongs to a blocklisted domain[%END%] [%|loc(report_param.email || report_param.value)%]Address "%1" belongs to a blocklisted domain[%END%]
[%~ ELSIF report_entry == 'incorrect_passwd' ~%] [%~ ELSIF report_entry == 'incorrect_passwd' ~%]
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
<strong><a href="[% 'review' | url_rel([list]) %]">[%|loc%]Manage Subscribers:[%END%]</a></strong> <strong><a href="[% 'review' | url_rel([list]) %]">[%|loc%]Manage Subscribers:[%END%]</a></strong>
[%|loc%]Allows you to add or delete list members, moderate subscriptions, and so on.[%END%] [%|loc%]Allows you to add or delete list members, moderate subscriptions, and so on.[%END%]
</li> </li>
[% IF conf.use_blacklist != 'none' %] [% IF conf.use_blocklist != 'none' %]
<li> <li>
<strong><a href="[% 'blacklist' | url_rel([list]) %]" >[%|loc%]Blocklist:[%END%]</a></strong> <strong><a href="[% 'blocklist' | url_rel([list]) %]" >[%|loc%]Blocklist:[%END%]</a></strong>
[%|loc%]Handles the set of black-listed mail addresses for this list.[%END%] [%|loc%]Handles the set of black-listed mail addresses for this list.[%END%]
</li> </li>
[% END %] [% END %]
......
<!-- blacklist.tt2 --> <!-- blocklist.tt2 -->
<div class="block"> <div class="block">
<h2>[%|loc%]Blocklist management[%END%]</h2><br /> <h2>[%|loc%]Blocklist management[%END%]</h2><br />
<div id="blacklist"> <div id="blocklist">
[% IF rows == '0' %] [% IF rows == '0' %]
<p class="small-12 medium-8 medium-centered columns alert-box info text-center">[%|loc%]The current blocklist is empty[%END%]</p> <p class="small-12 medium-8 medium-centered columns alert-box info text-center">[%|loc%]The current blocklist is empty[%END%]</p>
[% ELSE %] [% ELSE %]
<p class="small-12 medium-8 medium-centered columns alert-box info text-center">[%|loc(rows)%]The current blocklist contains %1 line(s)[%END%]</p> <p class="small-12 medium-8 medium-centered columns alert-box info text-center">[%|loc(rows)%]The current blocklist contains %1 line(s)[%END%]</p>
[% END %] [% END %]
[%|loc(conf.use_blacklist)%]Operation requested by users which email is listed in the blocklist file are rejected. The blocklist is in use for the following operation: %1.[%END%] [%|loc(conf.use_blocklist)%]Operation requested by users which email is listed in the blocklist file are rejected. The blocklist is in use for the following operation: %1.[%END%]
<br /> <br />
<br /> <br />
[%|loc%]Syntax:[%END%] [%|loc%]Syntax:[%END%]
...@@ -23,18 +23,18 @@ ...@@ -23,18 +23,18 @@
[% IF rows < '10' %] [% rows = '10' %] [% END %] [% IF rows < '10' %] [% rows = '10' %] [% END %]
[% IF rows > '20' %] [% rows = '20' %] [% END %] [% IF rows > '20' %] [% rows = '20' %] [% END %]
[% rows = rows+2 %] [% rows = rows+2 %]
<form class="noborder" action="[% 'blacklist' | url_rel %]" method="post"> <form class="noborder" action="[% 'blocklist' | url_rel %]" method="post">
<fieldset> <fieldset>
<textarea name="blacklist" cols="80" rows="[% rows %]"> <textarea name="blocklist" cols="80" rows="[% rows %]">
[%~ blacklist ~%] [%~ blocklist ~%]
</textarea> </textarea>
<br /> <br />
<input type="hidden" name="action" value="blacklist" /> <input type="hidden" name="action" value="blocklist" />
[% IF list %] [% IF list %]
<input type="hidden" name="list" value="[% list %]" /> <input type="hidden" name="list" value="[% list %]" />
[% END %] [% END %]
<br /> <br />
<input type="submit" class="MainMenuLinks" name="action_blacklist" value="[%|loc%]save[%END%]" /> <input type="submit" class="MainMenuLinks" name="action_blocklist" value="[%|loc%]save[%END%]" />
[% IF saved %] [% IF saved %]
[%|loc%]Template saved[%END%] ([% time %]) <br /><br /> [%|loc%]Template saved[%END%] ([% time %]) <br /><br />
[% END %] [% END %]
...@@ -42,4 +42,4 @@ ...@@ -42,4 +42,4 @@
</form> </form>
</div> </div>
</div> </div>
<!-- end blacklist.tt2 --> <!-- end blocklist.tt2 -->
...@@ -1352,7 +1352,7 @@ ul.no_style { ...@@ -1352,7 +1352,7 @@ ul.no_style {
margin: 1em; margin: 1em;
} }
#help_editfile ul, #blacklist ul { #help_editfile ul, #blocklist ul {
padding-left: 1em; padding-left: 1em;
margin-top: 0.5em; margin-top: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
......
...@@ -126,10 +126,10 @@ ...@@ -126,10 +126,10 @@
[%|loc %]Report messages as undetected spam[%END%] [%|loc %]Report messages as undetected spam[%END%]
</label> </label>
[% END ~%] [% END ~%]
[% IF conf.use_blacklist != 'none' ~%] [% IF conf.use_blocklist != 'none' ~%]
<input type="checkbox" id="blacklist" name="blacklist" <input type="checkbox" id="blocklist" name="blocklist"
form="moderate_mails" /> form="moderate_mails" />
<label for="blacklist"> <label for="blocklist">
[%|loc %]Add to blocklist[%END%] [%|loc %]Add to blocklist[%END%]
</label> </label>
[% END ~%] [% END ~%]
...@@ -154,8 +154,8 @@ ...@@ -154,8 +154,8 @@
<form class="noborder" action="[% path_cgi %]" method="post" name="moderation_management"> <form class="noborder" action="[% path_cgi %]" method="post" name="moderation_management">
<fieldset> <fieldset>
<input type="hidden" name="list" value="[% list %]" /> <input type="hidden" name="list" value="[% list %]" />
[% IF conf.use_blacklist != 'none' %] [% IF conf.use_blocklist != 'none' %]
<input class="MainMenuLinks" type="submit" name="action_blacklist" value="[%|loc%]edit blocklist[%END%]" /> <input class="MainMenuLinks" type="submit" name="action_blocklist" value="[%|loc%]edit blocklist[%END%]" />
[% END %] [% END %]
<input class="MainMenuLinks" type="submit" name="action_manage_template" value="[%|loc%]Manage rejection messages[%END%]" /> <input class="MainMenuLinks" type="submit" name="action_manage_template" value="[%|loc%]Manage rejection messages[%END%]" />
</fieldset> </fieldset>
......
...@@ -365,14 +365,14 @@ ...@@ -365,14 +365,14 @@
</ul> </ul>
</li> </li>
[%~ END %] [%~ END %]
[% IF conf.use_blacklist != 'none' %] [% IF conf.use_blocklist != 'none' %]
[% IF action == 'blacklist' %] [% IF action == 'blocklist' %]
[% SET class = 'active' %] [% SET class = 'active' %]
[% ELSE %] [% ELSE %]
[% SET class = '' %] [% SET class = '' %]
[% END %] [% END %]
<li class="[% class %]"> <li class="[% class %]">
<a href="[% 'blacklist' | url_rel([list]) %]" > <a href="[% 'blocklist' | url_rel([list]) %]" >
[%|loc%]Blocklist[%END%] [%|loc%]Blocklist[%END%]
</a> </a>
</li> </li>
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
<a class="actionMenuLinks" href="[% 'sigindex' | url_rel([list]) %]"> <a class="actionMenuLinks" href="[% 'sigindex' | url_rel([list]) %]">
[%|loc%]Pending unsubscriptions[%END%] [%|loc%]Pending unsubscriptions[%END%]
</a> </a>
[% IF conf.use_blacklist != 'none' %] [% IF conf.use_blocklist != 'none' %]
<a class="actionMenuLinks" href="[% 'blacklist' | url_rel([list]) %]"> <a class="actionMenuLinks" href="[% 'blocklist' | url_rel([list]) %]">
[%|loc%]Blocklist[%END%] [%|loc%]Blocklist[%END%]
</a> </a>
[% END %] [% END %]
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</p> </p>
[%~ END %] [%~ END %]
<p> <p>
<input type=checkbox name="blacklist" />[%|loc%]Add to blocklist[%END%] <input type=checkbox name="blocklist" />[%|loc%]Add to blocklist[%END%]
</p> </p>
[% IF is_owner && ! msg.value.is_subscriber ~%] [% IF is_owner && ! msg.value.is_subscriber ~%]
<p> <p>
......
...@@ -301,7 +301,7 @@ our %comm = ( ...@@ -301,7 +301,7 @@ our %comm = (
#'rss' => 'do_rss', #FIXME:Currently processed in differenct way. #'rss' => 'do_rss', #FIXME:Currently processed in differenct way.
'rss_request' => 'do_rss_request', 'rss_request' => 'do_rss_request',
'maintenance' => 'do_maintenance', 'maintenance' => 'do_maintenance',
'blacklist' => 'do_blacklist', 'blocklist' => 'do_blocklist',
'edit_attributes' => 'do_edit_attributes', 'edit_attributes' => 'do_edit_attributes',
'ticket' => 'do_ticket', 'ticket' => 'do_ticket',
'manage_template' => 'do_manage_template', 'manage_template' => 'do_manage_template',
...@@ -335,6 +335,7 @@ my %comm_aliases = ( ...@@ -335,6 +335,7 @@ my %comm_aliases = (
'add_request' => 'import', 'add_request' => 'import',
'automatic_lists' => 'create_automatic_list', 'automatic_lists' => 'create_automatic_list',
'automatic_lists_request' => 'create_automatic_list_request', 'automatic_lists_request' => 'create_automatic_list_request',
'blacklist' => 'blocklist',
'change_email' => 'move_user', 'change_email' => 'move_user',
'change_email_request' => 'move_user', 'change_email_request' => 'move_user',
'del_fromsig' => 'auth_del', 'del_fromsig' => 'auth_del',
...@@ -516,7 +517,7 @@ our %required_args = ( ...@@ -516,7 +517,7 @@ our %required_args = (
'auth_del' => ['param.list', 'param.user.email', 'id'], 'auth_del' => ['param.list', 'param.user.email', 'id'],
'auto_signoff' => ['param.list', 'email'], 'auto_signoff' => ['param.list', 'email'],
'attach' => ['param.list'], 'attach' => ['param.list'],
'blacklist' => ['param.list'], 'blocklist' => ['param.list'],
'move_user' => 'move_user' =>
['param.user.email', 'current_email|old_email', 'email|new_email'], ['param.user.email', 'current_email|old_email', 'email|new_email'],
'close_list' => ['param.user.email', 'param.list'], 'close_list' => ['param.user.email', 'param.list'],
...@@ -653,7 +654,7 @@ our %required_privileges = ( ...@@ -653,7 +654,7 @@ our %required_privileges = (
'arc_manage' => ['owner'], 'arc_manage' => ['owner'],
'auth_add' => ['owner', 'editor'], 'auth_add' => ['owner', 'editor'],
'auth_del' => ['owner', 'editor'], 'auth_del' => ['owner', 'editor'],
'blacklist' => ['owner', 'editor'], 'blocklist' => ['owner', 'editor'],
'close_list' => ['privileged_owner'], 'close_list' => ['privileged_owner'],
'copy_template' => ['listmaster'], 'copy_template' => ['listmaster'],
'd_install_shared' => ['editor', 'owner'], 'd_install_shared' => ['editor', 'owner'],
...@@ -783,7 +784,7 @@ my %action_type = ( ...@@ -783,7 +784,7 @@ my %action_type = (
'remove_template' => 'admin', 'remove_template' => 'admin',
'copy_template' => 'admin', 'copy_template' => 'admin',
'edit_template' => 'admin', 'edit_template' => 'admin',
'blacklist' => 'admin', 'blocklist' => 'admin',
'viewlogs' => 'admin', 'viewlogs' => 'admin',
'serveradmin' => 'serveradmin', 'serveradmin' => 'serveradmin',
'get_pending_lists' => 'serveradmin', 'get_pending_lists' => 'serveradmin',
...@@ -841,7 +842,8 @@ our %in_regexp = ( ...@@ -841,7 +842,8 @@ our %in_regexp = (
'body' => '.+', 'body' => '.+',
'info' => '.+', 'info' => '.+',
'new_scenario_content' => '.+', 'new_scenario_content' => '.+',
'blacklist' => '.*', 'blacklist' => '.*', # Compat.<=6.2.60
'blocklist' => '.*',
   
## Integer ## Integer
'page' => '\d+|owner|editor', 'page' => '\d+|owner|editor',
...@@ -1151,7 +1153,7 @@ while ($query = Sympa::WWW::FastCGI->new) { ...@@ -1151,7 +1153,7 @@ while ($query = Sympa::WWW::FastCGI->new) {
'main_menu_custom_button_3_title', 'main_menu_custom_button_3_title',
'main_menu_custom_button_3_target', 'main_menu_custom_button_3_target',
'static_content_url', 'static_content_url',
'use_blacklist', 'use_blocklist',
'antispam_feature', 'antispam_feature',
'custom_robot_parameter', 'custom_robot_parameter',
'reporting_spam_script_path', 'reporting_spam_script_path',
...@@ -1175,6 +1177,8 @@ while ($query = Sympa::WWW::FastCGI->new) { ...@@ -1175,6 +1177,8 @@ while ($query = Sympa::WWW::FastCGI->new) {
$param->{'css_url'} = sprintf '%s/%s', $Conf::Conf{'css_url'}, $robot; $param->{'css_url'} = sprintf '%s/%s', $Conf::Conf{'css_url'}, $robot;
# Compat. < 6.2.32: "host" parameter was deprecated. # Compat. < 6.2.32: "host" parameter was deprecated.
$param->{'conf'}{'host'} = Conf::get_robot_conf($robot, 'domain'); $param->{'conf'}{'host'} = Conf::get_robot_conf($robot, 'domain');
# Compat. < 6.2.62: Renamed parameters.
$param->{'conf'}{'use_blacklist'} = Conf::get_robot_conf($robot, 'use_blocklist');
   
foreach my $auth (keys %{$Conf::Conf{'cas_id'}{$robot}}) { foreach my $auth (keys %{$Conf::Conf{'cas_id'}{$robot}}) {
$log->syslog('debug2', 'CAS authentication service %s', $auth); $log->syslog('debug2', 'CAS authentication service %s', $auth);
...@@ -2051,6 +2055,10 @@ sub get_parameters { ...@@ -2051,6 +2055,10 @@ sub get_parameters {
$param->{'nomenu'} = $in{'nomenu'}; $param->{'nomenu'} = $in{'nomenu'};
} }
   
# Compatibility to the templates customized for version <=6.2.60:
# 'blacklist' was renamed to 'blocklist'.
$in{'blocklist'} //= $in{'blacklist'} if defined $in{'blacklist'};
# From CGI URL get {base_url} and {path_cgi} parameters. # From CGI URL get {base_url} and {path_cgi} parameters.
# Note that other links should keep the nomenu attribute. # Note that other links should keep the nomenu attribute.
# NOTE: The base_url is kept for compatibility to Sympa < 6.2.15. The # NOTE: The base_url is kept for compatibility to Sympa < 6.2.15. The
...@@ -7678,7 +7686,7 @@ sub do_d_reject_shared { ...@@ -7678,7 +7686,7 @@ sub do_d_reject_shared {
# do_reject # do_reject
#################################################### ####################################################
# Moderation of messages : rejects messages and notifies # Moderation of messages : rejects messages and notifies
# their senders. If in{'blacklist'} add sender to list blacklist # their senders. If in{'blocklist'} add sender to list blocklist
# #
# IN : - # IN : -
# #
...@@ -7700,15 +7708,15 @@ sub do_reject { ...@@ -7700,15 +7708,15 @@ sub do_reject {
$in{'quiet'} = 1; $in{'quiet'} = 1;
delete $in{'message_template'}; delete $in{'message_template'};
} }
if ($in{'blacklist'}) { if ($in{'blocklist'}) {
$in{'quiet'} = 1; $in{'quiet'} = 1;
} }
   
wwslog('info', '(%s)', $in{'id'}); wwslog('info', '(%s)', $in{'id'});
my $file; my $file;
   
$param->{'blacklist_added'} = 0; $param->{'blocklist_added'} = 0;
$param->{'blacklist_ignored'} = 0; $param->{'blocklist_ignored'} = 0;
foreach my $id (split(/,/, $in{'id'})) { foreach my $id (split(/,/, $in{'id'})) {
next unless $id and $id =~ /\A\w+\z/; next unless $id and $id =~ /\A\w+\z/;
   
...@@ -7737,8 +7745,8 @@ sub do_reject { ...@@ -7737,8 +7745,8 @@ sub do_reject {
} }
   
# extract sender address is needed to report reject to sender and in # extract sender address is needed to report reject to sender and in
# case the sender is to be added to the blacklist # case the sender is to be added to the blocklist
if (($in{'quiet'} ne '1') || ($in{'blacklist'})) { if (($in{'quiet'} ne '1') || ($in{'blocklist'})) {
my $rejected_sender = $message->{'sender'}; my $rejected_sender = $message->{'sender'};
if ($rejected_sender) { if ($rejected_sender) {
unless ($in{'message_template'} eq 'reject_quiet') { unless ($in{'message_template'} eq 'reject_quiet') {
...@@ -7757,23 +7765,23 @@ sub do_reject { ...@@ -7757,23 +7765,23 @@ sub do_reject {
); );
} }
} }
if ($in{'blacklist'}) { if ($in{'blocklist'}) {
if (_add_in_blacklist($rejected_sender, $robot, $list)) { if (_add_in_blocklist($rejected_sender, $robot, $list)) {
$param->{'blacklist_added'} += 1; $param->{'blocklist_added'} += 1;
wwslog('info', wwslog('info',
"added $rejected_sender to $list->{'name'} blacklist" "added $rejected_sender to $list->{'name'} blocklist"
); );
} else { } else {
wwslog('notice', wwslog('notice',
"Unable to add $rejected_sender to $list->{'name'} blacklist" "Unable to add $rejected_sender to $list->{'name'} blocklist"
); );
$param->{'blacklist_ignored'} += 0; $param->{'blocklist_ignored'} += 0;
} }
} }
} else { } else {
$log->syslog( $log->syslog(
'err', 'err',
'No sender found for message %s. Unable to use her address to add to blacklist or send notification', 'No sender found for message %s. Unable to use her address to add to blocklist or send notification',
$message $message
); );
} }
...@@ -15745,8 +15753,8 @@ sub export_topics { ...@@ -15745,8 +15753,8 @@ sub export_topics {
$param->{'topics'}[int($total / 2)]{'next'} = 1; $param->{'topics'}[int($total / 2)]{'next'} = 1;
} }
   
# manage blacklist # manage blocklist
sub do_blacklist { sub do_blocklist {
wwslog('info', '(%s)', $param->{'list'}); wwslog('info', '(%s)', $param->{'list'});
   
unless ($param->{'list'}) { unless ($param->{'list'}) {
...@@ -15786,11 +15794,11 @@ sub do_blacklist { ...@@ -15786,11 +15794,11 @@ sub do_blacklist {
); );
return undef; return undef;
} }
my $file = $list->{'dir'} . '/search_filters/blacklist.txt'; my $file = $list->{'dir'} . '/search_filters/blocklist.txt';
$param->{'rows'} = 0; $param->{'rows'} = 0;
   
if (defined $in{'blacklist'}) { if (defined $in{'blocklist'}) {
wwslog('info', 'Submit blacklist update'); wwslog('info', 'Submit blocklist update');
my $dir = $list->{'dir'} . '/search_filters'; my $dir = $list->{'dir'} . '/search_filters';
unless ((-d $dir) || mkdir($dir, 0755)) { unless ((-d $dir) || mkdir($dir, 0755)) {
Sympa::WWW::Report::reject_report_web('intern', Sympa::WWW::Report::reject_report_web('intern',
...@@ -15809,8 +15817,9 @@ sub do_blacklist { ...@@ -15809,8 +15817,9 @@ sub do_blacklist {
} }
); );
} }
my $file = $dir . '/blacklist.txt'; my $file = $dir . '/blocklist.txt';
unless (open BLACKLIST, "> $file") { my $ofh;
unless (open $ofh, '>', $file) {
Sympa::WWW::Report::reject_report_web('intern', Sympa::WWW::Report::reject_report_web('intern',
'unable to create file'); 'unable to create file');
wwslog('info', 'Unable to create file %s', $file); wwslog('info', 'Unable to create file %s', $file);
...@@ -15827,27 +15836,27 @@ sub do_blacklist { ...@@ -15827,27 +15836,27 @@ sub do_blacklist {
} }
); );
} }
my @lines = split(/\r\n|\r|\n/, $in{'blacklist'}); my @lines = split(/\r\n|\r|\n/, $in{'blocklist'});
$param->{'ignored'} = 0; $param->{'ignored'} = 0;
my $count = my $count =
0; # count utils lines in order to remove empty blacklist file 0; # count utils lines in order to remove empty blocklist file
foreach my $line (@lines) { foreach my $line (@lines) {
if ($line =~ /\*.*\*/) { if ($line =~ /\*.*\*/) {
$param->{'ignored_linest'} .= $line . "\n"; $param->{'ignored_linest'} .= $line . "\n";
$param->{'ignored'} += 1; $param->{'ignored'} += 1;
} else { } else {
print BLACKLIST "$line\n"; print $ofh "$line\n";
$param->{'blacklist'} .= $line . "\n"; $param->{'blocklist'} .= $line . "\n";
$param->{'rows'} += 1; $param->{'rows'} += 1;
$count += 1 unless ($line =~ /^\s*$/o || /^[\#\;]/o); $count += 1 unless ($line =~ /^\s*$/o || /^[\#\;]/o);
} }
} }
close BLACKLIST; close $ofh;
if ($count == 0) { if ($count == 0) {
unless (unlink $file) { unless (unlink $file) {
Sympa::WWW::Report::reject_report_web('intern', Sympa::WWW::Report::reject_report_web('intern',
'unable to remove empty blacklist file'); 'unable to remove empty blocklist file');
wwslog('info', 'Unable to remove empty blacklist file %s', wwslog('info', 'Unable to remove empty blocklist file %s',
$file); $file);
web_db_log( web_db_log(
{ 'robot' => $robot, { 'robot' => $robot,
...@@ -15862,11 +15871,12 @@ sub do_blacklist { ...@@ -15862,11 +15871,12 @@ sub do_blacklist {
} }
); );
} }
wwslog('info', 'Removed empty blacklist file %s', $file); wwslog('info', 'Removed empty blocklist file %s', $file);
} }
} else { } else {
if (-f $file) { if (-f $file) {
unless (open BLACKLIST, $file) { my $ifh;
unless (open $ifh, $file) {
Sympa::WWW::Report::reject_report_web( Sympa::WWW::Report::reject_report_web(
'intern', 'intern',
'unable to open file', 'unable to open file',
...@@ -15887,11 +15897,11 @@ sub do_blacklist { ...@@ -15887,11 +15897,11 @@ sub do_blacklist {
} }
); );
} }
while (<BLACKLIST>) { while (<$ifh>) {
$param->{'blacklist'} .= $_; $param->{'blocklist'} .= $_;
$param->{'rows'} += 1; $param->{'rows'} += 1;
} }
close BLACKLIST; close $ifh;
} }
} }
   
...@@ -17381,7 +17391,7 @@ sub prevent_visibility_bypass { ...@@ -17381,7 +17391,7 @@ sub prevent_visibility_bypass {
#sub purely_closed; #sub purely_closed;
   
# Old name: tools::add_in_blacklist(). # Old name: tools::add_in_blacklist().
sub _add_in_blacklist { sub _add_in_blocklist {
my $entry = shift; my $entry = shift;
my $robot = shift; my $robot = shift;
my $list = shift; my $list = shift;
...@@ -17390,10 +17400,10 @@ sub _add_in_blacklist { ...@@ -17390,10 +17400,10 @@ sub _add_in_blacklist {
$entry = lc($entry); $entry = lc($entry);
chomp $entry; chomp $entry;
   
# robot blacklist not yet availible # robot blocklist not yet availible
unless ($list) { unless ($list) {
$log->syslog('info', $log->syslog('info',
'Robot blacklist not yet availible, missing list parameter'); 'Robot blocklist not yet availible, missing list parameter');
return undef; return undef;
} }
unless (($entry) && ($robot)) { unless (($entry) && ($robot)) {
...@@ -17409,7 +17419,7 @@ sub _add_in_blacklist { ...@@ -17409,7 +17419,7 @@ sub _add_in_blacklist {
$log->syslog('info', 'Unable to create dir %s', $dir); $log->syslog('info', 'Unable to create dir %s', $dir);
return undef; return undef;
} }
my $file = $dir . '/blacklist.txt'; my $file = $dir . '/blocklist.txt';
   
my $fh; my $fh;
if (open $fh, '<', $file) { if (open $fh, '<', $file) {
...@@ -17420,7 +17430,7 @@ sub _add_in_blacklist { ...@@ -17420,7 +17430,7 @@ sub _add_in_blacklist {
$regexp =~ s/\*/.*/; $regexp =~ s/\*/.*/;
$regexp = '^' . $regexp . '$'; $regexp = '^' . $regexp . '$';
if ($entry =~ /$regexp/i) { if ($entry =~ /$regexp/i) {
$log->syslog('notice', '%s already in blacklist(%s)', $log->syslog('notice', '%s already in blocklist(%s)',
$entry, $_); $entry, $_);
return 0; return 0;
} }
......