head	1.4;
access;
symbols
	dlr:1.1.1;
locks; strict;
comment	@# @;


1.4
date	2000.04.28.01.41.38;	author manoj;	state dead;
branches;
next	1.3;

1.3
date	2000.04.06.04.47.28;	author jrobbins;	state Exp;
branches;
next	1.2;

1.2
date	2000.02.03.04.21.34;	author jrobbins;	state Exp;
branches;
next	1.1;

1.1
date	2000.01.30.03.22.38;	author jrobbins;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2001.02.21.00.35.48;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.4
log
@Changes to match the New World Order of paths.
@
text
@#!/usr/bin/perl -w

# ================================================================
# Copyright (c) 2000 Collab.Net.  All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement: "This product includes
# software developed by Collab.Net (http://www.Collab.Net/)."
# Alternately, this acknowlegement may appear in the software itself, if
# and wherever such third-party acknowlegements normally appear.
# 
# 4. The hosted project names must not be used to endorse or promote
# products derived from this software without prior written
# permission. For written permission, please contact info@@collab.net.
# 
# 5. Products derived from this software may not use the "Tigris" name
# nor may "Tigris" appear in their names without prior written
# permission of Collab.Net.
# 
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ====================================================================
# 
# This software consists of voluntary contributions made by many
# individuals on behalf of Collab.Net.
#




# CONFIG - set to /path/to/helm/perl
use lib "./helm/perl";

use Helm::Database;

use CGI::Carp;

# The list of modules to run 
# Note that order may be important - CVSmodules has to run before
# ApacheModules, for example
my @@modules = qw(Helm::CVSloginfo Helm::CVSmodules
	       Helm::ApacheConfig Helm::ApacheModules
	       Helm::QmailAlias Helm::QmailLists);

die "Not running setuid root\n" if $> != 0;

# Fix up some commonly-tainted variables
$ENV{'PATH'} = "/bin:/usr/bin";
delete $ENV{'BASH_ENV'};

my $db = new Helm::Database;

my ($query,$arg) = split /\+/, $ENV{"QUERY_STRING"};
die "No command given\n" unless $query;

print "Content-Type: text/html\n\n.\n";

print "<ul>\n";
foreach $module (@@modules) {
    eval "use $module;";
    my $user = $module->user($db);
    my $uid = getpwnam($module->user($db));
    die "Module $module tried to run as root ($user)\n" if $uid == 0;
    $> = $uid;
    die "Not running setuid $user ($uid) for $module (current uid $>)\n"
	unless $> == $uid;
    if ($query eq "add_project") {
	$module->add_project($db, $arg);
	$module->update($db);
	print "<li>add_project on $module returned\n\n";	    
    } elsif ($query eq "del_project") {
	$module->del_project($db, $arg);
	$module->update($db);
	print "<li>del_project on $module returned\n\n";	    
    } elsif ($query eq "update") {
	$module->update($db);
    } else {
	die "Unknown command $query\n";
    }
    $> = 0;
}
print "</ul>\n";

# Only print out the headers at the very end; that way, if something
# goes wrong, Apache spits out a 500 and Java gets an error.
print "Helm successfully updated.\n";

exit(0);
@


1.3
log
@Changes to allow helm to be put in a per-developer sandbox.
@
text
@@


1.2
log
@Added tigris.org license
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d53 1
a53 1
use lib "/home/httpd/helm/perl";
@


1.1
log
@initial checkin
@
text
@d3 46
a48 1
# Copyright (c) 2000 Collab.Net, Inc.
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d3 8
a10 45
# ================================================================
# Copyright (c) 2000 Collab.Net.  All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement: "This product includes
# software developed by Collab.Net (http://www.Collab.Net/)."
# Alternately, this acknowlegement may appear in the software itself, if
# and wherever such third-party acknowlegements normally appear.
# 
# 4. The hosted project names must not be used to endorse or promote
# products derived from this software without prior written
# permission. For written permission, please contact info@@collab.net.
# 
# 5. Products derived from this software may not use the "Tigris" name
# nor may "Tigris" appear in their names without prior written
# permission of Collab.Net.
# 
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ====================================================================
# 
# This software consists of voluntary contributions made by many
# individuals on behalf of Collab.Net.
#
a13 3
# Turn off buffering
#$| = 1;

d17 11
a27 3
my @@modules = qw(CVSloginfo CVSmodules
	       ApacheConfig ApacheModules
	       QmailAlias QmailLists);
a30 3
if ($query !~ /^(add|del)_project|update$/) {
    die "Unknown command $query\n";
}
d33 1
a34 1

d36 19
a54 10
    if ($arg) {
        system("../cgi-helpers/$module", $query, $arg);
    }
    else {
        system("../cgi-helpers/$module", $query);
    }
    if ($? >> 8) {
        my $ret = $? >> 8;
        my $sig = $? & 0xff;
        print STDERR "$module $query failed: $ret, $sig\n";
d56 1
a56 1
    print "<li>$module $query ran successfully\n";
a59 1
# XXX - we used to be doing this... oh well
@


