Fixed: [Trying to change the "config false" node through snmpset](https://github.com/clicon/clixon/issues/377)

* Fixed by returning `SNMP_ERR_NOTWRITABLE` when trying to reserve object
This commit is contained in:
Olof hagsand 2022-10-09 11:59:26 +02:00
parent d2c3b903f1
commit aff69127b6
3 changed files with 13 additions and 0 deletions

View file

@ -731,6 +731,10 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler,
case MODE_GETNEXT: /* 161 */
break;
case MODE_SET_RESERVE1: /* 0 */
if (!yang_config_ancestor(sh->sh_ys)){
retval = SNMP_ERR_NOTWRITABLE;
goto done;;
}
/* Translate from YANG ys leaf type to SNMP asn1.1 type ids (not value), also cvtype */
if (type_yang2asn1(sh->sh_ys, &asn1_type, 0) < 0)
goto done;
@ -1289,6 +1293,10 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
}
break;
case MODE_SET_RESERVE1: // 0
if (!yang_config_ancestor(sh->sh_ys)){
retval = SNMP_ERR_NOTWRITABLE;
goto done;;
}
// Check types: compare type in requestvb to yang type (or do later)
break;
case MODE_SET_RESERVE2: // 1