Debian Codegraph @

mysql-test/suite/x/include/connection_local_scope.inc

raw
1 #
2 ## Test cases for accounts created on local-scope IPv6
3 ## addresses. If the account address doesn't exactly match
4 ## the clients IP address (with scope specifier), such
5 ## connection attempt must be rejected
6 #
7 # Usage
8 #
9 # --let $ip = IPv6 ADDRESS
10 # --let $interface = scope name/interface name of the IP
11 # --let $execute_command = program that is going to connect to MySQLd
12 # --source ../include/connection_local_scop.inc
13 #
14
15 --disable_query_log
16 --disable_result_log
17 #
18 # Please note that '%' is going to be interpreted as wildcard character.
19 # anyway it doesn't matter for the test-case
20 #
21 --eval CREATE USER user1@`$ip%$interface` identified with 'mysql_native_password' by 'p1'
22 --eval CREATE USER user2@`$ip` identified with 'mysql_native_password' by 'p2'
23 --enable_result_log
24 --enable_query_log
25
26 --let $accounts_host=/$ip%$interface/localhost/ /user1@[a-zA-Z0-9:._%-]+/user1@localhost/ /'user2'@'[^']+'/'user2'@'localhost'/
27
28 --echo # Account user1 was created with interface name.
29 --echo # The authentication must be succesful
30 --replace_regex $accounts_host
31 exec $execute_command -uuser1 --password='p1'
32 -h$ip%$interface -e "SELECT USER()" 2>&1;
33
34 --echo # Account user2 was created without interface name.
35 --echo # The authentication must fail because account IP
36 --echo # and client IP doesn't match
37 --replace_regex $accounts_host
38 error 1;
39 exec $execute_command
40 -uuser2 --password='p2'
41 -h$ip%$interface -e "SELECT USER()" 2>&1;
42
43 --disable_query_log
44 --disable_result_log
45 --eval DROP USER user1@`$ip%$interface`
46 --eval DROP USER user2@`$ip`
47 --enable_result_log
48 --enable_query_log