C-API xmldb_validate() removed. compare_db_names() added.

This commit is contained in:
Olof hagsand 2023-04-09 17:08:53 +02:00
parent 7eb37273b8
commit 45d8e5b6ce
9 changed files with 54 additions and 81 deletions

View file

@ -121,23 +121,6 @@ xmldb_db2file(clicon_handle h,
return retval;
}
/*! Ensure database name is correct
* @param[in] db Name of database
* @retval 0 OK
* @retval -1 Failed validate, xret set to error
* XXX why is this function here? should be handled by netconf yang validation
*/
int
xmldb_validate_db(const char *db)
{
if (strcmp(db, "running") != 0 &&
strcmp(db, "candidate") != 0 &&
strcmp(db, "startup") != 0 &&
strcmp(db, "tmp") != 0)
return -1;
return 0;
}
/*! Connect to a datastore plugin, allocate resources to be used in API calls
* @param[in] h Clicon handle
* @retval 0 OK

View file

@ -379,6 +379,8 @@ clicon_msg_send(int s,
* @param[in] intr If set, make a ^C cause an error
* @param[out] msg CLICON msg data reply structure. Free with free()
* @param[out] eof Set if eof encountered
* @retval 0 OK
* @retval -1 Error
* Note: caller must ensure that s is closed if eof is set after call.
* @see clicon_msg_rcv1 using plain NETCONF
*/
@ -451,7 +453,7 @@ clicon_msg_rcv(int s,
clicon_debug(CLIXON_DBG_MSG, "Recv: %s", (*msg)->op_body);
ok:
retval = 0;
done:
done:
clicon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
if (intr){
set_signal(SIGINT, oldhandler, NULL);

View file

@ -1264,8 +1264,10 @@ xml2xpath1(cxobj *x,
cvi = NULL;
while ((cvi = cvec_each(cvk, cvi)) != NULL) {
keyname = cv_string_get(cvi);
if ((xkey = xml_find(x, keyname)) == NULL)
goto done; /* No key in xml */
if ((xkey = xml_find(x, keyname)) == NULL){
clicon_err(OE_XML, 0, "No key %s in list %s", keyname, xml_name(x));
goto done;
}
if ((xb = xml_find(x, keyname)) == NULL)
goto done;
b = xml_body(xb);