[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.2-116-ge910826



The following commit has been merged in the master branch:
commit e910826dcd8f93697d4fdde7953191d46d95aefe
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Sep 8 09:44:09 2011 +0200

    Catch "Name <Name <email>>" as an invalid email address

diff --git a/debian/changelog b/debian/changelog
index 95dd794..f91f382 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -197,6 +197,9 @@ lintian (2.5.3) UNRELEASED; urgency=low
       LANG.
     + [JW] Stricten the DCtrl parser to choke on some syntax errors
       that was silently ignored.  (Closes: #639516)
+  * lib/Lintian/Check.pm:
+    + [NT] Catch "Name <Name <Email>>" as a malformed email address.
+      (Closes: #640489)
   * lib/Lintian/Collect.pm:
     + [JW,NT] Create the source field from the package field if the
       former is not present.  This fixes a number of false-positves
diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index 2b948c6..5aa58ae 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -137,7 +137,16 @@ sub check_maintainer {
 
     # Some basic tests.
     my $malformed;
-    if ($extra) {
+    # If there is something after the mail address OR if there is a
+    # ">" after the last "@" in the mail it is malformed.  This
+    # happens with "name <name <email>>", where $mail will be "name
+    # <email>" (#640489).  Email::Valid->address (below) will accept
+    # this in most cases (because that is generally valid), but we
+    # only want Email::Valid to validate the "email" part and not the
+    # name (Policy allows "." to be unqouted in names, Email::Valid
+    # does not etc.).  Thus this check is to ensure we only pass the
+    # "email"-part to Email::Valid.
+    if ($extra or ($mail && $mail =~ m/\@[^\>\@]+\>[^\>\@]*$/o)) {
         tag "$field-address-malformed", $maintainer;
         $malformed = 1;
     }
@@ -159,7 +168,7 @@ sub check_maintainer {
     if (not $mail) {
         tag "$field-address-missing", $maintainer;
     } else {
-	if (not $malformed and not Email::Valid->address($mail)){
+	if (not $malformed and not Email::Valid->address($mail)) {
             # Either not a valid email or possibly missing a comma between
             # two entries.
             tag "$field-address-malformed", $maintainer;
diff --git a/t/tests/fields-uploaders/debian/debian/control.in b/t/tests/fields-uploaders/debian/debian/control.in
index 1338255..c8c67df 100644
--- a/t/tests/fields-uploaders/debian/debian/control.in
+++ b/t/tests/fields-uploaders/debian/debian/control.in
@@ -7,6 +7,7 @@ Uploaders: Mrs. Localhost <user@localhost>,
            One-name <has-only-1-name@elsewhere.com>,
            Malformed Email <@ddress@myspace.com>,
            John A. J. Doe <i.am.ok@somewhere.com>,
+           Doris Double-Email <Doris Double-Email <doris@demail.com>>,
            I have no email
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
diff --git a/t/tests/fields-uploaders/tags b/t/tests/fields-uploaders/tags
index 02f56ca..4db149f 100644
--- a/t/tests/fields-uploaders/tags
+++ b/t/tests/fields-uploaders/tags
@@ -1,4 +1,5 @@
 E: fields-uploaders source: uploader-address-is-on-localhost Mrs. Localhost <user@localhost>
+E: fields-uploaders source: uploader-address-malformed Doris Double-Email <Doris Double-Email <doris@demail.com>>
 E: fields-uploaders source: uploader-address-malformed Malformed Email <@ddress@myspace.com>
 E: fields-uploaders source: uploader-address-malformed Mrs. Localhost <user@localhost>
 E: fields-uploaders source: uploader-address-missing I have no email

-- 
Debian package checker


Reply to: