lookup-domain.pl, no where to be found

Hello,

I have a very generic, stock installation, CentOS5, and Virtualmin with all the updates. None of my domains are receiving email. I think it has to do with lookup-domain.pl. I searched the forums, and found what the script should be, and created it, but I think it needs to exist other places than /etc/webmin/virtual-server/lookup-domain.pl.

For that matter, it is no where on the system, not even in /usr/share, or /usr/lib. So I think something didn’t install right, but I can’t figure out what.

Here is a sample log entry for an email that isn’t getting delivered: (domains obfuscated)

[code:1]May 25 18:17:00 www postfix/local[16940]: 0CD2D1398017: to=<rwood.fron_line_er_sp_ce@www.ma_est_cdocum_nt_.com>, orig_to=<rwood@fron_line_er_sp_ce.com>, relay=local, delay=0.25, delays=0.24/0/0/0.01, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)[/code:1]

However it seems that the script isn’t working right.

[code:1] > ls /var/mail/rwood.fron_line_er_sp_ce
/var/mail/rwood.fron_line_er_sp_ce

> /etc/webmin/virtual-server/lookup-domain.pl rwood.fron_line_er_sp_ce
<no output>[/code:1]

Debugging lookup-domain.sh leads me to “/etc/webmin/miniserv.conf”, and the root entry, which is “/usr/libexec/webmin”, so according to the script, it is looking for “/usr/libexec/webmin/virtual-server/lookup-domain.pl”, and it doesn’t exist.

So I think something didn’t happen right during setup. I’d appreciate any help in troubleshooting this, or finding out the contents of “/usr/libexec/webmin/virtual-server/lookup-domain.pl”, as that might fix everything.

Thanks much.

–Brian

Thanks for posting that Ronald.

Apparently there is something else wrong here, as that didn’t do it.

I find it really odd that a stock installation didn’t create these things. It must have failed to create a bunch of other stuff as well. I’m concerned I might have to re-install or something. I’ve already got production domains.

I purchased a license of pro, but haven’t heard back from Virtualmin with a license key, hopefully thier support will help.

You can get your serial here --> http://www.virtualmin.com/serial/

Hi Brian,

The lookup-domain.pl script only exists on the Pro version of Virtualmin, as it is used for per-domain spam and virus filtering. The GPL install doesn’t create it at all, as it shouldn’t even refer to that file from /etc/procmailrc. On a typical GPL install, /etc/procmailrc only contains :

DEFAULT=$HOME/Maildir/
ORGMAIL=$HOME/Maildir/

or if your email is in /var/mail, something like :

DEFAULT=/var/mail/$USER
ORGMAIL=/var/mail/$USER

Did you create /etc/procmailrc manually on your system?

Thanks for the postings guys, I’m upgrading to pro now, I didn’t realize that about the GPL version. I think my system was looking for the lookup-domain.pl even though I had the GPL version.

I’ll post as soon as the pro version is finished installing.

It shouldn’t – Jamie/Joe must have forgotten to remove that bit of code.

JamieCameron wrote:

The lookup-domain.pl script only exists on the Pro version of Virtualmin, as it is used for per-domain spam and virus filtering. The GPL install doesn't create it at all, as it shouldn't even refer to that file from /etc/procmailrc. On a typical GPL install, /etc/procmailrc only contains : DEFAULT=$HOME/Maildir/ ORGMAIL=$HOME/Maildir/ or if your email is in /var/mail, something like :

DEFAULT=/var/mail/$USER
ORGMAIL=/var/mail/$USER
Did you create /etc/procmailrc manually on your system?

I did not create the /etc/procmailrc file. It currently looks like this after I have installed PRO:
> cat /etc/procmailrc
DROPPRIVS=yes
:0fw
| /usr/bin/spamc
:0

  • ^X-Spam-Status: Yes
    $HOME/spam
    DEFAULT=$HOME/Maildir/
    ORGMAIL=$HOME/Maildir/

After the pro install, I still do not have /etc/webmin/virtual-server/lookup-domain.pl, but the daemon is there and running, and it exists in /usr/libexec/webmin/virtual-server/lookup-domain.pl, not sure what that means.

You can force re-generation of the /etc/procmailrc file with the commands :

