From 3d91d264f5961786f34494d30281de04504916c7 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Mon, 17 May 2010 12:17:03 -0700 Subject: trap for illegal characters in comment field being set by user and provide feedback. --- scripts/vyatta-comment-config.pl | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/scripts/vyatta-comment-config.pl b/scripts/vyatta-comment-config.pl index d19268e..ab3191e 100644 --- a/scripts/vyatta-comment-config.pl +++ b/scripts/vyatta-comment-config.pl @@ -57,10 +57,13 @@ if (! -e $full_path) { exit 0; } } -#else { -# print "echo \"$ARGV[$#ARGV]\" > $full_path/node.comment\n"; -# `echo \"$ARGV[$#ARGV]\" > $full_path/node.comment`; -#} + +#scan for illegal characters here: '/*', '*/' +if ($ARGV[$#ARGV] =~ /\/\*|\*\//) { + print "illegal characters found in comment\n"; + exit 1; +} + if ($ARGV[$#ARGV] eq '') { `rm -f $full_path/.comment`; @@ -69,24 +72,5 @@ else { `echo \"$ARGV[$#ARGV]\" > $full_path/.comment`; } -#first let's check and ensure that there is not another child .disable node... -#also needs to be enforced when committing -#my $active_dir = "$ENV{VYATTA_ACTIVE_CONFIGURATION_DIR}/$path"; -#my $local_dir = $full_path; -#if (-e $active_dir) { -# find( \&wanted, $active_dir ); -#} -#if (-e $local_dir) { -# find( \&wanted, $local_dir ); -#} -#`touch $full_path/node.comment`; - -#if this is activate -# make sure no activate subnodes -# create .disable file in node -#else -# ensure .disable file exists -# remove node - print "Done\n"; exit 0; -- cgit v1.2.3