From 130c30c7d7b8166e38c30b95b9a19e3745d6240a Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 5 Jul 2017 02:39:19 -0400 Subject: [PATCH] Fix issue 3383, do not allow setting and getting in one command for rspconfig --- xCAT-server/lib/xcat/plugins/ipmi.pm | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 859283636..d37193ff3 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -8076,11 +8076,37 @@ sub preprocess_request { xCAT::Utils->filter_nodes($request, undef, undef, \@bmcnodes, \@nohandle); $realnoderange = \@bmcnodes; } elsif ($command eq "rspconfig") { - # filter out the nodes which should be handled by ipmi.pm my (@bmcnodes, @nohandle); xCAT::Utils->filter_nodes($request, undef, undef, \@bmcnodes, \@nohandle); $realnoderange = \@bmcnodes; + + if ($realnoderange) { + my $optset = 0; + my $optget = 0; + foreach (@exargs) { + if ($_ =~ /^(\w+)=(.*)/) { + $optset = 1; + my $option = $1; + unless ($option =~ /^USERID$|^ip$|^netmask$|^gateway$|^vlan$|^userid$|^username$|^password$|^snmpdest|^thermprofile$|^alert$|^garp$|^community$|^backupgateway$/) { + $callback->({ errorcode => [1], data => [ "Unsupported command: $command $option"] }); + $request = {}; + return; + } + } elsif ($_ =~ /^ip$|^netmask$|^gateway$|^vlan$|^userid$|^username$|^password$|^snmpdest|^thermprofile$|^alert$|^garp$|^community$|^backupgateway$/) { + $optget = 1; + } else { + $callback->({ errorcode => [1], data => [ "Unsupported command: $command $_"] }); + $request = {}; + return; + } + } + if ($optset and $optget) { + $callback->({ errorcode => [1], data => [ "Do not set and get information in the same command for $command."] }); + $request = {}; + return; + } + } } elsif ($command eq "rinv") { if ($exargs[0] eq "-t" and $#exargs == 0) { unshift @{ $request->{arg} }, 'all';