Annotation of embedaddon/php/ext/snmp/tests/snmp-object-setSecurity_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: OO API: SNMP::setSecurity (errors)
! 3: --CREDITS--
! 4: Boris Lytochkin
! 5: --SKIPIF--
! 6: <?php
! 7: require_once(dirname(__FILE__).'/skipif.inc');
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: require_once(dirname(__FILE__).'/snmp_include.inc');
! 12:
! 13: //EXPECTF format is quickprint OFF
! 14: snmp_set_quick_print(false);
! 15: snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
! 16:
! 17: $session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries);
! 18: $session->setSecurity('noAuthNoPriv');
! 19:
! 20: #echo "Checking error handling\n";
! 21: var_dump($session->setSecurity());
! 22: var_dump($session->setSecurity(''));
! 23: var_dump($session->setSecurity('bugusPriv'));
! 24: var_dump($session->setSecurity('authNoPriv', 'TTT'));
! 25: var_dump($session->setSecurity('authNoPriv', 'MD5', ''));
! 26: var_dump($session->setSecurity('authNoPriv', 'MD5', 'te'));
! 27: var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'BBB'));
! 28: var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', ''));
! 29: var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', 'ty'));
! 30: var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', 'test12345', 'context', 'dsa'));
! 31:
! 32: var_dump($session->close());
! 33:
! 34: ?>
! 35: --EXPECTF--
! 36:
! 37: Warning: SNMP::setSecurity() expects at least 1 parameter, 0 given in %s on line %d
! 38: bool(false)
! 39:
! 40: Warning: SNMP::setSecurity(): Invalid security level '' in %s on line %d
! 41: bool(false)
! 42:
! 43: Warning: SNMP::setSecurity(): Invalid security level 'bugusPriv' in %s on line %d
! 44: bool(false)
! 45:
! 46: Warning: SNMP::setSecurity(): Unknown authentication protocol 'TTT' in %s on line %d
! 47: bool(false)
! 48:
! 49: 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
! 50: bool(false)
! 51:
! 52: 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
! 53: bool(false)
! 54:
! 55: Warning: SNMP::setSecurity(): Unknown security protocol 'BBB' in %s on line %d
! 56: bool(false)
! 57:
! 58: 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
! 59: bool(false)
! 60:
! 61: 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
! 62: bool(false)
! 63:
! 64: Warning: SNMP::setSecurity(): Bad engine ID value 'dsa' in %s on line %d
! 65: bool(false)
! 66: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>