#48273 [NEW]: *_real_walk returns SNMP errors as values

2009-05-13 Thread lytboris at gmail dot com
From: lytboris at gmail dot com
Operating system: FreeBSD
PHP version:  5.2.9
PHP Bug Type: SNMP related
Bug description:  *_real_walk returns SNMP errors as values

Description:

When remote SNMP agent returns an error with same OID that contained
correct value *_real_walk functions will overwrite this correct value with
error message because there is no snmp reply status check.

Here is patch to address this issue:

--- ext/snmp/snmp.c.orig2008-12-31 14:17:43.0 +0300
+++ ext/snmp/snmp.c 2009-05-14 10:31:23.0 +0400
@@ -480,12 +480,15 @@
} else if (st == SNMP_CMD_WALK) {
   
add_next_index_zval(return_value,snmpval); /* Add to returned array */
} else if (st ==
SNMP_CMD_REALWALK)  {
+   if (vars->type !=
SNMP_ENDOFMIBVIEW &&
+   vars->type !=
SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) {
 #ifdef HAVE_NET_SNMP
-   snprint_objid(buf2,
sizeof(buf2), vars->name, vars->name_length);
+  
snprint_objid(buf2, sizeof(buf2), vars->name, vars->name_length);
 #else
-   sprint_objid(buf2,
vars->name, vars->name_length);
+   sprint_objid(buf2,
vars->name, vars->name_length);
 #endif
-  
add_assoc_zval(return_value,buf2,snmpval);
+  
add_assoc_zval(return_value,buf2,snmpval);
+   }
}
if (st >= SNMP_CMD_WALK && st !=
SNMP_CMD_SET) {
if (vars->type !=
SNMP_ENDOFMIBVIEW &&


in BASE64 form:
begin-base64 644 -
LS0tIGV4dC9zbm1wL3NubXAuYy5vcmlnCTIwMDgtMTItMzEgMTQ6MTc6NDMuMDAwMDAwMDAwICsw
MzAwCisrKyBleHQvc25tcC9zbm1wLmMJMjAwOS0wNS0xNCAxMDozMToyMy4wMDAwMDAwMDAgKzA0
MDAKQEAgLTQ4MCwxMiArNDgwLDE1IEBACiAJCQkJCX0gZWxzZSBpZiAoc3QgPT0gU05NUF9DTURf
V0FMSykgewogCQkJCQkJYWRkX25leHRfaW5kZXhfenZhbChyZXR1cm5fdmFsdWUsc25tcHZhbCk7
IC8qIEFkZCB0byByZXR1cm5lZCBhcnJheSAqLwogCQkJCQl9IGVsc2UgaWYgKHN0ID09IFNOTVBf
Q01EX1JFQUxXQUxLKSAgeworCQkJCQkJaWYgKHZhcnMtPnR5cGUgIT0gU05NUF9FTkRPRk1JQlZJ
RVcgJiYgCisJCQkJCQkJdmFycy0+dHlwZSAhPSBTTk1QX05PU1VDSE9CSkVDVCAmJiB2YXJzLT50
eXBlICE9IFNOTVBfTk9TVUNISU5TVEFOQ0UpIHsKICNpZmRlZiBIQVZFX05FVF9TTk1QCi0JCQkJ
CQlzbnByaW50X29iamlkKGJ1ZjIsIHNpemVvZihidWYyKSwgdmFycy0+bmFtZSwgdmFycy0+bmFt
ZV9sZW5ndGgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgCXNucHJpbnRfb2JqaWQoYnVmMiwgc2l6ZW9mKGJ1ZjIpLCB2YXJzLT5uYW1lLCB2YXJzLT5u
YW1lX2xlbmd0aCk7CiAjZWxzZQotCQkJCQkJc3ByaW50X29iamlkKGJ1ZjIsIHZhcnMtPm5hbWUs
IHZhcnMtPm5hbWVfbGVuZ3RoKTsKKwkJCQkJCQlzcHJpbnRfb2JqaWQoYnVmMiwgdmFycy0+bmFt
ZSwgdmFycy0+bmFtZV9sZW5ndGgpOwogI2VuZGlmCi0JCQkJCQlhZGRfYXNzb2NfenZhbChyZXR1
cm5fdmFsdWUsYnVmMixzbm1wdmFsKTsKKwkJCQkJCQlhZGRfYXNzb2NfenZhbChyZXR1cm5fdmFs
dWUsYnVmMixzbm1wdmFsKTsKKwkJCQkJCX0KIAkJCQkJfQogCQkJCQlpZiAoc3QgPj0gU05NUF9D
TURfV0FMSyAmJiBzdCAhPSBTTk1QX0NNRF9TRVQpIHsKIAkJCQkJCWlmICh2YXJzLT50eXBlICE9
IFNOTVBfRU5ET0ZNSUJWSUVXICYmIAo=



Reproduce code:
---
print_r(@snmp2_real_walk("host:161", "community",
".1.3.6.1.4.1.8072.2.1.2.3", (800 * 1000), 2)):
===
Result shown by snmpwalk:
>snmpwalk -v2c -ccommunity host .1.3.6.1.4.1.8072.2.1.2.3
NET-SNMP-MIB::netSnmp.2.1.2.3.1 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.2 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.3 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.4 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.5 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.6 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.7 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.8 = STRING: "blah"
NET-SNMP-MIB::netSnmp.2.1.2.3.8 = No more variables left in this MIB View
(It is past the end of the MIB tree)


Expected result:

Array
(
[NET-SNMP-MIB::netSnmp.2.1.2.3.1] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.2] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.3] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.4] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.5] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.6] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.7] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.8] => "blah"
)

