I just installed exim 0.56 on one of our machines for a specific
function. I've just finished banging my head against a keyboard.
Perhaps you know a better fix for what I want to do.
For maths.cam.ac.uk the mail is (will be) handled on a machine which shares
the YP domain with the damtp.cam.ac.uk machines. Thus lots of users have
"accounts", but can't log in due to magic in login etc. Thir home
directories are also not visible except in obscure circumstances due to
automounter magic.
If exim gets mail for such a "user" they should be treated as not existing,
since they arn't a valid recipient of mail at maths.cam.ac.uk.
I only want to accept for those in the aliases file, or have accounts with
home directories in a special place (actually local to this system).
So I've set up the directors thus:
(as normal)
system_aliases:
driver = aliasfile;
file = /etc/aliases,
search_type = lsearch
...
(special)
localuser:
driver = localuser,
transport = local_delivery;
directory = /home/chasm/${local_part},
Thus only user's who's home directories are /home/chasm/... will be
considered local. However, the forwardfile directory *insists* on
checking the home directory. Now on this machine it can't get at home
directories for non local users, so it defers the mail.
I tried changing the forwardfile director to:
userforward:
no_verify,
driver = forwardfile;
file = .forward,
directory = ${if exists:${home} {$home}{/dummy}}
# filter
but this seems to be an error. Seting the debug level to 11 I just
get told:
Eventually after banging away, I found that the definition of exists:
in the spec.txt is wrong, and I should use exists{$home}. My userforward now
looks like:
userforward:
no_verify,
driver = forwardfile;
file = .forward,
directory = ${if exists{$home} {${home}}{/dummy}},
# filter
Where /dummy actually exists and does not contain any .forward files!
Since this is a rather convoluted way to do things, is there a better trick?
Having seen the above, I thought to replace the directory = stuff in the
localuser director with:
directory = ${if exists{$home} {${home}}{/DOES-NOT-EXIST}},
exim of course doesn't expand directory in *this* case so I get a mismatch
error:
> localuser director failed to match pw_dir with "${if exists{$home}
> {${home}}{/doesnt}}" for testmaths
Wouldn't it be better to not use the same keywork in 2 similar situations in
such different ways? In the forwardfile the delivery is defered until the
directory exists, while in localuser delivery isn't attempted unless the
directory does exist and matches $home.
A simpler rule for all directors would be to have 2 options, one which causes
the defering, and the other which is tested for to see if the director
accepts the mail. e.g.
defer_if = ${if !exists{$home}},
for the forwardfile case, and:
accept_only = ${if eq{$home}{STRING}}
for the localuser case. This would be more generic and remove the
"special cases" from both directors, making it easier to do weird things!
-- Jon
P.S. Why doesn;t exim understand the -bi option?
Jon Peatfield, Computer Officer, the DAMTP, University of Cambridge
Telephone: +44 1223 3 37852 Mail: J.S.Peatfield@???