Skip to content

Commit

Permalink
Add check for unregistered 'mailman' list https://www.virtualmin.com/…
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Feb 8, 2018
1 parent 8c70292 commit fdd29b3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion virtualmin-mailman-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
our $mailman_var = $config{'mailman_var'} || $mailman_dir;
our $newlist_cmd = "$mailman_dir/bin/newlist";
our $rmlist_cmd = "$mailman_dir/bin/rmlist";
our $list_lists_cmd = "$mailman_dir/bin/list_lists";
our $mailman_cmd = $config{'mailman_cmd'} || "$mailman_dir/bin/mailman";
if (!-x $mailman_cmd && $config{'alt_mailman_cmd'}) {
# Hack needed to handle CentOS 4
Expand Down Expand Up @@ -84,6 +85,15 @@ sub list_lists
return @rv;
}

# list_real_lists()
# Returns a list of the names of actual lists that exist in the Mailman config
sub list_real_lists
{
my $out = &backquote_command("$list_lists_cmd -b 2>/dev/null </dev/null");
return ( ) if ($?);
return split(/\r?\n/, $out);
}

# can_edit_list(&list)
sub can_edit_list
{
Expand Down Expand Up @@ -500,7 +510,12 @@ sub needs_mailman_list
my @lists = &list_lists();
my ($mailman) = grep { $_->{'list'} eq 'mailman' } @lists;
if ($mailman) {
# Already exists
# Already exists and is known to Virtualmin
return 0;
}
my @real = &list_real_lists();
if (&indexof('mailman', @real) >= 0) {
# Already exists, although not registered in Virtualmin
return 0;
}
&foreign_require("init", "init-lib.pl");
Expand Down

0 comments on commit fdd29b3

Please sign in to comment.