Actual result:
--
Array
(
[NET-SNMP-MIB::netSnmp.2.1.2.3.1] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.2] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.3] => ""
[NET-SNMP-MIB::ne

#48273 [Opn]: *_real_walk returns SNMP errors as values

2009-05-13 Thread lytboris at gmail dot com
 ID:   48273
 User updated by:  lytboris at gmail dot com
 Reported By:  lytboris at gmail dot com
 Status:   Open
 Bug Type: SNMP related
 Operating System: FreeBSD
 PHP Version:  5.2.9
 New Comment:

Oups,
last line in Actual result should be read as 
[NET-SNMP-MIB::netSnmp.2.1.2.3.8] => No more variables left in this
MIB
View (It is past the end of the MIB tree)


(wrong copy-paste)


Previous Comments:


[2009-05-14 06:46:49] lytboris at gmail dot com

Description:

When remote SNMP agent returns an error with same OID that contained
correct value *_real_walk functions will overwrite this correct value
with error message because there is no snmp reply status check.

Here is patch to address this issue:

--- ext/snmp/snmp.c.orig2008-12-31 14:17:43.0 +0300
+++ ext/snmp/snmp.c 2009-05-14 10:31:23.0 +0400
@@ -480,12 +480,15 @@
} else if (st == SNMP_CMD_WALK)
{
   
add_next_index_zval(return_value,snmpval); /* Add to returned array */
} else if (st ==
SNMP_CMD_REALWALK)  {
+   if (vars->type !=
SNMP_ENDOFMIBVIEW &&
+   vars->type !=
SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) {
 #ifdef HAVE_NET_SNMP
-   snprint_objid(buf2,
sizeof(buf2), vars->name, vars->name_length);
+  
snprint_objid(buf2, sizeof(buf2), vars->name, vars->name_length);
 #else
-   sprint_objid(buf2,
vars->name, vars->name_length);
+  
sprint_objid(buf2, vars->name, vars->name_length);
 #endif
-  
add_assoc_zval(return_value,buf2,snmpval);
+  
add_assoc_zval(return_value,buf2,snmpval);
+   }
}
if (st >= SNMP_CMD_WALK && st
!= SNMP_CMD_SET) {
if (vars->type !=
SNMP_ENDOFMIBVIEW &&


in BASE64 form:
begin-base64 644 -
LS0tIGV4dC9zbm1wL3NubXAuYy5vcmlnCTIwMDgtMTItMzEgMTQ6MTc6NDMuMDAwMDAwMDAwICsw
MzAwCisrKyBleHQvc25tcC9zbm1wLmMJMjAwOS0wNS0xNCAxMDozMToyMy4wMDAwMDAwMDAgKzA0
MDAKQEAgLTQ4MCwxMiArNDgwLDE1IEBACiAJCQkJCX0gZWxzZSBpZiAoc3QgPT0gU05NUF9DTURf
V0FMSykgewogCQkJCQkJYWRkX25leHRfaW5kZXhfenZhbChyZXR1cm5fdmFsdWUsc25tcHZhbCk7
IC8qIEFkZCB0byByZXR1cm5lZCBhcnJheSAqLwogCQkJCQl9IGVsc2UgaWYgKHN0ID09IFNOTVBf
Q01EX1JFQUxXQUxLKSAgeworCQkJCQkJaWYgKHZhcnMtPnR5cGUgIT0gU05NUF9FTkRPRk1JQlZJ
RVcgJiYgCisJCQkJCQkJdmFycy0+dHlwZSAhPSBTTk1QX05PU1VDSE9CSkVDVCAmJiB2YXJzLT50
eXBlICE9IFNOTVBfTk9TVUNISU5TVEFOQ0UpIHsKICNpZmRlZiBIQVZFX05FVF9TTk1QCi0JCQkJ
CQlzbnByaW50X29iamlkKGJ1ZjIsIHNpemVvZihidWYyKSwgdmFycy0+bmFtZSwgdmFycy0+bmFt
ZV9sZW5ndGgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgCXNucHJpbnRfb2JqaWQoYnVmMiwgc2l6ZW9mKGJ1ZjIpLCB2YXJzLT5uYW1lLCB2YXJzLT5u
YW1lX2xlbmd0aCk7CiAjZWxzZQotCQkJCQkJc3ByaW50X29iamlkKGJ1ZjIsIHZhcnMtPm5hbWUs
IHZhcnMtPm5hbWVfbGVuZ3RoKTsKKwkJCQkJCQlzcHJpbnRfb2JqaWQoYnVmMiwgdmFycy0+bmFt
ZSwgdmFycy0+bmFtZV9sZW5ndGgpOwogI2VuZGlmCi0JCQkJCQlhZGRfYXNzb2NfenZhbChyZXR1
cm5fdmFsdWUsYnVmMixzbm1wdmFsKTsKKwkJCQkJCQlhZGRfYXNzb2NfenZhbChyZXR1cm5fdmFs
dWUsYnVmMixzbm1wdmFsKTsKKwkJCQkJCX0KIAkJCQkJfQogCQkJCQlpZiAoc3QgPj0gU05NUF9D
TURfV0FMSyAmJiBzdCAhPSBTTk1QX0NNRF9TRVQpIHsKIAkJCQkJCWlmICh2YXJzLT50eXBlICE9
IFNOTVBfRU5ET0ZNSUJWSUVXICYmIAo=



Reproduce code:
---
print_r(@snmp2_real_walk("host:161", "community",
".1.3.6.1.4.1.8072.2.1.2.3", (800 * 1000), 2)):
===
Result shown by snmpwalk:
>snmpwalk -v2c -ccommunity host .1.3.6.1.4.1.8072.2.1.2.3
NET-SNMP-MIB::netSnmp.2.1.2.3.1 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.2 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.3 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.4 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.5 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.6 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.7 = ""
NET-SNMP-MIB::netSnmp.2.1.2.3.8 = STRING: "blah"
NET-SNMP-MIB::netSnmp.2.1.2.3.8 = No more variables left in this MIB
View (It is past the end of the MIB tree)


Expected result:

Array
(
[NET-SNMP-MIB::netSnmp.2.1.2.3.1] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.2] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.3] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.4] => ""
[NET-SNMP-MIB::netSnmp.2.1.2.3.5] => ""
[

[PHP-BUG] Bug #51336 [NEW]: snmprealwalk (snmp v1) does not handle end of OID tree correctly

2010-03-20 Thread lytboris at gmail dot com
From: 
Operating system: *
PHP version:  Irrelevant
Package:  SNMP related
Bug Type: Bug
Bug description:snmprealwalk (snmp v1) does not handle end of OID tree correctly

Description:

When snmprealwalk is asked for complete OID tree (thus it may not be . OID
but every OID prefix covers system-wide last OID) it does not handle
nosuchname error (that is used in snmpv1 as NOSUCHINSTANCE) reported by
agent correctly showing nonsense warnings.



This is because error handling case does not `know' about SNMP_CMD_REALWALK
query type, only about SNMP_CMD_WALK.

 

Test script:
---




Expected result:

Number of entries: 

Actual result:
--
PHP Warning:  snmprealwalk(): Error in packet: (noSuchName) There is no
such variable name in this MIB. in
/home/nc/tmp/perl-snmp-test-case/case-1/php-walk-case1.php on line 8

PHP Warning:  snmprealwalk(): This name does not exist:
iso.3.6.1.6.3.16.1.5.2.1.6.6.115.121.115.116.101.109.1.1 in
/home/nc/tmp/perl-snmp-test-case/case-1/php-walk-case1.php on line 8

It's busted

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51336&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51336&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51336&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51336&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51336&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51336&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51336&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=51336&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=51336&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=51336&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=51336&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=51336&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=51336&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=51336&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51336&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=51336&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=51336&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=51336&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=51336&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=51336&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=51336&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=51336&r=mysqlcfg



Bug #51336 [Com]: snmprealwalk (snmp v1) does not handle end of OID tree correctly

2010-12-01 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=51336&edit=1

 ID: 51336
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:snmprealwalk (snmp v1) does not handle end of OID
 tree correctly
 Status: Open
 Type:   Bug
 Package:SNMP related
 Operating System:   *
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Any progress on this bug?


Previous Comments:

[2010-03-20 11:52:24] lytboris at gmail dot com

Description:

When snmprealwalk is asked for complete OID tree (thus it may not be .
OID but every OID prefix covers system-wide last OID) it does not handle
nosuchname error (that is used in snmpv1 as NOSUCHINSTANCE) reported by
agent correctly showing nonsense warnings.



This is because error handling case does not `know' about
SNMP_CMD_REALWALK query type, only about SNMP_CMD_WALK.

 

Test script:
---




Expected result:

Number of entries: 

Actual result:
--
PHP Warning:  snmprealwalk(): Error in packet: (noSuchName) There is no
such variable name in this MIB. in
/home/nc/tmp/perl-snmp-test-case/case-1/php-walk-case1.php on line 8

PHP Warning:  snmprealwalk(): This name does not exist:
iso.3.6.1.6.3.16.1.5.2.1.6.6.115.121.115.116.101.109.1.1 in
/home/nc/tmp/perl-snmp-test-case/case-1/php-walk-case1.php on line 8

It's busted






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51336&edit=1


[PHP-BUG] Req #53594 [NEW]: php-snmp rewrite

2010-12-22 Thread lytboris at gmail dot com
From: 
Operating system: irrelevant
PHP version:  5.2.16
Package:  SNMP related
Bug Type: Feature/Change Request
Bug description:php-snmp rewrite

Description:

The main new feature is multi OID get/getnext/set commands. Another

one - strong and simple return value logic: if command fails, return

nothing but FALSE. No empty strings, no SNMP error messages as values,

etc. Just FALSE.



Another effort was to cover source code with unit tests. Results: 100%

functions (-zm_info_snmp, but it is not actually snmp function), 94%

source code lines.


-- 
Edit bug report at http://bugs.php.net/bug.php?id=53594&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53594&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53594&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=53594&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53594&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53594&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53594&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=53594&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=53594&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=53594&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=53594&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=53594&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=53594&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=53594&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53594&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=53594&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=53594&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=53594&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=53594&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=53594&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=53594&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=53594&r=mysqlcfg



Req #53594 [Com]: php-snmp rewrite

2010-12-22 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53594&edit=1

 ID: 53594
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:php-snmp rewrite
 Status: Open
 Type:   Feature/Change Request
 Package:SNMP related
 Operating System:   irrelevant
 PHP Version:5.2.16
 Block user comment: N
 Private report: N

 New Comment:

Patch was created for 5.3 branch and then adopted to be used in 5.2
branch.


Previous Comments:

[2010-12-22 19:49:37] lytboris at gmail dot com

Description:

The main new feature is multi OID get/getnext/set commands. Another

one - strong and simple return value logic: if command fails, return

nothing but FALSE. No empty strings, no SNMP error messages as values,

etc. Just FALSE.



Another effort was to cover source code with unit tests. Results: 100%

functions (-zm_info_snmp, but it is not actually snmp function), 94%

source code lines.







-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53594&edit=1


Req #53594 [Com]: php-snmp rewrite

2010-12-22 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53594&edit=1

 ID: 53594
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:php-snmp rewrite
 Status: Feedback
 Type:   Feature/Change Request
 Package:SNMP related
 Operating System:   irrelevant
 PHP Version:5.2.16
 Block user comment: N
 Private report: N

 New Comment:

I know about version lifecycle. But Cacti 087 (Larry mentioned it) runs
on 5.2 branch.



Here you are patch for trunk. There is no difference between 5.3 and
trunk for now so this patch may be appied to 5.3 branch too.


Previous Comments:

[2010-12-22 22:07:14] paj...@php.net

Thanks for this great patch :)



