On Tue, Sep 17, 2002 at 03:54:42PM +0100, John Horne wrote:
> Example:
>
> Lookup file for domain 'example.com' contains:
>
> john: jhorne@???
> jh: john@???
> fred: fred@???
> fred.bloggs: fred@???
>
> We want the address 'support@???' to send mail to those users in the
> file with an '@example.com' address( i.e. 'jh' and 'fred.bloggs').
Well, my solutions would be:
1. store the aliases in, say, a SQL database to allow several different ways
to get at the database.
2. Compile several indices yourself-- do you already compile your aliases to
DBM files? If so, then write a script to run through the DBM files (or
source files), making essentially a new alias file that would contain:
example.com: john@??? fred@???
although I'd skip generating the alias file and just generate a DBM file.
(it's not clear to me if you want to send to jh@??? or
jh@${qualify_domain}).
so sth like:
#!/usr/bin/perl -w
use DB_File;
use POSIX;
tie %support, 'DB_File', '/etc/exim/support-aliases',
O_CREAT|O_RDWR|O_TRUNC, 0644;
opendir(DOMAINS, "/etc/exim/aliases.d/") or die "opendir: $!\n";
for my $domain (grep { !/^\./ && !/~$/ } readdir DOMAINS) {
open(ALIASFILE, "/etc/exim/aliases.d/$domain") or die "open: $!\n";
while (<ALIASFILE>) {
if (/(\S+):.*\@\Q$domain/) {
$support{$domain} .= " $1\@$domain";
}
}
close(ALIASFILE);
}
> I've tried various lookup combinations but cannot really get what is wanted.
> My thoughts are that we want a 'dynamically' created list whenever the
> address 'support' is used. It would be created from the list members. The
> use of the extract function seemed hopeful, but that seems to only return
> one entry and we need all the relevant addresses.
Which is essentially option 2., but I think that the lookup could be
sufficiently expensive that it's worth doing it offline. Unless there's some
fancy way of reinvoking the script on demand, but I doubt it and I'm not
sure it would be a good idead (when does it get invoked exactly? and as what
user?).
HTH
SRH
--
Steve Haslam Reading, UK araqnid@???
Debian GNU/Linux Maintainer araqnid@???
maybe the human race deserves to be wiped out