ID: 20857
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Feedback
+Status: Open
Bug Type: SNMP related
Operating System: Linux RH 7.3
PHP Version: 4.3.0RC2
New Comment:
I tried this patch in diff -u format. Note that there is also a change
in the php_error_docref-string, becaue the output was not very
informative. Of course, I would prefer, that a php-snmp maintainer
would have a look at it.
--- snmp.c.orig Mon Nov 11 22:37:18 2002
+++ snmp.c Sat Dec 7 11:23:24 2002
@@ -197,7 +197,7 @@
static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS,
int st,
struct snmp_session *session,
- char *objid)
+ char *objid, char type, char* value)
{
struct snmp_session *ss;
struct snmp_pdu *pdu=NULL, *response;
@@ -211,8 +211,6 @@
char buf[2048];
char buf2[2048];
int keepwalking=1;
- char type = (char) 0;
- char *value = (char *) 0;
char *err;
if (st >= 2) { /* walk */
@@ -267,7 +265,12 @@
} else if (st == 11) {
pdu = snmp_pdu_create(SNMP_MSG_SET);
if (snmp_add_var(pdu, name, name_length, type, value)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not
add
variable: %s", name);
+#ifdef HAVE_NET_SNMP
+ snprint_objid(buf, sizeof(buf), name, name_length);
+#else
+ sprint_objid(buf, name, name_length);
+#endif
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not
+add
variable: %s %c %s", buf, type, value);
snmp_close(ss);
RETURN_FALSE;
}
@@ -466,7 +469,7 @@
session.authenticator = NULL;
- php_snmp_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, st, &session,
Z_STRVAL_PP(a3));
+ php_snmp_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, st, &session,
Z_STRVAL_PP(a3), type, value);
}
/* }}} */
@@ -849,7 +852,7 @@
session.retries = retries;
session.timeout = timeout;
- php_snmp_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, st, &session,
Z_STRVAL_PP(a8));
+ php_snmp_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, st, &session,
Z_STRVAL_PP(a8), type, value);
}
/* }}} */
Previous Comments:
------------------------------------------------------------------------
[2002-12-06 18:37:58] [EMAIL PROTECTED]
Do you have a patch for this?
------------------------------------------------------------------------
[2002-12-06 08:12:46] [EMAIL PROTECTED]
I use php-4.3.0RC2 with net-snmp-5.0.6. It works so far, but snmpset()
always shows a warning "Could not add variable: " and the variable is
not set.
I found out, that there is a bug in ext/snmp.c. Here, type and value of
the varible are not passed to php_snmp_internal(), so these variables
are always 0 and snmp_add_var() fails. So, as a solution, php_snmp and
php_snmpv3 should pass type and value to php_snmp_internal ant
everything is ok.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20857&edit=1