However 5.3 is in maintenance mode (and 5.2 is dead btw), please provide
a patch against trunk instead.


[2010-12-22 20:05:04] lytboris at gmail dot com

Patch was created for 5.3 branch and then adopted to be used in 5.2
branch.


[2010-12-22 19:49:37] lytboris at gmail dot com

Description:

The main new feature is multi OID get/getnext/set commands. Another

one - strong and simple return value logic: if command fails, return

nothing but FALSE. No empty strings, no SNMP error messages as values,

etc. Just FALSE.



Another effort was to cover source code with unit tests. Results: 100%

functions (-zm_info_snmp, but it is not actually snmp function), 94%

source code lines.







-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53594&edit=1


Req #53594 [Com]: php-snmp rewrite

2010-12-23 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53594&edit=1

 ID: 53594
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:php-snmp rewrite
 Status: Feedback
 Type:   Feature/Change Request
 Package:SNMP related
 Operating System:   irrelevant
 PHP Version:5.2.16
 Block user comment: N
 Private report: N

 New Comment:

This patch covers bugs

#44193

#45893

#51336


Previous Comments:

[2010-12-23 07:20:18] lytboris at gmail dot com

I know about version lifecycle. But Cacti 087 (Larry mentioned it) runs
on 5.2 branch.



Here you are patch for trunk. There is no difference between 5.3 and
trunk for now so this patch may be appied to 5.3 branch too.


