BUGFIX missing attributes and namespace in rpc-reply when returning error information
diff --git a/src/io.c b/src/io.c
index c5f1100..6e853ab 100644
--- a/src/io.c
+++ b/src/io.c
@@ -966,8 +966,11 @@
/* can be NULL if replying with a malformed-message error */
if (rpc_elem) {
lyxml_print_clb(nc_write_xmlclb, (void *)&arg, rpc_elem, LYXML_PRINT_ATTRS);
+ nc_write_clb((void *)&arg, ">", 1, 0);
+ } else {
+ /* but put there at least the correct namespace */
+ nc_write_clb((void *)&arg, "xmlns=\""NC_NS_BASE"\">", 48, 0);
}
- nc_write_clb((void *)&arg, ">", 1, 0);
switch (reply->type) {
case NC_RPL_OK:
nc_write_clb((void *)&arg, "<ok/>", 5, 0);
diff --git a/src/session_server.c b/src/session_server.c
index 0f4e1bc..8205332 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -821,7 +821,7 @@
if (!(*rpc)->tree) {
/* parsing RPC failed */
reply = nc_server_reply_err(nc_err_libyang());
- ret = nc_write_msg(session, NC_MSG_REPLY, (*rpc)->root, reply);
+ ret = nc_write_msg(session, NC_MSG_REPLY, xml, reply);
nc_server_reply_free(reply);
if (ret == -1) {
ERR("Session %u: failed to write reply.", session->id);