X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FRecipients.pm;h=a06e69249f4f41877ea92613b4aabf40cf6cb192;hb=ff1a27527b4209e9f07c97e38da373eb4f0a45d9;hp=904106bc8e2a26a01eed892bbbe775cd3e2d2f52;hpb=9260707c653138683646791138d95549fa30e9ad;p=debbugs.git diff --git a/Debbugs/Recipients.pm b/Debbugs/Recipients.pm index 904106b..a06e692 100644 --- a/Debbugs/Recipients.pm +++ b/Debbugs/Recipients.pm @@ -46,7 +46,7 @@ use Params::Validate qw(:types validate_with); use Debbugs::Common qw(:misc :util); use Debbugs::Status qw(splitpackages isstrongseverity); -use Debbugs::Packages qw(binarytosource); +use Debbugs::Packages qw(binary_to_source); use Debbugs::Mail qw(get_addresses); @@ -114,7 +114,9 @@ sub add_recipients { for my $p (splitpackages($param{data}{package})) { $p = lc($p); if (defined $config{subscription_domain}) { - my @source_packages = binarytosource($p); + my @source_packages = binary_to_source(binary => $p, + source_only => 1, + ); if (@source_packages) { for my $source (@source_packages) { _add_address(recipients => $param{recipients}, @@ -140,18 +142,18 @@ sub add_recipients { type => 'bcc', ); } - if (defined(getmaintainers()->{$p})) { - $addmaint= getmaintainers()->{$p}; - print {$param{debug}} "MR|$addmaint|$p|$ref|\n"; - _add_address(recipients => $param{recipients}, - address => $addmaint, - reason => $p, - bug_num => $param{data}{bug_num}, - type => 'cc', - ); - print {$param{debug}} "maintainer add >$p|$addmaint<\n"; + my @maints = package_maintainer(binary => $p); + if (@maints) { + print {$param{debug}} "MR|".join(',',@maints)."|$p|$ref|\n"; + _add_address(recipients => $param{recipients}, + address => \@maints, + reason => $p, + bug_num => $param{data}{bug_num}, + type => 'cc', + ); + print {$param{debug}} "maintainer add >$p|".join(',',@maints)."<\n"; } - else { + else { print {$param{debug}} "maintainer none >$p<\n"; print {$param{transcript}} "Warning: Unknown package '$p'\n"; print {$param{debug}} "MR|unknown-package|$p|$ref|\n"; @@ -291,8 +293,13 @@ sub determine_recipients { $level = 'cc'; } } - # strip out all non-word non-spaces - $reason =~ s/[^\ \w]//g; + # RFC 2822 comments cannot contain specials and + # unquoted () or \; there's no reason for us to allow + # insane things here, though, so we restrict this even + # more to 20-7E ( -~) + $reason =~ s/\\/\\\\/g; + $reason =~ s/([\)\(])/\\$1/g; + $reason =~ s/[^\x20-\x7E]//g; push @reasons, $reason . ' for {'.join(',',@bugs).'}'; } if ($param{address_only}) { @@ -304,7 +311,10 @@ sub determine_recipients { } for (qw(to cc bcc)) { if ($param{$_}) { - return @{$final_recipients{$_}}; + if (exists $final_recipients{$_}) { + return @{$final_recipients{$_}||[]}; + } + return (); } } return %final_recipients;