1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00
cdt/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/auth.pl
David Dykstal 11e2a5c6da updating server runtime scripts to correct package names
adding source and SDK builds
pulling server scripts from correct directory during build
2006-04-21 21:42:15 +00:00

57 lines
1 KiB
Perl

#!/usr/bin/perl -w
use Shell;
if (!defined($ARGV[0]) || !defined($ARGV[1]) || !defined($ARGV[2]) || !defined($ARGV[3]) || !defined($ARGV[4]))
{
print("command usage:\n");
print("auth.pl USER, PATH, PORT, TIMEOUT, TICKET\n");
}
else
{
$userIN = $ARGV[0];
$pathIN = $ARGV[1];
$portIN = $ARGV[2];
$timeoutIN = $ARGV[3];
$ticketIN = $ARGV[4];
$pwdIN = <STDIN>;
chomp($pwdIN);
@passwdStruct = getpwnam($userIN);
if (@passwdStruct == 0)
{
print("invalid user name\n");
0;
}
else
{
$passwd=$passwdStruct[1];
$encryptedPWD = crypt($pwdIN, $passwd);
$classpath=$ENV{CLASSPATH};
$suOptions="-lp";
if ($passwd eq $encryptedPWD)
{
print("success\n");
$os = uname();
chomp($os);
if (lc($os) eq "aix")
{
$suOptions="-";
}
system("su $suOptions $userIN -c 'java -cp $classpath -DA_PLUGIN_PATH=$pathIN org.eclipse.dstore.core.server.Server $portIN $timeoutIN $ticketIN -Xshareclasses:name=RSE,verbose'");
1;
}
else
{
print("incorrect password\n");
0;
}
}
}