[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-bugs
Subject:    [ net-snmp-Bugs-1496476 ] 5.3.x CVS: versionUpdateConfig/SIGHUP
From:       "SourceForge.net" <noreply () sourceforge ! net>
Date:       2006-08-24 21:55:04
Message-ID: E1GGNAG-0002tr-8S () sc8-sf-web2 ! sourceforge ! net
[Download RAW message or body]

Bugs item #1496476, was opened at 2006-05-28 10:13
Message generated for change (Comment added) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1496476&group_id=12694

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: agent
Group: linux
Status: Open
Resolution: None
Priority: 5
Submitted By: Erez Makavy (makavy1)
Assigned to: Nobody/Anonymous (nobody)
Summary: 5.3.x CVS: versionUpdateConfig/SIGHUP breaks snmpNotifyTable

Initial Comment:
Bug summery:
-----------------------
 snmpNotifyTable insets duplicate entry when re-configured.

System Details:
-----------------
Linux, Net-SNMP-5.3.1.pre1. 
 
 
Reconstructing the BUG:
----------------------------------
1) Add an entry to snmpNotifyTable. (SNMP set with an
arbitrary index, and rowStatus 5 - creat&wait)
 
2) Save persistent data (SNMP set
ucdavis::versionSavePersistentData)
 
3) Re-vonfigure agent (SNMP set
ucdavis::versionUpdateConfig)
 
 
Bug behavior:
--------------------
- master agent prints out an error  "
header_complex_add_data_by_oid with duplicate index."
- a second duplicate snmpNotifyTable token is inserted
to /var/net-snmp/snmpd.conf when the master is shutdown, 
  or when Saving persistent data again (SNMP set
ucdavis::versionSavePersistentData)
- Walking the snmpNotifyTable hangs.


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2006-08-24 14:55

Message:
Logged In: NO 

This change blocks the adding of duplicate rows to the 
notify table.


diff -u snmpNotifyTable.c snmpNotifyTable.c.new 
--- snmpNotifyTable.c   Wed Jul 12 13:11:02 2006
+++ snmpNotifyTable.c.new      Thu Aug 24 16:39:13 2006
@@ -361,13 +361,14 @@
 parse_snmpNotifyTable(const char *token, char *line)
 {
     size_t          tmpint;
+    oid * tmpName;
+    int i;
     struct snmpNotifyTable_data *StorageTmp =
         SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
-
+    struct snmpNotifyTable_data *TestPtr;
 
     DEBUGMSGTL(("snmpNotifyTable", "parsing config...  "));
 
-
     if (StorageTmp == NULL) {
         config_perror("malloc failure");
         return;
@@ -379,6 +380,32 @@
                               &StorageTmp-
>snmpNotifyNameLen);
     if (StorageTmp->snmpNotifyName == NULL) {
         config_perror("invalid specification for 
snmpNotifyName");
+        return;
+    }
+
+    tmpint = StorageTmp->snmpNotifyNameLen;
+    tmpName = malloc(sizeof(oid)*tmpint + 1);
+    if (NULL != tmpName) {
+        for (i=0;i<tmpint;i++)
+            tmpName[i] = StorageTmp->snmpNotifyName[i];
+
+    /* Need to protect from duplicate entries in the conf 
files */ 
+        TestPtr = (struct snmpNotifyTable_data *)
+           header_complex((struct header_complex_index *)
+               snmpNotifyTableStorage, NULL,
+                tmpName,
+               &tmpint, 1,NULL,NULL);
+        free(tmpName);
+        if (TestPtr != NULL) /* already created */
+        {
+            DEBUGMSGTL(("snmpNotifyTable","Found duplicate 
entry\n"));
+            return;
+        }
+    }/* end of if tmpName != NULL */
+    else {
+        DEBUGMSGTL(("snmpNotifyTable",
+                "Unable to allocate space for duplicate 
entry test.\n"));
+        config_perror("malloc failure");
         return;
     }


----------------------------------------------------------------------

Comment By: Thomas Anders (tanders)
Date: 2006-08-11 15:36

Message:
Logged In: YES 
user_id=848638

Can you please attach your patch as a unified diff ("diff
-u")? Also, can you please elaborate on what your patch is
expected to address and what not (wrt. the original problem
description)?

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2006-08-11 15:09

Message:
Logged In: NO 

A partial fix based on netsnmp 5.2.2 - blocks the creation 
of bogus MIB entries
********************************
<<< file 1: ver-5.2.2/net-snmp-
5.2.2/agent/mibgroup/notification/snmpNotifyTable.c
>>> file 2: snmpNotifyTable.c
********************************
-----[after 363 inserted 364-365]-----
>     oid * tmpName;
>     int i;
-----[366 changed to 368]-----
< 
---
>     struct snmpNotifyTable_data *TestPtr;
-----[after 381 inserted 383-407]-----
>         return;
>     }
>     tmpint = StorageTmp->snmpNotifyNameLen;
>     tmpName = malloc(sizeof(oid)*tmpint + 1);
>     if (NULL != tmpName) {
>         for (i=0;i<tmpint;i++)
>             tmpName[i] = StorageTmp->snmpNotifyName[i];
> 
>     /* Need to protect from duplicate entries in the conf 
files */ 
>         TestPtr = (struct snmpNotifyTable_data *)
>           header_complex((struct header_complex_index *)
>               snmpNotifyTableStorage, NULL,
>                 tmpName,
>               &tmpint, 1,NULL,NULL);
>         free(tmpName);
>         if (TestPtr != NULL) /* already created */
>         {
>             DEBUGMSGTL(("snmpNotifyTable","Found 
duplicate entry\n"));
>             return;
>         }
>     }/* end of if tmpName != NULL */
>     else {
>         DEBUGMSGTL(("snmpNotifyTable",
>                 "Unable to allocate space for duplicate 
entry test.\n"));
>         config_perror("malloc failure");

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1496476&group_id=12694

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-bugs mailing list
Net-snmp-bugs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-bugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic