This issue is a variant of the following: https://sourceforge.net/tracker/index.php?func=detail&aid=1796886&group_id=12694&atid=112694
This issue is related to version: 5.7.1
The following hrSystemDate will stops varbind priting as it contains "00 00 00 00". Thus the logMatchName message string won't be available in "%v" output:
snmptrap -v 2c -c public localhost 1 coldstart hrSystemDate.0 x "07 DB 0B 1C 12 1C 2F 00 00 00 00" logMatchName.1 s "Alarm set: WARNING - Default user credentials detected"
This is an agent issue (malformed varbind, same as issue #1796886) as date should be provided as follow: "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
But it could be interesting if the display-hint formatting code could format non-printable characters differently when processing an "a" display-hint.
Now if the "1a" display-hint isn't a NULL byte (as follow), the logMatchName value is available using "%v":
snmptrap -v 2c -c public localhost 1 coldstart hrSystemDate.0 x "07 DB 0B 1C 12 1C 2F 00 2B 00 00" logMatchName.1 s "Alarm set: WARNING - Default user credentials detected"
ISSUE ILLUSTRATION
snmptrap -v 2c -c public localhost 1 coldstart hrSystemDate.0 x "07 DB 0B 1C 12 1C 2F 00 00 00 00" logMatchName.1 s "Alarm set: WARNING - Default user credentials detected"
Provides the following "%v":
sysUpTimeInstance = 0:0:00:00.01, snmpTrapOID.0 = coldStart, hrSystemDate.0 = 2011-11-28,18:28:47.0,
snmptrap -v 2c -c public localhost 1 coldstart hrSystemDate.0 x "07 DB 0B 1C 12 1C 2F 00 2B 00 00" logMatchName.1 s "Alarm set: WARNING - Default user credentials detected"
Provides the following "%v":
sysUpTimeInstance = 0:0:00:00.01, snmpTrapOID.0 = coldStart, hrSystemDate.0 = 2011-11-28,18:28:47.0,+0:0, logMatchName.1 = Alarm set: WARNING - Default user credentials detected
Proposed fix
Does the attached patch help ?
Thank you very much. The patch is working perfectly well !
Do you think it would be something that could be added to the official net-snmp distribution ?
Thanks for testing. The fix (commit 7f05daa8e0e0f533b0f12a3e1cf07641519909d6) has been applied on the 5.4, 5.5, 5.6, 5.7 and master branches so it will be included in future official releases.
Sounds great ! Thank you for your support.
I know, this is long time ago closed issue..
But exactly this patch created regression in net-snmp with get/walk UTF8 chars.
Please see issue description: https://sourceforge.net/p/net-snmp/bugs/2815/
Can you make another patch with can fix both issues?