From 82c5ed555f596e119efe7784b1b67b100d1bcb7c Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 23 Mar 2012 12:56:06 +0000 Subject: [PATCH] Update other p* commands to also be sudo friendly git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@11965 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/ppping | 9 ++++++--- xCAT-client/bin/prsync | 8 +++++--- xCAT-client/bin/pscp | 9 ++++++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/xCAT-client/bin/ppping b/xCAT-client/bin/ppping index 37e7c9045..206d60ef0 100755 --- a/xCAT-client/bin/ppping +++ b/xCAT-client/bin/ppping @@ -72,11 +72,14 @@ unless (@ARGV) { ## Connect to xcatd to expand a noderange my $noderange = $ARGV[0]; +my @user = getpwuid($>); +my $homedir=$user[7]; + my $client = IO::Socket::SSL->new( PeerAddr=>$xcathost, - SSL_key_file=>$ENV{HOME}."/.xcat/client-cred.pem", - SSL_cert_file=>$ENV{HOME}."/.xcat/client-cred.pem", - SSL_ca_file => $ENV{HOME}."/.xcat/ca.pem", + SSL_key_file=>$homedir."/.xcat/client-cred.pem", + SSL_cert_file=>$homedir."/.xcat/client-cred.pem", + SSL_ca_file => $homedir."/.xcat/ca.pem", SSL_use_cert => 1, #SSL_verify_mode => 1, ); diff --git a/xCAT-client/bin/prsync b/xCAT-client/bin/prsync index 1145fad9c..f5b485f7c 100755 --- a/xCAT-client/bin/prsync +++ b/xCAT-client/bin/prsync @@ -54,11 +54,13 @@ if ($version) { } (my $noderange,my $destloc) = split(/:/,$ARGV[1]); +my @user = getpwuid($>); +my $homedir=$user[7]; my $client = IO::Socket::SSL->new( PeerAddr=>$xcathost, - SSL_key_file=>$ENV{HOME}."/.xcat/client-cred.pem", - SSL_cert_file=>$ENV{HOME}."/.xcat/client-cred.pem", - SSL_ca_file => $ENV{HOME}."/.xcat/ca.pem", + SSL_key_file=>$homedir."/.xcat/client-cred.pem", + SSL_cert_file=>$homedir."/.xcat/client-cred.pem", + SSL_ca_file => $homedir."/.xcat/ca.pem", SSL_use_cert => 1, #SSL_verify_mode => 1, ); diff --git a/xCAT-client/bin/pscp b/xCAT-client/bin/pscp index a79a73330..d1c562faa 100755 --- a/xCAT-client/bin/pscp +++ b/xCAT-client/bin/pscp @@ -47,11 +47,14 @@ my $noderange, $destloc; if ($dest =~ /:/) { ($noderange, $destloc) = split(/:/, $dest); } else { usage("No node range specified\n\n"); } +my @user = getpwuid($>); +my $homedir=$user[7]; + my $client = IO::Socket::SSL->new( PeerAddr=>$xcathost, - SSL_key_file=>$ENV{HOME}."/.xcat/client-cred.pem", - SSL_cert_file=>$ENV{HOME}."/.xcat/client-cred.pem", - SSL_ca_file => $ENV{HOME}."/.xcat/ca.pem", + SSL_key_file=>$homedir."/.xcat/client-cred.pem", + SSL_cert_file=>$homedir."/.xcat/client-cred.pem", + SSL_ca_file => $homedir."/.xcat/ca.pem", SSL_use_cert => 1, #SSL_verify_mode => 1, );