Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- exim-da.pl Fri Feb 11 19:50:29 2011
- +++ exim-sb.pl Fri Feb 11 19:49:35 2011
- @@ -217,54 +217,39 @@
- #by a user. It also logs the bandwidth of the data
- #for received mail.
- sub check_limits
- {
- + my $count = 0;
- + open (LIMIT, "/etc/virtual/limit");
- + my $email_limit = int(<LIMIT>);
- + close(LIMIT);
- +
- #find the curent user
- $uid = find_uid();
- #log_str("Found uid: $uid\n");
- if (uid_exempt($uid)) { return "yes"; }
- my $name="";
- -
- - #check this users limit
- - $name = getpwuid($uid);
- -
- - if (!defined($name))
- - {
- - $name = "unknown";
- - }
- -
- - my $count = 0;
- - my $email_limit = 0;
- - if (open (LIMIT, "/etc/virtual/limit_$name"))
- - {
- - $email_limit = int(<LIMIT>);
- - close(LIMIT);
- - }
- - else
- - {
- - open (LIMIT, "/etc/virtual/limit");
- - $email_limit = int(<LIMIT>);
- - close(LIMIT);
- - }
- -
- if ($email_limit > 0)
- {
- #check this users limit
- - $count = (stat("/etc/virtual/usage/$name"))[7];
- - if ($count > $email_limit)
- + if (($name = getpwuid($uid)))
- {
- - die("You ($name) have reach your daily email limit of $email_limit emails\n");
- + $count = (stat("/etc/virtual/usage/$name"))[7];
- + if ($count > $email_limit)
- + {
- + die("You ($name) have reach your daily email limit of $email_limit emails\n");
- + }
- +
- + open(USAGE, ">>/etc/virtual/usage/$name");
- + print USAGE "1";
- + close(USAGE);
- + chmod (0660, "/etc/virtual/usage/$name");
- }
- -
- - open(USAGE, ">>/etc/virtual/usage/$name");
- - print USAGE "1";
- - close(USAGE);
- - chmod (0660, "/etc/virtual/usage/$name");
- }
- my $sender_address = Exim::expand_string('$sender_address');
- my $mid = Exim::expand_string('$message_id');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement