components/net-snmp/patches/002.pkcs.patch
author Ashik Ratnani <ashik.ratnani@oracle.com>
Mon, 22 Apr 2013 13:51:56 -0700
changeset 1278 5a3949922d70
parent 252 ee0fb1eabcbf
permissions -rw-r--r--
15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1278
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
     1
Following patch is a fix for a bug in libnetsnmp which, under certain
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
     2
circumstances, causes a core dump during snmp_shutdown.
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
     3
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
     4
(Upstream Bug) #2374 net-snmp is coring when stopped
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
     5
=====================================================================
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
     6
--- net-snmp-5.4.1/snmplib/pkcs.c	Tue Mar  5 17:29:50 2013
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
     7
+++ net-snmp-5.4.1/snmplib/pkcs.mod.c	Tue Mar  5 17:35:30 2013
252
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
     8
@@ -1,5 +1,5 @@
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
     9
 /*
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    10
- * Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
1278
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    11
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
252
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    12
  * Use is subject to license terms specified in the COPYING file
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    13
  * distributed with the Net-SNMP package.
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    14
  */
1278
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    15
@@ -105,19 +105,13 @@
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    16
 static int
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    17
 free_slots(int majorID, int minorID, void *serverarg, void *clientarg)
252
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    18
 {
1278
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    19
-    int            slotcount, i;
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    20
+    (void) C_Finalize(NULL);
252
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    21
 
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    22
     if (pSlot != NULL) {
1278
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    23
-        slotcount = pSlot->count;
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    24
-        for (i = 0; i < slotcount; i++) {
252
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    25
-            if (pSlot->pSession->hdl != NULL) {
1278
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    26
-                free(pSlot->pSession->hdl);
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    27
-            }
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    28
-        }
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    29
-        free(pSlot);
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    30
+        SNMP_FREE(pSlot->pSession);
5a3949922d70 15793150 SUNBT7170603 libnetsnmp free_slots frees things it doesn't own
Ashik Ratnani <ashik.ratnani@oracle.com>
parents: 252
diff changeset
    31
+        SNMP_FREE(pSlot);
252
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    32
     }
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    33
 
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    34
-    (void) C_Finalize(NULL);
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    35
     return 0;
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    36
 }
ee0fb1eabcbf 7041085 move net-snmp to userland
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
diff changeset
    37