summaryrefslogtreecommitdiff
path: root/rt/bin
diff options
context:
space:
mode:
authorivan <ivan>2004-11-11 12:13:50 +0000
committerivan <ivan>2004-11-11 12:13:50 +0000
commitc582e92888b4a5553e1b4e5214cf35217e4a0cf0 (patch)
tree3fe7cd7bf22bd356b478f0de0dd8f0b140fcee23 /rt/bin
parent289340780927b5bac2c7604d7317c3063c6dd8cc (diff)
import rt 3.0.12
Diffstat (limited to 'rt/bin')
-rw-r--r--rt/bin/mason_handler.fcgi.in3
-rw-r--r--rt/bin/mason_handler.scgi.in1
-rw-r--r--rt/bin/rt-crontool.in2
-rw-r--r--rt/bin/rt.in50
-rw-r--r--rt/bin/webmux.pl.in4
5 files changed, 43 insertions, 17 deletions
diff --git a/rt/bin/mason_handler.fcgi.in b/rt/bin/mason_handler.fcgi.in
index a009663..52dddd3 100644
--- a/rt/bin/mason_handler.fcgi.in
+++ b/rt/bin/mason_handler.fcgi.in
@@ -33,8 +33,9 @@ my $h = &RT::Interface::Web::NewCGIHandler(@RT::MasonParameters);
require CGI::Fast;
RT::Init();
+RT::DropSetGIDPermissions();
+
-# Response loop
while ( my $cgi = CGI::Fast->new ) {
# the whole point of fastcgi requires the env to get reset here..
# So we must squash it again
diff --git a/rt/bin/mason_handler.scgi.in b/rt/bin/mason_handler.scgi.in
index 614d4d4..fdbf624 100644
--- a/rt/bin/mason_handler.scgi.in
+++ b/rt/bin/mason_handler.scgi.in
@@ -31,6 +31,7 @@ my $h = &RT::Interface::Web::NewCGIHandler(@RT::MasonParameters);
require CGI;
RT::Init();
+RT::DropSetGIDPermissions();
my $cgi = CGI->new;
if ( ( !$h->interp->comp_exists( $cgi->path_info ) )
diff --git a/rt/bin/rt-crontool.in b/rt/bin/rt-crontool.in
index 8ecc718..45f9aef 100644
--- a/rt/bin/rt-crontool.in
+++ b/rt/bin/rt-crontool.in
@@ -68,7 +68,7 @@ GetOptions( "search=s" => \$search,
"help" => \$help,
"verbose|v" => \$verbose );
-help() if $help;
+help() if $help or not $search or not $action;
# We _must_ have a search object
load_module($search);
diff --git a/rt/bin/rt.in b/rt/bin/rt.in
index 90369b5..b44e041 100644
--- a/rt/bin/rt.in
+++ b/rt/bin/rt.in
@@ -46,6 +46,8 @@ my %config = (
user => eval{(getpwuid($<))[0]} || $ENV{USER} || $ENV{USERNAME},
passwd => undef,
server => 'http://localhost/rt/',
+ query => undef,
+ orderby => undef,
),
config_from_file($ENV{RTCONFIG} || ".rtrc"),
config_from_env()
@@ -123,9 +125,9 @@ sub help {
my $title = $item->[2]{Title};
my @titles = ref $title eq 'ARRAY' ? @$title : $title;
- foreach $title (grep $_, @titles) {
- $help{$title} = $item->[2]{Text};
- }
+ foreach $title (grep $_, @titles) {
+ $help{$title} = $item->[2]{Text};
+ }
}
# What does the user want help with?
@@ -167,6 +169,9 @@ sub help {
sub list {
my ($q, $type, %data, $orderby);
+ if ($config{orderby}) {
+ $data{orderby} = $config{orderby};
+ }
my $bad = 0;
while (@ARGV) {
@@ -179,7 +184,7 @@ sub list {
$bad = 1, last unless get_var_argument(\%data);
}
elsif (/^-o$/) {
- $orderby = shift @ARGV;
+ $data{'orderby'} = shift @ARGV;
}
elsif (/^-([isl])$/) {
$data{format} = $1;
@@ -200,7 +205,11 @@ sub list {
$bad = 1; last;
}
}
-
+
+ if (!defined $q) {
+ $q = $config{query};
+ }
+
$type ||= "ticket";
unless ($type && defined $q) {
my $item = $type ? "query string" : "object type";
@@ -209,7 +218,7 @@ sub list {
}
return help("list", $type) if $bad;
- my $r = submit("$REST/search/$type", { query => $q, %data, orderby => $orderby || "" });
+ my $r = submit("$REST/search/$type", { query => $q, %data });
print $r->content;
}
@@ -514,7 +523,14 @@ sub comment {
my $a = $_ eq "-b" ? \@bcc : \@cc;
@$a = split /\s*,\s*/, shift @ARGV;
}
- elsif (/-m/) { $msg = shift @ARGV }
+ elsif (/-m/) {
+ $msg = shift @ARGV;
+ if ( $msg =~ /^-$/ ) {
+ undef $msg;
+ while (<STDIN>) { $msg .= $_ }
+ }
+ }
+
elsif (/-w/) { $wtime = shift @ARGV }
}
elsif (!$id && m|^(?:ticket/)?($idlist)$|) {
@@ -733,10 +749,10 @@ sub submit {
my ($head, $text) = split /\n\n/, $res->content, 2;
my ($status, @headers) = split /\n/, $head;
- $text =~ s/\n*$/\n/;
+ $text =~ s/\n*$/\n/ if ($text);
# "RT/3.0.1 401 Credentials required"
- if ($status !~ m#^RT/\d+(?:\.\d+)+(?:-?\w+)? (\d+) ([\w\s]+)$#) {
+ if ($status !~ m#^RT/\d+(?:\S+) (\d+) ([\w\s]+)$#) {
warn "rt: Malformed RT response from $config{server}.\n";
warn "(Rerun with RTDEBUG=3 for details.)\n" if $config{debug} < 3;
exit -1;
@@ -812,7 +828,7 @@ sub submit {
sub cookie {
my ($self) = @_;
my $cookie = $self->{sids}{$s}{$u};
- return defined $cookie ? "RT_SID=$cookie" : undef;
+ return defined $cookie ? "RT_SID_$cookie" : undef;
}
# Deletes the current session cookie.
@@ -835,7 +851,7 @@ sub submit {
my ($self, $response) = @_;
my $cookie = $response->header("Set-Cookie");
- if (defined $cookie && $cookie =~ /^RT_SID=([0-9A-Fa-f]+);/) {
+ if (defined $cookie && $cookie =~ /^RT_SID_(.[^;,\s]+=[0-9A-Fa-f]+);/) {
$self->{sids}{$s}{$u} = $1;
}
}
@@ -852,7 +868,7 @@ sub submit {
while (<F>) {
chomp;
next if /^$/ || /^#/;
- next unless m#^https?://[^ ]+ \w+ [0-9A-Fa-f]+$#;
+ next unless m#^https?://[^ ]+ \w+ [^;,\s]+=[0-9A-Fa-f]+$#;
my ($server, $user, $cookie) = split / /, $_;
$sids->{$server}{$user} = $cookie;
}
@@ -1061,7 +1077,7 @@ sub Form::compose {
sub config_from_env {
my %env;
- foreach my $k ("DEBUG", "USER", "PASSWD", "SERVER") {
+ foreach my $k ("DEBUG", "USER", "PASSWD", "SERVER", "QUERY", "ORDERBY") {
if (exists $ENV{"RT$k"}) {
$env{lc $k} = $ENV{"RT$k"};
}
@@ -1112,7 +1128,7 @@ sub parse_config_file {
chomp;
next if (/^#/ || /^\s*$/);
- if (/^(user|passwd|server)\s+([^ ]+)$/) {
+ if (/^(user|passwd|server|query|orderby)\s+(.*)\s?$/) {
$cfg{$1} = $2;
}
else {
@@ -1343,6 +1359,8 @@ Text:
- server <URL> URL to RT server.
- user <username> RT username.
- passwd <passwd> RT user's password.
+ - query <RT Query> Default RT Query for list action
+ - orderby <order> Default RT order for list action
Blank and #-commented lines are ignored.
@@ -1357,6 +1375,8 @@ Text:
- RTDEBUG Numeric debug level. (Set to 3 for full logs.)
- RTCONFIG Specifies a name other than ".rtrc" for the
configuration file.
+ - RTQUERY Default RT Query for rt list
+ - RTORDERBY Default order for rt list
--
@@ -1380,7 +1400,7 @@ Text:
be used to specify more than one object of the same type. Note that
the list must be a single argument (i.e., no spaces). For example,
"user/root,1-3,5,7-10,ams" is a list of ten users; the same list
- can also be written as "user/ams,root,1,2,3,5,7,8-20".
+ can also be written as "user/ams,root,1,2,3,5,7,8-10".
Examples:
diff --git a/rt/bin/webmux.pl.in b/rt/bin/webmux.pl.in
index dca5705..2c8487c 100644
--- a/rt/bin/webmux.pl.in
+++ b/rt/bin/webmux.pl.in
@@ -32,6 +32,10 @@ BEGIN {
$ENV{'ENV'} = '' if defined $ENV{'ENV'};
$ENV{'IFS'} = '' if defined $ENV{'IFS'};
@ORACLE_ENV_PREF@
+
+ eval { require Apache2; require Apache::compat }
+ if $ENV{'MOD_PERL'} and $ENV{'MOD_PERL'} =~ m{mod_perl/(?:2|1\.9)};
+
}
use lib ("@LOCAL_LIB_PATH@", "@RT_LIB_PATH@");