The 5.4.1 code:
- Has an int in snmptrapd.c called "dropauth".
- This int is referenced (extern) in snmptrapd_handlers.c
- snmptrapd_handlers.c gets compiled into libnetsnmptrapd
- TrapReceiver.xs (part of the NetSNMP::TrapReceiver perl module) fails
to load at run-time because it links to libnetsnmptrapd.so which fails
to have that variable defined.
I previously patched an RPM (I think) by throwing a "int dropauth" into
TrapReceiver.xs and was done with it. But that's not a proper patch,
and it never made it back to the source and it just bit me again. This,
I think, is the proper way to deal with the library symbol issue and is
the same way we do it everywhere else in the code: through the use of
the default_store routines:
So at this point you're wondering why I haven't applied it yet?
Cause the solution also changes the interface for libnetsnmptrap too? I
think? And may need a libtool version bump?
This is where I need advice... Cause I can probably argue it either
way. We're dropping the requirement that a library need an external
symbol (in this case a variable). Anyone know if that requires a
libtool bump? I actually wouldn't think so, but I'm trying to play good
developer and ask first.
Index: snmptrapd_ds.h
===================================================================
--- snmptrapd_ds.h (revision 16710)
+++ snmptrapd_ds.h (working copy)
@@ -4,6 +4,7 @@
/* these must not conflict with agent's DS booleans */
#define NETSNMP_DS_APP_NUMERIC_IP 16
#define NETSNMP_DS_APP_NO_AUTHORIZATION 17
+#define NETSNMP_DS_DROPFAILEDAUTHNOTIFS 18
/*
* NB: The NETSNMP_DS_APP_NO_AUTHORIZATION definition is repeated
Index: snmptrapd.c
===================================================================
--- snmptrapd.c (revision 16710)
+++ snmptrapd.c (working copy)
@@ -139,7 +139,6 @@
char *logfile = 0;
int SyslogTrap = 0;
int Event = 0;
-int dropauth = 0;
int reconfig = 0;
char ddefault_port[] = "udp:162"; /* Default default port */
char *default_port = ddefault_port;
@@ -618,7 +617,8 @@
parse_config_ignoreAuthFailure(const char *token, char *cptr)
{
if (netsnmp_ds_parse_boolean(cptr) == 1)
- dropauth = 1;
+ ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_DROPFAILEDAUTHNOTIFS, 1);
}
void
@@ -776,7 +776,8 @@
break;
case 'a':
- dropauth = 1;
+ ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_DROPFAILEDAUTHNOTIFS, 1);
break;
case 'A':
Index: snmptrapd_handlers.c
===================================================================
--- snmptrapd_handlers.c (revision 16710)
+++ snmptrapd_handlers.c (working copy)
@@ -668,7 +668,6 @@
u_char *rbuf = NULL;
size_t r_len = 64, o_len = 0;
int trunc = 0;
- extern int dropauth;
DEBUGMSGTL(( "snmptrapd", "print_handler\n"));
@@ -676,7 +675,9 @@
* Don't bother logging authentication failures
* XXX - can we handle this via suitable handler entries instead?
*/
- if (pdu->trap_type == SNMP_TRAP_AUTHFAIL && dropauth)
+ if (pdu->trap_type == SNMP_TRAP_AUTHFAIL &&
+ netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_DROPFAILEDAUTHNOTIFS)
return NETSNMPTRAPD_HANDLER_OK;
if ((rbuf = (u_char *) calloc(r_len, 1)) == NULL) {
--
Wes Hardaker
Sparta, Inc.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders