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.
This commit is contained in:
Tobias Waldekranz
2025-10-29 16:36:04 +01:00
parent d26e311c6d
commit 0977ab476b
+2 -7
View File
@@ -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);
}