diff options
author | Boris Lytochkin <lytboris@php.net> | 2011-03-20 20:07:33 +0000 |
---|---|---|
committer | Boris Lytochkin <lytboris@php.net> | 2011-03-20 20:07:33 +0000 |
commit | 14eaa5ac58adcbbf80a5db7838f7c4080fbd6e0e (patch) | |
tree | 6d8a067bd3a2a0f5b5d91454568bad9a7e62cb2b /ext/snmp/tests | |
parent | 547a96090f2eb652c4f3c0978164199b835ac86f (diff) | |
download | php-git-14eaa5ac58adcbbf80a5db7838f7c4080fbd6e0e.tar.gz |
follow CS:
- method set_security should be named as setSecurity
- SNMP_VERSION_2C constant
Diffstat (limited to 'ext/snmp/tests')
-rw-r--r-- | ext/snmp/tests/generic_timeout_error.phpt | 2 | ||||
-rw-r--r-- | ext/snmp/tests/snmp-object-errno-errstr.phpt | 4 | ||||
-rw-r--r-- | ext/snmp/tests/snmp-object-error.phpt | 2 | ||||
-rw-r--r-- | ext/snmp/tests/snmp-object-properties.phpt | 2 | ||||
-rw-r--r-- | ext/snmp/tests/snmp-object-setSecurity_error.phpt | 66 | ||||
-rw-r--r-- | ext/snmp/tests/snmp-object-set_security_error.phpt | 66 | ||||
-rw-r--r-- | ext/snmp/tests/snmp-object.phpt | 12 | ||||
-rw-r--r-- | ext/snmp/tests/snmp2_set-nomib.phpt | 2 | ||||
-rw-r--r-- | ext/snmp/tests/snmp3-error.phpt | 2 | ||||
-rw-r--r-- | ext/snmp/tests/snmpset-nomib.phpt | 2 | ||||
-rw-r--r-- | ext/snmp/tests/wrong_hostname.phpt | 2 |
11 files changed, 81 insertions, 81 deletions
diff --git a/ext/snmp/tests/generic_timeout_error.phpt b/ext/snmp/tests/generic_timeout_error.phpt index 8a06c50bbf..0f5101a439 100644 --- a/ext/snmp/tests/generic_timeout_error.phpt +++ b/ext/snmp/tests/generic_timeout_error.phpt @@ -19,4 +19,4 @@ var_dump(snmpget($hostname, 'timeout_community_432', '.1.3.6.1.2.1.1.1.0', $time ?> --EXPECTF-- Warning: snmpget(): No response from %s in %s on line %d -bool(false)
\ No newline at end of file +bool(false) diff --git a/ext/snmp/tests/snmp-object-errno-errstr.phpt b/ext/snmp/tests/snmp-object-errno-errstr.phpt index 769588165d..5b29ff3ee0 100644 --- a/ext/snmp/tests/snmp-object-errno-errstr.phpt +++ b/ext/snmp/tests/snmp-object-errno-errstr.phpt @@ -38,7 +38,7 @@ var_dump($session->get_error()); $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 @@ bool(true) 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" diff --git a/ext/snmp/tests/snmp-object-error.phpt b/ext/snmp/tests/snmp-object-error.phpt index 5b77112408..5520958acf 100644 --- a/ext/snmp/tests/snmp-object-error.phpt +++ b/ext/snmp/tests/snmp-object-error.phpt @@ -91,4 +91,4 @@ NULL 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 diff --git a/ext/snmp/tests/snmp-object-properties.phpt b/ext/snmp/tests/snmp-object-properties.phpt index 6610d08001..0bdf51b46e 100644 --- a/ext/snmp/tests/snmp-object-properties.phpt +++ b/ext/snmp/tests/snmp-object-properties.phpt @@ -187,4 +187,4 @@ array(4) { ["retries"]=> int(%d) } -NULL
\ No newline at end of file +NULL diff --git a/ext/snmp/tests/snmp-object-setSecurity_error.phpt b/ext/snmp/tests/snmp-object-setSecurity_error.phpt new file mode 100644 index 0000000000..b5327649c0 --- /dev/null +++ b/ext/snmp/tests/snmp-object-setSecurity_error.phpt @@ -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) diff --git a/ext/snmp/tests/snmp-object-set_security_error.phpt b/ext/snmp/tests/snmp-object-set_security_error.phpt deleted file mode 100644 index 596fb53220..0000000000 --- a/ext/snmp/tests/snmp-object-set_security_error.phpt +++ /dev/null @@ -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 diff --git a/ext/snmp/tests/snmp-object.phpt b/ext/snmp/tests/snmp-object.phpt index 70bc86a6c9..d27e9db0a6 100644 --- a/ext/snmp/tests/snmp-object.phpt +++ b/ext/snmp/tests/snmp-object.phpt @@ -69,21 +69,21 @@ var_dump($session->close()); 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 @@ var_dump($session->close()); 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 @@ var_dump($session->close()); 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) bool(true) SNMPv3, setting contextEngineID (authPriv) string(%d) "%S" -bool(true)
\ No newline at end of file +bool(true) diff --git a/ext/snmp/tests/snmp2_set-nomib.phpt b/ext/snmp/tests/snmp2_set-nomib.phpt index e8106d81cc..af0baa3fdd 100644 --- a/ext/snmp/tests/snmp2_set-nomib.phpt +++ b/ext/snmp/tests/snmp2_set-nomib.phpt @@ -56,4 +56,4 @@ Single OID bool(true) bool(true) bool(true) -bool(true)
\ No newline at end of file +bool(true) diff --git a/ext/snmp/tests/snmp3-error.phpt b/ext/snmp/tests/snmp3-error.phpt index 26551e7744..b2e51da3f9 100644 --- a/ext/snmp/tests/snmp3-error.phpt +++ b/ext/snmp/tests/snmp3-error.phpt @@ -73,4 +73,4 @@ Warning: snmp3_set(): Invalid object identifier: .1.3.6.777...7.5.3 in %s on lin 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) diff --git a/ext/snmp/tests/snmpset-nomib.phpt b/ext/snmp/tests/snmpset-nomib.phpt index 39a455bafe..7428e57c78 100644 --- a/ext/snmp/tests/snmpset-nomib.phpt +++ b/ext/snmp/tests/snmpset-nomib.phpt @@ -57,4 +57,4 @@ Single OID bool(true) bool(true) bool(true) -bool(true)
\ No newline at end of file +bool(true) diff --git a/ext/snmp/tests/wrong_hostname.phpt b/ext/snmp/tests/wrong_hostname.phpt index 7b56e5c294..1227318078 100644 --- a/ext/snmp/tests/wrong_hostname.phpt +++ b/ext/snmp/tests/wrong_hostname.phpt @@ -19,4 +19,4 @@ var_dump(snmpget('192.168..6.1', 'community', '.1.3.6.1.2.1.1.1.0', $timeout, $r ?> --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) |