[2010-12-22 22:07:14] paj...@php.net

Thanks for this great patch :)



However 5.3 is in maintenance mode (and 5.2 is dead btw), please provide
a patch against trunk instead.


[2010-12-22 20:05:04] lytboris at gmail dot com

Patch was created for 5.3 branch and then adopted to be used in 5.2
branch.


[2010-12-22 19:49:37] lytboris at gmail dot com

Description:

The main new feature is multi OID get/getnext/set commands. Another

one - strong and simple return value logic: if command fails, return

nothing but FALSE. No empty strings, no SNMP error messages as values,

etc. Just FALSE.



Another effort was to cover source code with unit tests. Results: 100%

functions (-zm_info_snmp, but it is not actually snmp function), 94%

source code lines.







-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53594&edit=1


Req #53594 [Com]: php-snmp rewrite

2010-12-29 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53594&edit=1

 ID: 53594
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:php-snmp rewrite
 Status: Feedback
 Type:   Feature/Change Request
 Package:SNMP related
 Operating System:   irrelevant
 PHP Version:5.2.16
 Block user comment: N
 Private report: N

 New Comment:

Reuploaded patches (to be allied against trunk)



+ session-like workflow:

   $session = snmp_session_open(...);

   $result = snmpget($oid);

   ...

   snmp_session_close($session);

