On Mon, 2001-12-24 at 16:24, Markus Fischer wrote: > On Mon, Dec 24, 2001 at 12:27:48PM +0100, Henning Schmiedehausen wrote : > > Great, if you would tell me how to add a comment to an existing bug > > report if I'm neither owner nor developer. > > Don't forget to set a password. > > > And if you would point people somewhere to snaps.php.net, building of > > the existing snapshots would be much easier. :-) > > Occasionally, we do. I fault of mine was also to advice you > to patch against current CVS HEAD branch, not 4.1.0 .Well, > those days aren't really the most productive ones :) > > -- > Please always Cc to me when replying to me on the lists.
Hi, attached is an even more complete patch that doesn't just enable the usage of the sbuf stuff in snmp but checks for the vendor modified libraries. It works with RH 6.x (vendor modified) and should work with the original stuff from UCD. (It would be possible to do this at runtime by checking for the binit() symbol in the libsnmp, but this would be (IMHO) overkill.. =:-) Regards Henning -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen -- Geschaeftsfuehrer INTERMETA - Gesellschaft fuer Mehrwertdienste mbH [EMAIL PROTECTED] Am Schwabachgrund 22 Fon.: 09131 / 50654-0 [EMAIL PROTECTED] D-91054 Buckenhof Fax.: 09131 / 50654-20
diff -urb php-4.1.0.orig/ext/snmp/config.m4 php-4.1.0/ext/snmp/config.m4 --- php-4.1.0.orig/ext/snmp/config.m4 Mon Dec 24 02:39:03 2001 +++ php-4.1.0/ext/snmp/config.m4 Fri Dec 28 09:16:49 2001 @@ -67,18 +67,38 @@ PHP_EXTENSION(snmp, $ext_shared) PHP_SUBST(SNMP_SHARED_LIBADD) - fi - -AC_MSG_CHECKING(whether to enable UCD SNMP hack) -AC_ARG_ENABLE(ucd-snmp-hack, -[ --enable-ucd-snmp-hack Enable UCD SNMP hack],[ + AC_MSG_CHECKING(whether to enable UCD SNMP hack) + AC_ARG_ENABLE(ucd-snmp-hack, + [ --enable-ucd-snmp-hack Enable UCD SNMP hack],[ if test "$enableval" = "yes" ; then AC_DEFINE(UCD_SNMP_HACK, 1, [ ]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi -],[ + ],[ AC_MSG_RESULT(no) -]) + ]) + + _SAVE_CPPFLAGS=$CPPFLAGS + _SAVE_LDFLAGS=$LDFLAGS + _SAVE_LIBS=$LIBS + + CPPFLAGS="$CPPFLAGS -I$SNMP_INCDIR" + LDFLAGS="$LDFLAGS -L$SNMP_LIBDIR" + LIBS="$LIBS -lsnmp" + + AC_CACHE_CHECK([for vendor modified SNMP libs], ac_cv_snmp_vendor, + [AC_TRY_LINK([ #include <stdio.h> +#include <sys/types.h> +#include "asn1.h" +#include "parse.h" ],[binit(NULL, NULL, 0);], + ac_cv_snmp_vendor=yes, ac_cv_snmp_vendor=no)]) + if test "$ac_cv_snmp_vendor" = yes; then + AC_DEFINE(HAVE_SNMP_VENDORHACK,1,[SNMP libs are vendor modified]) + fi + CPPFLAGS=$_SAVE_CPPFLAGS + LDFLAGS=$_SAVE_LDFLAGS + LIBS=$_SAVE_LIBS + fi Only in php-4.1.0/ext/snmp: config.m4~ diff -urb php-4.1.0.orig/ext/snmp/snmp.c php-4.1.0/ext/snmp/snmp.c --- php-4.1.0.orig/ext/snmp/snmp.c Mon Dec 24 02:39:03 2001 +++ php-4.1.0/ext/snmp/snmp.c Fri Dec 28 09:14:27 2001 @@ -74,6 +74,8 @@ #define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG #endif +#define SNMP_BUFSIZE 2048 + void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st); /* constant - can be shared among threads */ @@ -158,8 +160,8 @@ int name_length; int status, count,rootlen=0,gotroot=0; oid root[MAX_NAME_LEN]; - char buf[2048]; - char buf2[2048]; + char buf[SNMP_BUFSIZE]; + char buf2[SNMP_BUFSIZE]; int keepwalking=1; long timeout=SNMP_DEFAULT_TIMEOUT; long retries=SNMP_DEFAULT_RETRIES; @@ -315,7 +317,11 @@ } if (st != 11) { +#ifdef HAVE_SNMP_VENDORHACK + sprint_value(binit(NULL, buf, SNMP_BUFSIZE) ,vars->name, vars->name_length, vars); +#else sprint_value(buf,vars->name, vars->name_length, vars); +#endif } #if 0 Debug("snmp response is: %s\n",buf); @@ -325,7 +331,11 @@ } else if (st == 2) { add_next_index_string(return_value,buf,1); /* Add to returned array */ } else if (st == 3) { +#ifdef HAVE_SNMP_VENDORHACK + sprint_objid(binit(NULL, buf2, SNMP_BUFSIZE), vars->name, vars->name_length); +#else sprint_objid(buf2, vars->name, vars->name_length); +#endif add_assoc_string(return_value,buf2,buf,1); } if (st >= 2 && st != 11) { @@ -344,7 +354,11 @@ for (count=1, vars = response->variables; vars && count != response->errindex; vars = vars->next_variable, count++); if (vars) { +#ifdef HAVE_SNMP_VENDORHACK + sprint_objid(binit(NULL, buf, SNMP_BUFSIZE), vars->name, vars->name_length); +#else sprint_objid(buf,vars->name, vars->name_length); +#endif } php_error(E_WARNING,"This name does not exist: %s\n",buf); }
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]