mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-19 12:50:49 +00:00
-Rest of fix for bug 1965012. gettab now checks for valid column names, Table.pm properly formats the SQL statement so SQLite won't blow up in the prepare phase when searching for NULL entries.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1428 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
@ -1478,7 +1478,6 @@ sub getAttribs
|
||||
my @exeargs;
|
||||
foreach (keys %keypairs)
|
||||
{
|
||||
|
||||
if ($keypairs{$_})
|
||||
{
|
||||
$statement .= "\"".$_ . "\" = ? and ";
|
||||
@ -1493,7 +1492,7 @@ sub getAttribs
|
||||
}
|
||||
else
|
||||
{
|
||||
$statement .= "$_ is NULL and ";
|
||||
$statement .= "\"$_\" is NULL and ";
|
||||
}
|
||||
}
|
||||
$statement .= "(\"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO'))";
|
||||
|
@ -153,6 +153,10 @@ sub gettab
|
||||
foreach (@keypairs)
|
||||
{
|
||||
(my $key, my $value) = split /=/, $_;
|
||||
unless (defined $key) {
|
||||
gettab_usage(1);
|
||||
return;
|
||||
}
|
||||
$keyhash{$key} = $value;
|
||||
}
|
||||
|
||||
@ -164,6 +168,15 @@ sub gettab
|
||||
$tabhash{$table}->{$column} = 1;
|
||||
}
|
||||
|
||||
#Sanity check the key against all tables in question
|
||||
foreach my $tabn (keys %tabhash) {
|
||||
foreach my $kcheck (keys %keyhash) {
|
||||
unless (grep /^$kcheck$/, @{$xCAT::Schema::tabspec{$tabn}->{cols}}) {
|
||||
$callback->({error => ["Unkown key $kcheck to $tabn"],errorcode=>[1]});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
# Get the requested columns from each table
|
||||
foreach my $tabn (keys %tabhash)
|
||||
{
|
||||
|
Reference in New Issue
Block a user