diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-12-19 21:50:08 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-19 21:50:08 +0000 |
| commit | a013378c3237e727ed39df55dc3c70f87190ed1d (patch) | |
| tree | 17d5ac73d4208b774664de932ff470a47a13def2 /src | |
| parent | 0f36d5a2650238d3bbd2b5837ec51fc0c01962aa (diff) | |
| parent | bbcbdf0e8620323fdfce9707cd97a4b756a5baf3 (diff) | |
| download | vyconf-a013378c3237e727ed39df55dc3c70f87190ed1d.tar.gz vyconf-a013378c3237e727ed39df55dc3c70f87190ed1d.zip | |
Merge pull request #40 from jestabro/fix-show-leaf
T8091: sanitize path of leaf values for show command
Diffstat (limited to 'src')
| -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 |
