diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-01 11:39:27 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-01 11:39:27 -0700 |
commit | 4e3a70dddcaa79909c13232be91a16be2262acfd (patch) | |
tree | 871eff634c197ed04cdc1ed1e5f875a407e63195 /src | |
parent | 45f0f4e2336f339ec0deefcd17a1892d0274e1e6 (diff) | |
download | vyatta-cfg-4e3a70dddcaa79909c13232be91a16be2262acfd.tar.gz vyatta-cfg-4e3a70dddcaa79909c13232be91a16be2262acfd.zip |
fix cli backend bug: syntax checking for leaf value nodes involving
variable references was not working.
Diffstat (limited to 'src')
-rw-r--r-- | src/cli_new.c | 2 | ||||
-rw-r--r-- | src/cli_val_engine.c | 2 | ||||
-rw-r--r-- | src/set.c | 16 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/cli_new.c b/src/cli_new.c index 07f0697..075b7d0 100644 --- a/src/cli_new.c +++ b/src/cli_new.c @@ -1120,7 +1120,7 @@ static int eval_va(valstruct *res, vtw_node *node) status=clind_config_engine_apply_command_path(n_cfg_path, n_tmpl_path, n_cmd_path, - FALSE, + TRUE, &cv, get_cdirp(), get_tdirp(), diff --git a/src/cli_val_engine.c b/src/cli_val_engine.c index d597c68..8090a2a 100644 --- a/src/cli_val_engine.c +++ b/src/cli_val_engine.c @@ -207,7 +207,6 @@ static char** clind_get_current_value(clind_path_ref cfg_path, struct stat statbuf; /* Directory reference: */ - if(!check_existence || (lstat(cfg_path_string, &statbuf) == 0)) { ret=(char**)realloc(ret,sizeof(char*)*1); ret[0]=clind_unescape(cfg_end); @@ -708,7 +707,6 @@ int clind_config_engine_apply_command_path(clind_path_ref cfg_path_orig, if(config_paths[i]) { int vallen=0; - char** valarr=clind_get_current_value(config_paths[i], tmpl_path, check_existence, @@ -49,8 +49,14 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val) clind_path_destruct(&tp); } - pop_path(&t_path); /* it was tag or real value */ - + if (strcmp(path_end, TAG_NAME) == 0) { + /* it was a tag, so the def is at 1 level up */ + pop_path(&t_path); + } else { + /* it's actual value, so the tmpl path is fine */ + free(path_end); + path_end = NULL; + } } push_path(&t_path, DEF_NAME); if (lstat(t_path.path, &statbuf) < 0 || @@ -190,8 +196,10 @@ int main(int argc, char **argv) exit(1); } /*ai == argc -1, must be actual value */ - if (!empty_val) - pop_path(&m_path); /*it was value, not path segment */ + if (!empty_val) { + pop_path(&m_path); /* pop the actual value at the end */ + pop_path(&t_path); /* pop the "node.tag" */ + } if(!set_validate(&def, argv[argc-1], empty_val)) { exit(1); |