You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2010/02/19 14:21:03 UTC

[Bug 6340] New: Impossible to find user home directory of VPOPMAIL alias

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

           Summary: Impossible to find user home directory of VPOPMAIL
                    alias
           Product: Spamassassin
           Version: 3.3.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P5
         Component: spamc/spamd
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: asossi@dotcom.ts.it


Created an attachment (id=4673)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4673)
proposed patch

The function 'handle_user_vpopmail' is unable to find the user home directory
(userdir) of a real user defined into the alias (DotQmail file). The bug is
similar to the #2536. The patch written for version 3.2.5 is not implemented in
version 3.3.
I rewrote the patch. It searchs userdir recursively from the alias defined as
email address (real or another alias) or as 'maildir'. I tested the patch on a
production server whit more than 100 domains, 300 real email address and 150
aliases.
My configuration is FreeBSD 7.1-RELEASE, perl 5.10 (installed from ports), and
SpamAssassin 3.3 (installed from ports).Is it possible to insert this patch in
the next version of SpamAssassin?

Test and comment please.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
  Status Whiteboard|needs 1 vote                |

--- Comment #16 from Mark Martinec <Ma...@ijs.si> 2010-03-10 17:42:21 UTC ---
trunk:
  Bug 6340, small update according to offline correspondence
  with Andrej Sossi, the original patch author
Sending spamd/spamd.raw
Committed revision 921458.

3.3:
  Bug 6340, small update according to offline correspondence
  with Andrej Sossi, the original patch author
Sending spamd/spamd.raw
Committed revision 921471.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #12 from Sossi Andrej <as...@dotcom.ts.it> 2010-03-02 14:35:50 UTC ---
Created an attachment (id=4686)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4686)
regexp correction

bout CLA there is no problem to remove my NICk name from patch.

I tested the Kevin's patch and it works fine. I putted it on our production
server and I'm looking the log. If I see any problem then I'll report.

I modify again Kevin's (my) patch with more correct regexp to check email
address in DotQmail file. '@' is not sufficient to determinate if line is an
email address. For example:

#test1@test.com
| /path/to/my/program test2@test.com
test3@test.com

Only test3 is email an valid address.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #19 from Sossi Andrej <as...@dotcom.ts.it> 2011-05-24 17:52:39 UTC ---
Yes, two spaces are wrong, one space is correct.
This error was corrected in version 949513 by Mark Martinec. Now in the SVN is
correct version.

I mean this bug is closed.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Sossi Andrej <as...@dotcom.ts.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asossi@dotcom.ts.it

