summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/vyatta-load-config.pl13
-rw-r--r--src/delete.c22
2 files changed, 30 insertions, 5 deletions
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl
index 05323e3..9513ffa 100755
--- a/scripts/vyatta-load-config.pl
+++ b/scripts/vyatta-load-config.pl
@@ -28,16 +28,19 @@ use VyattaConfigLoad;
my $etcdir = $ENV{vyatta_sysconfdir};
my $sbindir = $ENV{vyatta_sbindir};
my $bootpath = $etcdir . "/config";
+my $load_file = $bootpath . "/config.boot";
-if ($#ARGV != 0) {
+if ($#ARGV > 0) {
print "Usage: load <config_file_name>\n";
exit 1;
}
-my $load_file = $ARGV[0];
-if (!($load_file =~ /^\//)) {
- # relative path
- $load_file = "$bootpath/$load_file";
+if (defined($ARGV[0])) {
+ $load_file = $ARGV[0];
+ if (!($load_file =~ /^\//)) {
+ # relative path
+ $load_file = "$bootpath/$load_file";
+ }
}
if (!open(CFG, "<$load_file")) {
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()));