Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
None
-
10.2.6-2, 10.2.6-3, 10.3.1-1
Description
According to MDEV-7978, 5.7 account management syntax related to IDENTIFIED clause should be supported. The following variation is not:
CREATE USER ... IDENTIFIED WITH ... BY ... |
10.2 |
MariaDB [test]> create user foo@localhost identified with 'auth_socket' by 'abc'; |
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'by 'abc'' at line 1 |
MariaDB [test]> select @@version; |
+----------------------+ |
| @@version |
|
+----------------------+ |
| 10.2.3-MariaDB-debug |
|
+----------------------+ |
1 row in set (0.00 sec) |
MySQL 5.7 |
MySQL [test]> create user foo@localhost identified with 'auth_socket' by 'abc';Query OK, 0 rows affected (0.00 sec) |
|
MySQL [test]> select @@version; |
+--------------+ |
| @@version |
|
+--------------+ |
| 5.7.16-debug |
|
+--------------+ |
1 row in set (0.00 sec) |
I'm not sure if it is supposed to work, but it's worth checking.
Attachments
Issue Links
- relates to
-
MDEV-7978 CREATE/ALTER USER as in 5.7
-
- Closed
-
-
MDEV-12321 authentication plugin: SET PASSWORD support
-
- Closed
-
Investigated how MySQL does this. First, their documentation mentions:
IDENTIFIED WITH auth_plugin BY 'auth_string'
Sets the account authentication plugin to auth_plugin, hashes the cleartext 'auth_string' value, and stores the result in the mysql.user account row.
This doesn't explain how the hash is calculated. Trying out tests in the MySQL server reveals the following:
When doing:
We get a different hash value then:
This hints that the logic is different between authentication plugins. Looking for the code that detects this:
(Str->auth.length == 0 && !user_exists))
{
st_mysql_auth *auth= (st_mysql_auth *) plugin_decl(plugin)->info;
inbuf= Str->auth.str;
inbuflen= Str->auth.length;
&buflen,
inbuf,
inbuflen))
....
We find this function call that takes the authentication string passed by the parser and passes it forward to the plugin itself. This is newly introduced API for authentication plugins.
{
...
New plugin API to generate password digest out of authentication string.
This function will first invoke a service to check for validity of the
password based on the policies defined and then generate encrypted hash
@param[OUT] outbuf A buffer provided by server which will hold the
authentication string generated by plugin.
@param[INOUT] outbuflen Length of server provided buffer as IN param and
length of plugin generated string as OUT param.
@param[IN] inbuf auth string provided by user.
@param[IN] inbuflen auth string length.
@retval 0 OK
1 ERROR
*/
...
}
Our current implementation does not allow for easy introduction of this behavior. I would not do it in 10.2. I would adjust the documentation to not allow BY syntax for IDENTIFIED WITH <plugin> BY <not_hashed_auth_string>, as it currently is in the server code. We could implement this in 10.3.
serg Thoughts?