+ support for SNMPv3 contextName & contextEngineID properties in new
syntax style



+ tests for new features



snmp(real)?{get,walk,set} functions are now polymorphic - they accepts
both old (SNMPv1) arguments and new session-like. All version protocols
are handled by the since protocol version is now set using
snmp_session_open.


Previous Comments:

[2010-12-23 09:03:38] lytboris at gmail dot com

This patch covers bugs

#44193

#45893

#51336


[2010-12-23 07:20:18] lytboris at gmail dot com

I know about version lifecycle. But Cacti 087 (Larry mentioned it) runs
on 5.2 branch.



Here you are patch for trunk. There is no difference between 5.3 and
trunk for now so this patch may be appied to 5.3 branch too.


[2010-12-22 22:07:14] paj...@php.net

Thanks for this great patch :)



However 5.3 is in maintenance mode (and 5.2 is dead btw), please provide
a patch against trunk instead.


[2010-12-22 20:05:04] lytboris at gmail dot com

Patch was created for 5.3 branch and then adopted to be used in 5.2
branch.


[2010-12-22 19:49:37] lytboris at gmail dot com

Description:

The main new feature is multi OID get/getnext/set commands. Another

one - strong and simple return value logic: if command fails, return

nothing but FALSE. No empty strings, no SNMP error messages as values,

