xmldb_get cache bug

This commit is contained in:
Olof hagsand 2019-04-10 15:58:21 +02:00
parent 6bfa510ea3
commit 4a1e0f2cbc
2 changed files with 9 additions and 3 deletions

View file

@ -353,6 +353,10 @@ from_validate_common(clicon_handle h,
/* This is the state we are going to */ /* This is the state we are going to */
if (xmldb_get1(h, candidate, "/", &td->td_target, NULL) < 0) if (xmldb_get1(h, candidate, "/", &td->td_target, NULL) < 0)
goto done; goto done;
/* Clear flags xpath for get */
xml_apply0(td->td_target, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
(void*)(XML_FLAG_MARK|XML_FLAG_CHANGE));
/* Validate the target state. It is not completely clear this should be done /* Validate the target state. It is not completely clear this should be done
* here. It is being made in generic_validate below. * here. It is being made in generic_validate below.
* But xml_diff requires some basic validation, at least check that yang-specs * But xml_diff requires some basic validation, at least check that yang-specs
@ -367,7 +371,9 @@ from_validate_common(clicon_handle h,
* This is the state we are going from */ * This is the state we are going from */
if (xmldb_get1(h, "running", "/", &td->td_src, NULL) < 0) if (xmldb_get1(h, "running", "/", &td->td_src, NULL) < 0)
goto done; goto done;
/* Clear flags xpath for get */
xml_apply0(td->td_src, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
(void*)(XML_FLAG_MARK|XML_FLAG_CHANGE));
/* 3. Compute differences */ /* 3. Compute differences */
if (xml_diff(yspec, if (xml_diff(yspec,
td->td_src, td->td_src,

View file

@ -708,9 +708,9 @@ xmldb_get(clicon_handle h,
* @note if xvec is given, then purge tree, if not return whole tree. * @note if xvec is given, then purge tree, if not return whole tree.
* @see xmldb_get This version uses direct cache access and needs to be * @see xmldb_get This version uses direct cache access and needs to be
* cleanued up after use * cleanued up after use
* @see xmldb_get1_clean Must call after use * @see xmldb_get1_clear Must call after use
* @note If !CLICON_XMLDB_CACHE you need to free xret after use * @note If !CLICON_XMLDB_CACHE you need to free xret after use
* This should probably replace xmldb_get completely * @note If CLICON_XMLDB_CACHE mark|change flags set, need to clear after call
*/ */
int int
xmldb_get1(clicon_handle h, xmldb_get1(clicon_handle h,