diff options
Diffstat (limited to 'ext/snmp')
-rw-r--r-- | ext/snmp/config.h.stub | 2 | ||||
-rw-r--r-- | ext/snmp/config.m4 | 14 | ||||
-rw-r--r-- | ext/snmp/snmp.c | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/ext/snmp/config.h.stub b/ext/snmp/config.h.stub index e400f18f01..2e837eac70 100644 --- a/ext/snmp/config.h.stub +++ b/ext/snmp/config.h.stub @@ -1,2 +1,4 @@ /* Define if you want the SNMP interface */ #define HAVE_SNMP 0 + +#undef UCD_SNMP_HACK diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 index 07473fd9c8..c39d77908e 100644 --- a/ext/snmp/config.m4 +++ b/ext/snmp/config.m4 @@ -23,6 +23,20 @@ AC_ARG_WITH(snmp, PHP_EXTENSION(snmp) AC_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR) AC_ADD_INCLUDE($SNMP_INCDIR) + AC_CHECK_LIB(kstat, kstat_read, [AC_ADD_LIBRARY(kstat)]) + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) + +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 diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 7f11bb8413..13fce26a43 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -175,7 +175,11 @@ void _php3_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) { * in (at least) ucd-snmp 3.6.1 which frees * memory it did not allocate */ +#ifdef UCD_SNMP_HACK session.community = (u_char *) strdup(a2->value.str.val); +#else + session.community = (u_char *) a2->value.str.val; +#endif session.community_len = a2->value.str.len; session.retries = retries; session.timeout = timeout; |