summaryrefslogtreecommitdiff
path: root/src/cli_new.c
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-06-10 17:26:57 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-06-10 17:26:57 -0700
commitc1877d1acd48dfeba464b33b268107ccca65c5e2 (patch)
treef6a6ea742aef0b847c86212c8444af2ffe8e4bab /src/cli_new.c
parenteae0d49f34f70752084b6563e78811ccd2466bb8 (diff)
downloadvyatta-cfg-c1877d1acd48dfeba464b33b268107ccca65c5e2.tar.gz
vyatta-cfg-c1877d1acd48dfeba464b33b268107ccca65c5e2.zip
add value character restriction
* disallow newline in value strings. * move check into lib.
Diffstat (limited to 'src/cli_new.c')
-rw-r--r--src/cli_new.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index b5d7add..5fdf60b 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -2039,6 +2039,23 @@ boolean validate_value(vtw_def *def, char *cp)
int status;
boolean ret=TRUE;
+ /* certain characters are not allowed */
+ {
+ int i = 0;
+ for (i = 0; i < strlen(cp); i++) {
+ if (cp[i] == '\'') {
+ fprintf(out_stream, "Cannot use the \"'\" (single quote) character "
+ "in a value string\n");
+ bye("single quote in value string\n");
+ }
+ if (cp[i] == '\n') {
+ fprintf(out_stream, "Cannot use the newline character "
+ "in a value string\n");
+ bye("newline in value string\n");
+ }
+ }
+ }
+
/* prepare cur_value */
set_at_string(cp);
status = char2val(def, cp, &validate_value_val);