etc. Just FALSE.



Another effort was to cover source code with unit tests. Results: 100%

functions (-zm_info_snmp, but it is not actually snmp function), 94%

source code lines.







-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53594&edit=1


Req #53594 [Com]: php-snmp rewrite

2010-12-29 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53594&edit=1

 ID: 53594
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:php-snmp rewrite
 Status: Feedback
 Type:   Feature/Change Request
 Package:SNMP related
 Operating System:   irrelevant
 PHP Version:trunk
 Block user comment: N
 Private report: N

 New Comment:

You have guessed my next target - OO interface. :-)



If you apply new patch you'll see there is very small piece of code
making SNMPv1 functions be polymorphic - dozen of lines, not more.

My thoughts are that old API should be deprecated sometime, so there
will be session-only support: both OO and non-OO.


Previous Comments:

[2010-12-29 18:02:23] paj...@php.net

What do you think about keeping the old APIs as it is, froze it and add
a much nicer and flexible OO one instead? For any new improvements?
That's what I did for zip and brings much more rooms for new stuff while
reducing the maintenance work load.


[2010-12-29 17:56:28] lytboris at gmail dot com

Reuploaded patches (to be allied against trunk)



+ session-like workflow:

   $session = snmp_session_open(...);

   $result = snmpget($oid);

   ...

   snmp_session_close($session);

+ support for SNMPv3 contextName & contextEngineID properties in new
syntax style



+ tests for new features



snmp(real)?{get,walk,set} functions are now polymorphic - they accepts
both old (SNMPv1) arguments and new session-like. All version protocols
are handled by the since protocol version is now set using
snmp_session_open.


[2010-12-23 09:03:38] lytboris at gmail dot com

This patch covers bugs

#44193

#45893

#51336


[2010-12-23 07:20:18] lytboris at gmail dot com

I know about version lifecycle. But Cacti 087 (Larry mentioned it) runs
on 5.2 branch.



Here you are patch for trunk. There is no difference between 5.3 and
trunk for now so this patch may be appied to 5.3 branch too.


[2010-12-22 22:07:14] paj...@php.net

Thanks for this great patch :)



However 5.3 is in maintenance mode (and 5.2 is dead btw), please provide
a patch against trunk instead.




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

http://bugs.php.net/bug.php?id=53594


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53594&edit=1


