From 1bf52722b11ba225607f84e2a16c1dc749c3fe10 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 15 Apr 2008 21:05:08 +0000 Subject: [PATCH] -Add retrieval of root's xCAT client credentials to credentials plugin git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1075 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../lib/xcat/plugins/credentials.pm | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/credentials.pm b/xCAT-server-2.0/lib/xcat/plugins/credentials.pm index b3c9490d9..7fac63d42 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/credentials.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/credentials.pm @@ -99,20 +99,28 @@ sub process_request my $tmpfile; my @filecontent; my $retdata; + my $tfilename; foreach (@params_to_return) { if (/ssh_root_key/) { unless (-r "/root/.ssh/id_rsa") { push @{$rsp->{'error'}},"Unable to read root's private ssh key"; next; } - open($tmpfile,"/root/.ssh/id_rsa"); - @filecontent=<$tmpfile>; - close($tmpfile); - $retdata = "\n".join('',@filecontent); - push @{$rsp->{'data'}},{content=>[$retdata],desc=>[$_]}; - $retdata=""; - @filecontent=(); + $tfilename = "/root/.ssh/id_rsa"; + } elsif (/xcat_root_cred/) { + unless (-r "/root/.xcat/client-cred.pem") { + push @{$rsp->{'error'}},"Unable to read root's private xCAT key"; + next; + } + $tfilename = "/root/.xcat/client-cred.pem"; } + open($tmpfile,$tfilename); + @filecontent=<$tmpfile>; + close($tmpfile); + $retdata = "\n".join('',@filecontent); + push @{$rsp->{'data'}},{content=>[$retdata],desc=>[$_]}; + $retdata=""; + @filecontent=(); } xCAT::MsgUtils->message("D", $rsp, $callback, 0); return;