From c62a0c72ac2cc7c840f6004c274c37bf8ce6c854 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 22 Jun 2023 10:24:57 +0200
Subject: [PATCH 1/2] Allow 'factory' as copy-from (only) in rpc copy-config
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
 src/netconf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/netconf.c b/src/netconf.c
index 1d9ba79..2a6f1a4 100644
--- a/src/netconf.c
+++ b/src/netconf.c
@@ -334,6 +334,8 @@ np2srv_rpc_copyconfig_cb(const struct lyd_node *rpc, struct np_user_sess *user_s
         ds = SR_DS_STARTUP;
     } else if (!strcmp(nodeset->dnodes[0]->schema->name, "candidate")) {
         ds = SR_DS_CANDIDATE;
+    } else if (!strcmp(nodeset->dnodes[0]->schema->name, "factory")) {
+        ds = SR_DS_FACTORY_DEFAULT; /* only allowed as copy-from */
     } else {
         assert(!strcmp(nodeset->dnodes[0]->schema->name, "url"));
 #ifdef NP2SRV_URL_CAPAB
-- 
2.43.0

