-bug 2788254 is fixed; comitted the code change into trunk
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3331 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
1075c7fec8
commit
79abdf152c
@ -179,15 +179,22 @@ sub process_request
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
open($tmpfile,$tfilename);
|
||||
@filecontent=<$tmpfile>;
|
||||
close($tmpfile);
|
||||
$retdata = "\n".join('',@filecontent);
|
||||
push @{$rsp->{'data'}},{content=>[$retdata],desc=>[$_]};
|
||||
$retdata="";
|
||||
@filecontent=();
|
||||
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);
|
||||
}
|
||||
xCAT::MsgUtils->message("D", $rsp, $callback, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,33 +48,58 @@ fi
|
||||
allowcred.awk &
|
||||
CREDPID=$!
|
||||
sleep 1
|
||||
getcredentials.awk ssh_dsa_hostkey | grep -v '<'|sed -e 's/</</' -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/"/"/' -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/"/"/' -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/"/"/' -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 '</{0,1}xcatresponse>|</{0,1}serverdone>'|sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/$1
|
||||
grep -E '<error>' /tmp/$1
|
||||
if [ $? ]; then
|
||||
cat /tmp/$1 | grep -E -v '</{0,1}data>|</{0,1}content>|</{0,1}desc>' >/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%.*<error>\(.*\)</error>.*%\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 '</{0,1}xcatresponse>|</{0,1}serverdone>'|sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/$1
|
||||
grep -E '<error>' /tmp/$1
|
||||
if [ $? ]; then
|
||||
cat /tmp/$1 | grep -E -v '</{0,1}data>|</{0,1}content>|</{0,1}desc>' >/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%.*<error>\(.*\)</error>.*%\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
|
||||
|
Loading…
Reference in New Issue
Block a user