-Populate a hash of site table attributes for easy lookup in various places

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7895 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-10-20 18:37:09 +00:00
parent dc8c2b5bb2
commit f5921d7852

View File

@ -1450,6 +1450,15 @@ sub becomeuser {
#If here, unable to validate given credential
return undef;
}
sub populate_site_hash {
my $sitetab = xCAT::Table->new('site',-create=>0);
unless ($sitetab) { return; }
my @records = $sitetab->getAllAttribs(qw/key value/);
foreach (@records) {
$::XCATSITEVALS{$_->{key}}=$_->{value};
}
}
sub service_connection {
my $sock = shift;
@ -1458,6 +1467,7 @@ sub service_connection {
my $peerfqdn = shift;
my $peerport = $sock->peerport;
my %tables=();
populate_site_hash();
#some paranoid measures could reduce a third party abusing stage3 image to attempting to get USER/PASS for BMCs:
# -Well, minimally, ignore requests if requesting node is not in spconfig mode (stage3)
# -Option to generate a random password per 'getipmi' request. This reduces the exposure to a D.O.S. hopefully