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

List:       net-snmp-users
Subject:    Re: [SNMP] Maintainer of PHP binding?
From:       Johann Hanne <jonny () 1409 ! org>
Date:       2002-12-28 12:57:34
[Download RAW message or body]


On Fri, 27 Dec 2002, Peter Hicks wrote:
> Somebody on the list, I can't recall who, produced an extension for PHP 
> that handled SNMPv3 support... maybe searching the list archives will help?
> 
> If I recall, I used the module and liked it over PHP's native support.

I just checked PHP 4.3.0 and - surprise surprise - it has the SNMPv3 stuff 
in. I wonder, how this "Odd fix" got in...

It also has net-snmp support. Just a few ugly examples:
--
/* Ugly macro, since the length of OIDs in UCD-SNMP and NET-SNMP
 * is different and this way the code is not full of 'ifdef's.
 */
#define OIDSIZE(p) (sizeof(p)/sizeof(oid))
--
I'm not a net/ucd-snmp api expert, but is this really necessary?

--
#ifdef HAVE_NET_SNMP
  snprint_value(buf, sizeof(buf), vars->name, vars->name_length, vars);
#else
  sprint_value(buf,vars->name, vars->name_length, vars);
#endif
--
When did the snprint_* stuff get in? I think it was *before* net-snmp, 
i.e. before 5.0? So is it necessary to support the old sprint_value() 
function?

--
/*
 * FIXME: potential memory leak
 * This is a workaround for an "artifact" (Mike Slifcak)
 * in (at least) ucd-snmp 3.6.1 which frees
 * memory it did not allocate
 */
#ifdef UCD_SNMP_HACK
  /* memory freed by SNMP library, strdup NOT estrdup */
  session.community = (u_char *)strdup(Z_STRVAL_PP(a2));
#else
  session.community = (u_char *)Z_STRVAL_PP(a2);
#endif
--
This seems to have been in the PHP code for ages. And the net-snmp folks 
don't seem to be willing to change it?! So what is this all about? The PHP 
manual recommands to recompile net-snmp:
--
Important: In order to use the UCD SNMP package, you need to define 
NO_ZEROLENGTH_COMMUNITY to 1 before compiling it.
--
Isn't there a way to cleanly solve this problem??

Cheers, Jonny <jonny@1409.org>




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
[prev in list] [next in list] [prev in thread] [next in thread] 

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