# Usage: process nn
# Temps: incoming/Pnn
-use POSIX qw(strftime tzset);
-$ENV{"TZ"} = 'UTC';
-tzset();
+use POSIX qw(strftime);
use MIME::Parser;
use Debbugs::MIME qw(decode_rfc1522 create_mime_message);
use Debbugs::Mail qw(send_mail_message encode_headers);
use Debbugs::Packages qw(getpkgsrc);
+use Debbugs::User qw(read_usertags write_usertags);
-my $config_path = '/etc/debbugs';
-my $lib_path = '/usr/lib/debbugs';
+use Debbugs::CGI qw(html_escape);
+
+use Debbugs::Log qw(:misc);
# TODO DLA; needs config reworking and errorlib reworking
# use warnings;
# use strict;
-require "$config_path/config";
+use Debbugs::Status qw(:versions);
+use Debbugs::Config qw(:globals);
+my $lib_path = $gLibPath;
+
require "$lib_path/errorlib";
$ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
$fv =~ s/\s*$//;
print DEBUG ">$fn|$fv|\n";
$fn = lc $fn;
- $fv = lc $fv;
+ # Don't lc owner or forwarded
+ $fv = lc $fv unless $fh =~ /^(?:owner|forwarded|usertags|version|source-version)$/;
$pheader{$fn} = $fv;
print DEBUG ">$fn~$fv<\n";
}
if (defined $pheader{source}) {
$source_package = $pheader{source};
}
-elsif (defined $data->{package}) {
+elsif (defined $data->{package} or defined $pheader{package}) {
my $pkg_src = getpkgsrc();
- $source_package = $pkg_src->{$data->{package}};
+ $source_package = $pkg_src->{defined $data->{package}?$data->{package}:$pheader{package}};
}
-$source_pr_header = "X-$gProject-Pr-Source: $source_package\n"
- if length $source_package;
+$source_pr_header = "X-$gProject-PR-Source: $source_package\n"
+ if defined $source_package and length $source_package;
# Done and Forwarded Bugs
if ($codeletter eq 'D' || $codeletter eq 'F')
$receivedat= "forwarded\@$gEmailDomain";
$markaswhat= 'forwarded';
$set_forwarded= $header{'to'};
+ # Dissallow forwarded being set to this bug tracking system
+ if (defined $set_forwarded and $set_forwarded =~ /\Q$gEmailDomain\E/) {
+ undef $set_forwarded;
+ }
if ( length( $gListDomain ) > 0 && length( $gForwardList ) > 0 ) {
push @generalcc, "$gForwardList\@$gListDomain";
$generalcc= "$gForwardList\@$gListDomain";
"Content-Type" => 'text/plain; charset="utf-8"',
],<<END ,[join("\n",@msg)]),'',undef,1);
This is an automatic notification regarding your $gBug report
-#$ref: $data->{subject},
-which was filed against the $data->{package} package.
+which was filed against the $data->{package} package:
+
+#$ref: $data->{subject}
It has been closed by $markedby.
$data->{subject} = $subject;
$data->{msgid} = $header{'message-id'};
writebug($ref, $data);
+ # Deal with usertags
+ if (exists $pheader{usertags}) {
+ my $user = $replyto;
+ $user = $pheader{user} if exists $pheader{user};
+ $user =~ s/,.*//;
+ $user =~ s/^.*<(.*)>.*$/$1/;
+ $user =~ s/[(].*[)]//;
+ $user =~ s/^\s*(\S+)\s+.*$/$1/;
+ if ($user ne '' and Debbugs::User::is_valid_user($user)) {
+ $pheader{usertags} =~ s/(?:^\s+|\s+$)//g;
+ my %user_tags;
+ read_usertags(\%user_tags,$user);
+ for my $tag (split /[,\s]+/, $pheader{usertags}) {
+ if ($tag =~ /^[a-zA-Z0-9.+\@-]+/) {
+ my %bugs_with_tag;
+ @bugs_with_tag{@{$user_tags{$tag}}} = (1) x @{$user_tags{$tag}};
+ $bugs_with_tag{$ref} = 1;
+ $user_tags{$tag} = [keys %bugs_with_tag];
+ }
+ }
+ write_usertags(\%user_tags,$user);
+ }
+ else {
+ $brokenness .=<<END;
+Your message tried to set a usertag, but didn't have a valid
+user set ('$user' isn't valid)
+END
+ }
+ }
&overwrite("db-h/$hash/$ref.report",
join("\n",@msg)."\n");
}
&htmllog($newref ? "Report" : "Information", "forwarded",
join(', ',"$gSubmitList\@$gListDomain",@resentccs),
"<code>$gBug#$ref</code>".
- (length($data->{package})? "; Package <code>".&sani($data->{package})."</code>" : '').
+ (length($data->{package})? "; Package <code>".html_escape($data->{package})."</code>" : '').
".");
&sendmessage(<<END,["$gSubmitList\@$gListDomain",@resentccs],[@bccs]);
Subject: $gBug#$ref: $newsubject
&htmllog($newref ? "Report" : "Information", "forwarded",
$resentccval,
"<code>$gBug#$ref</code>".
- (length($data->{package}) ? "; Package <code>".&sani($data->{package})."</code>" : '').
+ (length($data->{package}) ? "; Package <code>".html_escape($data->{package})."</code>" : '').
".");
} else {
&htmllog($newref ? "Report" : "Information", "stored",
"",
"<code>$gBug#$ref</code>".
- (length($data->{package}) ? "; Package <code>".&sani($data->{package})."</code>" : '').
+ (length($data->{package}) ? "; Package <code>".html_escape($data->{package})."</code>" : '').
".");
}
&sendmessage(<<END,[@resentccs],[@bccs]);
END
}
-$htmlbreak= length($brokenness) ? "<p>\n".&sani($brokenness)."\n<p>\n" : '';
+$htmlbreak= length($brokenness) ? "<p>\n".html_escape($brokenness)."\n<p>\n" : '';
$htmlbreak =~ s/\n\n/\n<P>\n\n/g;
if (length($resentccval)) {
- $htmlbreak = " Copy sent to <code>".&sani($resentccval)."</code>.".
+ $htmlbreak = " Copy sent to <code>".html_escape($resentccval)."</code>.".
$htmlbreak;
}
unless (exists $header{'x-debbugs-no-ack'}) {
to $ref-$baddressroot\@$gEmailDomain (and *not*
to $baddress\@$gEmailDomain).
+If you have filed this report in error and wish to close it, please
+send mail to $ref-done\@$gEmailDomain with an explanation
+why the bug report should be closed.
+
Please do not reply to the address at the top of this message,
unless you wish to report a problem with the $gBug-tracking system.
$brokenness
it to $ref-$baddressroot\@$gEmailDomain (and *not*
to $baddress\@$gEmailDomain).
+If you have filed this report in error and wish to close it, please
+send mail to $ref-done\@$gEmailDomain with an explanation
+why the bug report should be closed.
+
Please do not reply to the address at the top of this message,
unless you wish to report a problem with the $gBug-tracking system.
$brokenness
it to $ref\@$gEmailDomain (and *not* to
$baddress\@$gEmailDomain).
+If you have filed this report in error and wish to close it, please
+send mail to $ref-done\@$gEmailDomain with an explanation
+why the bug report should be closed.
+
Please do not reply to the address at the top of this message,
unless you wish to report a problem with the $gBug-tracking system.
$brokenness
tracking system. Please ensure that you yourself have sent a copy of
the additional information to any relevant developers or mailing lists.
$resentccexplain
-If you wish to continue to submit further information on your problem,
+If you wish to continue to submit further information on this problem,
please send it to $ref-$baddressroot\@$gEmailDomain, as before.
Please do not reply to the address at the top of this message,
this problem report. It has been forwarded to the package maintainer(s)
(but not to other interested parties) to accompany the original report.
$resentccexplain
-If you wish to continue to submit further information on your problem,
+If you wish to continue to submit further information on this problem,
please send it to $ref-$baddressroot\@$gEmailDomain, as before.
Please do not reply to the address at the top of this message,
this problem report. It has been forwarded to the package maintainer(s)
and to other interested parties to accompany the original report.
$resentccexplain
-If you wish to continue to submit further information on your problem,
+If you wish to continue to submit further information on this problem,
please send it to $ref\@$gEmailDomain, as before.
Please do not reply to the address at the top of this message,
print DEBUG "failed open log err $!<\n";
&quit("opening db-h/$hash/$ref.log (li): $!");
}
- print(AP "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
+ print(AP "\7\n",escape_log(@log),"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!");
}
print(AP
"\6\n".
"<strong>$whatobj $whatverb</strong>".
- ($where eq '' ? "" : " to <code>".&sani($where)."</code>").
+ ($where eq '' ? "" : " to <code>".html_escape($where)."</code>").
":<br>\n". $desc.
"\n\3\n") || &quit("writing db-h/$hash/$ref.log (lh): $!");
close(AP) || &quit("closing db-h/$hash/$ref.log (lh): $!");
#save email to the log
open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lo): $!");
print(AP "\2\n",join("\4",@$recips),"\n\5\n",
- @{escapelog(stripbccs($msg))},"\n\3\n") ||
+ escape_log(stripbccs($msg)),"\n\3\n") ||
&quit("writing db-h/$hash/$ref.log (lo): $!");
close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!");