head	1.4;
access;
symbols
	TIGRIS_NOV_12_2000:1.3
	OLDHELM:1.3.0.4
	TIGRIS_NOV_11_2000:1.3
	TIGRIS_SEP_13_2000:1.3.0.2;
locks; strict;
comment	@# @;


1.4
date	2000.11.14.02.25.03;	author kmaples;	state dead;
branches;
next	1.3;

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

1.2
date	2000.05.17.00.02.17;	author manoj;	state dead;
branches;
next	1.1;

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


desc
@@


1.4
log
@Changed the way that child scripts are called in order to return the number
or the (child) script which failed (if any).  Currently returns 0 or the
number of the first script in the sequence to fail.  Removed leftovers from
merge.
@
text
@#!/usr/bin/perl

# ================================================================
# 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.
#


# 
# $Id: bugzilla-user-edit,v 1.3 2000/09/27 21:04:57 kmaples Exp $
# --------------------
# 

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

use strict;
use DBI;

# 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 $sandbox            = $ARGV[0] || '';
my $project_name       = $ARGV[1] || '';
my $domain_name        = $ARGV[2] || ''; 
my $bugs_password      = $ARGV[3] || '';

# Some email address for bugzilla:
my $login_name = "$project_name-bugs\@@$domain_name";
my $realname   = "$project_name bugs mailing list";

# String for current sql statement
my $command;

# Placeholder vars for db work:
my ($select, $ret);
my $profiles_index 0;
 
# NOTE - this script requires the info necessary to connect
# to the correct DB, e.g., username/password, DB name, etc.

my $dbname         = $ENV{DATABASE_NAME}     || '';
my $dbuser         = $ENV{DATABASE_USER}     || '';
my $dbpass         = $ENV{DATABASE_PASSWORD} || '';

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

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------
# Fail if we don't have what we need to talk to the database:
unless($dbname && $dbuser && $dbpass){
    print "$script_name: envrionmentals for DB access not set\n";
    exit(1);
}

my $dbc = "DBI:mysql:$dbname";
my $CONN = DBI->connect($dbc, $dbuser, $dbpass);

# Check for a good connection:
unless( $CONN =~ m/HASH/){
    print "$script_name: no connection to database: $!\n";
    exit(1);
}

# Do the sql quoting for the values we're gonna play with:
foreach($project_name, $domain_name, $bugs_password, $login_name, $realname){
    $_ = $CONN->quote( $_ );
}

    print "$script_name: performing update\n";
    $command = qq[

    UPDATE profiles SET 
	password      = $bugs_password,
	cryptpassword = PASSWORD($bugs_password),
    WHERE login_name  = $login_name 
    ];

    $select = $CONN->prepare($command);
    $ret    = $select->execute;

    unless($ret){
        print "$script_name: unable to perform insert: $!\n";
        $CONN->disconnect;
        exit(1);
    }    
}

# Clean up and leave quietly:
$select->finish();
$CONN->disconnect;

#---------------------------------------------------------------
# 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);
}

@


1.3
log
@First checkin; they're not much more than stubs with a lot of code swiped
from related scripts.  None currently function.
@
text
@d51 1
a51 1
# $Id: $
@


1.2
log
@These functions will be performed by the servlets.
@
text
@d1 1
a1 1
#!/usr/bin/perl -w
d50 2
a51 2
# bugzilla-user-edit
# $Id: bugzilla-user-edit,v 1.1 2000/04/29 00:04:10 jrobbins Exp $
d53 4
a56 1
# Provide functions related to configuring the bugzilla bug tracking tool
d59 7
d68 95
a162 9
my $sandbox      = $ARGV[0];
my $user_login_id      = $ARGV[1];
my $domain_name        = $ARGV[2];
my $brand_name         = $ARGV[3];
my $user_email_address = $ARGV[4];
my $password           = $ARGV[5];
    
print "bugzilla: update profile for: " . $user_email_address . "\n";
print "          to have password: " . $password . "\n";
@


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

