* RPC replies now verified with YANG

* Stricter checking of outgoing RPC replies from server
  * See [RPC output not verified by yang](https://github.com/clicon/clixon/issues/283)
  * This lead to some corrections of RPC replies in system code
This commit is contained in:
Olof hagsand 2021-11-16 22:09:16 +01:00
parent cfe1f2936e
commit 0626de9431
11 changed files with 197 additions and 26 deletions

View file

@ -588,6 +588,7 @@ netconf_application_rpc(clicon_handle h,
cbuf *cb = NULL;
cbuf *cbret = NULL;
int ret;
int nr = 0;
/* First check system / netconf RPC:s */
if ((cb = cbuf_new()) == NULL){
@ -623,9 +624,13 @@ netconf_application_rpc(clicon_handle h,
if (yrpc != NULL){
/* No need to check xn arguments with input statement since already bound and validated. */
/* Look for local (client-side) netconf plugins. */
if ((ret = rpc_callback_call(h, xn, cbret, NULL)) < 0)
if ((ret = rpc_callback_call(h, xn, NULL, &nr, cbret)) < 0)
goto done;
if (ret > 0){ /* Handled locally */
if (ret == 0){
if (clixon_xml_parse_string(cbuf_get(cbret), YB_NONE, NULL, xret, NULL) < 0)
goto done;
}
else if (nr > 0){ /* Handled locally */
if (clixon_xml_parse_string(cbuf_get(cbret), YB_NONE, NULL, xret, NULL) < 0)
goto done;
}