On 15/Apr/10 10:38, Michelle Konzack wrote:
> If I log into my mailserver as "root" and execute from that account
>
> ----[ comand 'HOME=/home/electronica rcptfilter -M rcptfilter -D 1028/1027' 
> ]--
> rd= 5, next= 0
> rd=29, next= 0
> rcptfilter[13347]: received signal 17
> rd= 0, next= 0

Hm... compile it with -DNDEBUG. That output may give no trouble, but 
it's uselessly noisy.

> ------------------------------------------------------------------------
>
> OK, now I run it under strace
> [...]

That looks fine.

> Apr 15 10:14:57 samba3 rcptfilter[13955]: /home/electronica/rcptfilter.sh 
> with  exited 0, rtc=0

Ok, so it logs that line even if everything runs fine. Possibly, the 
only case it logs nothing is if stat("rcptfilter.sh") gives ENOENT.

> So why does it work from the commandline and not from courier?

Hm... perhaps /etc/courier/maildropfilter is not readable by courier?

> However, I do not understand how "rcptfilter" ist working because  there
> are no infos which I can use to determiner whether the incoming messages
> are acceptable or not.

 From environment variables. It adds HOST and LOCAL, which are only 
meaningful in the aliasdir case, where courier invokes it passing an 
argument of -M rcptfilter-yourcatch...@whatever. Otherwise, LOCAL has 
the extension, if any. In the log line above, the two spaces in "with 
  " imply that it was empty.

Courier sets a bunch of useful variables too.

It is a simplification of maildropfilter, where the script should only 
return 0, 64, or 99. 0 accepts, 64 or 99 reject with "571 Delivery not 
authorized". 99 would be where maildrop allows a second call after the 
body of the message has been received. However, rcptfilter.c only 
returns 0 or 1 to courier, so the second call is never done. The 
advantage of this is that one can call the same script on delivery, 
e.g. by

   echo '|| /etc/courier/aliasdir/rcptfilter.sh' >
     /etc/courier/aliasdir/.courier-default

> My script
> [...]
> env>>${LOGFILE}

fine

>
> capure only
>
> ----[ '/home/electronica/log/20100415_102336.log' ]---------------------
> [...]

That should become more interesting when rcptfilter is run by courier 
(on each RCPT TO.)

> if I use the commandline:
>
> HOME=/home/electronica rcptfilter -M rcptfilter -D 
> 1028/1027<1271319687.22602_1.samba3

The script will have no stdin and no stdout. Only stderr to syslog.

> and there are some VARS interesting, because the logfile is  written  as
> user 1028/1027 (electronica) but the script use the  wrong  USER,  MAIL,
> and TMPDIR, TEMP, TEMPDIR and TMP...

They are inherited from the calling process.

> Also very important is, that PATH is wrong

ditto.

> It seems there are infos missing...
>  From the output of my script I can not see how to use it.

I only use it for the catchall, and occasionally for debugging. 
However, since 2006 I've added some site-specific functions, such as 
examining various BLOCKn (so as to compare DNSBLs), and checking that 
the SENDERAUTH environment variable matches the recipient if the 
"sent" extension is being used (this then requires a .courier-sent to 
deliver to each user's Maildir/.Sent). That stuff could be done with 
bash, but it's much easier in C, so I add to rcptfilter.c any 
processing that has to be done for each user.
































-- 

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to