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


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

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

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

1.9
date	2000.11.12.22.57.33;	author dlr;	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.06.23.55.23;	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.28;	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.12
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-add
# $Id: apache-project-add,v 1.10 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. Create directory for project HTML:
# bail if $project_name isn't suitable for directory creation - 
# alphanumeric or hyphen:
unless($project_name =~ m/^[-\w]+$/){
    print "$script_name: project_name not exclusively alphanumeric/hyphen.\n";
    exit(1);
}

# return success if it's already there:
if(-d $project_name){
    print "$script_name: directory $project_name already exists.\n";
} else {
    unless(mkdir($project_name, 0755)){
        print "$script_name: unable to create directory $project_name: $!\n";
        exit(1);
    };
    print "$script_name: directory $project_name created\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.11
log
@Scripts now use IN_PRODUCTION to determine logging level
@
text
@a53 5
my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';

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

d77 1
a77 1
print_log(1, "$script_name: beginning for project $project_name\n");
d80 1
a80 1
print_log(1, "$script_name: changed dir to $htdoc_root\n");
d86 1
a86 1
    print_log(1, "$script_name: project_name not exclusively alphanumeric/hyphen.\n");
d92 1
a92 1
    print_log(1, "$script_name: directory $project_name already exists.\n");
d95 1
a95 1
        print_log(1, "$script_name: unable to create directory $project_name: $!\n");
d98 1
a98 1
    print_log(1, "$script_name: directory $project_name created\n");
@


1.10
log
@It may or may not be a good idea, but here it is - the ability to edit
(rename) projects.
@
text
@d50 1
a50 1
# $Id: apache-project-add,v 1.9 2000/11/12 22:57:33 dlr Exp $
d54 5
d82 1
a82 1
print "$script_name: beginning for project $project_name\n";
d85 1
a85 1
print "$script_name: changed dir to $htdoc_root\n";
d91 1
a91 1
    print "$script_name: project_name not exclusively alphanumeric/hyphen.\n";
d97 1
a97 1
    print "$script_name: directory $project_name already exists.\n";
d100 1
a100 1
        print "$script_name: unable to create directory $project_name: $!\n";
d103 1
a103 1
    print "$script_name: directory $project_name created\n";
@


1.9
log
@Resolved merge conflicts.
@
text
@d50 1
a50 1
# $Id: apache-project-add,v 1.1.1.1 2000/11/12 21:17:28 dlr Exp $
d65 2
a66 6
my $sandbox          = $ARGV[0] || '';
my $htdoc_root       = $ARGV[1] || '';
my $project_name     = $ARGV[2] || '';
my $domain_name      = $ARGV[3] || '';
my $brand_name       = $ARGV[4] || ''; # unreferenced.
my $description      = $ARGV[5] || ''; # unreferenced.
a72 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;


a100 7
# 2. UNIMPLEMENTED - it appears that the intent of this was to 
# introduce some default html components into the project.  This was
# not implemented as such in the previous iteration of the system, so
# it is not implemented here.  The function call remains here as 
# intended for some ambitious programmer to implement:
set_up_pages($project_name, $domain_name, $brand_name, $description);

a104 16

#-------------------
sub set_up_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_pages()\n";
#    print "apache: Check in template files for project: " .
#        $project_name . " using brandname " . $brand_name . "\n";
    return;
}
@


1.8
log
@Fixed regex to display script name in logfiles.
@
text
@d50 1
a50 1
# $Id: apache-project-add,v 1.7 2000/09/13 22:33:46 kmaples Exp $
@


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
@d50 1
a50 1
# $Id: apache-project-add,v 1.6 2000/09/13 21:55:36 kmaples Exp $
d75 1
a75 1
$script_name =~ s/^.*\/([\w]+)$/$1/;
@


1.6
log
@Set PATH in child scripts to suppress -T warnings.
@
text
@d50 1
a50 1
# $Id: apache-project-add,v 1.5 2000/09/06 23:55:23 kmaples Exp $
d61 2
d137 16
@


1.5
log
@Fixed typo.
@
text
@d50 1
a50 1
# $Id: apache-project-add,v 1.3 2000/09/06 18:56:47 kmaples Exp $
d58 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
@d84 1
a84 1
chdir($script_name) || die "$script_name: couldn't chdir to $htdoc_root: $!\n";
@


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
@d50 1
a50 1
# $Id: apache-project-add,v 1.2 2000/08/18 18:52:06 kmaples Exp $
d84 2
a85 2
print "$scrip_name: NOT CURRENTLY WORKING"; exit;

d87 7
d95 3
a97 43
my $include_already_defined = 0;
my $include_exists          = 0;

