From 0977ab476b9d8b9d1d4894531cc0d705f3ce74f2 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 29 Oct 2025 16:10:32 +0100 Subject: [PATCH] bin: copy: Always get startup from sysrepo This will make sure to apply NACM rules for all the data. It also makes it possible for a luser access a subset of the data, even if they to do not have read access to /cfg/startup-config.cfg. --- src/bin/copy.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/bin/copy.c b/src/bin/copy.c index 2a8b75de..397c4fe0 100644 --- a/src/bin/copy.c +++ b/src/bin/copy.c @@ -432,7 +432,7 @@ static int get(const char *src, const struct infix_ds *ds, const char *path) { int err = 0; - if (ds && !ds->path) + if (ds) err = sysrepo_export(ds, path); else if (is_uri(src)) err = curl_download(src, path); @@ -444,18 +444,13 @@ static int resolve_src(const char **src, const struct infix_ds **ds, char **path { *src = infix_ds(*src, ds); - if ((*ds && !(*ds)->path) || is_uri(*src)) { + if (*ds || is_uri(*src)) { *path = tempnam(NULL, NULL); if (!*path) return 1; *rm = true; return 0; - } else if (*ds) { - /* TODO: This means that a luser can access the - * entirety of startup, without NACM filtering. - */ - *path = strdup((*ds)->path); } else { *path = cfg_adjust(*src, NULL, sanitize); }