summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
authorTom Grennan <tgrennan@io.vyatta.com>2007-12-13 18:36:43 -0800
committerTom Grennan <tgrennan@io.vyatta.com>2007-12-13 18:36:43 -0800
commit8d6bac43ac6604b3c2a0ac9315a2e5c168299a5a (patch)
tree4764a95a26a97186c638b8c37ce5335d7df85b8e /src/commit.c
parent9a781e1b6dbdba52ea430499d48730b6b311dd5c (diff)
parentfddadb2df7980fe86deabb0bfa27189d52479a0e (diff)
downloadvyatta-cfg-8d6bac43ac6604b3c2a0ac9315a2e5c168299a5a.tar.gz
vyatta-cfg-8d6bac43ac6604b3c2a0ac9315a2e5c168299a5a.zip
Merge branch 'master' of http://phuket.vyatta.com/vyatta-cfg
Diffstat (limited to 'src/commit.c')
-rw-r--r--src/commit.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/commit.c b/src/commit.c
index d0d2517..b2e1c8a 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -91,7 +91,7 @@ static boolean validate_dir_for_commit()
def_present = TRUE;
memset(&def, 0, sizeof(def));
#ifdef DEBUG1
- printf("Parsing definition\n");
+ printf("Parsing definition %s\n", t_path.path);
#endif
if ((status = parse_def(&def, t_path.path,
@@ -102,7 +102,7 @@ static boolean validate_dir_for_commit()
}
#ifdef DEBUG1
else
- printf("No definition\n");
+ printf("No definition %s\n", t_path.path);
#endif
pop_path(&t_path); /* for PUSH 1 */
@@ -156,11 +156,27 @@ static boolean validate_dir_for_commit()
/* read it */
cp = NULL;
status = get_value(&cp, &m_path);
- if (status == VTWERR_OK){
+ if (status == VTWERR_OK) {
#ifdef DEBUG1
printf("Validating value |%s|\n"
"for path %s\n", cp, m_path.path);
#endif
+
+ // multivalue has to be diff-ed with the pre-existing value.
+ // only the difference should be ran through the validation.
+ // Bug #2509
+ if (def.multi) {
+ char *old_value = NULL;
+ switch_path(APATH); // temporarily switching to the active config path
+ status = get_value(&old_value, &m_path);
+ if (status == VTWERR_OK) {
+ subtract_values(&cp, old_value);
+ }
+ switch_path(CPATH);
+ if (old_value)
+ my_free(old_value);
+ }
+
status = validate_value(&def, cp);
ret = ret && status;
}
@@ -232,7 +248,7 @@ static boolean validate_dir_for_commit()
}
if (def_present && def.tag)
- pop_path(&t_path); /* for PUSH 3a */
+ pop_path(&t_path); /* for PUSH 2a */
if (def_present)
free_def(&def);
#ifdef DEBUG