sniper          Fri Jan 24 04:52:46 2003 EDT

  Modified files:              
    /php4/ext/snmp      snmp.c 
  Log:
  Fixed bug: #20857, snmpset() fails
  
Index: php4/ext/snmp/snmp.c
diff -u php4/ext/snmp/snmp.c:1.74 php4/ext/snmp/snmp.c:1.75
--- php4/ext/snmp/snmp.c:1.74   Fri Jan 24 04:40:53 2003
+++ php4/ext/snmp/snmp.c        Fri Jan 24 04:52:46 2003
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: snmp.c,v 1.74 2003/01/24 09:40:53 sniper Exp $ */
+/* $Id: snmp.c,v 1.75 2003/01/24 09:52:46 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -195,7 +195,11 @@
 * 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 @@
        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 @@
                } 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 @@
        
        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 @@
        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);
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to