From: Ananth S. <ana...@wi...> - 2002-08-26 09:49:25
|
Hi, I have a MIB variable that is of type OCTET-STRING and represents the Hash value of a configuration file; it is used to authenticate the file received. pktcMtaDevProvConfigHash OBJECT-TYPE SYNTAX OCTET STRING (SIZE(16|20)) MAX-ACCESS read-write STATUS current DESCRIPTION "Hash of the contents of the config file, calculated and sent to the MTA prior to sending the config file. If the authenthenication algorithm is MD5, the length is 128 bits, If the authentication algorithm is SHA-1, the length is 160 bits." ::= { pktcMtaDevServer 7 } The hash of this value seems to be containing nulls because the actual length of the SHA1 hash is 20 whereas a strlen operation on it returns 17. In snmp_add_var function, we process octet strings under case 's','x' or'd'. snmp_hex_to_binary and snmp_decimal_to_binary check for hex or deximal digits whereas strlen(value) is assigned to value_len is performed if it is of type 's'. This strlen seem to be returning 17 whereas the hash string is actually 20 bytes in length. Due to this, the other end(agent) gets a 17-byte value which is wrong. Can we modify snmp_add_var to take in the value_len also so that such cases are taken care of? Thanks, Ananth. |