head	1.13;
access;
symbols
	TIGRIS_1_1_0RC2:1.11
	TIGRIS_1_1_0RC1:1.11
	TIGRIS_1_1:1.11.0.6
	TIGRIS_1_0_8:1.11
	TIGRIS_1_0_8RC3:1.11
	TIGRIS_1_0_8RC2:1.11
	TIGRIS_1_0_8RC1:1.11
	TIGRIS_1_0_7:1.11
	TIGRIS_1_0_7RC3:1.11
	TIGRIS_1_0_7RC2:1.11
	TIGRIS_1_0_7RC1:1.11
	TIGRIS_1_0_6:1.11
	TIGRIS_1_0_6RC5:1.11
	TIGRIS_1_0_6RC4:1.11
	TIGRIS_1_0_6RC3:1.11
	TIGRIS_1_0_6RC2:1.11
	TIGRIS_1_0_6RC1:1.11
	TIGRIS_1_0_5:1.11
	TIGRIS_1_0_5RC6:1.11
	TIGRIS_1_0_5RC5:1.11
	TIGRIS_1_0_5RC4:1.11
	TIGRIS_1_0_5RC3:1.11
	TIGRIS_1_0_5RC2:1.11
	TIGRIS_1_0_5RC1:1.11
	TIGRIS_1_0_4:1.11
	TIGRIS_1_0_3:1.11
	TIGRIS_1_0_2:1.11
	TIGRIS_1_0_1:1.11
	TIGRIS_1_0:1.11.0.8
	TIGRIS_1_0_0:1.11
	TIGRIS_1_0_0_RC1:1.11.0.4
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.11
	TIGRIS_0_9_2_3:1.11
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.11
	TIGRIS_0_9_2_1:1.11
	TIGRIS_0_9_2:1.11.0.2
	TIGRIS_0_9_0:1.10.0.4
	TIGRIS_0_8_4:1.10.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1
	OLDHELM:1.9.0.2
	TIGRIS_NOV_11_2000:1.9
	TIGRIS_SEP_13_2000:1.5.0.2
	TIGRIS_BASELINE:1.9;
locks; strict;
comment	@# @;


1.13
date	2001.04.18.02.02.58;	author kmaples;	state Exp;
branches;
next	1.12;

1.12
date	2001.04.17.04.44.54;	author kmaples;	state Exp;
branches;
next	1.11;

1.11
date	2001.01.05.23.31.11;	author kmaples;	state Exp;
branches;
next	1.10;

1.10
date	2000.11.12.22.57.33;	author dlr;	state Exp;
branches;
next	1.9;

1.9
date	2000.09.22.23.42.20;	author kmaples;	state Exp;
branches;
next	1.8;

1.8
date	2000.09.15.03.51.10;	author kmaples;	state Exp;
branches;
next	1.7;

1.7
date	2000.09.13.22.33.46;	author kmaples;	state Exp;
branches;
next	1.6;

1.6
date	2000.09.13.21.55.36;	author kmaples;	state Exp;
branches;
next	1.5;

1.5
date	2000.09.07.03.12.41;	author kmaples;	state Exp;
branches;
next	1.4;

1.4
date	2000.09.06.23.47.35;	author kmaples;	state Exp;
branches;
next	1.3;

1.3
date	2000.09.06.18.56.47;	author kmaples;	state Exp;
branches;
next	1.2;

1.2
date	2000.08.18.18.52.06;	author kmaples;	state Exp;
branches;
next	1.1;

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

1.1.1.1
date	2000.11.12.21.17.29;	author dlr;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.02.21.00.35.52;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.13
log
@Undoing yesterday's commit - my hastiness to implement some sort of logging
level notion into these scripts caused me great pain.
@
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.
#


# apache-project-delete
# $Id: apache-project-delete,v 1.11 2001/01/05 23:31:11 kmaples Exp $
# ----------------------
# Provides functions to update apache configuration files

use strict;

# Flush buffer, just in case:
$| = 1;

