ID: 22529
Updated by: [email]sniperphp.net[/email]
Reported By: mb at solstaden dot net
-Status: Open
+Status: Feedback
Bug Type: SNMP related
Operating System: FreeBSD 4.8 Prerelease
PHP Version: 4CVS-2003-03-04 (stable)
New Comment:

Please try using this CVS snapshot:

[url]http://snaps.php.net/php4-STABLE-latest.tar.gz[/url]

For Windows:

[url]http://snaps.php.net/win32/php4-win32-STABLE-latest.zip[/url]

And if it fails, try the patch above.



Previous Comments:
------------------------------------------------------------------------

[2003-03-19 17:44:00] jamuel at my740il dot com

That patch argument should be -p0 (a zero not an "oh").

FWIW, the diff was from PHP-4.3.2 RC1

Cheers,

JPS

------------------------------------------------------------------------

[2003-03-19 17:38:21] jamuel at my740il dot com

Ok so the following patch resolves the issue on my system. Not really
sure why the existing function call fails but regardless snmpset now
works correctly with shortened textual oids, full textual oids, and
full numeric oids. I also tested snmpget and it works fine as well.

--- snmp.c Fri Feb 21 02:42:01 2003
+++ snmp.c Tue Mar 18 13:58:48 2003
-217,7 +217,7 static void php_snmp_internal(INTERNAL_F
if (st >= 2) { /* walk */
rootlen = MAX_NAME_LEN;
if (strlen(objid)) { /* on a walk, an empty string
means top of tree
- no error */
- if (read_objid(objid, root, &rootlen)) {
+ if (snmp_p_oid(objid, root, &rootlen)) {
gotroot = 1;
} else {
php_error_docref(NULL TSRMLS_CC,
E_WARNING, "Invalid
object identifier: %s", objid);


Do a patch -po -l from the ../ext/snmp directory and paste the above
patch-text into patch, press <CTRL-D> twice to exit patch and you
should see "patching file snmp.c". cd back to the root of the PHP-4
source directory, make clean, make all, make install and you should be
in business!

BTW, no really sure how this form will mangle the patch-text but it's
really only a one line change. So you could just manually edit the
snmp.c file and look for line 220 and make the change from read_objid
to snmp_p_oid (the parameters remain unchanged.)

Hope that helps . . .


Cheers,

JPS

------------------------------------------------------------------------

[2003-03-12 16:06:55] jamuel at my740il dot com

I am getting the same error message with the latest (today's) 4.3 snap
shot. From a php script I can either specify the entire OID
numerically or the entire symbolic OID--I just can't use the shortened
symbolic OID:

snmpset("10.1.1.1", "private", ".1.3.6.1.2.1.1.5.0", "s", "MyBox") <--
works OK

snmpset("10.1.1.1", "private",
".iso.org.dod.internet.mgmt.mib-2.system.sysName.0", "s", "MyBox") <--
works OK

snmpset("10.1.1.1", "private", "system.sysName.0", "s", "MyBox") <--
BROKEN

snmpset("10.1.1.1", "private", "sysName.0", "s", "MyBox") <-- BROKEN

Linux 2.4
NetSNMP 5.0.8-pre1
PHP 4.3.2-dev [from phpinfo()]

Any help would be appreciated.

Regards,

JPS

------------------------------------------------------------------------

[2003-03-05 00:21:50] mb at solstaden dot net

I did upgrade!

Sorry to say, same error.
I tried with system.sysContact.0 and sysCobtact.0

Warning: snmpset() [function.snmpset]: Invalid object identifier:
system.sysContact.0 in /usr/local/www/data/snmp.php on line 27

Warning: snmpset() [function.snmpset]: Error in packet: (noSuchName)
There is no such variable name in this MIB. in
/usr/local/www/data/snmp.php on line 27

Warning: snmpset() [function.snmpset]: This name does not exist:
SNMPv2-SMI::mib-2 in /usr/local/www/data/snmp.php on line 27

Magnus

------------------------------------------------------------------------

[2003-03-04 19:23:43] [email]sniperphp.net[/email]

Please try using this CVS snapshot:

[url]http://snaps.php.net/php4-STABLE-latest.tar.gz[/url]

For Windows:

[url]http://snaps.php.net/win32/php4-win32-STABLE-latest.zip[/url]

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
[url]http://bugs.php.net/22529[/url]

--
Edit this bug report at [url]http://bugs.php.net/?id=22529&edit=1[/url]