[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rough zmailer treatment on .forward expansion
On Tue, Apr 29, 2003 at 03:24:26PM -0600, James MacKinnon wrote:
> Hello all,
>
> Does anyone know why zmailer (2.99.55) might be
> not handling empty .forward expansion in a graceful way?
That particular code has been in there a long time..
One way would be to notice when the thing is internal error
message, and at such time not to produce any of these messages.
... and mark these messages to be internal error messages.
There was also some different return code, when the .forward
is empty, I think. At least for that empty case there probably
should not be any notifications at all, just effectively ignoring
the existence of that file. That needs carefull coordinated
action with aliases.cf file's internal logics:
forward="$homedir/.forward"
priv=$(get $attr privilege)
if [ -z "$PUNTHOST" ] && $(didexpand forward) && [ "$hashomedir" ] &&
[ -f "$forward" ] ; then
db add expansions "$key.forward" 1
if priv=$(getpriv "644" $priv "$forward" .forward) ; then
nattr=$(newattribute $attr privilege $priv)
$(zapDSNnotify $nattr expanded "$sender" "$lcuser$domain")
a=$(runas $priv cat "$forward" | \
listaddresses -e "$user" -c "$forward .forward expansion" | \
maprrouter $nattr "$forward" "$host" "$plustail" "$domain")
postzapDSNnotify a
returns $a
fi
fi
Mind you, "empty" might be a file full of lines beginning
with "#" character, or pure whitespace, or mere newlines.
Exit status of the last routine in a pipe is the status of the pipe,
thus 'listaddresses' function's status is invisible, and it is the
place where that self-notification message is generated at.
That script internals can be turned into:
a=$(runas $priv cat "$forward" | \
listexpand -E "postmaster" -e $user \
-c "$forward .forward expansion" \
$nattr "$forward" "$host" "$plustail" "$domain")
(quite straight-forward transformation.)
Then the 'listexpand' exit code can be used in a test:
if a=$(runas ... | listexpand ...) ; then
... this and that ...
return $a
fi
Question of moving the 'db add expansions ...' inside that
runas|listexpand tested pipe is related -- but I don't think
it is worthwhile.
> I set an empty .forward (0 bytes) on a test account, and then
> only with a 'router -i' test, I got back a continuous series
> of delivered mail messages through our MTA from the MAILER-DAEMON
> ( 30 or 40, until I quickly removed the .forward file) all similar to:
...
> This could cause a lot of grief if a user is in a list
> and a .forward exists but is empty.
>
> Is there some configuration setting I can use, or do I need
> to modify router/functions.c as a temp fix ?
A bit of carefull thought, I should think.
(As if I had no better thing to do ..) I have now edited the
aliases.cf script to make those script transformations, and
then to wrap with that 'if' wrapper..
I need to check the 'listexpand' function for this (and its friends).
> Cheers,
> --
> James S. MacKinnon Office: P-139 Avadh-Bhatia Physics Lab
> University of Alberta email : Jim.MacKinnon@Phys.UAlberta.CA
> Edmonton, Canada T6G 2N5 WWW : http://www.phys.ualberta.ca/
--
/Matti Aarnio <mea@nic.funet.fi>
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to majordomo@nic.funet.fi