Dat is juist, hij komt wél aan.
Dit is de relevante code (licht aangepast):
Het script stopt ook op die die() (log_bandwidth wordt niet meer aangeroepen), maar exim vind het wel nodig om mail te sturen.Code:sub check_limits
{
my $notify = 'hidden@mail';
my $count = 0;
#find the curent user
my $uid = find_uid();
my $email_limit = 0;
my $name = getpwuid($uid);
if (open (LIMIT, "/etc/virtual/limit_$name"))
{
$email_limit = int(<LIMIT>);
close(LIMIT);
}
if ($email_limit == 0)
{
open (LIMIT, "/etc/virtual/limit");
$email_limit = int(<LIMIT>);
close(LIMIT);
}
if (uid_exempt($uid,$name)) { return "yes"; }
if ($email_limit == -1)
{
die("You ($name) are not allowed to send email\n");
}
if ($email_limit > 0)
{
$count = (stat("/etc/virtual/usage/$name.count"))[7];
if ($count > $email_limit)
{
open(MAIL, "|mail -s 'User $name have reached his daily email limit ($email_limit): $count' $notify");
print MAIL <<END;
User $name have reached his daily email limit ($email_limit): $limit.
------ This is initial part of the last message, including all the headers. ------
END
print MAIL Exim::expand_string('$message_headers'),"\n\n";
print MAIL Exim::expand_string('$message_body'),"\n";
close MAIL;
die("You ($name) have reach your daily email limit of $email_limit emails\n");
}
open(USAGE, ">>/etc/virtual/usage/$name.count");
print USAGE "1";
close(USAGE);
chmod (0660, "/etc/virtual/usage/$name.count");
}
my $sender_address = Exim::expand_string('$sender_address');
my $mid = Exim::expand_string('$message_id');
log_bandwidth($name,"$sender_address;$mid");
return "yes"
}
Mvg,
Lekensteyn
