From 0f2de76f020fcad060d2bb3c4de6213235fa01c5 Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 8 Jun 2015 03:00:40 -0400 Subject: [PATCH] fix for bug 4675: only allow alpha characters and numbers and dash in the new object name with chdef -n --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index ef07debca..369aa0b35 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -565,6 +565,15 @@ sub processArgs xCAT::MsgUtils->message("E", $rsp, $::callback); return 2; } + + # check the new object name specified with -n + if ($::command eq "chdef" && $::opt_n && ($::opt_n !~ /^[a-zA-Z0-9-_]+$/)) { + my $rsp; + $rsp->{data}->[0] = "The new object name \'$::opt_n\' is not valid."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + return 2; + } + # can get object names in many ways - easier to keep track $::objectsfrom_args = 0; $::objectsfrom_opto = 0;