my $buglog = buglog($ref);
-if ($ENV{REQUEST_METHOD} eq 'HEAD' and not defined($att) and not $mbox) {
+if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'HEAD' and not defined($att) and not $mbox) {
print "Content-Type: text/html; charset=utf-8\n";
my @stat = stat $buglog;
if (@stat) {
push @dlargs, "filename=$filename" if $filename ne '';
my $printname = $filename;
$printname = 'Message part ' . ($#$attachments + 1) if $filename eq '';
- $$this .= '[<a href="' . dlurl(@dlargs) . qq{">$printname</a> } .
+ $$this .= '[<a href="' . bugurl(@dlargs) . qq{">$printname</a> } .
"($type, $disposition)]\n\n";
if ($msg and defined($att) and $att eq $#$attachments) {
# Add links to the cloned bugs
$output =~ s{(Bug )(\d+)( cloned as bugs? )(\d+)(?:\-(\d+)|)}{$1.bug_links($2).$3.bug_links($4,$5)}eo;
$output .= '<a href="' . bugurl($ref, 'msg='.($msg_number+1)) . '">Full text</a> and <a href="' .
- bugurl($ref, 'msg='.($msg_number+1)) . '&mbox=yes">rfc822 format</a> available.</em>';
+ bugurl($ref, 'msg='.($msg_number+1), 'mbox') . '">rfc822 format</a> available.</em>';
}
elsif (/recips/) {
my ($msg_id) = $record->{text} =~ /^Message-Id:\s+<(.+)>/im;
elsif (defined $msg_id) {
$$seen_msg_ids{$msg_id} = 1;
}
- $output .= 'View this message in <a href="' . bugurl($ref, "msg=$msg_number") . '&mbox=yes">rfc822 format</a></em>';
+ $output .= 'View this message in <a href="' . bugurl($ref, "msg=$msg_number", "mbox") . '">rfc822 format</a></em>';
$output .= '<pre class="message">' .
handle_email_message($record->{text},
ref => $bug_number,
"<BR>" . $title . "</H1>\n";
print "$descriptivehead\n";
-printf "<p>View this report as an <a href=\"%s\">mbox folder</a>.</p>\n", mboxurl($ref);
+printf "<p>View this report as an <a href=\"%s\">mbox folder</a>.</p>\n", bugurl($ref, "mbox");
print "<HR>";
print "$log";
print "<HR>";
my $common_raw_sort = 0;
my $common_bug_reverse = 0;
+my $common_leet_urls = 0;
+
my %common_reverse = (
'pending' => 0,
'severity' => 0,
sub readparse {
my ($in, $key, $val, %ret);
- if (defined $ENV{"QUERY_STRING"} && $ENV{"QUERY_STRING"} ne "") {
+ if ($#ARGV >= 0) {
+ $in = join("&", map { s/&/%26/g; s/;/%3b/g; $_ } @ARGV);
+ } elsif (defined $ENV{"QUERY_STRING"} && $ENV{"QUERY_STRING"} ne "") {
$in=$ENV{QUERY_STRING};
} elsif(defined $ENV{"REQUEST_METHOD"}
&& $ENV{"REQUEST_METHOD"} eq "POST")
} else {
return;
}
+ if (defined $ENV{"HTTP_COOKIE"}) {
+ my $x = $ENV{"HTTP_COOKIE"};
+ $x =~ s/;\s+/;/g;
+ $in = "$x;$in";
+ }
foreach (split(/[&;]/,$in)) {
s/\+/ /g;
($key, $val) = split(/=/,$_,2);
}
$ret{$key}=$val;
}
+
$debug = 1 if (defined $ret{"debug"} && $ret{"debug"} eq "aj");
+
+ $common_leet_urls = 1
+ if (defined $ret{"leeturls"} && $ret{"leeturls"} eq "yes");
+
return %ret;
}
sub urlargs {
my $args = '';
- $args .= "&archive=yes" if $common_archive;
- $args .= "&repeatmerged=no" unless $common_repeatmerged;
- $args .= "&version=$common_version" if defined $common_version;
- $args .= "&dist=$common_dist" if defined $common_dist;
- $args .= "&arch=$common_arch" if defined $common_arch;
+ $args .= ";archive=yes" if $common_archive;
+ $args .= ";repeatmerged=no" unless $common_repeatmerged;
+ $args .= ";version=$common_version" if defined $common_version;
+ $args .= ";dist=$common_dist" if defined $common_dist;
+ $args .= ";arch=$common_arch" if defined $common_arch;
return $args;
}
-sub submitterurl {
- my $ref = shift || "";
- my $params = "submitter=" . emailfromrfc822($ref);
- $params .= urlargs();
- return urlsanit("pkgreport.cgi" . "?" . $params);
-}
-
-sub mainturl {
- my $ref = shift || "";
- my $params = "maint=" . emailfromrfc822($ref);
- $params .= urlargs();
- return urlsanit("pkgreport.cgi" . "?" . $params);
-}
+sub submitterurl { pkg_etc_url(emailfromrfc822($_[0] || ""), "submitter"); }
+sub mainturl { pkg_etc_url(emailfromrfc822($_[0] || ""), "maint"); }
+sub pkgurl { pkg_etc_url($_[0] || "", "pkg"); }
+sub srcurl { pkg_etc_url($_[0] || "", "src"); }
+sub tagurl { pkg_etc_url($_[0] || "", "tag"); }
-sub pkgurl {
+sub pkg_etc_url {
my $ref = shift;
- my $params = "pkg=$ref";
- $params .= urlargs();
- return urlsanit("pkgreport.cgi" . "?" . "$params");
-}
-
-sub srcurl {
- my $ref = shift;
- my $params = "src=$ref";
- $params .= urlargs();
- return urlsanit("pkgreport.cgi" . "?" . "$params");
-}
-
-sub tagurl {
- my $ref = shift;
- my $params = "tag=$ref";
- $params .= urlargs();
- return urlsanit("pkgreport.cgi" . "?" . "$params");
+ my $code = shift;
+ if ($common_leet_urls) {
+ $code = "package" if ($code eq "pkg");
+ $code = "source" if ($code eq "src");
+ return urlsanit("/x/$code/$ref");
+ } else {
+ my $params = "$code=$ref";
+ $params .= urlargs();
+ return urlsanit("pkgreport.cgi" . "?" . $params);
+ }
}
sub urlsanit {
sub bugurl {
my $ref = shift;
my $params = "bug=$ref";
- foreach my $val (@_) {
- $params .= "\&msg=$1" if ($val =~ /^msg=([0-9]+)/);
- $params .= "\&archive=yes" if (!$common_archive && $val =~ /^archive.*$/);
- }
- $params .= "&archive=yes" if ($common_archive);
- $params .= "&repeatmerged=no" unless ($common_repeatmerged);
+ my $filename = '';
- return urlsanit("bugreport.cgi" . "?" . "$params");
-}
+ if ($common_leet_urls) {
+ my $msg = "";
+ my $mbox = "";
+ my $att = "";
+ foreach my $val (@_) {
+ $mbox = "/mbox" if ($val eq "mbox");
+ $msg = "/$1" if ($val =~ /^msg=([0-9]+)/);
+ $att = "/$1" if ($val =~ /^att=([0-9]+)/);
+ $filename = "/$1" if ($val =~ /^filename=(.*)$/);
+ }
+ my $ext = "";
+ if ($mbox ne "") {
+ $ext = $mbox;
+ } elsif ($att ne "") {
+ $ext = "$att$filename";
+ }
+ return urlsanit("/x/$ref$msg$ext");
+ } else {
+ foreach my $val (@_) {
+ $params .= ";mbox=yes" if ($val eq "mbox");
+ $params .= ";msg=$1" if ($val =~ /^msg=([0-9]+)/);
+ $params .= ";att=$1" if ($val =~ /^att=([0-9]+)/);
+ $filename = $1 if ($val =~ /^filename=(.*)$/);
+ $params .= ";archive=yes" if (!$common_archive && $val =~ /^archive.*$/);
+ }
+ $params .= ";archive=yes" if ($common_archive);
+ $params .= ";repeatmerged=no" unless ($common_repeatmerged);
-sub dlurl {
- my $ref = shift;
- my $params = "bug=$ref";
- my $filename = '';
- foreach my $val (@_) {
- $params .= "\&$1=$2" if ($val =~ /^(msg|att)=([0-9]+)/);
- $filename = $1 if ($val =~ /^filename=(.*)$/);
- }
- $params .= "&archive=yes" if ($common_archive);
- my $pathinfo = '';
- $pathinfo = '/'.uri_escape($filename) if $filename ne '';
+ my $pathinfo = '';
+ $pathinfo = '/'.uri_escape($filename) if $filename ne '';
- return urlsanit("bugreport.cgi$pathinfo?$params");
+ return urlsanit("bugreport.cgi" . $pathinfo . "?" . $params);
+ }
}
-sub mboxurl {
- my $ref = shift;
- return urlsanit("bugreport.cgi" . "?" . "bug=$ref&mbox=yes");
-}
+sub dlurl { bugurl(@_); }
+sub mboxurl { return bugurl($ref, "mbox"); }
sub allbugs {
return @{getbugs(sub { 1 })};
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use POSIX qw(strftime);
+require './common.pl';
+
+$ENV{"HTTP_COOKIES"} = "";
+my %param = readparse();
+
+my $clear = (defined $param{"clear"} && $param{"clear"} eq "yes");
+my @time_now = gmtime(time());
+my $time_future = strftime("%a, %d-%b-%Y %T GMT",
+ 59, 59, 23, 31, 11, $time_now[5]+10);
+my $time_past = strftime("%a, %d-%b-%Y %T GMT",
+ 59, 59, 23, 31, 11, $time_now[5]-10);
+
+my @cookie_options = qw(repeatmerged terse reverse trim);
+
+print "Content-Type: text/html; charset=utf-8\n";
+
+for my $c (@cookie_options) {
+ if (defined $param{$c}) {
+ printf "Set-Cookie: %s=%s; expires=%s; domain=%s; path=/\n",
+ $c, $param{$c}, $time_future, "bugs.debian.org";
+ } elsif ($clear) {
+ printf "Set-Cookie: %s=%s; expires=%s; domain=%s; path=/\n",
+ $c, "", $time_past, "bugs.debian.org";
+ }
+}
+print "\n";
+print "<p>Cookies set!\n";
+for my $c (@cookie_options) {
+ if (defined $param{$c}) {
+ printf "<br>Set %s=%s\n", $c, $param{$c};
+ } elsif ($clear) {
+ printf "<br>Cleared %s\n", $c;
+ } else {
+ printf "<br>Didn't touch %s (use clear=yes to clear)\n", $c;
+ }
+}
--- /dev/null
+#!/usr/bin/perl -wT
+
+package debbugs;
+
+use strict;
+
+#require '/usr/lib/debbugs/errorlib';
+require './common.pl';
+
+require '/etc/debbugs/config';
+require '/etc/debbugs/text';
+
+use vars qw($gPackagePages $gWebDomain);
+
+if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'HEAD') {
+ print "Content-Type: text/html; charset=utf-8\n\n";
+ exit 0;
+}
+
+my $path = $ENV{PATH_INFO};
+my %param = readparse();
+
+if ($path =~ m,^/(\d+)(/(\d)+(/.*)?)?$,) {
+ my $bug = $1;
+ my $msg = $3;
+ my $rest = $4;
+
+ my @args = ("bug=$bug");
+ push @args, "msg=$msg" if (defined $msg);
+ if ($rest eq "") {
+ 1;
+ } elsif ($rest eq "/mbox") {
+ push @args, "mbox=yes";
+ } elsif ($rest =~ m,^/att/(\d+)(/[^/]+)?$,) {
+ push @args, "att=$1";
+ push @args, "filename=$2" if (defined $2);
+ } else {
+ bad_url();
+ }
+
+ { $ENV{"PATH"}="/bin"; exec "./bugreport.cgi", "leeturls=yes", @args; }
+
+ print "Content-Type: text/html; charset=utf-8\n\n";
+ print "<p>Couldn't execute bugreport.cgi!!";
+ exit(0);
+} else {
+ my $suite;
+ my $arch;
+ if ($path =~ m,^/suite/([^/]*)(/.*)$,) {
+ $suite = $1; $path = $2;
+ } elsif ($path =~ m,^/arch/([^/]*)(/.*)$,) {
+ $arch = $1; $path = $2;
+ } elsif ($path =~ m,^/suite-arch/([^/]*)/([^/]*)(/.*)$,) {
+ $suite = $1; $arch = $2; $path = $3;
+ }
+
+ my $type;
+ my $what;
+ my $selection;
+ if ($path =~ m,^/(package|source|maint|submitter|severity|tag|user-tag)/([^/]+)(/(.*))?$,) {
+ $type = $1; $what = $2; $selection = $4 || "";
+ if ($selection ne "") {
+ unless ($type =~ m,^(package|source|user-tag)$,) {
+ bad_url();
+ }
+ }
+ my @what = split /,/, $what;
+ my @selection = split /,/, $selection;
+ my $typearg = $type;
+ $typearg = "pkg" if ($type eq "package");
+ $typearg = "src" if ($type eq "source");
+
+ my @args = ();
+ push @args, $typearg . "=" . join(",", @what);
+ push @args, "version=" . join(",", @selection)
+ if ($type eq "package" and $#selection >= 0);
+ push @args, "utag=" . join(",", @selection)
+ if ($type eq "user-tag" and $#selection >= 0);
+ push @args, "arch=" . $arch if (defined $arch);
+ push @args, "suite=" . $suite if (defined $suite);
+
+ { $ENV{"PATH"}="/bin"; exec "./pkgreport.cgi", "leeturls=yes", @args }
+
+ print "Content-Type: text/html; charset=utf-8\n\n";
+ print "<p>Couldn't execute pkgreport.cgi!!";
+ exit(0);
+ } else {
+ bad_url();
+ }
+}
+
+sub bad_url {
+ print "Content-Type: text/html; charset=utf-8\n\n";
+ print "<p>Bad URL :(\n";
+ exit(0);
+}