rm /etc/procmailrc
cd /usr/libexec/webmin
WEBMIN_CONFIG=/etc/webmin WEBMIN_VAR=/var/webmin /usr/libexec/webmin/run-postinstalls.pl virtual-server

Sorry to side track a bit…

I am using GPL version. my /etc/procmailrc look like:
DEFAULT=$HOME/Maildir/

However, the mail modules seems look for email at /var/spool/mail . How to configure it so that it look at ~/Maildir instead?

Many thanks!

OIC

sorry, i got the answer now! it is in the module config page, though the option name is not clear. thanks!

This is what the file "/usr/libexec/webmin/virtual-server/lookup-domain.pl" says. I have centos 5 too:

[code:1]
#!/usr/bin/perl

Returns the domain ID for some user, if the domain has spam enabled and

if the user is not approaching his quota

$no_acl_check++;
@ARGV == 1 || die "usage: lookup-domain.pl <username>";
use Socket;

Get the message size

while($got = read(STDIN, $buf, 1024)) {
$size += $got;
}
$margin = $size2+51024*1024;

First, try connecting to the lookup-domain-daemon.pl process

socket(DAEMON, PF_INET, SOCK_STREAM, getprotobyname(“tcp"«»));
$rv = connect(DAEMON, pack_sockaddr_in(11000, inet_aton(“127.0.0.1"«»)));
if ($rv) {
select(DAEMON); $| = 1; select(STDOUT);
print DAEMON $ARGV[0],”\n”;
$fromdaemon = <DAEMON>;
$fromdaemon =~ s/\r|\n//g;
close(DAEMON);
}
if ($fromdaemon) {
# We have an answer from the server process
($did, $dname, $spam, $spamc, $quotaleft) = split(/\t/, $fromdaemon);
if (!$did || !$spam) {
# No such user, or user’s domain doesn’t have spam enabled -
# don’t do spam check
}
elsif ($spamc || $quotaleft eq “UNLIMITED"«») {
# Domain is using spamc, or user has no quota, or quota disabled
# Do spam check.
print $did,”\n";
}
elsif ($quotaleft < $margin) {
# Too close to quota - don’t check
}
else {
# Do spam check
print $did,"\n";
}
exit(0);
}

Open the cache DBM

$cachefile = “$ENV{‘WEBMIN_VAR’}/lookup-domain-cache”;
eval “use SDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
eval “$usercache{‘1111111111’} = 1”;
if ($@) {
dbmclose(%usercache);
eval “use NDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
}

Check our cache first, in case we have just done this user

$now = time();
if (defined($usercache{$ARGV[0]})) {
($cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient) =
split(/ /, $usercache{$ARGV[0]});
$cacheclient ||= “spamassassin”;
if ($now - $cachetime < 60*60) {
if (!$cachespam) {
# Domain doesn’t have spam enabled, so don’t do check
$cacheuquota += $size;
&update_cache();
exit(0);
}
elsif ($cacheclient eq “spamc"«») {
# Using spamc, so quotas don’t matter
$cacheuquota += $size;
&update_cache();
print $cachespam,”\n";
exit(0);
}
elsif ($cachequota && $cacheuquota+$margin >= $cachequota) {
# User is over quota, so don’t do spam check
$cacheuquota += $size;
$cacheuquota = $cachequota
if ($cacheuquota > $cachequota);
&update_cache();
exit(0);
}
else {
# User is under quota, so proceed
$cacheuquota += $size;
&update_cache();
print $cachespam,"\n";
exit(0);
}
}
}

Lookup the user for real

do ‘./virtual-server-lib.pl’;
$d = &get_user_domain($ARGV[0]);
if (!$d || !$d->{‘spam’}) {
$cachespam = $cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
exit(0);
}

See what kind of quotas are relevant

$qmode = &mail_under_home() && &has_home_quotas() ? “home” :
&has_mail_quotas() ? “mail” : undef;
if (!$qmode) {
# None … so run spam checks
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}

Check if the domain is using spamc or spamassassin

$cacheclient = &get_domain_spam_client($d);

Check if the user is approaching his quota

@users = &list_domain_users($d, 0, 1, 0, 1);
($user) = grep { $->{‘user’} eq $ARGV[0] ||
&replace_atsign($
->{‘user’}) eq $ARGV[0] } @users;
if (!$user) {
# Couldn’t find him?! So do the spam check
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}
if ($qmode eq "home"«») {
($quota, $uquota) = ($user->{‘quota’}, $user->{‘uquota’});
}
else {
($quota, $uquota) = ($user->{‘mquota’}, $user->{‘umquota’});
}
$bsize = &quota_bsize($qmode);
$quota *= $bsize;
$uquota *= $bsize;
if ($user->{‘nospam’}) {
# Spam filtering disabled for this user
$cachespam = 0;
}
elsif ($cacheclient eq "spamc"«») {
# Using spamc, so quotas don’t matter since spam processing is run
# by a daemon
print “$d->{‘id’}\n”;
}
elsif ($quota && $uquota+$margin >= $quota) {
# Over quota, or too close to it
}
else {
# Under quota … do the spam check
print “$d->{‘id’}\n”;
}
$cachespam = $d->{‘id’};
$cachequota = $quota;
$cacheuquota = $uquota;
$cachetime = $now;
&update_cache();

sub update_cache
{
$usercache{$ARGV[0]} = join(" ", $cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient);
dbmclose(%usercache);
}[/code:1]

This is what the file "/usr/libexec/webmin/virtual-server/lookup-domain.pl" says. I have centos 5 too:

[code:1]
#!/usr/bin/perl

Returns the domain ID for some user, if the domain has spam enabled and

if the user is not approaching his quota

$no_acl_check++;
@ARGV == 1 || die "usage: lookup-domain.pl <username>";
use Socket;

Get the message size

while($got = read(STDIN, $buf, 1024)) {
$size += $got;
}
$margin = $size2+51024*1024;

First, try connecting to the lookup-domain-daemon.pl process

socket(DAEMON, PF_INET, SOCK_STREAM, getprotobyname(“tcp"«»));
$rv = connect(DAEMON, pack_sockaddr_in(11000, inet_aton(“127.0.0.1"«»)));
if ($rv) {
select(DAEMON); $| = 1; select(STDOUT);
print DAEMON $ARGV[0],”\n”;
$fromdaemon = <DAEMON>;
$fromdaemon =~ s/\r|\n//g;
close(DAEMON);
}
if ($fromdaemon) {
# We have an answer from the server process
($did, $dname, $spam, $spamc, $quotaleft) = split(/\t/, $fromdaemon);
if (!$did || !$spam) {
# No such user, or user’s domain doesn’t have spam enabled -
# don’t do spam check
}
elsif ($spamc || $quotaleft eq “UNLIMITED"«») {
# Domain is using spamc, or user has no quota, or quota disabled
# Do spam check.
print $did,”\n";
}
elsif ($quotaleft < $margin) {
# Too close to quota - don’t check
}
else {
# Do spam check
print $did,"\n";
}
exit(0);
}

Open the cache DBM

$cachefile = “$ENV{‘WEBMIN_VAR’}/lookup-domain-cache”;
eval “use SDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
eval “$usercache{‘1111111111’} = 1”;
if ($@) {
dbmclose(%usercache);
eval “use NDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
}

Check our cache first, in case we have just done this user

$now = time();
if (defined($usercache{$ARGV[0]})) {
($cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient) =
split(/ /, $usercache{$ARGV[0]});
$cacheclient ||= “spamassassin”;
if ($now - $cachetime < 60*60) {
if (!$cachespam) {
# Domain doesn’t have spam enabled, so don’t do check
$cacheuquota += $size;
&update_cache();
exit(0);
}
elsif ($cacheclient eq “spamc"«») {
# Using spamc, so quotas don’t matter
$cacheuquota += $size;
&update_cache();
print $cachespam,”\n";
exit(0);
}
elsif ($cachequota && $cacheuquota+$margin >= $cachequota) {
# User is over quota, so don’t do spam check
$cacheuquota += $size;
$cacheuquota = $cachequota
if ($cacheuquota > $cachequota);
&update_cache();
exit(0);
}
else {
# User is under quota, so proceed
$cacheuquota += $size;
&update_cache();
print $cachespam,"\n";
exit(0);
}
}
}

Lookup the user for real

do ‘./virtual-server-lib.pl’;
$d = &get_user_domain($ARGV[0]);
if (!$d || !$d->{‘spam’}) {
$cachespam = $cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
exit(0);
}

See what kind of quotas are relevant

$qmode = &mail_under_home() && &has_home_quotas() ? “home” :
&has_mail_quotas() ? “mail” : undef;
if (!$qmode) {
# None … so run spam checks
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}

Check if the domain is using spamc or spamassassin

$cacheclient = &get_domain_spam_client($d);

Check if the user is approaching his quota

@users = &list_domain_users($d, 0, 1, 0, 1);
($user) = grep { $->{‘user’} eq $ARGV[0] ||
&replace_atsign($
->{‘user’}) eq $ARGV[0] } @users;
if (!$user) {
# Couldn’t find him?! So do the spam check
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}
if ($qmode eq "home"«») {
($quota, $uquota) = ($user->{‘quota’}, $user->{‘uquota’});
}
else {
($quota, $uquota) = ($user->{‘mquota’}, $user->{‘umquota’});
}
$bsize = &quota_bsize($qmode);
$quota *= $bsize;
$uquota *= $bsize;
if ($user->{‘nospam’}) {
# Spam filtering disabled for this user
$cachespam = 0;
}
elsif ($cacheclient eq "spamc"«») {
# Using spamc, so quotas don’t matter since spam processing is run
# by a daemon
print “$d->{‘id’}\n”;
}
elsif ($quota && $uquota+$margin >= $quota) {
# Over quota, or too close to it
}
else {
# Under quota … do the spam check
print “$d->{‘id’}\n”;
}
$cachespam = $d->{‘id’};
$cachequota = $quota;
$cacheuquota = $uquota;
$cachetime = $now;
&update_cache();

sub update_cache
{
$usercache{$ARGV[0]} = join(" ", $cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient);
dbmclose(%usercache);
}[/code:1]

This is what the file "/usr/libexec/webmin/virtual-server/lookup-domain.pl" says. I have centos 5 too:

[code:1]
#!/usr/bin/perl

Returns the domain ID for some user, if the domain has spam enabled and

if the user is not approaching his quota

$no_acl_check++;
@ARGV == 1 || die "usage: lookup-domain.pl <username>";
use Socket;

Get the message size

while($got = read(STDIN, $buf, 1024)) {
$size += $got;
}
$margin = $size2+51024*1024;

First, try connecting to the lookup-domain-daemon.pl process

socket(DAEMON, PF_INET, SOCK_STREAM, getprotobyname(“tcp"«»));
$rv = connect(DAEMON, pack_sockaddr_in(11000, inet_aton(“127.0.0.1"«»)));
if ($rv) {
select(DAEMON); $| = 1; select(STDOUT);
print DAEMON $ARGV[0],”\n”;
$fromdaemon = <DAEMON>;
$fromdaemon =~ s/\r|\n//g;
close(DAEMON);
}
if ($fromdaemon) {
# We have an answer from the server process
($did, $dname, $spam, $spamc, $quotaleft) = split(/\t/, $fromdaemon);
if (!$did || !$spam) {
# No such user, or user’s domain doesn’t have spam enabled -
# don’t do spam check
}
elsif ($spamc || $quotaleft eq “UNLIMITED"«») {
# Domain is using spamc, or user has no quota, or quota disabled
# Do spam check.
print $did,”\n";
}
elsif ($quotaleft < $margin) {
# Too close to quota - don’t check
}
else {
# Do spam check
print $did,"\n";
}
exit(0);
}

Open the cache DBM

$cachefile = “$ENV{‘WEBMIN_VAR’}/lookup-domain-cache”;
eval “use SDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
eval “$usercache{‘1111111111’} = 1”;
if ($@) {
dbmclose(%usercache);
eval “use NDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
}

Check our cache first, in case we have just done this user

$now = time();
if (defined($usercache{$ARGV[0]})) {
($cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient) =
split(/ /, $usercache{$ARGV[0]});
$cacheclient ||= “spamassassin”;
if ($now - $cachetime < 60*60) {
if (!$cachespam) {
# Domain doesn’t have spam enabled, so don’t do check
$cacheuquota += $size;
&update_cache();
exit(0);
}
elsif ($cacheclient eq “spamc"«») {
# Using spamc, so quotas don’t matter
$cacheuquota += $size;
&update_cache();
print $cachespam,”\n";
exit(0);
}
elsif ($cachequota && $cacheuquota+$margin >= $cachequota) {
# User is over quota, so don’t do spam check
$cacheuquota += $size;
$cacheuquota = $cachequota
if ($cacheuquota > $cachequota);
&update_cache();
exit(0);
}
else {
# User is under quota, so proceed
$cacheuquota += $size;
&update_cache();
print $cachespam,"\n";
exit(0);
}
}
}

Lookup the user for real

do ‘./virtual-server-lib.pl’;
$d = &get_user_domain($ARGV[0]);
if (!$d || !$d->{‘spam’}) {
$cachespam = $cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
exit(0);
}

See what kind of quotas are relevant

$qmode = &mail_under_home() && &has_home_quotas() ? “home” :
&has_mail_quotas() ? “mail” : undef;
if (!$qmode) {
# None … so run spam checks
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}

Check if the domain is using spamc or spamassassin

$cacheclient = &get_domain_spam_client($d);

Check if the user is approaching his quota

@users = &list_domain_users($d, 0, 1, 0, 1);
($user) = grep { $->{‘user’} eq $ARGV[0] ||
&replace_atsign($
->{‘user’}) eq $ARGV[0] } @users;
if (!$user) {
# Couldn’t find him?! So do the spam check
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}
if ($qmode eq "home"«») {
($quota, $uquota) = ($user->{‘quota’}, $user->{‘uquota’});
}
else {
($quota, $uquota) = ($user->{‘mquota’}, $user->{‘umquota’});
}
$bsize = &quota_bsize($qmode);
$quota *= $bsize;
$uquota *= $bsize;
if ($user->{‘nospam’}) {
# Spam filtering disabled for this user
$cachespam = 0;
}
elsif ($cacheclient eq "spamc"«») {
# Using spamc, so quotas don’t matter since spam processing is run
# by a daemon
print “$d->{‘id’}\n”;
}
elsif ($quota && $uquota+$margin >= $quota) {
# Over quota, or too close to it
}
else {
# Under quota … do the spam check
print “$d->{‘id’}\n”;
}
$cachespam = $d->{‘id’};
$cachequota = $quota;
$cacheuquota = $uquota;
$cachetime = $now;
&update_cache();

sub update_cache
{
$usercache{$ARGV[0]} = join(" ", $cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient);
dbmclose(%usercache);
}[/code:1]

This is what yours should look like:

$ cat /etc/procmailrc
DROPPRIVS=yes
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
:0

  • ?/usr/bin/test "$VIRTUALMIN" != ""
    {
    INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
    }
    ORGMAIL=/var/spool/mail/$LOGNAME
    DEFAULT=/var/spool/mail/$LOGNAME
    DROPPRIVS=yes

This is what the file "/usr/libexec/webmin/virtual-server/lookup-domain.pl" says. I have centos 5 too:

[code:1]
#!/usr/bin/perl

Returns the domain ID for some user, if the domain has spam enabled and

if the user is not approaching his quota

$no_acl_check++;
@ARGV == 1 || die "usage: lookup-domain.pl <username>";
use Socket;

Get the message size

while($got = read(STDIN, $buf, 1024)) {
$size += $got;
}
$margin = $size2+51024*1024;

First, try connecting to the lookup-domain-daemon.pl process

socket(DAEMON, PF_INET, SOCK_STREAM, getprotobyname(“tcp"«»));
$rv = connect(DAEMON, pack_sockaddr_in(11000, inet_aton(“127.0.0.1"«»)));
if ($rv) {
select(DAEMON); $| = 1; select(STDOUT);
print DAEMON $ARGV[0],”\n”;
$fromdaemon = <DAEMON>;
$fromdaemon =~ s/\r|\n//g;
close(DAEMON);
}
if ($fromdaemon) {
# We have an answer from the server process
($did, $dname, $spam, $spamc, $quotaleft) = split(/\t/, $fromdaemon);
if (!$did || !$spam) {
# No such user, or user’s domain doesn’t have spam enabled -
# don’t do spam check
}
elsif ($spamc || $quotaleft eq “UNLIMITED"«») {
# Domain is using spamc, or user has no quota, or quota disabled
# Do spam check.
print $did,”\n";
}
elsif ($quotaleft < $margin) {
# Too close to quota - don’t check
}
else {
# Do spam check
print $did,"\n";
}
exit(0);
}

Open the cache DBM

$cachefile = “$ENV{‘WEBMIN_VAR’}/lookup-domain-cache”;
eval “use SDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
eval “$usercache{‘1111111111’} = 1”;
if ($@) {
dbmclose(%usercache);
eval “use NDBM_File”;
dbmopen(%usercache, $cachefile, 0700);
}

Check our cache first, in case we have just done this user

$now = time();
if (defined($usercache{$ARGV[0]})) {
($cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient) =
split(/ /, $usercache{$ARGV[0]});
$cacheclient ||= “spamassassin”;
if ($now - $cachetime < 60*60) {
if (!$cachespam) {
# Domain doesn’t have spam enabled, so don’t do check
$cacheuquota += $size;
&update_cache();
exit(0);
}
elsif ($cacheclient eq “spamc"«») {
# Using spamc, so quotas don’t matter
$cacheuquota += $size;
&update_cache();
print $cachespam,”\n";
exit(0);
}
elsif ($cachequota && $cacheuquota+$margin >= $cachequota) {
# User is over quota, so don’t do spam check
$cacheuquota += $size;
$cacheuquota = $cachequota
if ($cacheuquota > $cachequota);
&update_cache();
exit(0);
}
else {
# User is under quota, so proceed
$cacheuquota += $size;
&update_cache();
print $cachespam,"\n";
exit(0);
}
}
}

Lookup the user for real

do ‘./virtual-server-lib.pl’;
$d = &get_user_domain($ARGV[0]);
if (!$d || !$d->{‘spam’}) {
$cachespam = $cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
exit(0);
}

See what kind of quotas are relevant

$qmode = &mail_under_home() && &has_home_quotas() ? “home” :
&has_mail_quotas() ? “mail” : undef;
if (!$qmode) {
# None … so run spam checks
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}

Check if the domain is using spamc or spamassassin

$cacheclient = &get_domain_spam_client($d);

Check if the user is approaching his quota

@users = &list_domain_users($d, 0, 1, 0, 1);
($user) = grep { $->{‘user’} eq $ARGV[0] ||
&replace_atsign($
->{‘user’}) eq $ARGV[0] } @users;
if (!$user) {
# Couldn’t find him?! So do the spam check
$cachespam = $d->{‘id’};
$cachequota = $cacheuquota = 0;
$cachetime = $now;
&update_cache();
print “$d->{‘id’}\n”;
exit(0);
}
if ($qmode eq "home"«») {
($quota, $uquota) = ($user->{‘quota’}, $user->{‘uquota’});
}
else {
($quota, $uquota) = ($user->{‘mquota’}, $user->{‘umquota’});
}
$bsize = &quota_bsize($qmode);
$quota *= $bsize;
$uquota *= $bsize;
if ($user->{‘nospam’}) {
# Spam filtering disabled for this user
$cachespam = 0;
}
elsif ($cacheclient eq "spamc"«») {
# Using spamc, so quotas don’t matter since spam processing is run
# by a daemon
print “$d->{‘id’}\n”;
}
elsif ($quota && $uquota+$margin >= $quota) {
# Over quota, or too close to it
}
else {
# Under quota … do the spam check
print “$d->{‘id’}\n”;
}
$cachespam = $d->{‘id’};
$cachequota = $quota;
$cacheuquota = $uquota;
$cachetime = $now;
&update_cache();

sub update_cache
{
$usercache{$ARGV[0]} = join(" ", $cachespam, $cachequota, $cacheuquota, $cachetime, $cacheclient);
dbmclose(%usercache);
}[/code:1]

This is what yours should look like:

$ cat /etc/procmailrc
DROPPRIVS=yes
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
:0

  • ?/usr/bin/test "$VIRTUALMIN" != ""
    {
    INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
    }
    ORGMAIL=/var/spool/mail/$LOGNAME
    DEFAULT=/var/spool/mail/$LOGNAME
    DROPPRIVS=yes