Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Maintenance:507
net-snmp.openSUSE_11.4_Update
net-snmp-5.6.1-avoid-callback-re-use-of-closed-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File net-snmp-5.6.1-avoid-callback-re-use-of-closed-sessions.patch of Package net-snmp.openSUSE_11.4_Update
commit fbbe2c75868110cbb3aaaef809fdd57322684954 Author: Dave Shield <dts12@users.sourceforge.net> Date: Thu Jan 6 14:11:22 2011 +0000 CHANGES: snmpd: PATCHES: 2975254: Avoid callback re-use of closed sessions Qn: Should this also be applied when main session is NULL? git-svn-id: file:///home/hardaker/lib/sf-bkups/net-snmp-convert-svnrepo/branches/V5-6-patches@19808 06827809-a52a-0410-b366-d66718629ded Index: net-snmp-5.6.1/agent/mibgroup/agentx/subagent.c =================================================================== --- net-snmp-5.6.1.orig/agent/mibgroup/agentx/subagent.c +++ net-snmp-5.6.1/agent/mibgroup/agentx/subagent.c @@ -103,6 +103,18 @@ subagent_startup(int majorID, int minorI return 0; } +static void +subagent_init_callback_session(void) +{ + if (agentx_callback_sess == NULL) { + agentx_callback_sess = netsnmp_callback_open(callback_master_num, + handle_subagent_response, + NULL, NULL); + DEBUGMSGTL(("agentx/subagent", "subagent_init sess %08x\n", + agentx_callback_sess)); + } +} + static int subagent_init_init = 0; /** * init subagent callback (local) session and connect to master agent @@ -131,13 +143,7 @@ subagent_init(void) /* * open (local) callback session */ - if (agentx_callback_sess == NULL) { - agentx_callback_sess = netsnmp_callback_open(callback_master_num, - handle_subagent_response, - NULL, NULL); - DEBUGMSGTL(("agentx/subagent", "subagent_init sess %p\n", - agentx_callback_sess)); - } + subagent_init_callback_session(); if (NULL == agentx_callback_sess) return -1; @@ -473,6 +479,12 @@ handle_subagent_response(int op, netsnmp int rc = 0; if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || magic == NULL) { + if (op == NETSNMP_CALLBACK_OP_TIMED_OUT && magic != NULL) { + if (smagic->ovars != NULL) { + snmp_free_varbind(smagic->ovars); + } + free(smagic); + } return 1; } @@ -980,6 +992,21 @@ agentx_check_session(unsigned int client if (main_session != NULL) { remove_trap_session(ss); snmp_close(main_session); + /* + * We need to remove the callbacks attached to the callback + * session because they have a magic callback data structure + * which includes a pointer to the main session + * (which is no longer valid). + * + * Given that the main session is not responsive anyway. + * it shoudn't matter if we lose some outstanding requests. + */ + if (agentx_callback_sess != NULL ) { + snmp_close(agentx_callback_sess); + agentx_callback_sess = NULL; + + subagent_init_callback_session(); + } main_session = NULL; agentx_reopen_session(0, NULL); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor