cvs commit: qpsmtpd/plugins count_unrecognized_commands dnsbl spamassassin

[email protected] (Robert Spier)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
cvsuser     04/11/26 23:02:23

  Modified:    plugins  count_unrecognized_commands dnsbl spamassassin
  Log:
  - dnsbl, count_unrec_commands, spamassassin:
      use symbolic log levels, instead of numeric
  - dnsbl:  set some (probably too large) timeouts
  - count_unrec_commands: DENYHARD
  - spamassassin: upgrade protocol to support switching users
  
  Revision  Changes    Path
  1.5       +1 -1      qpsmtpd/plugins/count_unrecognized_commands
  
  Index: count_unrecognized_commands
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/plugins/count_unrecognized_commands,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- count_unrecognized_commands	28 Jul 2004 17:06:45 -0000	1.4
  +++ count_unrecognized_commands	27 Nov 2004 07:02:23 -0000	1.5
  @@ -41,7 +41,7 @@
   
     if ($badcmdcount >= $self->{_unrec_cmd_max}) {
       $self->log(LOGINFO, "Closing connection. Too many unrecognized commands.");
  -    return (DENY, "Closing connection. $badcmdcount unrecognized commands.  Perhaps you should read RFC 2821?");
  +    return (DENYHARD, "Closing connection. $badcmdcount unrecognized commands.  Perhaps you should read RFC 2821?");
     }
   
     return DECLINED;
  
  
  
  1.13      +3 -0      qpsmtpd/plugins/dnsbl
  
  Index: dnsbl
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/plugins/dnsbl,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- dnsbl	27 Apr 2004 10:05:41 -0000	1.12
  +++ dnsbl	27 Nov 2004 07:02:23 -0000	1.13
  @@ -35,6 +35,9 @@
     # results in the first rcpt handler ... oh well.
   
     my $res = new Net::DNS::Resolver;
  +  $res->tcp_timeout(30);
  +  $res->udp_timeout(30);
  +
     my $sel = IO::Select->new();
   
     for my $dnsbl (keys %dnsbl_zones) {
  
  
  
  1.15      +14 -10    qpsmtpd/plugins/spamassassin
  
  Index: spamassassin
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/plugins/spamassassin,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- spamassassin	13 Oct 2004 01:52:35 -0000	1.14
  +++ spamassassin	27 Nov 2004 07:02:23 -0000	1.15
  @@ -94,7 +94,7 @@
   sub check_spam {
     my ($self, $transaction) = @_;
   
  -  $self->log(6, "check_spam");
  +  $self->log(LOGDEBUG, "check_spam");
     return (DECLINED) if $transaction->body_size > 500_000;
   
     my $leave_old_headers = lc($self->{_args}->{leave_old_headers}) || 'rename';
  @@ -129,8 +129,12 @@
     SPAMD->autoflush(1);
     
     $transaction->body_resetpos;
  -  
  -  print SPAMD "SYMBOLS SPAMC/1.0" . CRLF;
  +  my $username = getpwuid($>);
  +
  +  print SPAMD "SYMBOLS SPAMC/1.3" . CRLF;
  +  print SPAMD "User: $username" . CRLF;
  +       # Content-Length: 
  +  print SPAMD  CRLF;
     # or CHECK or REPORT or SYMBOLS
   
     print SPAMD "X-Envelope-From: ", $transaction->sender->format, CRLF
  @@ -150,10 +154,10 @@
   
     print SPAMD CRLF;
     shutdown(SPAMD, 1);
  -  $self->log(6, "check_spam: finished sending to spamd");
  +  $self->log(LOGDEBUG, "check_spam: finished sending to spamd");
     my $line0 = <SPAMD>; # get the first protocol lines out
     if ($line0) {
  -    $self->log(6, "check_spam: spamd: $line0");
  +    $self->log(LOGDEBUG, "check_spam: spamd: $line0");
   
       if ( $leave_old_headers eq 'rename' )
       {
  @@ -173,7 +177,7 @@
   
     my ($flag, $hits, $required);
     while (<SPAMD>) {
  -    $self->log(6, "check_spam: spamd: $_");
  +    $self->log(LOGDEBUG, "check_spam: spamd: $_");
       #warn "GOT FROM SPAMD1: $_";
       last unless m/\S/;
       if (m{Spam: (True|False) ; (-?\d+\.\d) / (-?\d+\.\d)}) {
  @@ -184,7 +188,7 @@
     my $tests = <SPAMD>;
     $tests =~ s/\015//;  # hack for outlook
     $flag = $flag eq 'True' ? 'Yes' : 'No';
  -  $self->log(6, "check_spam: finished reading from spamd");
  +  $self->log(LOGDEBUG, "check_spam: finished reading from spamd");
   
     if ( $leave_old_headers eq 'rename' )
     {
  @@ -218,14 +222,14 @@
   sub check_spam_reject {
     my ($self, $transaction) = @_;
   
  -  $self->log(6, "check_spam_reject: reject_threshold=" . $self->{_args}->{reject_threshold});
  +  $self->log(LOGDEBUG, "check_spam_reject: reject_threshold=" . $self->{_args}->{reject_threshold});
     my $score = $self->get_spam_score($transaction) or return DECLINED;  
  -  $self->log(6, "check_spam_reject: score=$score");
  +  $self->log(LOGDEBUG, "check_spam_reject: score=$score");
   
     return (DENY, "spam score exceeded threshold")
       if $score >= $self->{_args}->{reject_threshold};
   
  -  $self->log(6, "check_spam_reject: passed");
  +  $self->log(LOGDEBUG, "check_spam_reject: passed");
     return DECLINED;
   }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.