1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 04:32:19 +02:00
Files
archived-php-src/ext/snmp/tests/snmp-object-setSecurity_error.phpt
Christoph M. Becker 752012a491 Fix tests wrt. ZPP warnings to errors
Since these test parts are solely about checking ZPP, we drop them
altogether.
2019-09-27 19:07:29 +02:00

62 lines
2.2 KiB
PHP

--TEST--
OO API: SNMP::setSecurity (errors)
--CREDITS--
Boris Lytochkin
--SKIPIF--
<?php
require_once(__DIR__.'/skipif.inc');
?>
--FILE--
<?php
require_once(__DIR__.'/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('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(): 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)