From: foobar Date: Fri, 24 Jan 2003 09:53:16 +0000 (+0000) Subject: MFH: Fixed bug: #20857, snmpset() fails X-Git-Tag: PHP_4_3_before_13561_fix~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d5ade4cefcec28319e0eda4c3b56f87ff02c4fe;p=php MFH: Fixed bug: #20857, snmpset() fails --- diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index d19675d59a..c9ec40c8ce 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -197,7 +197,7 @@ PHP_MINFO_FUNCTION(snmp) 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 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, 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 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, } 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 @@ 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); } /* }}} */ @@ -836,7 +839,7 @@ 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); } /* }}} */