Author: adam-guest
Date: 2008-10-12 15:37:36 +0000 (Sun, 12 Oct 2008)
New Revision: 1661

Modified:
   trunk/debian/changelog
   trunk/scripts/bts.pl
Log:
Trim anything that doesn't look like an e-mail address from $DEBEMAIL or
$EMAIL before using it for un/claim or un/subscribe. (Closes: #501162)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-10-12 15:27:46 UTC (rev 1660)
+++ trunk/debian/changelog      2008-10-12 15:37:36 UTC (rev 1661)
@@ -6,6 +6,8 @@
     + If a HELO is not specified then attempt to use the content of
       /etc/mailname instread.
     + Expand on the definition of "claim" in the manpage. (Closes: #501142)
+    + Trim anything that doesn't look like an e-mail address from $DEBEMAIL or
+      $EMAIL before using it for un/claim or un/subscribe. (Closes: #501162)
   * checkbashisms: Recognise brace expansions containing a leading or
     trailing empty value ("{,foo}", etc). Thanks Jonny Lamb.
     (Closes: #499971)

Modified: trunk/scripts/bts.pl
===================================================================
--- trunk/scripts/bts.pl        2008-10-12 15:27:46 UTC (rev 1660)
+++ trunk/scripts/bts.pl        2008-10-12 15:37:36 UTC (rev 1661)
@@ -1518,6 +1518,7 @@
     if (! length $claim) {
        die "bts claim: use what claim token?\n";
     }
+    $claim=extractemail($claim);
     bts_user("[EMAIL PROTECTED]");
     bts_usertags("$bug" , " + $claim");
 }
@@ -1537,6 +1538,7 @@
     if (! length $claim) {
        die "bts unclaim: use what claim token?\n";
     }
+    $claim=extractemail($claim);
     bts_user("[EMAIL PROTECTED]");
     bts_usertags("$bug" , " - $claim");
 }
@@ -1654,6 +1656,7 @@
     else {
        $email ||= $ENV{'DEBEMAIL'};
        $email ||= $ENV{'EMAIL'};
+       $email = extractemail($email);
     }
     opts_done(@_);
     mailto('subscription request for bug #' . $bug, '',
@@ -1679,6 +1682,7 @@
     else {
        $email ||= $ENV{'DEBEMAIL'};
        $email ||= $ENV{'EMAIL'};
+       $email = extractemail($email);
     }
     opts_done(@_);
     mailto('unsubscription request for bug #' . $bug, '',
@@ -2367,6 +2371,16 @@
     return $_;
 }
 
+sub extractemail() {
+    my $thing=shift or die "bts: extract e-mail from what?\n";
+
+    if ($thing =~ /^(.*?)\s+<(.*)>\s*$/) {
+       $thing = $2;
+    }
+
+    return $thing;
+}
+
 # A simplified version of mailbtsall which sends one message only to
 # a specified address using the specified email From: header
 sub mailto {



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to