From b0f898cf66fdc228f27adf51b49f67aac83bce58 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sat, 5 Nov 2022 12:07:44 +0100 Subject: [PATCH] Fixed: [Yang identityref XML encoding is not general](https://github.com/clicon/clixon/issues/90) * Revisiting this issue now seems to work, there are no regressions that fail when disabling IDENTITYREF_KLUDGE. --- CHANGELOG.md | 2 ++ apps/cli/cli_common.c | 2 +- include/clixon_custom.h | 4 +++- lib/src/clixon_validate.c | 2 -- lib/src/clixon_xpath_function.c | 2 -- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 990e3b68..23188c94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,8 @@ Developers may need to change their code ### Corrected Bugs +* Fixed: [Yang identityref XML encoding is not general](https://github.com/clicon/clixon/issues/90) + * Revisiting this issue now seems to work, there are no regressions that fail when disabling IDENTITYREF_KLUDGE. * Fixed several xpath crashes discovered by unit xpath fuzzing * Fixed: SEGV when using NETCONF get filter xpath and non-existent key * eg `select="/ex:table[ex:non-exist='a']` diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c index 32f3042d..d076a304 100644 --- a/apps/cli/cli_common.c +++ b/apps/cli/cli_common.c @@ -572,7 +572,7 @@ cli_start_shell(clicon_handle h, char bcmd[128]; cg_var *cv1 = cvec_i(vars, 1); sigset_t oldsigset; - struct sigaction oldsigaction[32] = {0,}; + struct sigaction oldsigaction[32] = {{{0,},},}; if (cvec_len(argv) > 1){ clicon_err(OE_PLUGIN, EINVAL, "Received %d arguments. Expected: []", diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 02719d77..1be107b5 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -55,8 +55,10 @@ * needs to generate a netconf statement with correct xmlns binding. * The easy way to do this is to always generate all prefix/namespace bindings * on the top-level for the modules involved in the netconf operation. + * Update 2022-11: seems most cornercases are covered and this is now disabled. + * I am sure there are remaining cases but undef this for now and close #90 */ -#define IDENTITYREF_KLUDGE +#undef IDENTITYREF_KLUDGE /*! Optimize special list key searches in XPATH finds * Identify xpaths that search for exactly a list key, eg: "y[k='3']" and then call diff --git a/lib/src/clixon_validate.c b/lib/src/clixon_validate.c index f30c6a51..13c9cdd5 100644 --- a/lib/src/clixon_validate.c +++ b/lib/src/clixon_validate.c @@ -275,9 +275,7 @@ validate_identityref(cxobj *xt, if (prefix == NULL) ymod = ys_module(ys); else{ /* from prefix to name */ -#if 1 /* IDENTITYREF_KLUDGE */ ymod = yang_find_module_by_prefix_yspec(ys_spec(ys), prefix); -#endif } if (ymod == NULL){ cprintf(cberr, "Identityref validation failed, %s not derived from %s in %s.yang:%d", diff --git a/lib/src/clixon_xpath_function.c b/lib/src/clixon_xpath_function.c index 430f90ac..15174c98 100644 --- a/lib/src/clixon_xpath_function.c +++ b/lib/src/clixon_xpath_function.c @@ -267,9 +267,7 @@ derived_from_one(char *baseidentity, if (prefix == NULL) ymod = ys_module(yleaf); else{ /* from prefix to name */ -#if 1 /* IDENTITYREF_KLUDGE */ ymod = yang_find_module_by_prefix_yspec(ys_spec(yleaf), prefix); -#endif } if (ymod == NULL) goto nomatch;