[Rt-commit] [svn] r1110 - in rt/branches/rt-3.1: . bin lib lib/RT/Interface

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Fri Jun 18 01:46:00 EDT 2004


Author: jesse
Date: Fri Jun 18 01:45:58 2004
New Revision: 1110

Removed:
   rt/branches/rt-3.1/bin/rt-commit-handler.in
Modified:
   rt/branches/rt-3.1/   (props changed)
   rt/branches/rt-3.1/Makefile.in
   rt/branches/rt-3.1/README
   rt/branches/rt-3.1/bin/mason_handler.scgi.in
   rt/branches/rt-3.1/bin/rt-crontool.in
   rt/branches/rt-3.1/bin/webmux.pl.in
   rt/branches/rt-3.1/configure.ac
   rt/branches/rt-3.1/lib/RT.pm.in
   rt/branches/rt-3.1/lib/RT/Interface/Web.pm
Log:
 ----------------------------------------------------------------------
 r1918 at tinbook:  jesse | 2004-06-18T02:59:32.811556Z
 
 Starting to refactor CGI/Apache handler code to reduce duplication
 ----------------------------------------------------------------------
 r1919 at tinbook:  jesse | 2004-06-18T03:03:37.413121Z
 
 Add back mason data_dir support
 ----------------------------------------------------------------------
 r1920 at tinbook:  jesse | 2004-06-18T03:27:07.080772Z
 
 Removed the rest of SetGID from the RT core.
 ----------------------------------------------------------------------


Modified: rt/branches/rt-3.1/Makefile.in
==============================================================================
--- rt/branches/rt-3.1/Makefile.in	(original)
+++ rt/branches/rt-3.1/Makefile.in	Fri Jun 18 01:45:58 2004
@@ -276,8 +276,6 @@
 				$(DESTDIR)/$(MASON_SESSION_PATH)
 # }}}
 
-fixperms-nosetgid: fixperms
-
 # {{{ dirs
 dirs:
 	mkdir -p $(DESTDIR)/$(RT_LOG_PATH)
@@ -316,9 +314,6 @@
 regression-install: config-install
 	$(PERL) -pi -e 's/Set\(\$$DatabaseName.*\);/Set\(\$$DatabaseName, "rt3regression"\);/' $(DESTDIR)/$(CONFIG_FILE)
 
-regression-nosetgid: regression-install dirs files-install libs-install sbin-install bin-install regression-instruct regression-reset-db  testify-pods fixperms-nosetgid apachectl
-	$(PERL) lib/t/02regression.t
-
 regression: regression-install dirs files-install libs-install sbin-install bin-install regression-instruct regression-reset-db  testify-pods fixperms apachectl
 	$(PERL) lib/t/02regression.t
 
@@ -439,53 +434,12 @@
 factory: initialize-database
 	cd lib; $(PERL) ../sbin/factory  $(DB_DATABASE) RT
 
-commit:
-	aegis -build ; aegis -diff ; aegis -test; aegis -develop_end
-
-integrate:
-	aegis -integrate_begin;	aegis -build; aegis -diff; aegis -test ; aegis -integrate_pass
-
-predist: commit tag-and-tar
-
-tag-and-release-baseline:
-	aegis -cp -ind Makefile -output /tmp/Makefile.tagandrelease; \
-	$(MAKE) -f /tmp/Makefile.tagandrelease tag-and-release-never-by-hand
-
-
-# Running this target in a working directory is 
-# WRONG WRONG WRONG.
-# it will tag the current baseline with the version of RT defined 
-# in the currently-being-worked-on makefile. which is wrong.
-#  you want tag-and-release-baseline
-
-tag-and-release-never-by-hand:
-	aegis --delta-name $(TAG)
-	rm -rf /tmp/$(TAG)
-	mkdir /tmp/$(TAG)
-	cd /tmp/$(TAG); \
-		aegis -cp -ind -delta $(TAG) . ;\
-		make reconfigure;\
-		chmod 600 Makefile;\
-		aegis --report --project rt.$(RT_VERSION_MAJOR) \
-		      --page_width 80 \
-		      --page_length 9999 \
-		      --change $(RT_VERSION_MINOR) --output Changelog Change_Log
-
-	cd /tmp; tar czvf /home/ftp/pub/rt/devel/$(TAG).tar.gz $(TAG)/
-	chmod 644 /home/ftp/pub/rt/devel/$(TAG).tar.gz
-
-
 reconfigure:
 	aclocal -I m4
 	autoconf
 	chmod 755 ./configure
 	./configure
 
-rpm:
-	(cd ..; tar czvf /usr/src/redhat/SOURCES/rt.tar.gz rt)
-	rpm -ba etc/rt.spec
-
-
 start-httpd:
 	$(PERL) bin/standalone_httpd 80 &
 

Modified: rt/branches/rt-3.1/README
==============================================================================
--- rt/branches/rt-3.1/README	(original)
+++ rt/branches/rt-3.1/README	Fri Jun 18 01:45:58 2004
@@ -45,10 +45,6 @@
 
 o   Perl 5.8.3 or later (http://www.perl.com).
 
- 	(If you intend to use the FastCGI or SpeedyCGI support, you 
-	 need to make sure that perl has been built with support for 
-	 setgid perl scripts.)`
-
     Perl versions prior to 5.8.3 contain bugs that could result in data
     corruption. We recommend strongly that you use 5.8.3 or newer.
 
@@ -70,23 +66,7 @@
 
         mod_perl 1.x must be build with EVERYTHING=1
 
-        RT's FastCGI handler runs setgid to the 'rt' group to
-        protect RT's database password.  You may need to install
-        a special  "suidperl" package or reconfigure your perl
-        setup to support "setuid scripts" if you intend to use RT
-        with FastCGI.
-
-        Debian GNU/* 3.0+: the package which installs suidperl is
-         called perl-suid, and should work without any tweaking.
-
-        FreeBSD 4.2+: the package is called sperl, and should
-         install a suidperl that just works 
-
-        Conectiva Linux 6.0+: suidperl is installed by default when 
-         perl is installed, but the program /bin/suidperl is not setuid. 
-         You must use chmod to make it setuid.
-
-
+        RT's FastCGI handler needs to access RT's configuration file.
 
 o    Various and sundry perl modules
 	A tool included with RT takes care of the installation of

Modified: rt/branches/rt-3.1/bin/mason_handler.scgi.in
==============================================================================
--- rt/branches/rt-3.1/bin/mason_handler.scgi.in	(original)
+++ rt/branches/rt-3.1/bin/mason_handler.scgi.in	Fri Jun 18 01:45:58 2004
@@ -31,7 +31,6 @@
 require CGI;
 
 RT::Init();
-RT::DropSetGIDPermissions();
 
 my $cgi = CGI->new;
 if ( ( !$h->interp->comp_exists( $cgi->path_info ) )

Modified: rt/branches/rt-3.1/bin/rt-crontool.in
==============================================================================
--- rt/branches/rt-3.1/bin/rt-crontool.in	(original)
+++ rt/branches/rt-3.1/bin/rt-crontool.in	Fri Jun 18 01:45:58 2004
@@ -45,9 +45,6 @@
 #Connect to the database and get RT::SystemUser and RT::Nobody loaded
 RT::Init();
 
-#Drop setgid permissions
-RT::DropSetGIDPermissions();
-
 #Get the current user all loaded
 my $CurrentUser = GetCurrentUser();
 

Modified: rt/branches/rt-3.1/bin/webmux.pl.in
==============================================================================
--- rt/branches/rt-3.1/bin/webmux.pl.in	(original)
+++ rt/branches/rt-3.1/bin/webmux.pl.in	Fri Jun 18 01:45:58 2004
@@ -1,43 +1,44 @@
 #!@PERL@
 # BEGIN LICENSE BLOCK
-# 
+#
 # Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
-# 
+#
 # (Except where explictly superceded by other copyright notices)
-# 
+#
 # This work is made available to you under the terms of Version 2 of
 # the GNU General Public License. A copy of that license should have
 # been provided with this software, but in any event can be snarfed
 # from www.gnu.org.
-# 
+#
 # This work is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # General Public License for more details.
-# 
+#
 # Unless otherwise specified, all modifications, corrections or
 # extensions to this work which alter its source code become the
 # property of Best Practical Solutions, LLC when submitted for
 # inclusion in the work.
-# 
-# 
+#
+#
 # END LICENSE BLOCK
 
 use strict;
 
 BEGIN {
-    $ENV{'PATH'}   = '/bin:/usr/bin';                      # or whatever you need
+    $ENV{'PATH'}   = '/bin:/usr/bin';                     # or whatever you need
     $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
     $ENV{'SHELL'}  = '/bin/sh' if defined $ENV{'SHELL'};
     $ENV{'ENV'}    = '' if defined $ENV{'ENV'};
     $ENV{'IFS'}    = '' if defined $ENV{'IFS'};
 
     eval { require Apache2; require Apache::compat }
-        if $ENV{'MOD_PERL'} and $ENV{'MOD_PERL'} =~ m{mod_perl/(?:2|1\.9)};
+      if $ENV{'MOD_PERL'}
+      and $ENV{'MOD_PERL'} =~ m{mod_perl/(?:2|1\.9)};
 
 }
 
-use lib ("@LOCAL_LIB_PATH@", "@RT_LIB_PATH@");
+use lib ( "@LOCAL_LIB_PATH@", "@RT_LIB_PATH@" );
 use RT;
 
 package RT::Mason;
@@ -46,26 +47,27 @@
                                    #set private_tempfiles
 
 BEGIN {
-    if ($mod_perl::VERSION && ($mod_perl::VERSION >= 1.9908)) {
-	require Apache::RequestUtil;
-	no warnings 'redefine';
-	my $sub = *Apache::request{CODE};
-	*Apache::request = sub {
-	    my $r;
-	    eval { $r = $sub->('Apache'); };
-	    # warn $@ if $@;
-	    return $r;
-	};
+    if ( $mod_perl::VERSION && ( $mod_perl::VERSION >= 1.9908 ) ) {
+        require Apache::RequestUtil;
+        no warnings 'redefine';
+        my $sub = *Apache::request{CODE};
+        *Apache::request = sub {
+            my $r;
+            eval { $r = $sub->('Apache'); };
+
+            # warn $@ if $@;
+            return $r;
+        };
     }
     if ($CGI::MOD_PERL) {
-	require HTML::Mason::ApacheHandler;
+        require HTML::Mason::ApacheHandler;
     }
     else {
-	require HTML::Mason::CGIHandler;
+        require HTML::Mason::CGIHandler;
     }
 }
 
-use HTML::Mason;                   # brings in subpackages: Parser, Interp, etc.
+use HTML::Mason;    # brings in subpackages: Parser, Interp, etc.
 
 use vars qw($Nobody $SystemUser $r);
 
@@ -75,6 +77,7 @@
 use Carp;
 
 {
+
     package HTML::Mason::Commands;
     use vars qw(%session);
 
@@ -103,25 +106,28 @@
     use Text::Quoted;
 }
 
-
 # Activate the following if running httpd as root (the normal case).
 # Resets ownership of all files created by Mason at startup.
 # Note that mysql uses DB for sessions, so there's no need to do this.
-unless ($RT::DatabaseType =~ /(mysql|Pg)/) {
+unless ( $RT::DatabaseType =~ /(mysql|Pg)/ ) {
+
     # Clean up our umask to protect session files
     umask(0077);
 
-if ( $CGI::MOD_PERL)  {
-    chown( Apache->server->uid, Apache->server->gid, [$RT::MasonSessionDir] )
-	if Apache->server->can('uid');
-        }
+    if ($CGI::MOD_PERL) {
+        chown( Apache->server->uid, Apache->server->gid,
+            [$RT::MasonSessionDir] )
+          if Apache->server->can('uid');
+    }
+
     # Die if WebSessionDir doesn't exist or we can't write to it
     stat($RT::MasonSessionDir);
     die "Can't read and write $RT::MasonSessionDir"
-	unless ( ( -d _ ) and ( -r _ ) and ( -w _ ) );
+      unless ( ( -d _ ) and ( -r _ ) and ( -w _ ) );
 }
 
-my $ah = &RT::Interface::Web::NewApacheHandler(@RT::MasonParameters) if $CGI::MOD_PERL;
+my $ah = &RT::Interface::Web::NewApacheHandler(@RT::MasonParameters)
+  if $CGI::MOD_PERL;
 
 sub handler {
     ($r) = @_;
@@ -138,14 +144,16 @@
     my $status;
     eval { $status = $ah->handle_request($r) };
     if ($@) {
-	$RT::Logger->crit($@);
+        $RT::Logger->crit($@);
     }
 
-    undef (%session);
+    undef(%session);
 
-    if ($RT::Handle->TransactionDepth) {
-	$RT::Handle->ForceRollback;
-    	$RT::Logger->crit("Transaction not committed. Usually indicates a software fault. Data loss may have occurred") ;
+    if ( $RT::Handle->TransactionDepth ) {
+        $RT::Handle->ForceRollback;
+        $RT::Logger->crit(
+"Transaction not committed. Usually indicates a software fault. Data loss may have occurred"
+        );
     }
     return $status;
 }

Modified: rt/branches/rt-3.1/configure.ac
==============================================================================
--- rt/branches/rt-3.1/configure.ac	(original)
+++ rt/branches/rt-3.1/configure.ac	Fri Jun 18 01:45:58 2004
@@ -28,6 +28,8 @@
 if test "$PERL" = 'not found'; then
 	AC_MSG_ERROR([cannot use $PACKAGE_NAME without perl])
 fi
+
+
 dnl SPEED_BIN
 AC_ARG_WITH(speedycgi,
 	    AC_HELP_STRING([--with-speedycgi=/path/to/speedy],
@@ -239,7 +241,6 @@
  		 bin/mason_handler.scgi
  		 bin/standalone_httpd
  		 bin/mason_handler.svc
- 		 bin/rt-commit-handler
  		 bin/rt-crontool
  		 bin/rt-mailgate
 		 bin/rt

Modified: rt/branches/rt-3.1/lib/RT.pm.in
==============================================================================
--- rt/branches/rt-3.1/lib/RT.pm.in	(original)
+++ rt/branches/rt-3.1/lib/RT.pm.in	Fri Jun 18 01:45:58 2004
@@ -279,26 +279,14 @@
 }
 
 
-=head2 DropSetGIDPermissions
-
-Drops setgid permissions.
-
-=cut
-
-sub DropSetGIDPermissions {
-    # Now that we got the config read in, we have the database 
-    # password and don't need to be setgid
-    # make the effective group the real group
-    $) = $(;
-}
-
-
 =head1 SYNOPSIS
 
 =head1 BUGS
 
-Please report them to rt-3.0-bugs at fsck.com, if you know what's broken and have at least some idea of what needs to be fixed.
-If you're not sure what's going on, report them rt-devel at lists.fsck.com.
+Please report them to rt-bugs at fsck.com, if you know what's broken and have at least 
+some idea of what needs to be fixed.
+
+If you're not sure what's going on, report them rt-devel at lists.bestpractical.com.
 
 =head1 SEE ALSO
 

Modified: rt/branches/rt-3.1/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/rt-3.1/lib/RT/Interface/Web.pm	Fri Jun 18 01:45:58 2004
@@ -45,7 +45,18 @@
 
 
 
+my @DefaultHandlerArgs = (
 
+    comp_root => [
+        [ local    => $RT::MasonLocalComponentRoot ],
+        [ standard => $RT::MasonComponentRoot ]
+    ],
+    default_escape_flags => 'h',
+    data_dir             => "$RT::MasonDataDir",
+    allow_globals        => [qw(%session)],
+    autoflush            => 1
+
+);
 
 # {{{ sub NewApacheHandler 
 
@@ -58,22 +69,9 @@
 
 sub NewApacheHandler {
     require HTML::Mason::ApacheHandler;
-    my $ah = new HTML::Mason::ApacheHandler( 
-    
-        comp_root                    => [
-            [ local    => $RT::MasonLocalComponentRoot ],
-            [ standard => $RT::MasonComponentRoot ]
-        ],
-        args_method => "CGI",
-        default_escape_flags => 'h',
-        allow_globals        => [qw(%session)],
-        autoflush => 1,
-        @_
-    );
-
-    $ah->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 );
-    
-    return ($ah);
+    return RT::Interface::Web::NewHandler('HTML::Mason::ApacheHandler',
+                                            args_method => "CGI",
+                                            @_);
 }
 
 # }}}
@@ -87,28 +85,20 @@
 =cut
 
 sub NewCGIHandler {
-    my %args = (
-        @_
-    );
+    return RT::Interface::Web::NewHandler('HTML::Mason::CGIHandler', at _);
+}
 
-    my $handler = HTML::Mason::CGIHandler->new(
-        comp_root                    => [
-            [ local    => $RT::MasonLocalComponentRoot ],
-            [ standard => $RT::MasonComponentRoot ]
-        ],
-        default_escape_flags => 'h',
-        allow_globals        => [qw(%session)],
-        autoflush => 1,
+sub NewHandler {
+    my $class = shift;
+    my $handler = $class->new(
+        @DefaultHandlerArgs,
         @_
     );
   
-
     $handler->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 );
-
-
-    return ($handler);
-
+    return($handler);
 }
+
 # }}}
 
 


More information about the Rt-commit mailing list