"Fossies" - the Fresh Open Source Software archive

Member "SiteMgrYAP/secure/sitemgruadd.pl" of archive SiteMgrYAP-0.2.0.tar.gz:


#!/usr/bin/perl
##
#  Tool contributed by Aharon Chernin
##


$username = @ARGV[0];
$path1    = @ARGV[1];
$path2    = @ARGV[2];
$desc     = @ARGV[3];
$location = @ARGV[4];
$passwd   = @ARGV[5];

if (!defined(@ARGV[0])) {
        print "Usage:\n";
        print "sitemgruadd.pl [USER] [PATH1] [PATH2] [DESCRIPTION] [PATH TO sitemgrpasswd] [PASSWD] \n\n";
        print "You must complete all fields!\n";
        print "Example: ./sitemgruadd.pl test test/www/htdocs test/www/cgi-bin TEST_USER /home/httpd/secure PASSWD\n";
        exit;
}

#htpasswd needs to be in your path
system ("htpasswd -b -c $location/tmpfile $username $passwd");
open (tmp, "$location/tmpfile");
while (<tmp>) {
        chomp;
        $saveme = $_;
}
close(tmp);
system ("rm -f $location/tmpfile");

open (mgrpass, ">>$location/sitemgrpasswd");
print mgrpass "$saveme\:\*\:$path1\,$path2\:$desc\n";
close (mgrpass);