--- Comment #14 from Sossi Andrej <as...@dotcom.ts.it> 2010-03-02 18:34:00 UTC ---
(In reply to comment #13)
> > Created an attachment (id=4686)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4686) [details]
[details]
> > regexp correction
> 
> Which is (compared to the already applied changes):
> 
> -  } elsif ($vpopusername =~ /\@/) {
> +  } elsif ($vpopusername =~ /^[a-z0-9._%+-]+\@[a-z0-9.-]+\.[a-z]{2,4}$/) {
> 
> What about capitals in the email address?
> In principle any character is allowed in a mailbox name, as long as it is
> in double quotes. And the IDN ccTLDs allow a '-' and digits in the name.

Qmail not allow email with capitals letter, it automatic lowercase all
cheracters and I forgot in regexp. Sorry. About other characters I not sure. I
not know any top level domain with number.
Qmail not allow double quotes or other special character in forward line. From
documentation:
[...]
# the following examples are WRONG
&me@new
&<me...@new.job.com>
& me@new.job.com
&me@new.job.com (New Address)
[...]

I tested also
&"me@new.job.com"
and qmail said:
Sorry, I couldn't find any host named new.job.com". (#5.1.2)


Corrected regexp:
    } elsif ($vpopusername =~ /^[^#\| ][^\@ ]+\@[^\@ ]+\.[a-zA-Z]{2,4}$/) {

and correct also:
-        if ($vpopusername =~ s{(/.+)/Maildir/}{$1}) {
+        if ($vpopusername =~ s{^(/.+)/Maildir/$}{$1}) {
Previously regexp match also:
#/usr/local/vpopmail/domains/foo/bar
but it is a comment.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #6 from Kevin Golding <ca...@gmail.com> 2010-03-02 10:52:20 UTC ---
Created an attachment (id=4685)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4685)
Edge cases

Just to be awkward a different patch.

Both previous patches miss a few edge cases (alias domains and mailing lists) -
by removing the die() mail to alias domains is still processed.  (Basically
it's Mark's patch with some edge case thinking I badgered Sossi about on the
previous bug brought in.)  In theory it should handle mailing lists/mail routed
to scripts also but I've not seen any yet.

This is more in tune with how it was processed in 3.2.5.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #8 from Justin Mason <jm...@jmason.org> 2010-03-02 12:58:41 UTC ---
(In reply to comment #6)
> Just to be awkward a different patch.
> 
> Both previous patches miss a few edge cases (alias domains and mailing lists) -
> by removing the die() mail to alias domains is still processed.  (Basically
> it's Mark's patch with some edge case thinking I badgered Sossi about on the
> previous bug brought in.)  In theory it should handle mailing lists/mail routed
> to scripts also but I've not seen any yet.
> 
> This is more in tune with how it was processed in 3.2.5.

I've had a quick look, and ran the tests (as well as 'sudo make test
TEST_FILES=t/root_spamd*') and all passed.  so I'm +1

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #10 from Mark Martinec <Ma...@ijs.si> 2010-03-02 14:01:34 UTC ---
Ok, I'm checking-in the patch - with die replaced by a dbg,
and without the redundant 'if' block.  Please test the change.

trunk:
Sending spamd/spamd.raw
Committed revision 918041.

3.3:
Sending spamd/spamd.raw
Committed revision 918042.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #3 from Mark Martinec <Ma...@ijs.si> 2010-03-01 17:13:15 UTC ---
Created an attachment (id=4680)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4680)
alternative proposed patch

The attached patch is mostly a cosmetic brushup of the original proposed
patch: quote @ in a regexp, avoid too long lines, allow username "0".
Please test it.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #7 from Mark Martinec <Ma...@ijs.si> 2010-03-02 11:19:58 UTC ---
> Just to be awkward a different patch. 
> Both previous patches miss a few edge cases (alias domains and mailing lists)

Thanks!

> by removing the die() mail to alias domains is still processed

Fine with me. We depend on actual users of vpopmail for input and testing.

> (Basically it's Mark's patch with some edge case thinking I badgered
> Sossi about on the previous bug brought in.) In theory it should handle
> mailing lists/mail routed to scripts also but I've not seen any yet.
> This is more in tune with how it was processed in 3.2.5.

Here is a diff between our (latest) versions:

--- spamd.raw.mark    2010-03-02 12:00:16.000000000 +0100
+++ spamd.raw.kevin   2010-03-02 12:04:40.000000000 +0100
@@ -2204,4 +2204,5 @@
     if (!defined($userdir)) {
-      die "failed to resolve vpopmail user/alias '$username' ".
-          "using vuserinfo/valias";
+      # A .qmail handler
+      undef $userdir;
+      last;
     }
@@ -2211,3 +2212,2 @@
     undef $userdir;
-    die "failed to resolve vpopmail user/alias '$username' in time
($vpoptimeout seconds)";
   } else {


I fail to see a point in: if (!defined($userdir)) { undef $userdir  } .
Also, what does a 'last' in that block do? We are already outside the loop.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Kevin Golding <ca...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |caomhin@gmail.com

--- Comment #1 from Kevin Golding <ca...@gmail.com> 2010-02-22 09:06:01 UTC ---
As there was a port revision bump over the weekend I just dropped this patch
into files and let ports handle it all.  The patched applied cleanly and
appears to be working as expected for me.

+1

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Justin Mason <jm...@jmason.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
                 CC|                            |jm@jmason.org
            Summary|Impossible to find user     |[review] Impossible to find
                   |home directory of VPOPMAIL  |user home directory of
                   |alias                       |VPOPMAIL alias
  Status Whiteboard|                            |needs 1 vote

--- Comment #2 from Justin Mason <jm...@jmason.org> 2010-03-01 15:57:29 UTC ---
I don't think we need a CLA for a patch of this size. setting the bug to review
state.

+1

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #11 from Kevin Golding <ca...@gmail.com> 2010-03-02 14:18:45 UTC ---
(In reply to comment #10)
> Ok, I'm checking-in the patch - with die replaced by a dbg,
> and without the redundant 'if' block.  Please test the change.

A couple of test emails suggest no problems.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #15 from Mark Martinec <Ma...@ijs.si> 2010-03-02 18:54:03 UTC ---
> Qmail not allow email with capitals letter, it automatic lowercase all
> cheracters and I forgot in regexp.

Does it make a syntax error when a capital letter is present?
If not, it should be allowed. The only purpose of that regexp is parsing,
not e-mail address syntax validation.

> About other characters I not sure. I not know any top level domain with number.

Here is one: test@test.xn--p1ai

See:
  https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6353#c10

> Corrected regexp:
>     } elsif ($vpopusername =~ /^[^#\| ][^\@ ]+\@[^\@ ]+\.[a-zA-Z]{2,4}$/) {

A TLD can have more than 4 characters, e.g.:  .museum, .travel .
See:
  http://en.wikipedia.org/wiki/Sponsored_top-level_domain

Do not be too strict there, the only purpose is to parse that config line.
Perhaps even splitting on whitespace might suffice.

> and correct also:
> -        if ($vpopusername =~ s{(/.+)/Maildir/}{$1}) {
> +        if ($vpopusername =~ s{^(/.+)/Maildir/$}{$1}) {
> Previously regexp match also:
> #/usr/local/vpopmail/domains/foo/bar
> but it is a comment.

Ok, thanks, will apply that on the next round.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #9 from Kevin Golding <ca...@gmail.com> 2010-03-02 13:11:08 UTC ---
(In reply to comment #7)

> I fail to see a point in: if (!defined($userdir)) { undef $userdir  } .
> Also, what does a 'last' in that block do? We are already outside the loop.

Both those will largely come down to my stubborn determination to finish what I
started despite forgetting to switch off my phone, in my distraction I didn't
notice I was out of the loop.  I think in the 3.2.5 patch the check was still
done inside the loop so when I first thought I was still in there I didn't
double check.

As for the other part..  I was mainly looking at the die() part of the
statement which I wanted to kick out.  Given the disturbances here this morning
I must confess I didn't really think about the if() but logically I guess that
whole statement should be purged now we don't die() in there.

Basically just I assumed it was a trivial enough tweak I didn't need to worry
about my mind being elsewhere and I should have.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P5                          |P3
   Target Milestone|Undefined                   |3.3.1

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |major

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Sossi Andrej <as...@dotcom.ts.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #17 from Sossi Andrej <as...@dotcom.ts.it> 2010-05-26 06:13:43 EDT ---
One of patch is wrong. Please correct:

-      if ($vpopusername_tainted =~ /->  &?(.+)$/) {
+      if ($vpopusername_tainted =~ /-> &?(.+)$/) {

Here's one more space. It's possible fix this in 3.3.2?
Thanks.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #4 from Justin Mason <jm...@jmason.org> 2010-03-01 23:00:45 UTC ---
+1 to Mark's alt patch

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |kmcgrail@pccc.com
         Resolution|                            |INVALID

--- Comment #18 from Kevin A. McGrail <km...@pccc.com> 2011-05-24 16:30:31 UTC ---
(In reply to comment #17)
> One of patch is wrong. Please correct:
> 
> -      if ($vpopusername_tainted =~ /->  &?(.+)$/) {
> +      if ($vpopusername_tainted =~ /-> &?(.+)$/) {
> 
> Here's one more space. It's possible fix this in 3.3.2?
> Thanks.

Best I can tell, this is in 3.3.2rc1 in spamd.raw and there was no reason to
reopen this unless you meant to have two spaces and the patch above is
reversed.

      if ($vpopusername_tainted =~ /-> &?(.+)$/) {
        $vpopusername = untaint_var($1);
        if ($vpopusername =~ s{^(/.+)/Maildir/$}{$1}) {
          # this is the path to a real mailbox
          $userdir = $vpopusername;

Did you mean you WANT it to be 

+      if ($vpopusername_tainted =~ /-> &?(.+)$/) {
-      if ($vpopusername_tainted =~ /->  &?(.+)$/) {

regards,
KAM

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #13 from Mark Martinec <Ma...@ijs.si> 2010-03-02 15:28:32 UTC ---
> Created an attachment (id=4686)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4686) [details]
> regexp correction

Which is (compared to the already applied changes):

-  } elsif ($vpopusername =~ /\@/) {
+  } elsif ($vpopusername =~ /^[a-z0-9._%+-]+\@[a-z0-9.-]+\.[a-z]{2,4}$/) {

What about capitals in the email address?
In principle any character is allowed in a mailbox name, as long as it is
in double quotes. And the IDN ccTLDs allow a '-' and digits in the name.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6340] [review] Impossible to find user home directory of VPOPMAIL alias

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6340

--- Comment #5 from Kevin Golding <ca...@gmail.com> 2010-03-02 09:34:28 UTC ---
+1 on the new patch also.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.