schema BUGFIX several tests and bugfixes of lys_getnext()
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 6b89cb3..f5b9174 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -95,6 +95,7 @@
const struct lys_module *mod;
const char *nodeid_type;
int getnext_extra_flag = 0;
+ int current_nodetype = 0;
assert(nodeid);
assert(target);
@@ -147,11 +148,15 @@
/* move through input/output manually */
if (!strncmp("input", name, name_len)) {
(*result_flag) |= LYSC_OPT_RPC_INPUT;
- } else if (!strncmp("input", name, name_len)) {
+ } else if (!strncmp("output", name, name_len)) {
(*result_flag) |= LYSC_OPT_RPC_OUTPUT;
getnext_extra_flag = LYS_GETNEXT_OUTPUT;
+ } else {
+ goto getnext;
}
+ current_nodetype = LYS_INOUT;
} else {
+getnext:
context_node = lys_child(context_node, mod, name, name_len, 0,
getnext_extra_flag | LYS_GETNEXT_NOSTATECHECK | LYS_GETNEXT_WITHCHOICE | LYS_GETNEXT_WITHCASE);
if (!context_node) {
@@ -160,8 +165,9 @@
return LY_ENOTFOUND;
}
getnext_extra_flag = 0;
+ current_nodetype = context_node->nodetype;
- if (context_node->nodetype == LYS_NOTIF) {
+ if (current_nodetype == LYS_NOTIF) {
(*result_flag) |= LYSC_OPT_NOTIFICATION;
}
}
@@ -179,7 +185,10 @@
if (ret == LY_SUCCESS) {
*target = context_node;
- if (nodetype && !(context_node->nodetype & nodetype)) {
+ if (nodetype & LYS_INOUT) {
+ /* instead of input/output nodes, the RPC/action node is actually returned */
+ }
+ if (nodetype && !(current_nodetype & nodetype)) {
return LY_EDENIED;
}
} else {