Skip to content

Commit 044d8c5

Browse files
FooBarriorsanja-byelkin
authored andcommitted
ed25519: support empty password
1 parent 583a5a7 commit 044d8c5

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

mysql-test/suite/plugins/r/auth_ed25519.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ current_user()
7070
test1@localhost
7171
disconnect con1;
7272
connection default;
73+
create user test2@localhost identified via ed25519 using PASSWORD('');
74+
show grants for test2@localhost;
75+
Grants for test2@localhost
76+
GRANT USAGE ON *.* TO `test2`@`localhost` IDENTIFIED VIA ed25519 USING '4LH+dBF+G5W2CKTyId8xR3SyDqZoQjUNUVNxx8aWbG4'
77+
connect con2, localhost, test2,;
78+
select current_user();
79+
current_user()
80+
test2@localhost
81+
disconnect con2;
82+
connect(localhost,test2,wrong_pwd,test,MASTER_MYPORT,MASTER_MYSOCK);
83+
connect con3, localhost, test2, "wrong_pwd";
84+
ERROR 28000: Access denied for user 'test2'@'localhost' (using password: YES)
85+
connection default;
86+
drop user test2@localhost;
7387
drop user test1@localhost;
7488
uninstall plugin ed25519;
7589
select ed25519_password("foo");

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ select current_user();
5050
disconnect con1;
5151
connection default;
5252

53+
create user test2@localhost identified via ed25519 using PASSWORD('');
54+
show grants for test2@localhost;
55+
connect con2, localhost, test2,;
56+
select current_user();
57+
disconnect con2;
58+
59+
replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT;
60+
error ER_ACCESS_DENIED_ERROR;
61+
connect con3, localhost, test2, "wrong_pwd";
62+
connection default;
63+
drop user test2@localhost;
64+
5365
drop user test1@localhost;
5466
uninstall plugin ed25519;
5567
error ER_CANT_INITIALIZE_UDF;

plugin/auth_ed25519/server_ed25519.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static int compute_password_digest(const char *pw, size_t pwlen,
6464
char *d, size_t *dlen)
6565
{
6666
unsigned char pk[CRYPTO_PUBLICKEYBYTES];
67-
if (*dlen < PASSWORD_LEN || pwlen == 0)
67+
if (*dlen < PASSWORD_LEN)
6868
return 1;
6969
*dlen= PASSWORD_LEN;
7070
crypto_sign_keypair(pk, (unsigned char*)pw, pwlen);

0 commit comments

Comments
 (0)