From: Quentin Campbell
Date: 2010-01-20 03:10:56 -0500
Subject: RE: Re: RE: wimp
>From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of
>Sent: 19 January 2010 14:12
>Subject: [milters] Re: RE: wimp
>What I don't understand is that why is there a shell being used at all.
>The wimp binary should be forked/execed directly without an intervening
>shell. That is how I assume sendmail was invoking the software and
>piping stdin and collecting stdout/stderr as documented in the Bat Book
>I'll have to look more closely to this "wrapper" setup which wasn't
According to the Bat Book the piping of standard input/output/error is as you suppose but it also makes clear (section 12.2.3) that either /bin/sh -c or /usr/sbin/smrsh -c is used to invoke wimp.
In the case of the alias file entry
wimp-test: "|/usr/local/sbin/wimp list-name=wimp-test"
then according to the Bat Book (Ed 3), section 12.2 (12.2.3 in particular), sendmail runs the Bourne Shell and the Bourne Shell runs /usr/local/sbin/wimp. The shell is invoked with "-c" which means that it reads its commands from the string following -c as if they were commands typed interactively to the shell. How the argument following the "-c" option is constructed from the alias file entry is crucial here. Note also that mail from sendmail reaches the shell by attaching the output of sendmail to the standard input of the shell as you say.
I can do all this successfully by hand but not via sendmail!
For example, if a message text is in the file x.msg then as I understand the Bat Book explanation in section 12.2.3 then it means that sendmail (i.e. the standard 'prog' mailer) would execute the above alias file entry as:
/bin/sh -c "/usr/local/sbin/wimp list-name=wimp-test" < x.msg
That works as expected as does
cat x.msg |/bin/sh -c "/usr/local/sbin/wimp list-name=wimp-test"
There is no output from standard output or standard error and wimp correctly generates a message to the reviewer address.
Most strange that it does not work from sendmail here.
Copyright 2009, 2012 by SnertSoft. All rights reserved.