Hi!

We also came across this bug. Turns out the Python bindings do not correctly 
check if a session could be established and keep using a NULL pointer in that 
case.

The following patch prevents the segfault in Frank's example program and raises 
an ordinary Exception instead:

--- ./net-snmp-5.4.3~dfsg/python/netsnmp/client.py      2009-04-23 
16:21:53.000000000 +0000
+++ /usr/share/pyshared/netsnmp/client.py       2012-06-28 12:19:49.170930128 
+0000
@@ -143,6 +143,8 @@
                 sess_args['PrivPass'],
                 sess_args['Engineboots'],
                 sess_args['Enginetime'])
+            if self.sess_ptr == 0:
+                raise Exception("Could not open session")
         else:
             self.sess_ptr = client_intf.session(
                 sess_args['Version'],
@@ -151,6 +153,8 @@
                 sess_args['LocalPort'],
                 sess_args['Retries'],
                 sess_args['Timeout'])
+            if self.sess_ptr == 0:
+                raise Exception("Could not open session")
         
     def get(self, varlist):
         res = client_intf.get(self, varlist)





-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to