summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-05-17 12:17:03 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-05-17 12:17:03 -0700
commit3d91d264f5961786f34494d30281de04504916c7 (patch)
tree9995799905b252513e3ff10d78033a995a3b4989
parent2636b15d7974cc56502f50ac8f323b31f901eaee (diff)
downloadvyatta-cfg-3d91d264f5961786f34494d30281de04504916c7.tar.gz
vyatta-cfg-3d91d264f5961786f34494d30281de04504916c7.zip
trap for illegal characters in comment field being set by user and provide feedback.
-rw-r--r--scripts/vyatta-comment-config.pl30
1 files 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;