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");
33 mysqli_query($link, 'DROP USER expiretest');
34 mysqli_query($link, 'DROP USER expiretest@localhost');
36 if (!mysqli_query($link, 'CREATE USER expiretest IDENTIFIED BY \'expiredpassword\'') ||
37 !mysqli_query($link, 'CREATE USER expiretest@localhost IDENTIFIED BY \'expiredpassword\'')) {
38 printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
39 mysqli_close($link);
43 if (!mysqli_query($link, 'ALTER USER expiretest PASSWORD EXPIRE') ||
44 !mysqli_query($link, 'ALTER USER expiretest@localhost PASSWORD EXPIRE')) {
45 printf("skip Cannot modify second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
46 mysqli_close($link);
50 if (!$link->query("DROP TABLE IF EXISTS test") ||
51 !$link->query("CREATE TABLE test (id INT)") || !$link->query("INSERT INTO test(id) VALUES (1)"))
52 die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
56 if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%%'", $db)) ||
57 !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'localhost'", $db))) {
58 printf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link));
59 mysqli_close($link);
69 if (!$link = my_mysqli_connect($host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
73 $link->query("SELECT id FROM test WHERE id = 1");
74 printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error);
78 $link = mysqli_init();
79 $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0);
80 if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
84 $link->query("SELECT id FROM test WHERE id = 1");
85 printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error);
89 $link = mysqli_init();
90 $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
91 if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
95 $link->query("SELECT id FROM test WHERE id = 1");
96 printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error);
97 $link->close();
101 $link = mysqli_init();
102 $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
103 if (!my_mysqli_real_connect($link, $host, 'expiretest', 'expiredpassword', $db, $port, $socket)) {
107 $link->query("SET PASSWORD=PASSWORD('expiretest')");
108 printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error);
109 if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
111 $link->close();
116 if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) {
120 $link->query("SELECT id FROM test WHERE id = 1");
121 if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
123 $link->close();
133 mysqli_query($link, 'DROP USER expiretest');
134 mysqli_query($link, 'DROP USER expiretest@localhost');