[ Reminder - *please* don't mail me privately, without copying
     any responses to the mailing list.  I don't have the time
     or inclination to offer private, unpaid, SNMP consultancy.
     Keep discussions to the list, where others can both learn
     and offer advice.  Thanks.   ]

On Sat, 2006-03-18 at 15:55 +0100, Tomasz Nowak wrote:
> Dave Shield <[EMAIL PROTECTED]> wrote:
> > That one I wasn't able to reproduce.
> > Can you try with the attached patch, and see if you still have
> > the same problem.  If so, please could you let me know the relevant
> > lines from your snmpd.conf
> 
> But the second problem still exists.
> Information given below should help you be able
> to reproduce the bug.


> /etc/snmp/snmpd.conf part:
> 
> extend onetping /root/ping.sh onet.pl

        [snip]

Not immediately, no.
I tried with a version of your script, and everything worked fine.
But it suddenly occurred to me to try with *two* identically
named "extend" directives, and that did trigger the same symptoms.
The registration of the nsExtend{Config,Output1}Tables failed,
but the config handling routine didn't detect this, so carried
on setting things up for the (manually implemented) Output2Table.

I suspect that either you have a duplicate "extend" entry in your
config file, or the system is reading in the config file twice.
(It doesn't check for this, although it really should do so).

I'm appending a patch to perform some basic error checking on this
registration.  It's not complete, and almost certainly introduces
a minor memory leak.  But it ought to fix the immediate problem.

Dave
--- extend.c.cln	2006-03-15 18:14:18.000000000 +0000
+++ extend.c	2006-03-21 08:16:39.000000000 +0000
@@ -341,7 +341,12 @@
     extension->row = row;
     netsnmp_table_row_add_index( row, ASN_OCTET_STR,
                                  exec_name, strlen(exec_name));
-    netsnmp_table_data_add_row( dinfo, row);
+    if ( netsnmp_table_data_add_row( dinfo, row) != SNMPERR_SUCCESS ) {
+        /* _free_extension( extension, ereg ); */
+        SNMP_FREE( extension );  /* Probably not sufficient */
+        SNMP_FREE( row );
+        return NULL;
+    }
 
     ereg->num_entries++;
         /*

Reply via email to