cvs commit: qpsmtpd/lib/Qpsmtpd Plugin.pm SMTP.pm

[email protected] (Matt Sergeant)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
cvsuser     04/07/16 00:27:27

  Modified:    lib/Qpsmtpd Plugin.pm SMTP.pm
  Log:
  Add a hook for the DATA command
  
  Revision  Changes    Path
  1.9       +1 -1      qpsmtpd/lib/Qpsmtpd/Plugin.pm
  
  Index: Plugin.pm
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/Plugin.pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -w -r1.8 -r1.9
  --- Plugin.pm	29 Jun 2004 21:45:09 -0000	1.8
  +++ Plugin.pm	16 Jul 2004 07:27:26 -0000	1.9
  @@ -2,7 +2,7 @@
   use strict;
   
   my %hooks = map { $_ => 1 } qw(
  -    config  queue  data_post  quit  rcpt  mail  ehlo  helo
  +    config  queue  data  data_post  quit  rcpt  mail  ehlo  helo
       auth auth-plain auth-login auth-cram-md5
       connect  reset_transaction  unrecognized_command  disconnect
   );
  
  
  
  1.33      +29 -1     qpsmtpd/lib/Qpsmtpd/SMTP.pm
  
  Index: SMTP.pm
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/SMTP.pm,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -w -r1.32 -r1.33
  --- SMTP.pm	16 Jul 2004 05:06:43 -0000	1.32
  +++ SMTP.pm	16 Jul 2004 07:27:26 -0000	1.33
  @@ -365,7 +365,35 @@
     my $self = shift;
     $self->respond(503, "MAIL first"), return 1 unless $self->transaction->sender;
     $self->respond(503, "RCPT first"), return 1 unless $self->transaction->recipients;
  +  
  +  my ($rc, $msg) = $self->run_hooks("data");
  +  if ($rc == DONE) {
  +    return 1;
  +  }
  +  elsif ($rc == DENY) {
  +    $self->respond(554, $msg || "Message denied");
  +    $self->reset_transaction();
  +    return 1;
  +  }
  +  elsif ($rc == DENYSOFT) {
  +    $self->respond(451, $msg || "Message denied temporarily");
  +    $self->reset_transaction();
  +    return 1;
  +  } 
  +  elsif ($rc == DENY_DISCONNECT) {
  +    $self->respond(554, $msg || "Message denied");
  +    $self->disconnect;
  +    return 1;
  +  }
  +  elsif ($rc == DENYSOFT_DISCONNECT) {
  +    $self->respond(451, $msg || "Message denied temporarily");
  +    $self->disconnect;
  +    return 1;
  +  }
  +  else {
     $self->respond(354, "go ahead");
  +  }
  +  
     my $buffer = '';
     my $size = 0;
     my $i = 0;
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.