Strings in xmldb_put not properly encoded, eg eth/0 became eth.00000

This commit is contained in:
Olof hagsand 2017-05-25 15:10:51 +02:00
parent 9d8a2f73c2
commit d58ffb2c72
5 changed files with 23 additions and 11 deletions

View file

@ -1,5 +1,7 @@
# Clixon CHANGELOG
- Strings in xmldb_put not properly encoded, eg eth/0 became eth.00000
## 3.3.0
May 2017

6
configure vendored
View file

@ -2136,7 +2136,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
CLIXON_VERSION_MAJOR="3"
CLIXON_VERSION_MINOR="3"
CLIXON_VERSION_PATCH="0"
CLIXON_VERSION_PATCH="1"
CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}\""
# Fix to specific version (eg 3.5) or head (3)
CLIGEN_VERSION="3"
@ -2172,8 +2172,8 @@ _ACEOF
# Bind to specific CLIgen version
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CLIXON version is ${CLIXON_VERSION}_PRE1" >&5
$as_echo "CLIXON version is ${CLIXON_VERSION}_PRE1" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CLIXON version is ${CLIXON_VERSION}_PRE" >&5
$as_echo "CLIXON version is ${CLIXON_VERSION}_PRE" >&6; }
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do

View file

@ -43,7 +43,7 @@ AC_INIT(lib/clixon/clixon.h.in)
CLIXON_VERSION_MAJOR="3"
CLIXON_VERSION_MINOR="3"
CLIXON_VERSION_PATCH="0"
CLIXON_VERSION_PATCH="1"
CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}\""
# Fix to specific version (eg 3.5) or head (3)
CLIGEN_VERSION="3"
@ -62,7 +62,7 @@ AC_SUBST(CLIXON_VERSION_MAJOR)
AC_SUBST(CLIXON_VERSION_MINOR)
AC_SUBST(CLIGEN_VERSION) # Bind to specific CLIgen version
AC_MSG_RESULT(CLIXON version is ${CLIXON_VERSION}_PRE1)
AC_MSG_RESULT(CLIXON version is ${CLIXON_VERSION}_PRE)
AC_CANONICAL_TARGET
AC_SUBST(CC)

View file

@ -458,7 +458,8 @@ text_apipath_modify(char *api_path,
int i;
int j;
char *name;
char *restval;
char *restval_enc;
char *restval = NULL;
yang_stmt *y = NULL;
yang_stmt *ykey;
cxobj *x = NULL;
@ -490,9 +491,16 @@ text_apipath_modify(char *api_path,
i = 1;
while (i<nvec){
name = vec[i]; /* E.g "x=1,2" -> name:x restval=1,2 */
if ((restval = index(name, '=')) != NULL){
*restval = '\0';
restval++;
/* restval is RFC 3896 encoded */
if (restval){
free(restval);
restval = NULL;
}
if ((restval_enc = index(name, '=')) != NULL){
*restval_enc = '\0';
restval_enc++;
if (percent_decode(restval_enc, &restval) < 0)
goto done;
}
if (y == NULL) /* top-node */
y = yang_find_topnode(yspec, name);
@ -646,6 +654,8 @@ text_apipath_modify(char *api_path,
ok:
retval = 0;
done:
if (restval)
free(restval);
if (vec)
free(vec);
if (valvec)

View file

@ -260,7 +260,7 @@ clicon_rpc_get_config(clicon_handle h,
if (xpath && strlen(xpath))
cprintf(cb, "<filter type=\"xpath\" select=\"%s\"/>", xpath);
cprintf(cb, "</get-config></rpc>");
if ((msg = clicon_msg_encode(cbuf_get(cb))) == NULL)
if ((msg = clicon_msg_encode("%s", cbuf_get(cb))) == NULL)
goto done;
if (clicon_rpc_msg(h, msg, &xret, NULL) < 0)
goto done;
@ -325,7 +325,7 @@ clicon_rpc_edit_config(clicon_handle h,
if (xmlstr)
cprintf(cb, "%s", xmlstr);
cprintf(cb, "</edit-config></rpc>");
if ((msg = clicon_msg_encode(cbuf_get(cb))) == NULL)
if ((msg = clicon_msg_encode("%s", cbuf_get(cb))) == NULL)
goto done;
if (clicon_rpc_msg(h, msg, &xret, NULL) < 0)
goto done;