Signed-off-by: Mislav Novakovic <mislav.novakovic@sartura.hr>lilik-openwrt-22.03
@ -1,48 +0,0 @@ | |||
Index: netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/server/ietf_netconf_server.c | |||
=================================================================== | |||
--- netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459.orig/server/ietf_netconf_server.c | |||
+++ netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/server/ietf_netconf_server.c | |||
@@ -1161,8 +1161,8 @@ feature_change_ietf_netconf_server(const | |||
{ | |||
int rc, rc2 = 0; | |||
const char *path = NULL; | |||
- sr_val_iter_t *sr_iter; | |||
- sr_val_t *sr_val; | |||
+ sr_val_t *values; | |||
+ size_t value_cnt; | |||
assert(feature_name); | |||
@@ -1180,26 +1180,26 @@ feature_change_ietf_netconf_server(const | |||
return EXIT_SUCCESS; | |||
} | |||
- rc = sr_get_items_iter(np2srv.sr_sess.srs, path, &sr_iter); | |||
+ rc =sr_get_items(np2srv.sr_sess.srs, path, &values, &value_cnt); | |||
if (rc != SR_ERR_OK) { | |||
ERR("Failed to get \"%s\" values iterator from sysrepo (%s).", sr_strerror(rc)); | |||
return EXIT_FAILURE; | |||
} | |||
- while ((rc = sr_get_item_next(np2srv.sr_sess.srs, sr_iter, &sr_val)) == SR_ERR_OK) { | |||
- if (sr_val->type == SR_LIST_T) { | |||
+ size_t i; | |||
+ for(i = 0; i < value_cnt; i++) { | |||
+ if (values[i].type == SR_LIST_T) { | |||
/* no semantic meaning */ | |||
continue; | |||
} | |||
- rc2 = module_change_resolve(np2srv.sr_sess.srs, SR_OP_CREATED, NULL, sr_val, NULL, NULL); | |||
- sr_free_val(sr_val); | |||
+ rc2 = module_change_resolve(np2srv.sr_sess.srs, SR_OP_CREATED, NULL, &values[i], NULL, NULL); | |||
if (rc2) { | |||
ERR("Failed to enable nodes depending on the \"%s\" ietf-netconf-server feature.", feature_name); | |||
break; | |||
} | |||
} | |||
- sr_free_val_iter(sr_iter); | |||
+ sr_free_values(values, value_cnt); | |||
if (rc2) { | |||
return EXIT_FAILURE; | |||
} else if ((rc != SR_ERR_OK) && (rc != SR_ERR_NOT_FOUND)) { |
@ -1,59 +0,0 @@ | |||
Index: netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/CMakeLists.txt | |||
=================================================================== | |||
--- netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459.orig/cli/CMakeLists.txt | |||
+++ netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/CMakeLists.txt | |||
@@ -67,6 +67,9 @@ if(NOT MAN_INSTALL_DIR) | |||
set(MAN_INSTALL_DIR share/man) | |||
endif() | |||
+include(CheckFunctionExists) | |||
+check_function_exists(eaccess HAVE_EACCESS) | |||
+ | |||
# install binary | |||
install(TARGETS netopeer2-cli DESTINATION ${BIN_INSTALL_DIR}) | |||
Index: netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/commands.c | |||
=================================================================== | |||
--- netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459.orig/cli/commands.c | |||
+++ netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/commands.c | |||
@@ -37,6 +37,10 @@ | |||
# include <openssl/x509v3.h> | |||
#endif | |||
+#ifndef HAVE_EACCESS | |||
+#define eaccess access | |||
+#endif | |||
+ | |||
#include "commands.h" | |||
#include "configuration.h" | |||
#include "completion.h" | |||
Index: netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/completion.c | |||
=================================================================== | |||
--- netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459.orig/cli/completion.c | |||
+++ netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/completion.c | |||
@@ -27,6 +27,10 @@ | |||
#include <nc_client.h> | |||
+#ifndef HAVE_EACCESS | |||
+#define eaccess access | |||
+#endif | |||
+ | |||
#include "commands.h" | |||
#include "linenoise/linenoise.h" | |||
Index: netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/configuration.c | |||
=================================================================== | |||
--- netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459.orig/cli/configuration.c | |||
+++ netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/configuration.c | |||
@@ -28,6 +28,10 @@ | |||
#include <libyang/libyang.h> | |||
#include <nc_client.h> | |||
+#ifndef HAVE_EACCESS | |||
+#define eaccess access | |||
+#endif | |||
+ | |||
#include "configuration.h" | |||
#include "commands.h" | |||
#include "linenoise/linenoise.h" |
@ -1,51 +0,0 @@ | |||
Index: netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/CMakeLists.txt | |||
=================================================================== | |||
--- netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459.orig/cli/CMakeLists.txt | |||
+++ netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/CMakeLists.txt | |||
@@ -69,6 +69,10 @@ endif() | |||
include(CheckFunctionExists) | |||
check_function_exists(eaccess HAVE_EACCESS) | |||
+check_function_exists(mkstemps HAVE_MKSTEMPS) | |||
+if(HAVE_MKSTEMPS) | |||
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_MKSTEMPS") | |||
+endif(HAVE_MKSTEMPS) | |||
# install binary | |||
install(TARGETS netopeer2-cli DESTINATION ${BIN_INSTALL_DIR}) | |||
Index: netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/completion.c | |||
=================================================================== | |||
--- netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459.orig/cli/completion.c | |||
+++ netopeer2-0.4.0-d028c1f931819db4b3e3cb1fd2d349a4fd5c0459/cli/completion.c | |||
@@ -120,6 +120,7 @@ readinput(const char *instruction, const | |||
char* tmpname = NULL, *input = NULL, *old_content = NULL, *ptr, *ptr2; | |||
/* Create a unique temporary file */ | |||
+#ifdef HAVE_MKSTEMPS | |||
if (asprintf(&tmpname, "/tmp/tmpXXXXXX.xml") == -1) { | |||
ERROR(__func__, "asprintf() failed (%s).", strerror(errno)); | |||
goto fail; | |||
@@ -129,6 +130,23 @@ readinput(const char *instruction, const | |||
ERROR(__func__, "Failed to create a temporary file (%s).", strerror(errno)); | |||
goto fail; | |||
} | |||
+#else | |||
+ if (asprintf(&tmpname, "/tmp/tmpXXXXXX") == -1) { | |||
+ ERROR(__func__, "asprintf() failed (%s).", strerror(errno)); | |||
+ goto fail; | |||
+ } | |||
+ /* cannot fail */ | |||
+ mktemp(tmpname); | |||
+ if (asprintf(&tmpname, ".xml") == -1) { | |||
+ ERROR(__func__, "asprintf() failed (%s).", strerror(errno)); | |||
+ goto fail; | |||
+ } | |||
+ tmpfd = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0600); | |||
+ if (tmpfd == -1) { | |||
+ ERROR(__func__, "Failed to create a temporary file (%s).", strerror(errno)); | |||
+ goto fail; | |||
+ } | |||
+#endif /* #ifdef HAVE_MKSTEMPS */ | |||
/* Read the old content, if any */ | |||
if (old_tmp != NULL) { |