#!/usr/bin/perl
#
#
use strict;

select(undef,undef,undef,0.1);  # timing problems(?)

my @authlines = split /\n/, $ENV{AUTHLINES};


my @mailfilter = split /,(\s+)?/, $ENV{adminfilter} || ('*@*');

foreach my $line (@authlines) {
    chomp $line;
    if ($line =~ /^ROLE ADMIN$/) {
        foreach my $filter (@mailfilter) {
            next if $filter =~ /^$/;
            print "MAIL $filter\n";
        }
        exit;
    }
}
