Hello,

I apologize in advance if this is the wrong place to post this, I
could not find any information about source contributions and I am not
looking to get into full time development. This was a 'need basis'.

in short, there is no way to do per virtual user configs w/
spamc/spamd under anything but vpopmail (not even sure if thats
possible.. but not that point). This patch is very tiny, doesnt break
any backwards compatibility and works.

spamc -u [EMAIL PROTECTED]@domain.com
example: spamc -u [EMAIL PROTECTED]@spamassassin.org

this tells spamd that the system user that owns the email address is
spamassi, and it also passes the email address (which that latter part
spamd already handled).

I use this option when starting spamd:
--virtual-config-dir=/var/domains/%s/%d/%l

This way I can break up my mail domains directory structure much nicer
w/o the need for a hashing function. Anyway.. here is the patch.. My
hopes was that since this doesn't break anything, and is tiny enough..
that it could be added in future versions. If this is the wrong place,
I would appreciate somebody pointing me to the proper channels. Thank
you for your time.

--- spamd       2007-10-31 00:18:56.000000000 -0400
+++ spamd       2007-10-31 00:20:57.000000000 -0400
@@ -2108,9 +2108,19 @@
     $safename =~ s/[^-A-Za-z0-9\+_\.\,[EMAIL PROTECTED]/_/gs;
     my $localpart = '';
     my $domain    = '';
-    if ( $safename =~ /^(.*)\@(.*)$/ ) { $localpart = $1; $domain = $2; }
+    my $sysuser   = '';
+    my $atcount   = 0;

     $dir =~ s/\%u/${safename}/g;
+    $atcount = ($safename =~ tr/@//);
+
+    if ($atcount == 2) {
+        if ( $safename =~ /^(.*)\@(.*)\@(.*)$/ ) { $sysuser = $1;
$localpart = $2; $domain = $3; }
+        $dir =~ s/\%s/${sysuser}/g;
+    } else {
+        if ( $safename =~ /^(.*)\@(.*)$/ ) { $localpart = $1; $domain = $2; }
+    }
+
     $dir =~ s/\%l/${localpart}/g;
     $dir =~ s/\%d/${domain}/g;
     $dir =~ s/\%\%/\%/g;

Reply via email to