From ccc69fc3306ecb5fe4275452945910f7ea50e97d Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Thu, 2 Aug 2018 11:22:43 +0800 Subject: [PATCH] remind incorrect syntax in object name regular expression (#5455) Remind incorrect syntax in object name regular expression --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index b1198b346..d454abaf4 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -3922,6 +3922,16 @@ sub defls # the object names are passed in through command line if ($::objectsfrom_args || $::opt_o || (($type eq 'node') && ($::opt_o || @::noderange))) { + + eval { /$obj/ }; + if ($@) + { + my $rsp = {}; + $rsp->{data}->[0] = "Invalid \'$obj\' name, check the object named \'$obj\' of type \'$type\' syntax."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + next; + } + if (!grep(/^$obj$/, @allobjoftype)) { my $rsp;