summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af068d2)
raw | patch | inline | side by side (parent: af068d2)
author | Robin H. Johnson <robbat2@gentoo.org> | |
Thu, 26 Apr 2007 02:37:19 +0000 (19:37 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 26 Apr 2007 04:11:15 +0000 (21:11 -0700) |
Always perform quoting of the recipient names if they contain periods,
previously only the author's address was treated this way. This stops sendmail
binaries from exploding the name into bad addresses.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
previously only the author's address was treated this way. This stops sendmail
binaries from exploding the name into bad addresses.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-send-email.perl | patch | blob | history |
diff --git a/git-send-email.perl b/git-send-email.perl
index ad83009e236c4b8be2fa0b4204ed340c0e205de5..e4fe8965bbb305bcf569d354d3d8cc4f9fc084a3 100755 (executable)
--- a/git-send-email.perl
+++ b/git-send-email.perl
return "$_";
}
+# If an address contains a . in the name portion, the name must be quoted.
+sub sanitize_address_rfc822
+{
+ my ($recipient) = @_;
+ my ($recipient_name) = ($recipient =~ /^(.*?)\s+</);
+ if ($recipient_name && $recipient_name =~ /\./ && $recipient_name !~ /^".*"$/) {
+ my ($name, $addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
+ $recipient = "\"$name\"$addr";
+ }
+ return $recipient;
+}
+
sub send_message
{
my @recipients = unique_email_list(@to);
+ @cc = (map { sanitize_address_rfc822($_) } @cc);
my $to = join (",\n\t", @recipients);
@recipients = unique_email_list(@recipients,@cc,@bcclist);
my $date = format_2822_time($time++);
}
my $cc = join(", ", unique_email_list(@cc));
-my ($author_name) = ($from =~ /^(.*?)\s+</);
- if ($author_name && $author_name =~ /\./ && $author_name !~ /^".*"$/) {
- my ($name, $addr) = ($from =~ /^(.*?)(\s+<.*)/);
- $from = "\"$name\"$addr";
- }
+ $from = sanitize_address_rfc822($from);
my $header = "From: $from
To: $to
Cc: $cc