This shouldn't be part of check_basicheaders.  How about creating a
new plugin, add_messageid_if_missing (or something).  

-R


David Nicol wrote:
> 
> Submitted for inclusion without restriction. These message IDs will
> never duplicate nor repeat.
> 
> 
> ---------- Forwarded message ----------
> From:  <da...@hexaflexagon.nevermeta.com>
> Date: Wed, Mar 18, 2009 at 5:21 PM
> Subject: patch providing Message-Id creation feature for check_basicheaders
> To: davidni...@gmail.com
> 
> 
> --- /home/smtpd/plugins/check_basicheaders_original     2009-03-18
> 17:34:20.000000000 -0400
> +++ /home/smtpd/plugins/check_basicheaders      2009-03-18
> 18:13:10.000000000 -0400
> @@ -40,6 +40,8 @@
>   }
>  }
> 
> +my $SMTPIN = 'SMTPIN';
> +
>  sub hook_data_post {
>   my ($self, $transaction) = @_;
> 
> @@ -66,5 +68,12 @@
>   return (DENY, "The Date in the header was too far in the future")
>     if $ts > time + ($self->{_days}*24*3600);
> 
> +  unless ($transaction->header->get('Message-Id')){
> +    my $me =  $self->qp->config('me');
> +    my $newMID =
> time()."-$me-$$".$SMTPIN++.rand(99999).'@'.($self->qp->connection->remote_ip);
> +    $self->log(LOGINFO, "new Message-Id: $newMID");
> +    $transaction->header->add('Message-Id', $newMID);
> +  };
> +
>   return (DECLINED);
>  }

Reply via email to