Fixed: [clixon_snmp module crashes on snmpwalk command](https://github.com/clicon/clixon/issues/378)
This commit is contained in:
parent
11eccd5478
commit
d29c81fce0
3 changed files with 9 additions and 7 deletions
|
|
@ -75,6 +75,7 @@ Developers may need to change their code
|
|||
|
||||
### Corrected Bugs
|
||||
|
||||
* Fixed: [clixon_snmp module crashes on snmpwalk command](https://github.com/clicon/clixon/issues/378)
|
||||
* Fixed: [unneeded trailing zero character on SNMP strings](https://github.com/clicon/clixon/issues/367)
|
||||
* Fixed: [message-id present on netconf app "hello"](https://github.com/clicon/clixon/issues/369)
|
||||
* Fixed: [SNMP "smiv2" yang extension doesn't work on augmented nodes](https://github.com/clicon/clixon/issues/366)
|
||||
|
|
|
|||
|
|
@ -146,13 +146,14 @@ snmp_scalar_return(cxobj *xs,
|
|||
char *reason = NULL;
|
||||
netsnmp_variable_list *requestvb = request->requestvb;
|
||||
int ret;
|
||||
char *body = NULL;
|
||||
|
||||
/* SMI default value, How is this different from yang defaults?
|
||||
*/
|
||||
if (yang_extension_value(ys, "defval", IETF_YANG_SMIV2_NS, NULL, &defaultval) < 0)
|
||||
goto done;
|
||||
if (xs != NULL){
|
||||
if ((ret = type_xml2snmp_pre(xml_body(xs), ys, &xmlstr)) < 0)
|
||||
if (xs != NULL && (body = xml_body(xs)) != NULL){
|
||||
if ((ret = type_xml2snmp_pre(body, ys, &xmlstr)) < 0) // XXX <---
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGVALUE)) != SNMPERR_SUCCESS){
|
||||
|
|
@ -242,6 +243,7 @@ snmp_scalar_get(clicon_handle h,
|
|||
char *reason = NULL;
|
||||
netsnmp_variable_list *requestvb = request->requestvb;
|
||||
cxobj *xcache = NULL;
|
||||
char *body = NULL;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
/* Prepare backend call by constructing namespace context */
|
||||
|
|
@ -270,9 +272,8 @@ snmp_scalar_get(clicon_handle h,
|
|||
* 1. From XML to SNMP string, there is a special case for enumeration, and for default value
|
||||
* 2. From SNMP string to SNMP binary value which invloves parsing
|
||||
*/
|
||||
if (x != NULL){
|
||||
assert(xml_spec(x) == ys);
|
||||
if ((ret = type_xml2snmp_pre(xml_body(x), ys, &xmlstr)) < 0)
|
||||
if (x != NULL && (body = xml_body(x)) != NULL){
|
||||
if ((ret = type_xml2snmp_pre(body, ys, &xmlstr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGVALUE)) != SNMPERR_SUCCESS){
|
||||
|
|
|
|||
|
|
@ -633,8 +633,8 @@ type_xml2snmp_pre(char *xmlstr0,
|
|||
char *str = NULL;
|
||||
int ret;
|
||||
|
||||
if (xmlstr1 == NULL){
|
||||
clicon_err(OE_UNIX, EINVAL, "xmlstr1");
|
||||
if (xmlstr0 == NULL || xmlstr1 == NULL){
|
||||
clicon_err(OE_UNIX, EINVAL, "xmlstr0/1 is NULL");
|
||||
goto done;
|
||||
}
|
||||
/* Get yang type of leaf and trasnslate to ASN.1 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue