diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-12-18 20:40:10 -0600 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2025-12-19 09:47:24 -0600 |
| commit | bbcbdf0e8620323fdfce9707cd97a4b756a5baf3 (patch) | |
| tree | 17d5ac73d4208b774664de932ff470a47a13def2 /src/session.ml | |
| parent | 0f36d5a2650238d3bbd2b5837ec51fc0c01962aa (diff) | |
| download | vyconf-bbcbdf0e8620323fdfce9707cd97a4b756a5baf3.tar.gz vyconf-bbcbdf0e8620323fdfce9707cd97a4b756a5baf3.zip | |
T8091: sanitize path of leaf values for show command
In the context of fixing output on leaf nodes, drop last path component
if leaf value is included (as it is not prohibited).
Diffstat (limited to 'src/session.ml')
| -rw-r--r-- | src/session.ml | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/session.ml b/src/session.ml index 0bd3d95..00d47c0 100644 --- a/src/session.ml +++ b/src/session.ml @@ -590,15 +590,20 @@ let exists w s path = let show_config w s path = let path_total = s.edit_level @ path in + let path_show = + match RT.get_path_type w.reference_tree path_total with + | `Leaf_value -> Vyos1x.Util.drop_last path_total + | _ -> path_total + in let proposed_config = get_proposed_config w s in - if not (Vyos1x.Util.is_empty path_total) && - not ((VT.exists[@alert "-exn"]) proposed_config path_total) + if not (Vyos1x.Util.is_empty path_show) && + not ((VT.exists[@alert "-exn"]) proposed_config path_show) then raise (Session_error "Path does not exist") else let res = (CD.diff_show[@alert "-exn"]) w.reference_tree - path_total + path_show w.running_config proposed_config in res |
