Thanks,
->Spike
I know of no other way than "manually" running "sendmail -bv" to
expand the alias. This may or may not work, depending on the
permissions on your alias files and the user the milter is running
as. It's also pretty inefficient.
You could also write code that simulates Sendmail's alias processing
by opening the alias maps, but that's an awful lot of work.
--
David.
In the normal scheme of things, sendmail won't try to expand the
alias until it is ready to deliver. The milter has finished its work
before then.
Which makes sense, but in my case I'd like to check a per user whitelist in
a milter and need to by able to figure out who the actual user is. I guess
I'll have to look reading the alias db directly.
->Spike
Something like this should do it (untested of course, but you should get
the idea). Something similar can be used to expand virtusertable
entries or any other server side data that you want to know in your
milter.
dnl # helpful define for adding to comma separated lists
define(`COMMAAPPEND', `define(`$1', ifdef(`$1', `$1`,$2'', `$2'))')
dnl # pass the "alias_user" macro to the milter xxfi_envrcpt() function
COMMAAPPEND(`confMILTER_MACROS_ENVRCPT',`{alias_user}')
LOCAL_CONFIG
# used to create macros to send to milter interface
Kstorage macro
# get access to the aliases file
Kaliases implicit
LOCAL_RULESETS
SLocal_check_rcpt
# clear the alias user storage and parse the recipient
R$* $: $(storage {alias_user} $) $1
R$* $: <?> $>ParseRecipient $1
# look for local users
R<?> $* < @ $=w > $: <!> $1 @ $2
R<?> $* < @ $* > $: $1 < @ $2 >
R<?> $* $: <!> $1
# look up user in aliases - this is not recursive (split this out to
# another ruleset if that is wanted)
R<!> $* $: <?> $1
R<?> $+ + $* @ $+ $: <!> < $(aliases $1 $: @ $) > $1 + $2 @ $3
R<?> $+ @ $+ $: <!> < $(aliases $1 $: @ $) > $1 @ $2
R<?> $+ + $* $: <!> < $(aliases $1 $: @ $) > $1 + $2
R<?> $* $: <!> < $(aliases $1 $: @ $) > $1
R<!> < @ > $+ $: $1
# got a match - store it
R<!> < $+ > $+ $: $(storage {alias_user} $@ $1 $) $2
--
Chris Adams <cma...@hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.