summaryrefslogtreecommitdiff
path: root/ext/snmp
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>1999-06-27 21:45:06 +0000
committerSascha Schumann <sas@php.net>1999-06-27 21:45:06 +0000
commite205a6749dae3092a454e5db8371abb4a819f0e0 (patch)
tree99bb899d9b9016619be1587c60441f29c6ac404f /ext/snmp
parentd819da4897cdd19e420208cb26527f1c6b5d9955 (diff)
downloadphp-git-e205a6749dae3092a454e5db8371abb4a819f0e0.tar.gz
more porting
Diffstat (limited to 'ext/snmp')
-rw-r--r--ext/snmp/config.h.stub2
-rw-r--r--ext/snmp/config.m414
-rw-r--r--ext/snmp/snmp.c4
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;