/usr/share/snmp/mib2c-data/node-validate.m2i is in libsnmp-base 5.7.3+dfsg-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | ############################################################# -*- c -*-
## generic include for XXX. Do not use directly.
##
## $Id$
##
## assumes an integer rc is available and will be tested by caller
##
########################################################################
@if $m2c_mark_boundary == 1@
/** START code generated by $RCSfile$ $Revision$ */
@end@
########################################################################
##----------------------------------------------------------------------
## setup
##----------------------------------------------------------------------
@if $node.enums == 1@
##------------------------------------------------------
@ if "$node.perltype" ne "BITS"@
/* check that the value is one of defined enums */
if( (SNMPERR_SUCCESS == rc)
@ foreach $e $v enum@
@ include m2c_setup_enum.m2i@
&& ( $m2c_nv_val != $m2c_ename )
@ end@ # for each
) {
rc = SNMP_ERR_WRONGVALUE;
}
##------------------------------------------------------
@ else@ # BITS
## {
if($m2c_nv_len > 4) {
snmp_log(LOG_ERR,"I can not handle BITS > 4 bytes\n");
rc = SNMP_ERR_GENERR;
}
else if (SNMPERR_SUCCESS == rc){
u_long bits = 0;
/* check that value is within enum mask */
memcpy( &bits, $m2c_nv_str, $m2c_nv_len);
if( (bits | $m2c_enum_mask) != $m2c_enum_mask)
rc = SNMP_ERR_WRONGVALUE;
}
@ end@
##----------------------------------------------------------------------
## check RANGES
##----------------------------------------------------------------------
@elsif $node.ranges == 1@
@ if ("$node.decl" eq "long") || ("$node.decl" eq "u_long")@
@ eval $m2c_nv_rc = "SNMP_ERR_WRONGVALUE"@
@ eval $m2c_nv_tmp = "$m2c_nv_val"@
@ else@
@ eval $m2c_nv_rc = "SNMP_ERR_WRONGLENGTH"@
@ eval $m2c_nv_tmp = "$m2c_nv_len"@
@ end@
/* check defined range(s). */
if( (SNMPERR_SUCCESS == rc)
@ foreach $a $b range $node@
@ if $a == $b@
&& ($m2c_nv_tmp != $a)
@ else@
&& (($m2c_nv_tmp < $a) || ($m2c_nv_tmp > $b))
@ end@
@ end@
) {
rc = $m2c_nv_rc;
}
@end@
##
########################################################################
@if $m2c_mark_boundary == 1@
/** END code generated by $RCSfile$ $Revision$ */
@end@
|