net-snmp/net-snmp-5.7.3-fix-snmpd-crashing-when-an-agentx-disconnects.patch
Stephan Kulow f9936db948 Accepting request 317257 from net-snmp:factory
changes file modificatons after factory-auto reject (forwarded request 317256 from abergmann)

OBS-URL: https://build.opensuse.org/request/show/317257
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/net-snmp?expand=0&rev=75
2015-07-21 11:26:21 +00:00

55 lines
2.4 KiB
Diff

commit f9304c83f76202db0e684269ca1af32e43cd9db4
Author: Jan Safranek <jsafranek@users.sourceforge.net>
Date: Tue Feb 7 14:53:44 2012 +0100
CHANGES: PATCH 1633670: fixed snmpd crashing when an AgentX subagent disconnect in the middle of processing of a request.
I fixed also the memory leak reported in the tracker comments.
Index: net-snmp-5.7.2/agent/mibgroup/agentx/master.c
===================================================================
--- net-snmp-5.7.2.orig/agent/mibgroup/agentx/master.c
+++ net-snmp-5.7.2/agent/mibgroup/agentx/master.c
@@ -219,6 +219,9 @@ agentx_got_response(int operation,
if (!cache) {
DEBUGMSGTL(("agentx/master", "response too late on session %8p\n",
session));
+ /* response is too late, free the cache */
+ if (magic)
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
return 0;
}
requests = cache->requests;
@@ -606,6 +609,8 @@ agentx_master_handler(netsnmp_mib_handle
result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
if (result == 0) {
snmp_free_pdu(pdu);
+ if (cb_data)
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) cb_data);
}
return SNMP_ERR_NOERROR;
Index: net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c
===================================================================
--- net-snmp-5.7.2.orig/agent/mibgroup/agentx/master_admin.c
+++ net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c
@@ -133,11 +133,16 @@ close_agentx_session(netsnmp_session * s
* requests, so that the delegated request will be completed and
* further requests can be processed
*/
- netsnmp_remove_delegated_requests_for_session(session);
+ while (netsnmp_remove_delegated_requests_for_session(session)) {
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated reqests\n"));
+ }
+
if (session->subsession != NULL) {
netsnmp_session *subsession = session->subsession;
for(; subsession; subsession = subsession->next) {
- netsnmp_remove_delegated_requests_for_session(subsession);
+ while (netsnmp_remove_delegated_requests_for_session(subsession)) {
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated subsession reqests\n"));
+ }
}
}