[PATCH 3/3] transports/ipv4: When plain hostname unavailable, return plain ip

2013-05-16 Thread Robin Sonefors
snmptrapd_sql needs the sending hostname to be made available to it. To do so, it asks for the formating string %B, or CHR_PDU_NAME, which according to a comment will "Try to convert the numerical transport information into a hostname [...] Otherwise falls back to the numeric address format." The

Patches for snmptrapd_sql

2013-05-16 Thread Robin Sonefors
Hi list, We've been using snmptrapd_sql and noticed a few issues with it. The first one should be obvious, and I hope the second isn't too contentious. The third one is the one I'm not sure about - if it should be done another way, I'm all ears. -

[PATCH 1/3] snmptrapd_sql: Fix memory error when hostname is short

2013-05-16 Thread Robin Sonefors
realloc_format_trap expects the second parameter to be the input buffer's length, but instead it was sent sizeof(char*). When the host name was shorter than that, realloc_format_trap would write to unallocated memory, potentially crashing the daemon. --- apps/snmptrapd_sql.c | 2 +- 1 file changed

[PATCH 2/3] snmptrapd_sql: Make the database name configurable

2013-05-16 Thread Robin Sonefors
The database name was hardcoded to net_snmp. This patch makes it possible to configure it to use something else from the command line, or from a my.cnf file. --- apps/snmptrapd_sql.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/snmptrapd_sql.c b/apps/snmptrapd_sql.c index 628c9bf..08