VBTK
view release on metacpan or search on metacpan
# Check to see if VBHOME is created and writeable.
if(! -d $::VBHOME)
{
print STDOUT "Can't find '$::VBHOME', please create it or set the " .
"Environment variable \$VBHOME to an alternate location\n";
exit 1;
}
# See if we're running as the userid 'vbtk', and warn if not.
my ($uname) = getpwuid($<);
if($uname ne 'vbtk')
{
print STDOUT "\n" .
"It is recommended that you run all VB processes under a separate userid,\n" .
"such as 'vbtk'. You are currently running with the userid '$uname'.\n";
$resp = prompt("Do you want to continue under this userid? ","n");
exit 1 if($resp !~ /^y/i);
}
# Create appropriate directories under VBHOME, die if error
VBTK/PHttpd.pm view on Meta::CPAN
# else
# {
# $conn->send_error(RC_INTERNAL_SERVER_ERROR);
# }
#
# (0);
#}
#-------------------------------------------------------------------------------
# Function: unixAuthWGroup
# Description: Check the passed userid and password using the getpwuid function.
# If they authenticate, then check to see if the user is in one of
# the specified groups.
# Input Parms: Userid, Password, Group List (space or comma delimited)
# Output Parms: True | False
#-------------------------------------------------------------------------------
sub unixAuthWGroup
{
my ($userId,$passwd,$groupList) = @_;
&unixAuth($userId,$passwd) && &inGroup($userId,$groupList);
}
#-------------------------------------------------------------------------------
# Function: unixAuth
# Description: Check the passed userid and password using the getpwuid function
# Input Parms: Userid, Password
# Output Parms: True | False
#-------------------------------------------------------------------------------
sub unixAuth
{
my ($userId,$passwd) = @_;
my $pwd = (getpwnam($userId))[1];
if (! defined $pwd)
( run in 0.246 second using v1.01-cache-2.11-cpan-8d75d55dd25 )