# For the sake of -T:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
# Detaint the args by brute force:
@@ARGV = detaint_array(@@ARGV);

# Process arguments
my $htdoc_root       = $ARGV[0] || ''; 
my $project_name     = $ARGV[1] || '';

# Grab just the filename portion of this script to use as a 
# log identifier:
my $script_name = $0;
$script_name =~ s/^.*\/([^\/]+)$/  $1/;

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------

print "$script_name: beginning for project $project_name\n";

chdir($htdoc_root) || die "$script_name: couldn't chdir to $htdoc_root: $!\n";
print "$script_name: changed dir to $htdoc_root\n";

# 1. Remove the directory being used for project HTML:

if(-d $project_name){
	system('rm','-rf',$project_name) == 0 
 		|| die "$script_name: unable to remove directory $project_name: $!\n";
	print "$script_name: directory $project_name deleted.\n";
} else {
	# return success if the dir isn't present:
	print "$script_name: directory $project_name not found.\n";
}

#---------------------------------------------------------------
# END MAIN
#---------------------------------------------------------------

# A crude attempt to overcome data tainting in perl:
#-------------------
sub detaint_array {
#-------------------
    my @@unclean = @@_;
    my @@clean = ();

    foreach(@@unclean){
        # We don't really have rules for this, so at the moment
        # this acts as a passthrough:
        $_ =~ m/^(.*)$/;
        push(@@clean,$1);
    }

    return(@@clean);
}

__END__

@


1.12
log
@Scripts now use IN_PRODUCTION to determine logging level
@
text
@a56 5
my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';

require "$scripts_dir/ParentChildArgumentBridge.pl"
    or die "Require failed: $!\n";

d78 1
a78 1
print_log(1, "$script_name: beginning for project $project_name\n");
d81 1
a81 1
print_log(1, "$script_name: changed dir to $htdoc_root\n");
d88 1
a88 1
	print_log(1, "$script_name: directory $project_name deleted.\n");
d91 1
a91 1
	print_log(1, "$script_name: directory $project_name not found.\n");
@


1.11
log
@It may or may not be a good idea, but here it is - the ability to edit
(rename) projects.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.10 2000/11/12 22:57:33 dlr Exp $
d57 5
d83 1
a83 1
print "$script_name: beginning for project $project_name\n";
d86 1
a86 1
print "$script_name: changed dir to $htdoc_root\n";
d93 1
a93 1
	print "$script_name: directory $project_name deleted.\n";
d96 1
a96 1
	print "$script_name: directory $project_name not found.\n";
@


1.10
log
@Resolved merge conflicts.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.1.1.1 2000/11/12 21:17:29 dlr Exp $
a67 2
my $domain_name      = $ARGV[2] || ''; # unreferenced.
my $brand_name       = $ARGV[3] || ''; # unreferenced.
a73 6
# TODO: where does #force come from?
# it is not at all clear to me what this represents or where it 
# was supposed to be coming from - it was statically declared:
my $force = 0;


a93 5
# UNIMPLEMENTED:
# 2. create 'project deleted' page?
set_up_sorry_pages($project_name, $domain_name, $brand_name);


a97 15
#-------------------
sub set_up_sorry_pages {
#-------------------
	# Unimplemented routine
	# will need to determine at some point in the future what the
	# actual intent was here, and what the best way of executing
	# on it would be.  It is also possible that this function does
	# not really belong in a script at this level - that is, that
	# it is not strictly speaking an apache function.
	my ($project_name, $domain_name, $brand_name, $description) = @@_;
	print "$script_name: UNIMPLEMENTED: set_up_sorry_pages()\n";
#    print "apache: Check in a sorry index.html for project: " .
#        $project_name . " using brandname " . $brand_name . "\n";
	return;
}
@


1.9
log
@Many changes and fixes; specified arguments to pass to bugzilla-*-delete
scripts; fixed some omissions preventing project dirs from being properly
deleted, etc.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.8 2000/09/15 03:51:10 kmaples Exp $
@


1.8
log
@Fixed regex to display script name in logfiles.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.7 2000/09/13 22:33:46 kmaples Exp $
d94 2
a95 1
	system('rm','-rf') == 0 || die "$script_name: unable to remove directory $project_name: $!\n";
@


1.7
log
@Added crude subroutine to all child scripts to detaint @@ARGV.  At the moment,
this isn't doing any real detainting - just spitting the args back out to get
around warnings setuid generates.  Complications with the scripts' knowledge
of it's own working dir when it's called prevent the effective use of 'require'
in the child scripts, thus the redundancy of code in the children (for the time
being)
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.6 2000/09/13 21:55:36 kmaples Exp $
d74 1
a74 1
$script_name =~ s/^.*\/([\w]+)$/$1/;
@


1.6
log
@Set PATH in child scripts to suppress -T warnings.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.5 2000/09/07 03:12:41 kmaples Exp $
d62 2
d125 17
@


1.5
log
@Brought apache-project-delete into agreement with the current definition
of adding/deleting projects with respect to apache (e.g., existence of
directory under HTDOC_ROOT for project)
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.4 2000/09/06 23:47:35 kmaples Exp $
d59 3
@


1.4
log
@Fixed typo in apache-project-delete; rewrote MAIN of apache-project-add to
create new directory under $htdoc_root (this is the extent of how adding a
project to apache is defined at the moment).
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.3 2000/09/06 18:56:47 kmaples Exp $
d61 4
a64 5
my $sandbox          = $ARGV[0] || '';
my $htdoc_root       = $ARGV[1] || ''; # unreferenced.
my $project_name     = $ARGV[2] || '';
my $domain_name      = $ARGV[3] || ''; # unreferenced.
my $brand_name       = $ARGV[4] || ''; # unreferenced.
a81 1
print "$script_name: NOT CURRENTLY WORKING"; exit;
d83 2
d86 8
a93 4
# 1. back up the vhost config file, if it exists
if(-e $vhost_project_conf){
	rename("$vhost_project_conf", "$vhost_project_conf" . '.bak') 
		or die "$script_name: couldn't backup $vhost_project_conf\n";
a95 8
# 2. write 'new' vhost config file
open(CONFIG, ">$vhost_project_conf")
	or die "$script_name: Could not open $vhost_project_conf: $!\n";
	
print CONGIF vhost_config($project_name, $domain_name, $force);	

close(CONFIG) or die "$script_name: could not close $vhost_project_conf: $!\n"; 

d97 1
a97 1
# 3. create 'project deleted' page?
a103 10
#-------------------
sub vhost_config {
#-------------------
	my ($project_name, $domain_name, $force) = @@_;
	my $text = '';

	$text .= "# THIS SPACE INTENTIONALLY BLANK\n";

	return($text);
}
@


1.3
log
@Removed depricated tokens APACHE_HOST_IP and APACHE_HELM_CONF from the arg list; adjusted child scripts accordingly.  Introduced new test harness (work in progress).
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.2 2000/08/18 18:52:06 kmaples Exp $
d83 1
a83 1
print "$scrip_name: NOT CURRENTLY WORKING"; exit;
@


1.2
log
@Rewrote scripts to standardize interface with calling scripts.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.1 2000/04/29 00:04:10 jrobbins Exp $
d62 4
a65 5
my $apache_helm_conf = $ARGV[1] || '';
my $htdoc_root       = $ARGV[2] || ''; # unreferenced.
my $project_name     = $ARGV[3] || '';
my $domain_name      = $ARGV[4] || ''; # unreferenced.
my $brand_name       = $ARGV[5] || ''; # unreferenced.
a71 7

# Paths and files derived from @@ARGV:
my $vhost_file_ident    = '.vhost.conf';       # static i.d. for vhost 
                                               # config files
# config file for individual vhosts:
my $vhost_project_conf     = "$apache_helm_conf/" . $project_name . $vhost_file_ident;

d83 2
@


1.1
log
@initial checkin
@
text
@d51 1
a51 1
# $Id: apache.pm,v 1.1 2000/03/24 20:33:58 jrobbins Exp $
d57 2
a58 1

d61 36
a96 6
my $sandbox      = $ARGV[0];
my $project_name = $ARGV[1];
my $domain_name  = $ARGV[2];
my $brand_name   = $ARGV[3];


d98 5
d104 1
a104 2
delete_vhost($project_name, $domain_name, 0);
#TODO: where does #force come from?
d106 2
d111 8
d120 1
d122 1
a122 7
################################################################


sub delete_vhost {
    my ($project_name, $domain_name, $force) = @@_;
    print "apache  : dont actually remove the vhost entry\n";
    print "        : move it to a .bak file and put in redirect rules for all URLs to sorry page\n";
d125 1
a125 1

d127 12
a138 4
    my ($project_name, $domain_name, $brand_name, $description) = @@_;
    print "apache: Check in a sorry index.html for project: " .
        $project_name . " using brandname " . $brand_name . "\n";

d140 1
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.1 2000/10/05 20:05:49 jrobbins Exp $
a56 2
# Flush buffer, just in case:
$| = 1;
a57 4
# For the sake of -T:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
# Detaint the args by brute force:
@@ARGV = detaint_array(@@ARGV);
d60 10
a69 35
my $htdoc_root       = $ARGV[0] || ''; 
my $project_name     = $ARGV[1] || '';
my $domain_name      = $ARGV[2] || ''; # unreferenced.
my $brand_name       = $ARGV[3] || ''; # unreferenced.

# Grab just the filename portion of this script to use as a 
# log identifier:
my $script_name = $0;
$script_name =~ s/^.*\/([^\/]+)$/  $1/;

# TODO: where does #force come from?
# it is not at all clear to me what this represents or where it 
# was supposed to be coming from - it was statically declared:
my $force = 0;


#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------

print "$script_name: beginning for project $project_name\n";

chdir($htdoc_root) || die "$script_name: couldn't chdir to $htdoc_root: $!\n";
print "$script_name: changed dir to $htdoc_root\n";

# 1. Remove the directory being used for project HTML:

if(-d $project_name){
	system('rm','-rf',$project_name) == 0 
 		|| die "$script_name: unable to remove directory $project_name: $!\n";
	print "$script_name: directory $project_name deleted.\n";
} else {
	# return success if the dir isn't present:
	print "$script_name: directory $project_name not found.\n";
}
a70 2
# UNIMPLEMENTED:
# 2. create 'project deleted' page?
a73 3
#---------------------------------------------------------------
# END MAIN
#---------------------------------------------------------------
d75 11
a85 1
#-------------------
d87 3
a89 26
#-------------------
	# Unimplemented routine
	# will need to determine at some point in the future what the
	# actual intent was here, and what the best way of executing
	# on it would be.  It is also possible that this function does
	# not really belong in a script at this level - that is, that
	# it is not strictly speaking an apache function.
	my ($project_name, $domain_name, $brand_name, $description) = @@_;
	print "$script_name: UNIMPLEMENTED: set_up_sorry_pages()\n";
#    print "apache: Check in a sorry index.html for project: " .
#        $project_name . " using brandname " . $brand_name . "\n";
	return;
}
# A crude attempt to overcome data tainting in perl:
#-------------------
sub detaint_array {
#-------------------
    my @@unclean = @@_;
    my @@clean = ();

    foreach(@@unclean){
        # We don't really have rules for this, so at the moment
        # this acts as a passthrough:
        $_ =~ m/^(.*)$/;
        push(@@clean,$1);
    }
a90 1
    return(@@clean);
a91 2

__END__
@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d51 1
a51 1
# $Id: apache-project-delete,v 1.11 2001/01/05 23:31:11 kmaples Exp $
d68 2
d76 6
d102 5
d111 15
@