Req #53594 [Com]: php-snmp rewrite

2010-12-31 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53594&edit=1

 ID: 53594
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:php-snmp rewrite
 Status: Feedback
 Type:   Feature/Change Request
 Package:SNMP related
 Operating System:   irrelevant
 PHP Version:trunk
 Block user comment: N
 Private report: N

 New Comment:

OK. There will be full-featured OO API without adding new functions into
legacy API (e.g. no session support). Though old functions will be
provided with two features (in sake of code cimplicity):

 * multi-OID

 * strict output typing


Previous Comments:

[2010-12-29 18:22:55] paj...@php.net

No need to deprecate it, but tell anyone asking for a feature for the
legacy API to migrate to the new shiny one :)


[2010-12-29 18:21:57] paj...@php.net

It is much easier and cleaner to simply go straight to OO then, without
procedural API, and keep the old for legacy apps.


[2010-12-29 18:17:11] lytboris at gmail dot com

You have guessed my next target - OO interface. :-)



If you apply new patch you'll see there is very small piece of code
making SNMPv1 functions be polymorphic - dozen of lines, not more.

My thoughts are that old API should be deprecated sometime, so there
will be session-only support: both OO and non-OO.


[2010-12-29 18:02:23] paj...@php.net

What do you think about keeping the old APIs as it is, froze it and add
a much nicer and flexible OO one instead? For any new improvements?
That's what I did for zip and brings much more rooms for new stuff while
reducing the maintenance work load.


[2010-12-29 17:56:28] lytboris at gmail dot com

Reuploaded patches (to be allied against trunk)



+ session-like workflow:

   $session = snmp_session_open(...);

   $result = snmpget($oid);

   ...

   snmp_session_close($session);

+ support for SNMPv3 contextName & contextEngineID properties in new
syntax style



+ tests for new features



snmp(real)?{get,walk,set} functions are now polymorphic - they accepts
both old (SNMPv1) arguments and new session-like. All version protocols
are handled by the since protocol version is now set using
snmp_session_open.




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

http://bugs.php.net/bug.php?id=53594


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53594&edit=1


Req #53594 [Com]: php-snmp rewrite

2011-01-05 Thread lytboris at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53594&edit=1

 ID: 53594
 Comment by: lytboris at gmail dot com
 Reported by:lytboris at gmail dot com
 Summary:php-snmp rewrite
 Status: Feedback
 Type:   Feature/Change Request
 Package:SNMP related
 Operating System:   irrelevant
 PHP Version:trunk
 Block user comment: N
 Private report: N

 New Comment:

Introducing full-featured OO API.

It covers bug #46065 also.



Old API *_set_* functions actually sets `global' preferences, they are
used when creating new object instance. $object->... properties are used
object(session)-wise.


Previous Comments:

[2010-12-31 19:52:07] lytboris at gmail dot com

OK. There will be full-featured OO API without adding new functions into
legacy API (e.g. no session support). Though old functions will be
provided with two features (in sake of code cimplicity):

 * multi-OID

 * strict output typing


[2010-12-29 18:22:55] paj...@php.net

No need to deprecate it, but tell anyone asking for a feature for the
legacy API to migrate to the new shiny one :)


[2010-12-29 18:21:57] paj...@php.net

It is much easier and cleaner to simply go straight to OO then, without
procedural API, and keep the old for legacy apps.


[2010-12-29 18:17:11] lytboris at gmail dot com

You have guessed my next target - OO interface. :-)



If you apply new patch you'll see there is very small piece of code
making SNMPv1 functions be polymorphic - dozen of lines, not more.

My thoughts are that old API should be deprecated sometime, so there
will be session-only support: both OO and non-OO.


[2010-12-29 18:02:23] paj...@php.net

What do you think about keeping the old APIs as it is, froze it and add
a much nicer and flexible OO one instead? For any new improvements?
That's what I did for zip and brings much more rooms for new stuff while
reducing the maintenance work load.




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

http://bugs.php.net/bug.php?id=53594


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53594&edit=1