Sorry, it's not a patch, it's a plugin...

Félix Horro Pita escribió:
> Hello!
> 
> I installed qpsmtpd in my server today. I tested it in a secondary
> server, and it seems to work fine.
> 
> But I have a couple of customers who send very big mails (~20Mb) to a
> lot of adresses (~300), so it slows down the server (a mail take about
> 6Gb traffic).
> 
> That was the reason why i made this patch; i hope it helps somebody else.
> 
> It ckecks how many recipients are, and it returns a DENYSOFT_DISCONNECT
> if there are more than the value of $maxrcpt (you can pass it as an
> argument when you call the plugin, or 20 by default).
> 
> I'm a newbee... perhaps it's not perfect, but it works.
> 
> 
> 
> sub init {
>     my ($self, $qp, @args) = @_;
> 
>     my $maxrcpt=20;
> 
>     if ( ($args[0]!~/\d+/) ){
>         $self->log(LOGWARN,"maxrcpt not valid, using 20 by default");
>     }else{
>         $maxrcpt=$args[0];
>     }
> 
>     $self->{maxrcpt} = $maxrcpt;
> }
> 
> 
> 
> sub hook_data {
>   my ($self, $transaction) = @_;
> 
>   if ( scalar($transaction->recipients()) > ($self->{maxrcpt}) ){
>         return DENYSOFT_DISCONNECT, "Too much recipients (Max.
> ".$self->{maxrcpt}." adresses)";
>   }else{
>         return DECLINED;
>   }
> 
> }
> 
> 
> 
> 
> 
> 
> 
> 

-- 
Félix Horro Pita

CORUNET S.L.
Internet, animación y multimedia
Tfno./Fax: 981 160 133
www.corunet.com

Reply via email to