Revert Temporar fix in clixon_custom.h: XPATH_CANONICAL_SKIP_CHECK

This commit is contained in:
Olof hagsand 2023-04-19 10:45:21 +02:00
parent c56d5aa44e
commit 04d5f52d90
3 changed files with 15 additions and 21 deletions

View file

@ -201,9 +201,3 @@
* Introduced in 6.1, remove in 6.2 * Introduced in 6.1, remove in 6.2
*/ */
#define AUTOCLI_DEPRECATED_HIDE #define AUTOCLI_DEPRECATED_HIDE
/*! Temporar fix for xpath_traverse_canonical for yang schema mount
* Must rewrite function to handle mountpoints, now just ignore errors
* See also
*/
#define XPATH_CANONICAL_SKIP_CHECK

View file

@ -1005,7 +1005,6 @@ xpath_traverse_canonical(xpath_tree *xs,
goto fail; goto fail;
} }
if ((ymod = yang_find_module_by_namespace(yspec, namespace)) == NULL){ if ((ymod = yang_find_module_by_namespace(yspec, namespace)) == NULL){
#ifndef XPATH_CANONICAL_SKIP_CHECK
if ((cb = cbuf_new()) == NULL){ if ((cb = cbuf_new()) == NULL){
clicon_err(OE_UNIX, errno, "cbuf_new"); clicon_err(OE_UNIX, errno, "cbuf_new");
goto done; goto done;
@ -1014,20 +1013,22 @@ xpath_traverse_canonical(xpath_tree *xs,
if (reason) if (reason)
*reason = cb; *reason = cb;
goto fail; goto fail;
#endif
} }
if (ymod == NULL) #if 0 /* safe-catch if previous check is not considered as an error */
if (ymod == NULL)
prefix1 = prefix0; prefix1 = prefix0;
else if ((prefix1 = yang_find_myprefix(ymod)) == NULL){ else
if ((cb = cbuf_new()) == NULL){ #endif
clicon_err(OE_UNIX, errno, "cbuf_new"); if ((prefix1 = yang_find_myprefix(ymod)) == NULL){
goto done; if ((cb = cbuf_new()) == NULL){
clicon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
cprintf(cb, "No prefix found in module: %s", yang_argument_get(ymod));
if (reason)
*reason = cb;
goto fail;
} }
cprintf(cb, "No prefix found in module: %s", yang_argument_get(ymod));
if (reason)
*reason = cb;
goto fail;
}
if (xml_nsctx_get(nsc1, prefix1) == NULL) if (xml_nsctx_get(nsc1, prefix1) == NULL)
if (xml_nsctx_add(nsc1, prefix1, namespace) < 0) if (xml_nsctx_add(nsc1, prefix1, namespace) < 0)
goto done; goto done;

View file

@ -59,9 +59,8 @@ expectpart "$($clixon_util_xpath -c -y $ydir -p "//x[.='42']" -n null:urn:exampl
new "xpath canonical form (no default should fail)" new "xpath canonical form (no default should fail)"
expectpart "$($clixon_util_xpath -c -y $ydir -p /x/j:y -n i:urn:example:a -n j:urn:example:b 2>&1)" 0 "/x/j:y: No namespace found for prefix" expectpart "$($clixon_util_xpath -c -y $ydir -p /x/j:y -n i:urn:example:a -n j:urn:example:b 2>&1)" 0 "/x/j:y: No namespace found for prefix"
# comment as long as XPATH_CANONICAL_SKIP_CHECK new "xpath canonical form (wrong namespace should fail)"
#new "xpath canonical form (wrong namespace should fail)" expectpart "$($clixon_util_xpath -c -y $ydir -p /i:x/j:y -n i:urn:example:c -n j:urn:example:b 2>&1)" 0 "/i:x/j:y: No yang found for namespace"
#expectpart "$($clixon_util_xpath -c -y $ydir -p /i:x/j:y -n i:urn:example:c -n j:urn:example:b 2>&1)" 0 "/i:x/j:y: No yang found for namespace"
rm -rf $dir rm -rf $dir