Debian Codegraph @

mysql-test/suite/plugins/t/auth_ed25519.test

raw
1 #
2 # MDEV-12160 Modern alternative to the SHA1 authentication plugin
3 #
4 source include/not_embedded.inc;
5 if (!$AUTH_ED25519_SO) {
6 skip No auth_ed25519 plugin;
7 }
8
9 replace_result dll so;
10 eval create function ed25519_password returns string soname "$AUTH_ED25519_SO";
11 error ER_CANT_INITIALIZE_UDF;
12 select ed25519_password();
13 error ER_CANT_INITIALIZE_UDF;
14 select ed25519_password(1);
15 error ER_CANT_INITIALIZE_UDF;
16 select ed25519_password("foo", "bar");
17 error ER_CANT_INITIALIZE_UDF;
18 select ed25519_password("foo");
19
20 install soname 'auth_ed25519';
21 select ed25519_password("foo");
22 select ed25519_password("foobar");
23 select ed25519_password("foo bar");
24 select ed25519_password(NULL);
25
26 replace_result dll so;
27 query_vertical select * from information_schema.plugins where plugin_name='ed25519';
28 let $pwd=`select ed25519_password("secret")`;
29 eval create user test1@localhost identified via ed25519 using '$pwd';
30 show grants for test1@localhost;
31 drop user test1@localhost;
32 --error ER_PASSWD_LENGTH
33 create user test1@localhost identified via ed25519 using 'foo';
34 --error ER_PASSWD_LENGTH
35 create user test1@localhost identified via ed25519 using '>>>1234567890123456789012345678901234567890';
36 create user test1@localhost identified via ed25519 using password('foo');
37 show grants for test1@localhost;
38 select ed25519_password('foo');
39 set password for test1@localhost = password('bar');
40 show create user test1@localhost;
41 select ed25519_password('bar');
42 eval set password for test1@localhost = '$pwd';
43 show create user test1@localhost;
44
45 replace_result $MASTER_MYPORT PORT $MASTER_MYSOCK SOCKET;
46 error ER_ACCESS_DENIED_ERROR;
47 connect con1, localhost, test1, public;
48 connect con1, localhost, test1, secret;
49 select current_user();
50 disconnect con1;
51 connection default;
52
53 --echo # Executing 'mariadb-admin'
54 --exec $MYSQLADMIN -u test1 -S $MASTER_MYSOCK -P $MASTER_MYPORT --password=secret ping
55
56 create user test2@localhost identified via ed25519 using PASSWORD('');
57 show grants for test2@localhost;
58 connect con2, localhost, test2,;
59 select current_user();
60 disconnect con2;
61
62 replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT;
63 error ER_ACCESS_DENIED_ERROR;
64 connect con3, localhost, test2, "wrong_pwd";
65 connection default;
66 drop user test2@localhost;
67
68 drop user test1@localhost;
69 uninstall plugin ed25519;
70 error ER_CANT_INITIALIZE_UDF;
71 select ed25519_password("foo");
72 drop function ed25519_password;