mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
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:
+2
-7
@@ -432,7 +432,7 @@ static int get(const char *src, const struct infix_ds *ds, const char *path)
|
|||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (ds && !ds->path)
|
if (ds)
|
||||||
err = sysrepo_export(ds, path);
|
err = sysrepo_export(ds, path);
|
||||||
else if (is_uri(src))
|
else if (is_uri(src))
|
||||||
err = curl_download(src, path);
|
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);
|
*src = infix_ds(*src, ds);
|
||||||
|
|
||||||
if ((*ds && !(*ds)->path) || is_uri(*src)) {
|
if (*ds || is_uri(*src)) {
|
||||||
*path = tempnam(NULL, NULL);
|
*path = tempnam(NULL, NULL);
|
||||||
if (!*path)
|
if (!*path)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
*rm = true;
|
*rm = true;
|
||||||
return 0;
|
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 {
|
} else {
|
||||||
*path = cfg_adjust(*src, NULL, sanitize);
|
*path = cfg_adjust(*src, NULL, sanitize);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user