[PATCH] send-email: quiet some warnings, reject invalid addresses

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

 



I'm not sure why we never actually rejected invalid addresses in
the first place.  We just seemed to be using our email validity
checkers to kill duplicates.

Now we just drop invalid email addresses completely and warn
the user about it.

Since we support local sendmail, we'll also accept username-only
addresses.

Signed-off-by: Eric Wong <normalperson@xxxxxxxx>

---

 git-send-email.perl |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

f069e9a9cee726d82dfeee1d477152a0fe0651c1
diff --git a/git-send-email.perl b/git-send-email.perl
index 0540e93..312a4ea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -307,6 +307,10 @@ our ($message_id, $cc, %mail, $subject, 
 
 sub extract_valid_address {
 	my $address = shift;
+
+	# check for a local address:
+	return $address if ($address =~ /^([\w\-]+)$/);
+
 	if ($have_email_valid) {
 		return Email::Valid->address($address);
 	} else {
@@ -498,9 +502,14 @@ sub unique_email_list(@) {
 	my @emails;
 
 	foreach my $entry (@_) {
-		my $clean = extract_valid_address($entry);
-		next if $seen{$clean}++;
-		push @emails, $entry;
+		if (my $clean = extract_valid_address($entry)) {
+			$seen{$clean} ||= 0;
+			next if $seen{$clean}++;
+			push @emails, $entry;
+		} else {
+			print STDERR "W: unable to extract a valid address",
+					" from: $entry\n";
+		}
 	}
 	return @emails;
 }
-- 
1.3.2.g7d11

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]