summaryrefslogtreecommitdiff
path: root/ext/snmp/snmp.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2003-01-24 09:52:46 +0000
committerfoobar <sniper@php.net>2003-01-24 09:52:46 +0000
commite771bdb23dfdb36aff8f18089a09be39de36b180 (patch)
treef9b057fc92dcc5917273dfc234e4a0af93cf94b9 /ext/snmp/snmp.c
parent45f1f1711d884c7787006536705283a0840fcd91 (diff)
downloadphp-git-e771bdb23dfdb36aff8f18089a09be39de36b180.tar.gz
Fixed bug: #20857, snmpset() fails
Diffstat (limited to 'ext/snmp/snmp.c')
-rw-r--r--ext/snmp/snmp.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 7a702842e0..6f95b28772 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -195,7 +195,11 @@ PHP_MINFO_FUNCTION(snmp)
* st=11 snmpset() - query an agent and set a single value
*
*/
-static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st, struct snmp_session *session, char *objid)
+static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
+ struct snmp_session *session,
+ char *objid,
+ char type,
+ char* value)
{
struct snmp_session *ss;
struct snmp_pdu *pdu=NULL, *response;
@@ -209,8 +213,6 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st, struct snmp_
char buf[2048];
char buf2[2048];
int keepwalking=1;
- char type = (char) 0;
- char *value = (char *) 0;
char *err;
if (st >= 2) { /* walk */
@@ -265,7 +267,12 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st, struct snmp_
} 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;
}
@@ -464,7 +471,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st)
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);
}
/* }}} */
@@ -837,7 +844,7 @@ static void php_snmpv3(INTERNAL_FUNCTION_PARAMETERS, int st)
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);
}
/* }}} */