From 71cf318ee9713b3e8b8e53dbed5187eebfaabbe2 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 22 Mar 2012 13:57:17 +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/trunk@11947 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, );