lytboris Sun, 20 Mar 2011 20:07:33 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=309485
Log: follow CS: - method set_security should be named as setSecurity - SNMP_VERSION_2C constant Changed paths: U php/php-src/trunk/ext/snmp/php_snmp.h U php/php-src/trunk/ext/snmp/snmp.c U php/php-src/trunk/ext/snmp/tests/generic_timeout_error.phpt U php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt U php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt U php/php-src/trunk/ext/snmp/tests/snmp-object-properties.phpt A + php/php-src/trunk/ext/snmp/tests/snmp-object-setSecurity_error.phpt (from php/php-src/trunk/ext/snmp/tests/snmp-object-set_security_error.phpt:r309453) D php/php-src/trunk/ext/snmp/tests/snmp-object-set_security_error.phpt U php/php-src/trunk/ext/snmp/tests/snmp-object.phpt U php/php-src/trunk/ext/snmp/tests/snmp2_set-nomib.phpt U php/php-src/trunk/ext/snmp/tests/snmp3-error.phpt U php/php-src/trunk/ext/snmp/tests/snmpset-nomib.phpt U php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt
Modified: php/php-src/trunk/ext/snmp/php_snmp.h =================================================================== --- php/php-src/trunk/ext/snmp/php_snmp.h 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/php_snmp.h 2011-03-20 20:07:33 UTC (rev 309485) @@ -73,7 +73,7 @@ PHP_FUNCTION(snmp_read_mib); PHP_METHOD(SNMP, open); -PHP_METHOD(SNMP, set_security); +PHP_METHOD(SNMP, setSecurity); PHP_METHOD(SNMP, close); PHP_METHOD(SNMP, get); PHP_METHOD(SNMP, getnext); Modified: php/php-src/trunk/ext/snmp/snmp.c =================================================================== --- php/php-src/trunk/ext/snmp/snmp.c 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/snmp.c 2011-03-20 20:07:33 UTC (rev 309485) @@ -374,7 +374,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_snmp_void, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_security, 0, 0, 8) +ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_setSecurity, 0, 0, 8) ZEND_ARG_INFO(0, session) ZEND_ARG_INFO(0, sec_level) ZEND_ARG_INFO(0, auth_protocol) @@ -1847,9 +1847,9 @@ php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_SET, (-1)); } -/* {{{ proto bool SNMP::set_security(resource session, string sec_level, [ string auth_protocol, string auth_passphrase [, string priv_protocol, string priv_passphrase [, string contextName [, string contextEngineID]]]]) +/* {{{ proto bool SNMP::setSecurity(resource session, string sec_level, [ string auth_protocol, string auth_passphrase [, string priv_protocol, string priv_passphrase [, string contextName [, string contextEngineID]]]]) Set SNMPv3 security-related session parameters */ -PHP_METHOD(snmp, set_security) +PHP_METHOD(snmp, setSecurity) { php_snmp_object *snmp_object; zval *object = getThis(); @@ -2338,7 +2338,7 @@ static zend_function_entry php_snmp_class_methods[] = { PHP_ME(snmp, open, arginfo_snmp_open, ZEND_ACC_PUBLIC) PHP_ME(snmp, close, arginfo_snmp_void, ZEND_ACC_PUBLIC) - PHP_ME(snmp, set_security, arginfo_snmp_set_security, ZEND_ACC_PUBLIC) + PHP_ME(snmp, setSecurity, arginfo_snmp_setSecurity, ZEND_ACC_PUBLIC) PHP_ME(snmp, get, arginfo_snmp_get, ZEND_ACC_PUBLIC) PHP_ME(snmp, getnext, arginfo_snmp_get, ZEND_ACC_PUBLIC) @@ -2434,6 +2434,7 @@ REGISTER_LONG_CONSTANT("SNMP_VERSION_1", SNMP_VERSION_1, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SNMP_VERSION_2c", SNMP_VERSION_2c, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_VERSION_2C", SNMP_VERSION_2c, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SNMP_VERSION_3", SNMP_VERSION_3, CONST_CS | CONST_PERSISTENT); REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_NOERROR", (long)PHP_SNMP_ERRNO_NOERROR); Modified: php/php-src/trunk/ext/snmp/tests/generic_timeout_error.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/generic_timeout_error.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/generic_timeout_error.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -19,4 +19,4 @@ ?> --EXPECTF-- Warning: snmpget(): No response from %s in %s on line %d -bool(false) \ No newline at end of file +bool(false) Modified: php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -38,7 +38,7 @@ $session->close(); echo "SNMP::ERRNO_GENERIC\n"; $session = new SNMP(SNMP_VERSION_3, $hostname, 'somebogususer', $timeout, $retries); -$session->set_security('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); +$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); var_dump(@$session->get('.1.3.6.1.2.1.1.1.0')); var_dump($session->get_errno() == SNMP::ERRNO_GENERIC); var_dump($session->get_error()); @@ -60,4 +60,4 @@ SNMP::ERRNO_GENERIC bool(false) bool(true) -%string|unicode%(%d) "Fatal error: Unknown user name" \ No newline at end of file +%string|unicode%(%d) "Fatal error: Unknown user name" Modified: php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -91,4 +91,4 @@ Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d -NULL \ No newline at end of file +NULL Modified: php/php-src/trunk/ext/snmp/tests/snmp-object-properties.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp-object-properties.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmp-object-properties.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -187,4 +187,4 @@ ["retries"]=> int(%d) } -NULL \ No newline at end of file +NULL Copied: php/php-src/trunk/ext/snmp/tests/snmp-object-setSecurity_error.phpt (from rev 309453, php/php-src/trunk/ext/snmp/tests/snmp-object-set_security_error.phpt) =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp-object-setSecurity_error.phpt (rev 0) +++ php/php-src/trunk/ext/snmp/tests/snmp-object-setSecurity_error.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -0,0 +1,66 @@ +--TEST-- +OO API: SNMP::setSecurity (errors) +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +//EXPECTF format is quickprint OFF +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +$session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); +$session->setSecurity('noAuthNoPriv'); + +#echo "Checking error handling\n"; +var_dump($session->setSecurity()); +var_dump($session->setSecurity('')); +var_dump($session->setSecurity('bugusPriv')); +var_dump($session->setSecurity('authNoPriv', 'TTT')); +var_dump($session->setSecurity('authNoPriv', 'MD5', '')); +var_dump($session->setSecurity('authNoPriv', 'MD5', 'te')); +var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'BBB')); +var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', '')); +var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', 'ty')); +var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', 'test12345', 'context', 'dsa')); + +var_dump($session->close()); + +?> +--EXPECTF-- + +Warning: SNMP::setSecurity() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Invalid security level '' in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Invalid security level 'bugusPriv' in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Unknown authentication protocol 'TTT' in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Error generating a key for authentication pass phrase 'te': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Unknown security protocol 'BBB' in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Error generating a key for privacy pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Error generating a key for privacy pass phrase 'ty': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::setSecurity(): Bad engine ID value 'dsa' in %s on line %d +bool(false) +bool(true) Deleted: php/php-src/trunk/ext/snmp/tests/snmp-object-set_security_error.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp-object-set_security_error.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmp-object-set_security_error.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -1,66 +0,0 @@ ---TEST-- -OO API: SNMP::set_security (errors) ---CREDITS-- -Boris Lytochkin ---SKIPIF-- -<?php -require_once(dirname(__FILE__).'/skipif.inc'); -?> ---FILE-- -<?php -require_once(dirname(__FILE__).'/snmp_include.inc'); - -//EXPECTF format is quickprint OFF -snmp_set_quick_print(false); -snmp_set_valueretrieval(SNMP_VALUE_PLAIN); - -$session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); -$session->set_security('noAuthNoPriv'); - -#echo "Checking error handling\n"; -var_dump($session->set_security()); -var_dump($session->set_security('')); -var_dump($session->set_security('bugusPriv')); -var_dump($session->set_security('authNoPriv', 'TTT')); -var_dump($session->set_security('authNoPriv', 'MD5', '')); -var_dump($session->set_security('authNoPriv', 'MD5', 'te')); -var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'BBB')); -var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'AES', '')); -var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'AES', 'ty')); -var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'AES', 'test12345', 'context', 'dsa')); - -var_dump($session->close()); - -?> ---EXPECTF-- - -Warning: SNMP::set_security() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Invalid security level '' in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Invalid security level 'bugusPriv' in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Unknown authentication protocol 'TTT' in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Error generating a key for authentication pass phrase 'te': Generic error (The supplied password length is too short.) in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Unknown security protocol 'BBB' in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Error generating a key for privacy pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Error generating a key for privacy pass phrase 'ty': Generic error (The supplied password length is too short.) in %s on line %d -bool(false) - -Warning: SNMP::set_security(): Bad engine ID value 'dsa' in %s on line %d -bool(false) -bool(true) \ No newline at end of file Modified: php/php-src/trunk/ext/snmp/tests/snmp-object.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp-object.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmp-object.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -69,21 +69,21 @@ echo "SNMPv3 (default security settings)\n"; $session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); -#$session->set_security($user_noauth, 'noAuthNoPriv', '', '', '', '', '', ''); +#$session->setSecurity($user_noauth, 'noAuthNoPriv', '', '', '', '', '', ''); var_dump($session->get('.1.3.6.1.2.1.1.1.0')); var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); var_dump($session->close()); echo "SNMPv3 (noAuthNoPriv)\n"; $session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); -$session->set_security('noAuthNoPriv'); +$session->setSecurity('noAuthNoPriv'); var_dump($session->get('.1.3.6.1.2.1.1.1.0')); var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); var_dump($session->close()); echo "SNMPv3 (authPriv)\n"; $session = new SNMP(SNMP_VERSION_3, $hostname, $rwuser, $timeout, $retries); -$session->set_security('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); +$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); var_dump($session->get('.1.3.6.1.2.1.1.1.0')); var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); var_dump($session->walk('.1.3.6.1.2.1.1.1.0')); @@ -91,7 +91,7 @@ echo "SET single OID\n"; $session = new SNMP(SNMP_VERSION_3, $hostname, $rwuser, $timeout, $retries); -$session->set_security('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); +$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); $oid1 = 'SNMPv2-MIB::sysContact.0'; $oldvalue1 = $session->get($oid1); $newvalue1 = $oldvalue1 . '0'; @@ -106,7 +106,7 @@ echo "SNMPv3, setting contextEngineID (authPriv)\n"; $session = new SNMP(SNMP_VERSION_3, $hostname, $rwuser, $timeout, $retries); -$session->set_security('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 'aeeeff'); +$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 'aeeeff'); var_dump($session->get('.1.3.6.1.2.1.1.1.0')); var_dump($session->close()); @@ -174,4 +174,4 @@ bool(true) SNMPv3, setting contextEngineID (authPriv) string(%d) "%S" -bool(true) \ No newline at end of file +bool(true) Modified: php/php-src/trunk/ext/snmp/tests/snmp2_set-nomib.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp2_set-nomib.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmp2_set-nomib.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -56,4 +56,4 @@ bool(true) bool(true) bool(true) -bool(true) \ No newline at end of file +bool(true) Modified: php/php-src/trunk/ext/snmp/tests/snmp3-error.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmp3-error.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmp3-error.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -73,4 +73,4 @@ bool(false) Warning: snmp3_set(): Single objid and multiple type or values are not supported in %s on line %d -bool(false) \ No newline at end of file +bool(false) Modified: php/php-src/trunk/ext/snmp/tests/snmpset-nomib.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/snmpset-nomib.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/snmpset-nomib.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -57,4 +57,4 @@ bool(true) bool(true) bool(true) -bool(true) \ No newline at end of file +bool(true) Modified: php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt =================================================================== --- php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt 2011-03-20 17:10:28 UTC (rev 309484) +++ php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt 2011-03-20 20:07:33 UTC (rev 309485) @@ -19,4 +19,4 @@ ?> --EXPECTF-- Warning: snmpget(): Could not open snmp connection: Unknown host (192.168..6.1) (%s) in %s on line %d -bool(false) \ No newline at end of file +bool(false)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php