Skip to content

Commit 7e1f5fb

Browse files
committed
session BUGFIX handle opaque nodes
Fixes CESNET/netopeer2#1062
1 parent 0a8bace commit 7e1f5fb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ nc_write_msg_io(struct nc_session *session, int io_timeout, int type, ...)
962962
nc_write_clb((void *)&arg, buf, count, 0);
963963
free(buf);
964964

965-
if (op->schema->nodetype != LYS_RPC) {
965+
if (op->schema && (op->schema->nodetype & (LYS_CONTAINER | LYS_LIST))) {
966966
/* <action> open */
967967
str = "<action xmlns=\"urn:ietf:params:xml:ns:yang:1\">";
968968
nc_write_clb((void *)&arg, str, strlen(str), 0);
@@ -974,7 +974,7 @@ nc_write_msg_io(struct nc_session *session, int io_timeout, int type, ...)
974974
goto cleanup;
975975
}
976976

977-
if (op->schema->nodetype != LYS_RPC) {
977+
if (op->schema && (op->schema->nodetype & (LYS_CONTAINER | LYS_LIST))) {
978978
/* <action> close */
979979
str = "</action>";
980980
nc_write_clb((void *)&arg, str, strlen(str), 0);

src/session.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ nc_session_get_data(const struct nc_session *session)
599599
NC_MSG_TYPE
600600
nc_send_msg_io(struct nc_session *session, int io_timeout, struct lyd_node *op)
601601
{
602-
if (session->ctx != op->schema->module->ctx) {
603-
ERR(session, "RPC \"%s\" was created in different context than that of the session.", op->schema->name);
602+
if (session->ctx != LYD_CTX(op)) {
603+
ERR(session, "RPC \"%s\" was created in different context than that of the session.", LYD_NAME(op));
604604
return NC_MSG_ERROR;
605605
}
606606

0 commit comments

Comments
 (0)