|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Wietse Venema (wietse
porcupine.org)
Date: Thu May 17 2012 - 13:31:19 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ben Rosengart:
> On Thu, May 17, 2012 at 01:19:52PM -0400, Wietse Venema wrote:
> >
> > Adding headers is implemented in cleanup(8). Headers will never be
> > added when smtpd(8) is followed by a before-queue content filter.
> > Perhaps that is your problem?
>
> No, but I appreciate the process behind the guess.
>
> > Otherwise, can you provide a small Perl sample that reproduces
> > the problem?
I installed Sendmail::PMilter and it works out of the box (I used
TCP instead of UNIX-domain because I didn't want to mess with chroot
configuration).
Wietse
Script code:
#!/usr/bin/perl
use IO::Select;
use IO::File;
use Sendmail::PMilter ':all';
my $sock = "inet:9999";
my $milter = Sendmail::PMilter->new();
# Do this before dropping privs.
$milter->setconn($sock);
$milter->register('floodstopper', { eom => \&eom_callback, }, SMFIF_ADDHDRS);
$milter->set_dispatcher( Sendmail::PMilter::sequential_dispatcher() );
$milter->main();
sub eom_callback {
my $ctx = shift;
$ctx->addheader('X-MS-Floodstopper', 'hi!');
print "addheader 'X-MS-Floodstopper', 'hi!'\n";
return(SMFIS_CONTINUE);
}
Postconf configuration:
non_smtpd_milters = inet:127.0.0.1:9999
Commands 1:
$ perl *pl
addheader 'X-MS-Floodstopper', 'hi!'
Commands 2:
$ echo test|sendmail -f wietse
localhost wietse
localhost
Message in inbox, domain name censored:
From wietse
localhost.example.com Thu May 17 14:23:21 2012
Return-Path: <wietse
localhost.example.com>
X-Original-To: wietse
localhost
Delivered-To: wietse
localhost.example.com
Received: by laptop.example.com (Postfix, from userid 0)
id D8BF020D6C6B; Thu, 17 May 2012 14:23:20 -0400 (EDT)
Message-Id: <20120517182320.D8BF020D6C6B
laptop.example.com>
Date: Thu, 17 May 2012 14:23:20 -0400 (EDT)
From: wietse
localhost.example.com (Wietse Venema)
X-MS-Floodstopper: hi!
test
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]