From 028c57b77f07aee4aa81cb22bd40ec3b89ec7112 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 8 Jan 2013 06:31:40 +0000 Subject: [PATCH] add the option check for litefile git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@14795 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/statelite.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index d90482715..0a07dfb05 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -257,6 +257,13 @@ sub process_request { # the directory/file in litefile table must be the absolute path ("/***") foreach my $entry (@$listNew) { my @tmp = split (/\s+/, $entry); + + # check the validity of the option + if ($tmp[1] !~ /^(tmpfs|persistent|localdisk|rw|ro|con|link|tmpfs,rw|link,ro|link,persistent|link,con)$/) { + $callback->({error=>[qq{ $tmp[2] has invalid option. The valid options: tmpfs persistent localdisk rw ro con link tmpfs,rw link,ro link,persistent link,con}], errorcode=>[1]}); + return; + } + unless ($tmp[2] =~ m{^/}) { $callback->({error=>[qq{ $tmp[2] is not one absolute path. }], errorcode=>[1]}); return;