Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Sympa
Commits
101b3d62
Unverified
Commit
101b3d62
authored
Nov 09, 2018
by
Luc Didry
Browse files
Fix #295 — Add domain blacklist feature
parent
3028d0fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
default/mail_tt2/report.tt2
View file @
101b3d62
...
...
@@ -597,6 +597,9 @@ Warning: this message may already have been sent by one of the list's moderators
[%~ ELSIF report_entry == 'incorrect_email' ~%]
[%|loc(report_param.email || report_param.value)%]Address "%1" is incorrect[%END%]
[%~ ELSIF report_entry == 'blacklisted_domain' ~%]
[%|loc(report_param.email || report_param.value)%]Address "%1" belongs to a blacklisted domain[%END%]
[%~ ELSIF report_entry == 'incorrect_passwd' ~%]
[%|loc%]Provided password is incorrect[%END%]
...
...
src/lib/Sympa/ConfDef.pm
View file @
101b3d62
...
...
@@ -2132,6 +2132,18 @@ our @params = (
'
file
'
=>
'
sympa.conf
',
'
optional
'
=>
1
,
},
{
'
name
'
=>
'
domains_blacklist
',
'
gettext_id
'
=>
'
Prevent people to subscribe to a list with adresses using these domains
',
'
gettext_comment
'
=>
'
This parameter is a comma-separated list.
',
'
default
'
=>
undef
,
'
sample
'
=>
'
example.org,spammer.com
',
'
split_char
'
=>
'
,
',
'
file
'
=>
'
sympa.conf
',
'
optional
'
=>
1
,
},
## Not implemented yet.
## {
...
...
src/lib/Sympa/List.pm
View file @
101b3d62
...
...
@@ -3826,6 +3826,20 @@ sub add_list_member {
$new_user->{'email'});
next;
}
if (defined($Conf::Conf{'domains_blacklist'})) {
my @parts = split '@', $who;
my $next = 0;
foreach my $f (split ',', lc($Conf::Conf{'domains_blacklist'})) {
if ($parts[1] && $parts[1] eq $f) {
$log->syslog('err',
'Ignoring %s which uses a blacklisted domain',
$new_user->{'email'});
$next++;
next;
}
}
next if $next;
}
unless (
$current_list_members_count < $self->{'admin'}{'max_list_members'}
|| $self->{'admin'}{'max_list_members'} == 0) {
...
...
src/lib/Sympa/Request/Handler/add.pm
View file @
101b3d62
...
...
@@ -71,6 +71,20 @@ sub _twist {
return
undef
;
}
if
(
defined
(
$
Conf::
Conf
{'
domains_blacklist
'}))
{
my
@parts
=
split
'
@
',
Sympa::Tools::Text::
canonic_email
(
$email
);
foreach
my
$f
(
split
'
,
',
lc
(
$
Conf::
Conf
{'
domains_blacklist
'}))
{
if
(
$parts
[
1
]
&&
$parts
[
1
]
eq
$f
)
{
$self
->
add_stash
(
$request
,
'
user
',
'
blacklisted_domain
',
{'
email
'
=>
$email
});
$log
->
syslog
('
err
',
'
ADD command rejected; blacklisted domain for "%s"
',
$email
);
return
undef
;
}
}
}
if
(
$list
->
is_list_member
(
$email
))
{
$self
->
add_stash
(
$request
,
'
user
',
'
already_subscriber
',
{'
email
'
=>
$email
,
'
listname
'
=>
$list
->
{'
name
'}});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment