R
Ravi Bhave
Hi,
I have a perl script which is used to log on to a server using
username and encrypted password file and key file. The script runs
FINE when I execute it on command line passing all parameters. It gets
the file without any errors or warnings.
BUT when my program(C++ program) calls the same script(ftp_get) and
passes the required parameters it does not work. It fails at line
where 'crypt' is used and gives me error: 'Insecure depedency
in''while running setgid at ftp_get (script shown at the end) at line
21, <INF> line 1.
Please help me in fixing this error.
Any help is greatly apreciated.
Thanks in advance.
Ravi
The encrypted password file is created using 'crypt' command on Sun
solaris server. The password encrypted file is created by using
following shell script(set_ibm_password), which uses keyfile($PWCKEY).
-------------------------------------------------
#! /bin/sh
# Read in the crypt seed key:
.. ibmpwckey
PWC_File=ibmpwc
echo "Enter FTP User name for IBM ? \c"
read IBM_User
echo "Enter FTP Password ? \c"
stty -echo
read IBM_password
stty echo
echo ""
echo $IBM_password | crypt $PWCKEY > $PWC_File
--------------------------------------------------------
My perl script which uses the file created by above file is as follows
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#! /usr/local/bin/perl -w
# Load the required libraries.
use Net::FTP;
$Usage="Usage: ftp_get remote_host login_name local_file remote_file
PasswdFile PasswdKeyFile";
# Get the parameters.
my( $host ) = shift || die $Usage;
my( $login ) = shift || die $Usage;
my( $local_file ) = shift || die $Usage;
my( $remote_file ) = shift || die $Usage;
my( $SeedFile ) = shift || die $Usage;
my( $PWC_File ) = shift || die $Usage;
my( $PWCKEY );
my( $PW );
open INF, $SeedFile;
while ( $Line = <INF> ) {
chomp $Line;
( $Name, $PWCKEY ) = split /=/, $Line;
if ( $Name eq "PWCKEY" ) {
break;
}
}
line 21: $PW=`crypt $PWCKEY < $PWC_File`;
chomp $PW;
print "PASSWD $PW \n";
my( $ftp ) = Net::FTP->new( $host );
$ftp->login( $login, $PW );
print "local file = $local_file Remote_file = $remote_file \n";
$ftp->get( $local_file, $remote_file )
or die "Can not get file \n";
$ftp->quit();
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I have a perl script which is used to log on to a server using
username and encrypted password file and key file. The script runs
FINE when I execute it on command line passing all parameters. It gets
the file without any errors or warnings.
BUT when my program(C++ program) calls the same script(ftp_get) and
passes the required parameters it does not work. It fails at line
where 'crypt' is used and gives me error: 'Insecure depedency
in''while running setgid at ftp_get (script shown at the end) at line
21, <INF> line 1.
Please help me in fixing this error.
Any help is greatly apreciated.
Thanks in advance.
Ravi
The encrypted password file is created using 'crypt' command on Sun
solaris server. The password encrypted file is created by using
following shell script(set_ibm_password), which uses keyfile($PWCKEY).
-------------------------------------------------
#! /bin/sh
# Read in the crypt seed key:
.. ibmpwckey
PWC_File=ibmpwc
echo "Enter FTP User name for IBM ? \c"
read IBM_User
echo "Enter FTP Password ? \c"
stty -echo
read IBM_password
stty echo
echo ""
echo $IBM_password | crypt $PWCKEY > $PWC_File
--------------------------------------------------------
My perl script which uses the file created by above file is as follows
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#! /usr/local/bin/perl -w
# Load the required libraries.
use Net::FTP;
$Usage="Usage: ftp_get remote_host login_name local_file remote_file
PasswdFile PasswdKeyFile";
# Get the parameters.
my( $host ) = shift || die $Usage;
my( $login ) = shift || die $Usage;
my( $local_file ) = shift || die $Usage;
my( $remote_file ) = shift || die $Usage;
my( $SeedFile ) = shift || die $Usage;
my( $PWC_File ) = shift || die $Usage;
my( $PWCKEY );
my( $PW );
open INF, $SeedFile;
while ( $Line = <INF> ) {
chomp $Line;
( $Name, $PWCKEY ) = split /=/, $Line;
if ( $Name eq "PWCKEY" ) {
break;
}
}
line 21: $PW=`crypt $PWCKEY < $PWC_File`;
chomp $PW;
print "PASSWD $PW \n";
my( $ftp ) = Net::FTP->new( $host );
$ftp->login( $login, $PW );
print "local file = $local_file Remote_file = $remote_file \n";
$ftp->get( $local_file, $remote_file )
or die "Can not get file \n";
$ftp->quit();
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++