|
|
b5ae06 |
1050971 - snmpd segfault with entry->sysUpTime = *sysUT_var.val.integer
|
|
|
b5ae06 |
|
|
|
b5ae06 |
commit 9f4c572614091404decba0d4ef1a4cbaf9fc5bd2
|
|
|
b5ae06 |
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
|
|
b5ae06 |
Date: Thu Jan 9 13:35:27 2014 +0100
|
|
|
b5ae06 |
|
|
|
b5ae06 |
CHANGES: snmpd: Fixed monitoring based on non-delta trigger.
|
|
|
b5ae06 |
|
|
|
b5ae06 |
snmpd crashed wit following snmpd.conf:
|
|
|
b5ae06 |
monitor -s -D -r 10 -e LOGMATCH -o logMatchCurrentCount "Log Match" != logMatchCurrentCount
|
|
|
b5ae06 |
logmatch LoginFailure1 /var/log/secure 10 su: .*fail.*
|
|
|
b5ae06 |
|
|
|
b5ae06 |
The reason was unitialized variable sysUT_var in mteTrigger_run(), it was
|
|
|
b5ae06 |
filled only if the trigger was delta-valued, while its value was used for all
|
|
|
b5ae06 |
triggers.
|
|
|
b5ae06 |
|
|
|
b5ae06 |
With this patch, sysUT_var is filled for all code branches where it is needed.
|
|
|
b5ae06 |
|
|
|
b5ae06 |
diff --git a/agent/mibgroup/disman/event/mteTrigger.c b/agent/mibgroup/disman/event/mteTrigger.c
|
|
|
b5ae06 |
index bb585ed..11cb5b7 100644
|
|
|
b5ae06 |
--- a/agent/mibgroup/disman/event/mteTrigger.c
|
|
|
b5ae06 |
+++ b/agent/mibgroup/disman/event/mteTrigger.c
|
|
|
b5ae06 |
@@ -533,6 +533,13 @@ mteTrigger_run( unsigned int reg, void *clientarg)
|
|
|
b5ae06 |
} /* !old_results - end of else block */
|
|
|
b5ae06 |
} /* MTE_TRIGGER_EXISTENCE */
|
|
|
b5ae06 |
|
|
|
b5ae06 |
+ /*
|
|
|
b5ae06 |
+ * We'll need sysUpTime.0 regardless...
|
|
|
b5ae06 |
+ */
|
|
|
b5ae06 |
+ DEBUGMSGTL(("disman:event:delta", "retrieve sysUpTime.0\n"));
|
|
|
b5ae06 |
+ memset( &sysUT_var, 0, sizeof( netsnmp_variable_list ));
|
|
|
b5ae06 |
+ snmp_set_var_objid( &sysUT_var, _sysUpTime_instance, _sysUpTime_inst_len );
|
|
|
b5ae06 |
+ netsnmp_query_get( &sysUT_var, entry->session );
|
|
|
b5ae06 |
|
|
|
b5ae06 |
if (( entry->mteTriggerTest & MTE_TRIGGER_BOOLEAN ) ||
|
|
|
b5ae06 |
( entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD )) {
|
|
|
b5ae06 |
@@ -582,14 +589,6 @@ mteTrigger_run( unsigned int reg, void *clientarg)
|
|
|
b5ae06 |
* (including sysUpTime.0 if not specified explicitly).
|
|
|
b5ae06 |
*/
|
|
|
b5ae06 |
if ( entry->flags & MTE_TRIGGER_FLAG_DELTA ) {
|
|
|
b5ae06 |
- /*
|
|
|
b5ae06 |
- * We'll need sysUpTime.0 regardless...
|
|
|
b5ae06 |
- */
|
|
|
b5ae06 |
- DEBUGMSGTL(("disman:event:delta", "retrieve sysUpTime.0\n"));
|
|
|
b5ae06 |
- memset( &sysUT_var, 0, sizeof( netsnmp_variable_list ));
|
|
|
b5ae06 |
- snmp_set_var_objid( &sysUT_var, _sysUpTime_instance,
|
|
|
b5ae06 |
- _sysUpTime_inst_len );
|
|
|
b5ae06 |
- netsnmp_query_get( &sysUT_var, entry->session );
|
|
|
b5ae06 |
|
|
|
b5ae06 |
if (!(entry->flags & MTE_TRIGGER_FLAG_SYSUPT)) {
|
|
|
b5ae06 |
/*
|