# 1. Check the state of things.
# Check for previously existing include and directive:    
if (-e $vhost_master_conf) {
    print "$script_name: $vhost_master_conf exists\n";
    open(VHOSTLIST, "<$vhost_master_conf") or die "$script_name: Could not open $vhost_master_conf: $!\n";
    
    print "$script_name: checking for existing 'Include' directive\n";
    while (<VHOSTLIST>) {
        # We're only looking for lines specifying includes, so 
        # skip anything else:
        next unless m/^\s*[iI]nclude (\S)+/;
        
        # Hang on to the path portion for comparison.
        my $found_include = $1 || 0;
        
        if ($found_include) {
            # compare the captured path against the name of the 
            # project we're trying to add - the presumption being
            # that if a config file is already included in that 
            # path, that indicates that a project has already been
            # created:
            my $pos = index $found_include, $project_name;

            if ($pos != -1) {
                print "$script_name: found existing 'Include' directive\n";
                $include_already_defined = 1;
                
                # And check that it actually exists:
                print "$script_name: checking that include file exists\n";
                if(-e $vhost_project_conf){
                    print "$script_name: found $vhost_project_conf\n";
                    $include_exists = 1;
                } else {
                    print "$script_name: did NOT find $vhost_project_conf\n";
                }
                last;
            }
        }
    }
    close VHOSTLIST or die "$script_name: Could not close $vhost_master_conf: $!\n";
d99 5
a103 38
	# I assume that if there's no such master file, something more 
	# sinister is afoot, and that it would be prudent to stop now:
    die "$script_name: $vhost_master_conf does NOT exist\n";
}

# 2. Create the file to be included.
# Try to write the config. file itself, unless it exists or 'force'
# was specified:
unless($include_exists || $force){

    # Backup the old, if 'force':
    if($include_exists){
        print "$script_name: backing up old $vhost_project_conf\n";
        rename("$vhost_project_conf", "$vhost_project_conf" . '.bak')
            or die "$script_name: couldn't backup $vhost_project_conf\n";
    }

    print "$script_name: creating config file $vhost_project_conf\n";

	open(CONFIG, ">$vhost_project_conf")
        or die "$script_name: Could not open $vhost_project_conf: $!\n";
    
    print CONFIG vhost_config($apache_host_ip, $project_name, $domain_name, $htdoc_root);
    
    close(CONFIG) or die "$script_name: could not close $vhost_project_conf: $!\n"; 
}

