Advertisement
Guest User

Diff between DA and SB exim.pl

a guest
Feb 11th, 2011
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.66 KB | None | 0 0
  1. --- exim-da.pl  Fri Feb 11 19:50:29 2011
  2. +++ exim-sb.pl  Fri Feb 11 19:49:35 2011
  3. @@ -217,54 +217,39 @@
  4.  #by a user.  It also logs the bandwidth of the data
  5.  #for received mail.
  6.  
  7.  sub check_limits
  8.  {
  9. +   my $count = 0;
  10. +   open (LIMIT, "/etc/virtual/limit");
  11. +   my $email_limit = int(<LIMIT>);
  12. +   close(LIMIT);  
  13. +
  14.     #find the curent user
  15.     $uid = find_uid();
  16.  
  17.     #log_str("Found uid: $uid\n");
  18.  
  19.     if (uid_exempt($uid)) { return "yes"; }
  20.  
  21.     my $name="";
  22. -
  23. -   #check this users limit
  24. -   $name = getpwuid($uid);
  25. -
  26. -   if (!defined($name))
  27. -   {
  28. -       $name = "unknown";
  29. -   }
  30. -
  31. -   my $count = 0;
  32. -   my $email_limit = 0;
  33. -   if (open (LIMIT, "/etc/virtual/limit_$name"))
  34. -   {
  35. -       $email_limit = int(<LIMIT>);
  36. -       close(LIMIT);
  37. -   }
  38. -   else
  39. -   {
  40. -       open (LIMIT, "/etc/virtual/limit");
  41. -       $email_limit = int(<LIMIT>);
  42. -       close(LIMIT);
  43. -   }
  44. -
  45.     if ($email_limit > 0)
  46.     {
  47.         #check this users limit
  48. -       $count = (stat("/etc/virtual/usage/$name"))[7];
  49. -       if ($count > $email_limit)
  50. +       if (($name = getpwuid($uid)))
  51.         {
  52. -           die("You ($name) have reach your daily email limit of $email_limit emails\n");
  53. +           $count = (stat("/etc/virtual/usage/$name"))[7];
  54. +           if ($count > $email_limit)
  55. +           {
  56. +               die("You ($name) have reach your daily email limit of $email_limit emails\n");
  57. +           }
  58. +
  59. +           open(USAGE, ">>/etc/virtual/usage/$name");
  60. +           print USAGE "1";
  61. +           close(USAGE);
  62. +           chmod (0660, "/etc/virtual/usage/$name");
  63.         }
  64. -
  65. -       open(USAGE, ">>/etc/virtual/usage/$name");
  66. -       print USAGE "1";
  67. -       close(USAGE);
  68. -       chmod (0660, "/etc/virtual/usage/$name");
  69.     }
  70.  
  71.     my $sender_address = Exim::expand_string('$sender_address');
  72.     my $mid = Exim::expand_string('$message_id');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement