* Backend plugin returning NULL was still installed - is now logged and skipped.

* [Parent list key is not validated if not provided via RESTCONF #83](https://github.com/clicon/clixon/issues/83), thanks achernavin22.
This commit is contained in:
Olof hagsand 2019-04-11 11:25:42 +02:00
parent 881dd56ee1
commit 56f32371ce
9 changed files with 62 additions and 38 deletions

View file

@ -1971,6 +1971,7 @@ api_path2xml_vec(char **vec,
cxobj *x0,
yang_stmt *y0,
yang_class nodeclass,
int strict,
cxobj **xpathp,
yang_stmt **ypathp)
{
@ -2053,9 +2054,10 @@ api_path2xml_vec(char **vec,
valvec = NULL;
}
if (restval==NULL){
// XXX patch to allow for lists without restval to be backward compat
// clicon_err(OE_XML, 0, "malformed key, expected '=restval'");
// goto done;
if (strict){
clicon_err(OE_XML, 0, "malformed key, expected '=restval'");
goto fail;
}
}
else{
if ((valvec = clicon_strsep(restval, ",", &nvalvec)) == NULL)
@ -2086,9 +2088,11 @@ api_path2xml_vec(char **vec,
}
break;
default: /* eg Y_CONTAINER, Y_LEAF */
if ((x = xml_new(name, x0, y)) == NULL)
goto done;
xml_type_set(x, CX_ELMNT);
if ((x = xml_find_type(x0, NULL, name, CX_ELMNT)) == NULL){ /* eg key of list */
if ((x = xml_new(name, x0, y)) == NULL)
goto done;
xml_type_set(x, CX_ELMNT);
}
break;
}
if (x && namespace){
@ -2097,7 +2101,7 @@ api_path2xml_vec(char **vec,
}
if ((retval = api_path2xml_vec(vec+1, nvec-1,
x, y,
nodeclass,
nodeclass, strict,
xpathp, ypathp)) < 1)
goto done;
ok:
@ -2144,6 +2148,7 @@ api_path2xml(char *api_path,
yang_stmt *yspec,
cxobj *xtop,
yang_class nodeclass,
int strict,
cxobj **xbotp,
yang_stmt **ybotp)
{
@ -2169,7 +2174,7 @@ api_path2xml(char *api_path,
}
nvec--; /* NULL-terminated */
if ((retval = api_path2xml_vec(vec+1, nvec,
xtop, yspec, nodeclass,
xtop, yspec, nodeclass, strict,
xbotp, ybotp)) < 1)
goto done;
xml_yang_root(*xbotp, &xroot);