ID: 22723 User updated by: jamuel at my740il dot com Reported By: jamuel at my740il dot com Status: Closed Bug Type: SNMP related Operating System: Linux 2.4.18 PHP Version: 4.3.2RC1 New Comment:
that patch argument should be -p0 (a zero not an "oh"). Previous Comments: ------------------------------------------------------------------------ [2003-03-19 17:40:45] 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_parse_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_parse_oid (the parameters remain unchanged.) Hope that helps . . . Cheers, JPS ------------------------------------------------------------------------ [2003-03-15 23:04:03] [EMAIL PROTECTED] Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the existing bug instead. Thank you for your interest in PHP. See Bug #22529 ------------------------------------------------------------------------ [2003-03-15 02:25:59] jamuel at my740il dot com with Net-SNMP v5.0.9pre1 snmpset always fails for shortened textual OIDs even though the same smmpset cmd (built from the netsnmp library) works correctly from the linux shell. (Makes me think the problem is in PHP vs in Net-SNMP) The failure text is: Warning: snmpset() [http://www.php.net/function.snmpset]: Invalid object identifier: sysContact.0 in /var/www/html/set-test.php on line 16 Warning: snmpset() [http://www.php.net/function.snmpset]: Error in packet: (noSuchName) There is no such variable name in this MIB. in /var/www/html/set-test.php on line 16 Warning: snmpset() [http://www.php.net/function.snmpset]: This name does not exist: SNMPv2-SMI::internet in /var/www/html/set-test.php on line 16 (Please note the value is not set as well.) Also, full text OIDs from the ".iso.org.dod . . ." root work just fine with snmpset (and so do full numeric OIDs). FWIW, the shortened text OIDs *do* work correctly with snmpget. Here's the line in php that fails: echo snmpset ('10.1.1.1', 'private', 'sysContact.0', 's', 'My Name'); Thanks for your help . . . JPS ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22723&edit=1