summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-04-03 14:18:31 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-04-03 14:18:31 -0700
commitf71417e0209a48bb88fb614acb186109e0573941 (patch)
tree9a5e6f531521ff06a323596a0f0f1c1db5a1f252
parentbfd1fedf32528a5fe714ba9491c5bc5dd2052e91 (diff)
downloadvyatta-cfg-f71417e0209a48bb88fb614acb186109e0573941.tar.gz
vyatta-cfg-f71417e0209a48bb88fb614acb186109e0573941.zip
fix for bug 2507
-rw-r--r--src/delete.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/delete.c b/src/delete.c
index bb36fd1..b95a7d9 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -267,6 +267,28 @@ int main(int argc, char **argv)
remove_rf(FALSE);
return 0;
}
+
+ /*
+ let's do a new check here:
+ -> if this is a leaf and there is a value look for a match of the value
+ -> make sure to check existing configuration as well as uncommitted config
+ */
+ if (ai+1 == argc) {
+ //does this work up until the last value
+ pop_path(&m_path);
+ if(lstat(m_path.path, &statbuf) == 0) {
+ //now compare last value with that in the node.def file to determine whether to accept this delete
+ status = get_value(&cp, &m_path);
+ if (status != VTWERR_OK) {
+ bye("Cannot read old value %s\n", m_path.path);
+ }
+ if (!strcmp(cp,argv[argc - 1])) {
+ remove_rf(FALSE);
+ return 0;
+ }
+ }
+ }
+
fprintf(out_stream, "The specified configuration node is not valid\n");
bye("There is no appropriate template for %s",
m_path.path + strlen(get_mdirp()));