* Much better support for XPATH 1.0 according to https://www.w3.org/TR/xpath-10 using yacc/lex
* NOTE: Due to an error in the previous implementation, all XPATH calls on the form `x[a=str]` where `str` is a string (not a number or XML symbol), must be changed to: `x[a='str'] or x[a="str"]`
* This includes all calls to `xpath_vec, xpath_first`, etc.
* All calls to cli_copy_config in CLI spec files must replace 2nd argument from `x[%s=%s]` to `x[%s='%s']`
* The old API is stillenabled. To define the new, define XPATH_USE_NEW in include/clixon_custom.h and recompile
This commit is contained in:
parent
5d7c4a8d18
commit
ba7f84afee
29 changed files with 395 additions and 79 deletions
|
|
@ -985,7 +985,13 @@ nacm_access(clicon_handle h,
|
|||
if (username == NULL)
|
||||
goto step10;
|
||||
/* User's group */
|
||||
if (xpath_vec(xacm, "groups/group[user-name=%s]", &gvec, &glen, username) < 0)
|
||||
if (xpath_vec(xacm,
|
||||
#ifdef XPATH_USE_NEW
|
||||
"groups/group[user-name='%s']",
|
||||
#else
|
||||
"groups/group[user-name=%s]",
|
||||
#endif
|
||||
&gvec, &glen, username) < 0)
|
||||
goto done;
|
||||
/* 5. If no groups are found, continue with step 10. */
|
||||
if (glen == 0)
|
||||
|
|
@ -1002,7 +1008,13 @@ nacm_access(clicon_handle h,
|
|||
for (j=0; j<glen; j++){
|
||||
char *gname;
|
||||
gname = xml_find_body(gvec[j], "name");
|
||||
if (xpath_first(xrlist,".[group=%s]", gname)!=NULL)
|
||||
if (xpath_first(xrlist,
|
||||
#ifdef XPATH_USE_NEW
|
||||
".[group='%s']",
|
||||
#else
|
||||
".[group=%s]",
|
||||
#endif
|
||||
gname)!=NULL)
|
||||
break; /* found */
|
||||
}
|
||||
if (j==glen) /* not found */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue