xref: /PHP-7.3/ext/snmp/tests/snmp3-error.phpt (revision 782352c5)
1--TEST--
2SNMPv3 Support (errors)
3--CREDITS--
4Boris Lytochkin
5--SKIPIF--
6<?php
7require_once(dirname(__FILE__).'/skipif.inc');
8?>
9--FILE--
10<?php
11require_once(dirname(__FILE__).'/snmp_include.inc');
12
13echo "Checking error handling\n";
14
15//int snmp3_get(string host, string sec_name, string sec_level, string auth_protocol,
16//              string auth_passphrase, string priv_protocol, string priv_passphrase,
17//              string object_id [, int timeout [, int retries]]);
18
19var_dump(snmp3_get($hostname, $community, '', '', '', '', ''));
20var_dump(snmp3_get($hostname, $community, '', '', '', '', '', '.1.3.6.1.2.1.1.1.0'));
21var_dump(snmp3_get($hostname, $community, 'bugusPriv', '', '', '', '', '.1.3.6.1.2.1.1.1.0'));
22var_dump(snmp3_get($hostname, $community, 'authNoPriv', 'TTT', '', '', '', '.1.3.6.1.2.1.1.1.0'));
23var_dump(snmp3_get($hostname, $community, 'authNoPriv', 'MD5', '', '', '', '.1.3.6.1.2.1.1.1.0'));
24var_dump(snmp3_get($hostname, $community, 'authNoPriv', 'MD5', 'te', '', '', '.1.3.6.1.2.1.1.1.0'));
25var_dump(snmp3_get($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'BBB', '', '.1.3.6.1.2.1.1.1.0'));
26var_dump(snmp3_get($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES', '', '.1.3.6.1.2.1.1.1.0'));
27var_dump(snmp3_get($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES', 'ty', '.1.3.6.1.2.1.1.1.0'));
28var_dump(snmp3_get($hostname, 'somebogususer', 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
29
30var_dump(snmp3_set($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 's'));
31
32var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.777...7.5.3', 's', 'ttt', $timeout, $retries));
33var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.777.7.5.3', array('s'), 'yyy', $timeout, $retries));
34
35?>
36--EXPECTF--
37Checking error handling
38
39Warning: snmp3_get() expects at least 8 parameters, 7 given in %s on line %d
40bool(false)
41
42Warning: snmp3_get(): Invalid security level '' in %s on line %d
43bool(false)
44
45Warning: snmp3_get(): Invalid security level 'bugusPriv' in %s on line %d
46bool(false)
47
48Warning: snmp3_get(): Unknown authentication protocol 'TTT' in %s on line %d
49bool(false)
50
51Warning: snmp3_get(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d
52bool(false)
53
54Warning: snmp3_get(): Error generating a key for authentication pass phrase 'te': Generic error (The supplied password length is too short.) in %s on line %d
55bool(false)
56
57Warning: snmp3_get(): Unknown security protocol 'BBB' in %s on line %d
58bool(false)
59
60Warning: snmp3_get(): Error generating a key for privacy pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d
61bool(false)
62
63Warning: snmp3_get(): Error generating a key for privacy pass phrase 'ty': Generic error (The supplied password length is too short.) in %s on line %d
64bool(false)
65
66Warning: snmp3_get(): Fatal error: Unknown user name in %s on line %d
67bool(false)
68
69Warning: snmp3_set() expects at least 10 parameters, 9 given in %s on line %d
70bool(false)
71
72Warning: snmp3_set(): Invalid object identifier: .1.3.6.777...7.5.3 in %s on line %d
73bool(false)
74
75Warning: snmp3_set(): Single objid and multiple type or values are not supported in %s on line %d
76bool(false)
77