Memory error
[Netconf get/get-config :xpath capability does not support namespaces](https://github.com/clicon/clixon/issues/75)
This commit is contained in:
parent
1f8c759f3d
commit
89f751357d
3 changed files with 5 additions and 33 deletions
|
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
### API changes on existing features (you may need to change your code)
|
### API changes on existing features (you may need to change your code)
|
||||||
|
|
||||||
* The Clixon API has been extended with namespaces, or namespace contexts in the following cases:
|
* The Clixon API has been extended with namespaces, or namespace contexts in the following cases [Netconf get/get-config :xpath capability does not support namespaces](https://github.com/clicon/clixon/issues/75)
|
||||||
* CLIspec functions have added namespace parameter:
|
* CLIspec functions have added namespace parameter:
|
||||||
* `cli_show_config <db> <format> <xpath>` --> `cli_show_config <db> <format> <xpath> <namespace>`
|
* `cli_show_config <db> <format> <xpath>` --> `cli_show_config <db> <format> <xpath> <namespace>`
|
||||||
* `cli_copy_config <db> <xpath> ...` --> `cli_copy_config <db> <xpath> <namespace> ...`
|
* `cli_copy_config <db> <xpath> ...` --> `cli_copy_config <db> <xpath> <namespace> ...`
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ api_data_get2(clicon_handle h,
|
||||||
yang_stmt *yspec;
|
yang_stmt *yspec;
|
||||||
cxobj *xret = NULL;
|
cxobj *xret = NULL;
|
||||||
cxobj *xerr = NULL; /* malloced */
|
cxobj *xerr = NULL; /* malloced */
|
||||||
cxobj *xe = NULL;
|
cxobj *xe = NULL; /* not malloced */
|
||||||
cxobj **xvec = NULL;
|
cxobj **xvec = NULL;
|
||||||
size_t xlen;
|
size_t xlen;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -293,10 +293,10 @@ api_data_get2(clicon_handle h,
|
||||||
instance that does not exist, then an error response containing
|
instance that does not exist, then an error response containing
|
||||||
a "404 Not Found" status-line MUST be returned by the server.
|
a "404 Not Found" status-line MUST be returned by the server.
|
||||||
The error-tag value "invalid-value" is used in this case. */
|
The error-tag value "invalid-value" is used in this case. */
|
||||||
if (netconf_invalid_value_xml(&xe, "application", "Instance does not exist") < 0)
|
if (netconf_invalid_value_xml(&xerr, "application", "Instance does not exist") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
/* override invalid-value default 400 with 404 */
|
/* override invalid-value default 400 with 404 */
|
||||||
if (api_return_err(h, r, xe, pretty, use_xml, 404) < 0)
|
if (api_return_err(h, r, xerr, pretty, use_xml, 404) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ netconf_invalid_value_xml(cxobj **xret,
|
||||||
char *message)
|
char *message)
|
||||||
{
|
{
|
||||||
int retval =-1;
|
int retval =-1;
|
||||||
cxobj *xerr;
|
cxobj *xerr = NULL;
|
||||||
char *encstr = NULL;
|
char *encstr = NULL;
|
||||||
|
|
||||||
if (*xret == NULL){
|
if (*xret == NULL){
|
||||||
|
|
@ -162,7 +162,6 @@ netconf_invalid_value(cbuf *cb,
|
||||||
char *type,
|
char *type,
|
||||||
char *message)
|
char *message)
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
cxobj *xret = NULL;
|
cxobj *xret = NULL;
|
||||||
|
|
||||||
|
|
@ -175,33 +174,6 @@ netconf_invalid_value(cbuf *cb,
|
||||||
if (xret)
|
if (xret)
|
||||||
xml_free(xret);
|
xml_free(xret);
|
||||||
return retval;
|
return retval;
|
||||||
#else
|
|
||||||
int retval = -1;
|
|
||||||
char *encstr = NULL;
|
|
||||||
|
|
||||||
if (cprintf(cb, "<rpc-reply><rpc-error>"
|
|
||||||
"<error-type>%s</error-type>"
|
|
||||||
"<error-tag>invalid-value</error-tag>"
|
|
||||||
"<error-severity>error</error-severity>",
|
|
||||||
type) <0)
|
|
||||||
goto err;
|
|
||||||
if (message){
|
|
||||||
if (xml_chardata_encode(&encstr, "%s", message) < 0)
|
|
||||||
goto done;
|
|
||||||
if (cprintf(cb, "<error-message>%s</error-message>", encstr) < 0)
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if (cprintf(cb, "</rpc-error></rpc-reply>") <0)
|
|
||||||
goto err;
|
|
||||||
retval = 0;
|
|
||||||
done:
|
|
||||||
if (encstr)
|
|
||||||
free(encstr);
|
|
||||||
return retval;
|
|
||||||
err:
|
|
||||||
clicon_err(OE_XML, errno, "cprintf");
|
|
||||||
goto done;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Create Netconf too-big error XML tree according to RFC 6241 Appendix A
|
/*! Create Netconf too-big error XML tree according to RFC 6241 Appendix A
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue