components/net-snmp/patches/045.16003771.agent_registry.patch
author Rich Burridge <rich.burridge@oracle.com>
Thu, 28 Jan 2016 16:50:14 -0800
changeset 5363 6759a241e5ed
parent 1965 374a90784fdd
permissions -rw-r--r--
22617967 libidn should be 64-bit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1839
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     1
This patch taken from the net-snmp community fixes, an issue related to registration
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     2
error recorded in the /var/log/snmpd.log file when snmp is enabled.
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     3
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     4
The details can be found in the following location
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     5
http://sourceforge.net/p/net-snmp/patches/973/
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     6
--- a/agent/agent_registry.c	2012-12-18 02:02:56.032682052 -0800
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     7
+++ b/agent/agent_registry.c	2012-12-18 02:34:11.953844076 -0800
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     8
@@ -532,7 +532,23 @@
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
     9
	
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    10
	    if (next && (next->namelen  == new_sub->namelen) &&
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    11
		(next->priority == new_sub->priority)) {
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    12
-                netsnmp_assert(!"registration != duplicate"); /* always false */
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    13
+                if (new_sub->namelen != 1) {    /* ignore root OID dups */
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    14
+                    size_t          out_len = 0;
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    15
+                    size_t          buf_len = 0;
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    16
+                    char           *buf = NULL;
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    17
+                    int             buf_overflow = 0;
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    18
+
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    19
+                    netsnmp_sprint_realloc_objid((u_char **) &buf, &buf_len, &out_len,
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    20
+                                                 1, &buf_overflow,
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    21
+                                                 new_sub->start_a,
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    22
+                                                 new_sub->start_len);
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    23
+                    snmp_log(LOG_ERR,
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    24
+                             "duplicate registration: MIB modules %s and %s (oid %s%s).\n",
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    25
+                             next->label_a, new_sub->label_a,
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    26
+                             buf ? buf : "",
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    27
+                             buf_overflow ? " [TRUNCATED]" : "");
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    28
+                    free(buf);
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    29
+                }
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    30
		return MIB_DUPLICATE_REGISTRATION;
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    31
	    }
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    32
 
796735c6337a 16003771 net-snmp service records a registration error when service is enabled
Rohith Ramesh Bangalore India <rohith.ramesh@oracle.com>
parents:
diff changeset
    33