From f164c76ca1550dee186a2c12ff75f4284a3a28cc Mon Sep 17 00:00:00 2001 From: mxi1 Date: Mon, 11 May 2009 15:47:34 +0000 Subject: [PATCH] Undoing change commited in r3331 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3342 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/credentials.pm | 23 +++--- xCAT/postscripts/remoteshell | 77 +++++++-------------- 2 files changed, 34 insertions(+), 66 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/credentials.pm b/xCAT-server/lib/xcat/plugins/credentials.pm index 9b937a277..fe5e32ec9 100644 --- a/xCAT-server/lib/xcat/plugins/credentials.pm +++ b/xCAT-server/lib/xcat/plugins/credentials.pm @@ -179,22 +179,15 @@ sub process_request } else { next; } - if (defined $tfilename && -r $tfilename) { - open($tmpfile,$tfilename); - @filecontent=<$tmpfile>; - close($tmpfile); - $retdata = "\n".join('',@filecontent); - push @{$rsp->{'data'}},{content=>[$retdata],desc=>[$_]}; - $retdata=""; - @filecontent=(); - } - } - if (defined $rsp->{data}->[0]) { - xCAT::MsgUtils->message("D", $rsp, $callback, 0); - }else { - delete $rsp->{'data'}; - xCAT::MsgUtils->message("E", $rsp, $callback, 0); + 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; } diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 0fb3acaaf..afd566a89 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -48,58 +48,33 @@ fi allowcred.awk & CREDPID=$! sleep 1 +getcredentials.awk ssh_dsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_dsa_key +MYCONT=`cat /etc/ssh/ssh_host_dsa_key` +while [ -z "$MYCONT" ]; do + let SLI=$RANDOM%10 + let SLI=SLI+10 + sleep $SLI + getcredentials.awk ssh_dsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_dsa_key + MYCONT=`cat /etc/ssh/ssh_host_dsa_key` +done +chmod 600 /etc/ssh/ssh_host_dsa_key +if ! grep "PRIVATE KEY" /etc/ssh/ssh_host_dsa_key > /dev/null 2>&1 ; then + rm /etc/ssh/ssh_host_dsa_key +fi +getcredentials.awk ssh_rsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_rsa_key +MYCONT=`cat /etc/ssh/ssh_host_rsa_key` +while [ -z "$MYCONT" ]; do + let SLI=$RANDOM%10 + let SLI=SLI+10 + sleep $SLI + getcredentials.awk ssh_rsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_rsa_key + MYCONT=`cat /etc/ssh/ssh_host_rsa_key` +done +chmod 600 /etc/ssh/ssh_host_rsa_key +if ! grep "PRIVATE KEY" /etc/ssh/ssh_host_rsa_key > /dev/null 2>&1 ; then + rm /etc/ssh/ssh_host_rsa_key +fi -function cred_handler() { - getcredentials.awk $1 | grep -E -v '|'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/$1 - grep -E '' /tmp/$1 - if [ $? ]; then - cat /tmp/$1 | grep -E -v '||' >/etc/ssh/$1 - chmod 600 /etc/ssh/$1 - if ! grep "PRIVATE KEY" /etc/ssh/$1 > /dev/null 2>&1 ; then - logger -t xCAT $1 is PRIVATE KEY - rm /etc/ssh/$1 - return - fi - logger -t xCAT $1 - rm /tmp/$1 - else - ERR_MSG = `send -n 's%.*\(.*\).*%\1%p' /tmp/$1` - logger -t xCAT $1 Error: $ERR_MSG - rm /tm/$1 - return - fi - - MYCONT=`cat /etc/ssh/$1` - while [ -z "$MYCONT" ]; do - let SLI=$RANDOM%10 - let SLI=SLI+10 - sleep $SLI - getcredentials.awk $1 | grep -E -v '|'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/$1 - grep -E '' /tmp/$1 - if [ $? ]; then - cat /tmp/$1 | grep -E -v '||' >/etc/ssh/$1 - chmod 600 /etc/ssh/$1 - if ! grep "PRIVATE KEY" /etc/ssh/$1 > /dev/null 2>&1 ; then - logger -t xCAT $1 is PRIVATE KEY - rm /etc/ssh/$1 - return - fi - logger -t xCAT $1 - rm /tmp/$1 - else - ERR_MSG = `send -n 's%.*\(.*\).*%\1%p' /tmp/$1` - logger -t xCAT $1 Error: $ERR_MSG - rm /tm/$1 - return - fi - - MYCONT=`cat /etc/ssh/$1` - done - - return -} -cred_handler ssh_dsa_hostkey -cred_handler ssh_rsa_hostkey if [ -r /etc/xCATSN ] ; then mkdir /etc/xcat/hostkeys