php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19601 snmp_set_quick_print doesn't work
Submitted: 2002-09-25 13:54 UTC Modified: 2002-11-01 01:00 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: cbowman at amtelecom dot ca Assigned:
Status: No Feedback Package: SNMP related
PHP Version: 4.2.1 OS: RedHat Linux 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cbowman at amtelecom dot ca
New email:
PHP Version: OS:

 

 [2002-09-25 13:54 UTC] cbowman at amtelecom dot ca
OS:  RedHat Linux 7.3 (Linux version 2.4.18-10) i386
PHP RPM:  php-4.1.2-7.3.4
PHP SNMP RPM:  php-snmp-4.1.2-7.3.4
UCD SNMP RPM:  ucd-snmp-4.2.5-7.73.0


Basically, all this fuction will do is remove the "=" sign between the OID & the value.

ie.. 
snmp_set_quick_print(0)
69.1.3.5.0 = "2.1.1.107.004"

OR

snmp_set_quick_print(1)
69.1.3.5.0 "2.1.1.107.004"

I'm not sure why this happens, perhaps it is a bug in UCD & not PHP.

Any help appreciated.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-16 18:34 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-16 21:53 UTC] sniper@php.net
Basically: snmp_set_quick_print(1) just makes the ucd-snmp library to return less informative values, so the snmp_set_quick_print() obviously works for you since the output changes. But there indeed might be some bug in the ucd-snmp libs. At least ucd-snmp-4.2.6 and net-snmp-5.0.6 behave differently.

I suggest you try the latest CVS snapshot of PHP with net-snmp-5.0.6.

 [2002-11-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2003-03-31 08:37 UTC] domi at saargate dot de
I don't think this is a bug, neither in PHP or in the UCD SNMP library. Maybe the behaviour of the latter has changed between 4.2.3 and 4.2.5 - there were a lot of changes between the two versions, as far as I can know.

Apart from the "quick print" option, the SNMP API supports another option, which is described in the snmpcmd(1) manual page:

       -Ov    Output only the variable value, not the OID:
              snmpget -c public -Ov localhost ip.ipForwarding.0
              forwarding(1)

Avoiding to print the OID is probably the problem stated in this case.

I managed to add two new functions to PHP 4.2.3 in order to toggle the value of this options (internally it is called "bare value"). They can be used just as snmp_[sg]et_quick_print() can be used:

diff -urN php-4.2.3.orig/ext/snmp/php_snmp.h php-4.2.3/ext/snmp/php_snmp.h
--- php-4.2.3.orig/ext/snmp/php_snmp.h	Thu Feb 28 09:26:42 2002
+++ php-4.2.3/ext/snmp/php_snmp.h	Mon Mar 31 16:36:22 2003
@@ -34,6 +34,8 @@
 PHP_FUNCTION(snmpget);
 PHP_FUNCTION(snmpwalk);
 PHP_FUNCTION(snmprealwalk);
+PHP_FUNCTION(snmp_get_bare_value);
+PHP_FUNCTION(snmp_set_bare_value);
 PHP_FUNCTION(snmp_get_quick_print);
 PHP_FUNCTION(snmp_set_quick_print);
 PHP_FUNCTION(snmpset);
diff -urN php-4.2.3.orig/ext/snmp/snmp.c php-4.2.3/ext/snmp/snmp.c
--- php-4.2.3.orig/ext/snmp/snmp.c	Fri Mar  1 04:31:01 2002
+++ php-4.2.3/ext/snmp/snmp.c	Mon Mar 31 16:36:26 2003
@@ -88,6 +88,8 @@
 		PHP_FALIAS(snmpwalkoid, snmprealwalk, NULL)
 		PHP_FE(snmp_get_quick_print, NULL)
 		PHP_FE(snmp_set_quick_print, NULL)
+		PHP_FE(snmp_get_bare_value, NULL)
+		PHP_FE(snmp_set_bare_value, NULL)
 		PHP_FE(snmpset, NULL)
     {NULL,NULL,NULL}
 };
@@ -433,6 +435,32 @@
 }
 /* }}} */
 
+/* {{{ proto bool snmp_get_bare_value(void)
+   Return the current status of bare_value */
+PHP_FUNCTION(snmp_get_bare_value)
+{
+	if (ZEND_NUM_ARGS() != 0) {
+		WRONG_PARAM_COUNT;
+	}
+
+	RETURN_LONG(ds_get_boolean(DS_LIBRARY_ID, DS_LIB_PRINT_BARE_VALUE) ? 1 : 0);
+}
+/* }}} */
+
+/* {{{ proto void snmp_set_bare_value(int bare_value)
+   Set the current status of bare_value */
+PHP_FUNCTION(snmp_set_bare_value)
+{
+	int argc = ZEND_NUM_ARGS();
+	long a1;
+
+	if (zend_parse_parameters(argc TSRMLS_CC, "l", &a1) == FAILURE) {
+		return;
+	}
+
+	ds_set_boolean(DS_LIBRARY_ID, DS_LIB_PRINT_BARE_VALUE, (int)a1);
+}
+/* }}} */
 /* {{{ proto int snmpset(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]]) 
    Set the value of a SNMP object */
 PHP_FUNCTION(snmpset)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC