Thanks! This looks very promising.
Would it be possible to incorporate some additional recursion? 2 levels
of recursion may be too little, in my opinion, and it'd just require
an additional "for" loop scope in the patch below to fix bug 4714 too.
Either way, I think I'd be happy to apply this ;) but let me know if
that's possible.
--j.
Daniel Albers writes:
> as you probably know, the current vpopmail implementation is broken.
> This is my attempt to resolve the regression bug 5798 and to shed some
> light on the remaining issues.
>
> The following comment by jmason can be found in bugzilla:
>
> | vpopmail note: if anyone who runs vpopmail would like to fix the
> | assorted bugs in spamd's support for it, and update the documentation
> | to be correct, please have at it. We currently have a number of bugs:
> | bug 2536, bug 4568, bug 4714, bug 3120 and bug 2866, all related to
> | vpopmail, and none of the dev team use this code, so the various
> | proposed fixes are untested. Basically, we need a vpopmail maintainer.
>
> Regarding the mentioned bugs, the following changes would result from
> this patch:
>
> 2536: vpopmail/qmail code neither warning- nor 100% taint-safe -- No change
> ~ - The proposed change is far too extensive to be included in spamd
> imho. I would rather switch to a VPopmail implementation from CPAN. ->
> wontfix
>
> 2866: patch: allow user config file in places other than ~/.spa... -- No
> change
> ~ - This bug has to do with vpopmail only remotely
> ~ - Depends on bug 5138, RFE: pluginize spamd user_prefs lookup code
>
> 3120: vpopmail user_prefs lookup bug for catch-all users -- No change
> ~ - The bug proposed to create user_prefs in a domain directory for
> catch-all accounts. This wouldn't even comply with the vpopmail design I
> guess, so I'd see this as a wontfix.
>
> 4568: vpopmail alias broken -- partly fixed
> ~ - This is similar to 3120. The remaining parts are described in bug
> 4717 more precisely. I'd mark it as duplicate of 3120 and 4717 if
> Bugzilla allows this.
>
> 4714: Vpopmail handling of aliases fails -- partly fixed
> ~ - Resolving vpopmail aliases is supported with the attached patch,
> although it doesn't do recursion, but only one additional try. Again I
> don't think this should be done in spamd or spamassassin codebase at all.
>
> 5798: spamd vpopmail support is broke -- fixed
>
>
> I don't really like vpopmail myself and I have only one server using it
> remaining, but I could help out with testing/resolving further issues.
>
> Regards, Daniel
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFIVGKPjG7gjygyQSURAnSzAJ42DnGzd7f7T/mL3+HWSsXZIdrL+gCeJz9y
> +fYFhBhVcnNk5UQwTOOpNSk=
> =b3R7
> -----END PGP SIGNATURE-----
> Index: spamd/spamd.raw
> ===================================================================
> --- spamd/spamd.raw (Revision 667845)
> +++ spamd/spamd.raw (Arbeitskopie)
> @@ -2084,6 +2084,30 @@
>
> if ($prefsfrom eq $suidto) {
> $userdir = $suiddir; # reuse the already-looked-up info
> + } elsif ( $opt{'vpopmail'} ) {
> + #
> + # If vpopmail config enabled then set $userdir to virtual homedir
> + #
> + my $vpopdir = $suiddir; # This should work with common vpopmail setups
> + $userdir = `$vpopdir/bin/vuserinfo -d \Q$username\E`;
> + if ($? != 0) {
> + #
> + # If vuserinfo failed $username could be an alias
> + #
> + $userdir = `$vpopdir/bin/valias \Q$username\E`;
> + if ($? == 0) {
> + if ($userdir =~ /.+ -> &(.+)/) {
> + #
> + # another alias - it could point to an alias again, but we'll
> try to resolve it only once
> + #
> + $userdir = `$vpopdir/bin/vuserinfo -d \Q$1\E`;
> + }
> + $userdir =~ s,.+ -> (/.+)/Maildir/,$1,;
> + } else {
> + undef($userdir);
> + }
> + }
> + chomp($userdir);
> } else {
> $userdir = (getpwnam($prefsfrom))[7];
> }
> @@ -2108,25 +2132,6 @@
> sub handle_user_set_user_prefs {
> my ($dir, $username) = @_;
>
> - # If vpopmail config enabled then set $dir to virtual homedir
> - #
> - if ( $opt{'vpopmail'} ) {
> - my $vpopdir = $dir;
> - $dir = `$vpopdir/bin/vuserinfo -d \Q$username\E`;
> - if ($? != 0) {
> - #
> - # If vuserinfo failed $username could be an alias
> - #
> - $dir = `$vpopdir/bin/valias \Q$username\E`;
> - if ($? == 0 && $dir !~ /.+ -> &/) {
> - $dir =~ s,.+ -> (/.+)/Maildir/,$1,;
> - } else {
> - undef($dir);
> - }
> - }
> - chomp($dir);
> - }
> -
> # don't do this if we weren't passed a directory
> if ($dir) {
> my $cf_file = $dir . "/.spamassassin/user_prefs";