Jason L Tibbitts III wrote:
>>>>>> "BS" == Ben Smithurst <ben@scientia.demon.co.uk> writes:
>
> BS> If the file specified by require_files (i.e. the list's base directory)
> BS> doesn't exist, the director will simply be ignored and the address
> BS> passed on to the next, in the normal Exim way.
>
> This is kind of cute. It hardcodes in some specific intelligence of how
> Mj2 stores its lists, though, which seems vaguely nasty.
It also has one more serious problem: case sensitivity. If this list
were named majordomo-workers on the server, and I addressed it to
Majordomo-Workers, it wouldn't see that list. That isn't technically a
problem, since local-parts _are_, by definition, case sensitive, but it
would likely cause a lot of unexpected surprises.
> Is it possible to call a program and use the return value to determine
> whether or not the director succeeded? I'm basically trying to mirror the
> qmail support here; we get the address we're being called at from the
> command line or the environment and we figure out if the address is one of
> ours.
Hmm... There is a queryprogram router which does something like that,
but routers only deal with remote addresses. Something similar, if not
better, should be possible though, since recent Exim versions can have a
built in Perl interpreter. This isn't compiled in by default though, and
may mean folk have to recompile Exim with this support, and also means
they have to be using a fairly recent version of Exim.
This would mean you could use a condition like:
condition = ${perl{Mj::Exim::check_list}{$local_part}{$domain}}
on the director, which would call the check_list() function (whatever
you may call it), with the expanded value of $local_part as its first
argument, $domain as its second. If check_list() returns 1 (or anything
other than 0, "no", or "false"), it is assumed to be a valid list,
otherwise it is not. (Returning undef would probably not be a good idea,
since Exim assumes something has gone wrong and defers the message.) If
it is a valid list, the message is passed to the specified transport for
piping into Majordomo itself.
The other bit of configuring which Exim would need would be to pull
in the check_list() routine. That would be specified using something
something like
perl_startup = use lib "/home/mj2/lib"; use Mj::Exim
or whichever modules might be used. I created a very simple Mj::Exim
module to test it,
package Mj::Exim;
sub check_list {
# assumes $list and $domain aren't "0" -- not likely.
my $list = shift || return;
my $domain = shift || return;
return -d "/usr/local/mj2/lists/$domain/$list" ? 1 : 0;
}
1;
and it seems to work. Obviously that would need improving to pull the
list path from wherever Mj2 stores them, rather than hardcoding. I'd
also be tempted to use readdir() or something to check both $list and
$domain case insensitively.
So, sticking it all together, the configuration needed for Exim would be
## main config section
perl_startup = use lib "/home/mj2/lib"; use Mj::Exim
## transport
mj2_pipe:
driver = pipe
command = "/home/mj2/bin/mj_email -l ${local_part} -d ${domain} -M ${local_part_suffix}"
return_output
## director
mj2_lists:
driver = smartuser
transport = mj2_pipe
condition = ${perl{Mj::Exim::check_list}{$local_part}{$domain}}
user = mj2
group = mail
If you create any code to let this work, I'll gladly test it.
--
Ben Smithurst
ben@scientia.demon.co.uk
send a blank message to ben+pgp@scientia.demon.co.uk for PGP key
References:
|
|