Lines Matching refs:link
9 if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
14 if ($link->server_version < 50610)
15 die(sprintf("SKIP Needs MySQL 5.6.10 or newer, found MySQL %s\n", $link->server_info));
17 if ($link->server_version >= 100000) {
18 if ($link->server_version < 100403)
19 die(sprintf("SKIP Needs MariaDB 10.4.3 or newer, found MariaDB %s\n", $link->server_info));
20 $result = $link->query("select @@disconnect_on_expired_password");
29 mysqli_query($link, 'DROP USER expiretest');
30 mysqli_query($link, 'DROP USER expiretest@localhost');
32 if (!mysqli_query($link, 'CREATE USER expiretest IDENTIFIED BY \'expiredpassword\'') ||
33 !mysqli_query($link, 'CREATE USER expiretest@localhost IDENTIFIED BY \'expiredpassword\'')) {
34 printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
35 mysqli_close($link);
39 if (!mysqli_query($link, 'ALTER USER expiretest PASSWORD EXPIRE') ||
40 !mysqli_query($link, 'ALTER USER expiretest@localhost PASSWORD EXPIRE')) {
41 printf("skip Cannot modify second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
42 mysqli_close($link);
46 if (!$link->query("DROP TABLE IF EXISTS test") ||
47 !$link->query("CREATE TABLE test (id INT)") || !$link->query("INSERT INTO test(id) VALUES (1)"))
48 die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
52 if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%%'", $db)) ||
53 !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'localhost'", $db))) {
54 printf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link));
55 mysqli_close($link);
65 if (!$link = my_mysqli_connect($host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
69 $link->query("SELECT id FROM test WHERE id = 1");
70 printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error);
74 $link = mysqli_init();
75 $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0);
76 … if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
80 $link->query("SELECT id FROM test WHERE id = 1");
81 printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error);
85 $link = mysqli_init();
86 $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
87 … if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
91 $link->query("SELECT id FROM test WHERE id = 1");
92 printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error);
93 $link->close();
97 $link = mysqli_init();
98 $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
99 … if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
103 if (!$link->query("SET PASSWORD='expiretest'")) {
104 $link->query("SET PASSWORD=PASSWORD('expiretest')");
106 printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error);
107 if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
109 $link->close();
114 if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) {
118 $link->query("SELECT id FROM test WHERE id = 1");
119 if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
121 $link->close();
131 mysqli_query($link, 'DROP USER expiretest');
132 mysqli_query($link, 'DROP USER expiretest@localhost');