Skip to content

Commit 0977ab4

Browse files
committed
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.
1 parent d26e311 commit 0977ab4

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/bin/copy.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static int get(const char *src, const struct infix_ds *ds, const char *path)
432432
{
433433
int err = 0;
434434

435-
if (ds && !ds->path)
435+
if (ds)
436436
err = sysrepo_export(ds, path);
437437
else if (is_uri(src))
438438
err = curl_download(src, path);
@@ -444,18 +444,13 @@ static int resolve_src(const char **src, const struct infix_ds **ds, char **path
444444
{
445445
*src = infix_ds(*src, ds);
446446

447-
if ((*ds && !(*ds)->path) || is_uri(*src)) {
447+
if (*ds || is_uri(*src)) {
448448
*path = tempnam(NULL, NULL);
449449
if (!*path)
450450
return 1;
451451

452452
*rm = true;
453453
return 0;
454-
} else if (*ds) {
455-
/* TODO: This means that a luser can access the
456-
* entirety of startup, without NACM filtering.
457-
*/
458-
*path = strdup((*ds)->path);
459454
} else {
460455
*path = cfg_adjust(*src, NULL, sanitize);
461456
}

0 commit comments

Comments
 (0)