# 3. Write 'include' directive to the primary config. file in order
# to include the file created above.
unless ($include_already_defined) {   
    print "$script_name: adding 'Include' directive to $vhost_master_conf\n";

	my $directive = "\n\nInclude $vhost_project_conf\n";

    open(VHOSTLIST, ">>$vhost_master_conf") 
        or die "$script_name: Could not open $vhost_master_conf: $!\n";
    print VHOSTLIST $directive;
    close VHOSTLIST or die "$script_name: Could not close $vhost_master_conf: $!\n";
d106 1
a106 1
# 4. UNIMPLEMENTED - it appears that the intent of this was to 
a116 57
#-------------------
sub vhost_config {
#-------------------
	my ($apache_host_ip, $project_name, $domain_name, $htdoc_root) = @@_;
    my $text = '';

	# Derived vars:
	my $server_name   = "$project_name.$domain_name";
	my $admin_email   = "webmaster\@@$server_name";
	my $doc_root      = "$htdoc_root/$project_name/www";
	my $err_log       = "project-$project_name-error.log";
	my $acc_log       = "project-$project_name-access.log";

	## begin quoted text
    $text .= qq{

NameVirtualHost $apache_host_ip    
# Configuration for Web module $project_name  
  
<VirtualHost $apache_host_ip>
  ServerAdmin  $admin_email
  DocumentRoot $doc_root
  ServerName   $server_name
  ErrorLog     log/$err_log
  CustomLog    log/$acc_log combined

#
# rewrite rules
#
  <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteLog logs/rewrite_log
    RewriteLogLevel 0
    RewriteRule ^(/.*/nonav/.*)\$        \$1 [PT]
    RewriteRule ^(/bugs)\$               \$1 [PT]
    RewriteRule ^(/bugs/.*)\$            \$1 [PT]
    RewriteRule ^(/source/.*)\$          \$1 [PT]
    RewriteRule ^(/search/.*)\$          \$1 [PT]
    RewriteRule ^(.*/)\$                 /helm/TView?page=\$1/index.html [PT]
    RewriteRule ^(/.*\.html)\$           /helm/TView?page=\$1 [QSA,PT]
    RewriteRule ^(/.*\.js)\$             \$1 [PT]
    RewriteRule ^/([A-Za-z0-9_]+)\$      /helm/\$1 [PT]
  </IfModule>

</VirtualHost>

<Directory $doc_root>
  Options Indexes FollowSymLinks
  AllowOverride None
  order allow,deny
  allow from all
</Directory>
}; ## end of quoted text

	return($text);

}
d121 8
a128 8
	# 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_pages()\n";
d135 1
@


1.2
log
@Rewrote scripts to standardize interface with calling scripts.
@
text
@d50 1
a50 1
# $Id: apache-project-add,v 1.1 2000/04/29 00:04:10 jrobbins Exp $
d61 5
a65 7
my $apache_host_ip   = $ARGV[1] || '';
my $apache_helm_conf = $ARGV[2] || '';
my $htdoc_root       = $ARGV[3] || '';
my $project_name     = $ARGV[4] || '';
my $domain_name      = $ARGV[5] || '';
my $brand_name       = $ARGV[6] || ''; # unreferenced.
my $description      = $ARGV[7] || ''; # unreferenced.
a71 12
# Paths and files derived from @@ARGV:
my $webmodulesfilename  = 'webmodules.conf';   # static i.d. for mods.
my $vhost_file_ident    = '.vhost.conf';       # static i.d. for vhost 

# This is the 'master' apache config file for helm:
my $vhost_master_conf       = "$apache_helm_conf/$webmodulesfilename";

# config file for individual vhosts:
my $vhost_project_conf     = "$apache_helm_conf/" . $project_name . $vhost_file_ident;

#my $port = 80;

d83 4
a86 1
print "$script_name: updating '$vhost_master_conf' to include '$project_name.$domain_name'\n";
@


1.1
log
@initial checkin
@
text
@a48 1

d50 1
a50 1
# $Id: apache.pm,v 1.1 2000/03/24 20:33:58 jrobbins Exp $
d56 3
d60 47
a106 29
my $sandbox      = $ARGV[0];
my $project_name = $ARGV[1];
my $domain_name  = $ARGV[2];
my $brand_name   = $ARGV[3];
my $description  = $ARGV[4];


add_vhost($project_name, $domain_name, 0);
#TODO: where does #force come from?

set_up_pages($project_name, $domain_name, $brand_name, $description);




################################################################


sub add_vhost {
    my ($project_name, $domain_name, $force) = @@_;
    print "apache: Update SERVERROOT/helm/conf/webmodules.conf to add: " .
        $project_name . "." . $domain_name . "\n";
    my $vhostlistreldir = "helm/conf";
    my $vhostlistdir = "$sandbox/$vhostlistreldir";
    my $webmodulesfilename = "webmodules.conf";
    my $vhostlistfile = $vhostlistdir . "/" . $webmodulesfilename;
    # TODO: get dir name from from database instead.

    my $already_exists = 0;
d108 32
a139 16
    if (-e $vhostlistfile) {
	open(VHOSTLIST, "<$vhostlistfile")
	    or die "Could not open $vhostlistfile: $!\n";
	
	print "apache: check if there is already an entry\n";
	while (<VHOSTLIST>) {
	    /^\s+[iI]nclude (\S)+/;
	    if ($1) {
		my $pos = index $1, $project_name;
		if ($pos != -1) {
		    $already_exists = 1;
		    last;
		}
	    }
	}
	close VHOSTLIST;
d141 6
d148 10
a157 12
    if ($already_exists == 0) {
	print "apache: append an entry to webmodules.conf\n";
	my $project_pathname = write_vhost_config($project_name, $vhostlistreldir, $force);

	
	open(VHOSTLIST, ">>$vhostlistfile")
	    or die "Could not open $vhostlistfile: $!\n";
	print VHOSTLIST "\n\nInclude $project_pathname\n";
	close VHOSTLIST;
    }
    else {
	print "apache: found existing an entry to webmodules.conf\n";
a158 2
}

d160 1
d162 2
a163 10
sub write_vhost_config {
    my ($project, $vhostlistreldir, $force) = @@_;
    my $project_filename = $project . ".vhost.conf";
    my $project_pathname = $vhostlistreldir . "/" . $project_filename;

    print "project_pathname = $project_pathname\n";
    if ($force == 0 && -e "$sandbox/$project_pathname") {
	die "apache: project config file already exists! giving up! \n";
	#TODO: move existing file to .bak
    }
d165 1
a165 4
    print "apache: writing project config file\n";

    open(CONFIG, ">$sandbox/$project_pathname")
	or die "Could not open $sandbox/$project_pathname: $!\n";
d167 2
a168 2
    #print CONFIG "# THIS FILE WAS AUTOMATICALLY GENERATED - DO NOT EDIT\n";
    #print CONFIG "# output from Helm::ApacheConfig\n\n";
d170 12
a181 5
    my $ip = '63.211.145.5';
    #my $port = 80;
    my $htdocs = '$sandbox/html';
    
    print CONFIG "NameVirtualHost $ip\n";
d183 6
a188 8
    print CONFIG "\n# Configuration for Web module $project\n";
    print CONFIG <<"EOF";
<VirtualHost $ip>
ServerAdmin webmaster\@@$project.$domain_name
DocumentRoot $htdocs/$project/www
ServerName $project.$domain_name
ErrorLog logs/project-$project-error.log
CustomLog logs/project-$project-access.log combined
d190 29
a218 1
EOF
a219 3


    print CONFIG <<"EOF";
d224 13
a236 13
  RewriteEngine on
  RewriteLog logs/rewrite_log
  RewriteLogLevel 0
  RewriteRule ^(/.*/nonav/.*)\$        \$1 [PT]
  RewriteRule ^(/bugs)\$               \$1 [PT]
  RewriteRule ^(/bugs/.*)\$            \$1 [PT]
  RewriteRule ^(/source/.*)\$          \$1 [PT]
  RewriteRule ^(/search/.*)\$          \$1 [PT]
  RewriteRule ^(.*/)\$                 /helm/TView?page=\$1/index.html [PT]
  RewriteRule ^(/.*\.html)\$           /helm/TView?page=\$1 [QSA,PT]
  RewriteRule ^(/.*\.js)\$             \$1 [PT]
  RewriteRule ^/([A-Za-z0-9_]+)\$      /helm/\$1 [PT]
</IfModule>
a237 2
EOF
                print CONFIG <<"EOF";
a238 1
EOF
d240 5
a244 8

	# The options should be configurable
	print CONFIG <<"EOF";
<Directory $htdocs/$project/www>
Options Indexes FollowSymLinks
AllowOverride None
order allow,deny
allow from all
d246 1
a246 1
EOF
d248 1
a248 1
    close CONFIG;
a249 1
    return $project_pathname;
d252 1
a252 2


d254 13
a266 3
    my ($project_name, $domain_name, $brand_name, $description) = @@_;
    print "apache: Check in template files for project: " .
        $project_name . " using brandname " . $brand_name . "\n";
d268 1
a268 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
@d49 1
d51 1
a51 1
# $Id: apache-project-add,v 1.1 2000/10/05 20:05:49 jrobbins Exp $
d57 12
a68 2
# Flush buffer, just in case:
$| = 1;
a69 4
# For the sake of -T:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
# Detaint the args by brute force:
@@ARGV = detaint_array(@@ARGV);
a70 35
# Process arguments
my $sandbox          = $ARGV[0] || '';
my $htdoc_root       = $ARGV[1] || '';
my $project_name     = $ARGV[2] || '';
my $domain_name      = $ARGV[3] || '';
my $brand_name       = $ARGV[4] || ''; # unreferenced.
my $description      = $ARGV[5] || ''; # 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. Create directory for project HTML:
# bail if $project_name isn't suitable for directory creation - 
# alphanumeric or hyphen:
unless($project_name =~ m/^[-\w]+$/){
    print "$script_name: project_name not exclusively alphanumeric/hyphen.\n";
    exit(1);
}
a71 10
# return success if it's already there:
if(-d $project_name){
    print "$script_name: directory $project_name already exists.\n";
} else {
    unless(mkdir($project_name, 0755)){
        print "$script_name: unable to create directory $project_name: $!\n";
        exit(1);
    };
    print "$script_name: directory $project_name created\n";
}
d73 1
a73 6
# 2. UNIMPLEMENTED - it appears that the intent of this was to 
# introduce some default html components into the project.  This was
# not implemented as such in the previous iteration of the system, so
# it is not implemented here.  The function call remains here as 
# intended for some ambitious programmer to implement:
set_up_pages($project_name, $domain_name, $brand_name, $description);
a74 3
#---------------------------------------------------------------
# END MAIN
#---------------------------------------------------------------
d76 29
d106 13
a118 14
#-------------------
sub set_up_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_pages()\n";
#    print "apache: Check in template files for project: " .
#        $project_name . " using brandname " . $brand_name . "\n";
    return;
d120 12
a131 12
# 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);
d133 62
d196 3
a198 1
    return(@@clean);
a200 1
__END__
d202 7
@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d50 1
a50 1
# $Id: apache-project-add,v 1.10 2001/01/05 23:31:11 kmaples Exp $
d65 6
a70 2
my $htdoc_root       = $ARGV[0] || '';
my $project_name     = $ARGV[1] || '';
d77 6
d111 7
d122 16
@


