Bug 122560 - Mysql Native Connector - failure to connect to mysql 8 server instance with SHA2 caching
Summary: Mysql Native Connector - failure to connect to mysql 8 server instance with S...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.1.4.2 release
Hardware: x86-64 (AMD64) All
: high major
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0 target:7.0.3
Keywords:
: 122675 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-01-08 12:52 UTC by Alex Thurgood
Modified: 2021-01-08 17:25 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Thurgood 2019-01-08 12:52:29 UTC
Description:
The latest release of mysql community server implements SHA2 caching for passwordk encryption when connecting to the server.

This is not supported by the libmysqlconnector.

Attempting to create an ODB file connecting directly to a 8.0 mysql server using SHA2 caching leads to the error :

Statut SQL: HY000
Code d'erreur: 2058

Plugin caching_sha2_password could not be loaded:

The ODB file can not be created.


Steps to Reproduce:
1. Try to create an ODB file connecting directly to a 8.0 mysql server instance that uses SHA2 caching for password management (default setting on 8.x servers) 

2. Enter IP address, user name and click on password required box in the relevant dialogs using the wizard.

3. Click on Test connection. Enter the user password.

4) Error message : Statut SQL: HY000
Code d'erreur: 2058

Plugin caching_sha2_password could not be loaded:

5) No ODB file can be created.

Actual Results:
No ODB file can be created, the wizard doesn't finish.

Expected Results:
The connection should proceed and allow the user to register the ODB file.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Comment 1 Julien Nabet 2019-01-08 13:44:03 UTC
Taking a look to https://bugs.mysql.com/bug.php?id=90676

Error: 2058 (CR_ALREADY_CONNECTED)
Message: This handle is already connected. Use a separate handle for each connection.

Tamas: thought you might be interested in this one.
Comment 2 Alex Thurgood 2019-01-08 13:49:01 UTC
Testing with 


Version: 6.3.0.0.alpha0+
Build ID: 31c1995037a7ad408a5af6917288d8e3888a472d
CPU threads: 4; OS: Mac OS X 10.14.2; UI render: default; VCL: osx; 
Locale: fr-FR (fr_FR.UTF-8); UI-Language: en-US
Calc: threaded

leads to the following error message :

Error code: 2019

Can't initialize character set unknown (path: compiled_in)

Looking this message up on the internet seems to imply that the connector code wasn't compiled with the necessary character sets. Changing the default collation for the server at the server level and restarting the server has no visible effect on this error message, i.e. it is still displayed.
Comment 3 Alex Thurgood 2019-01-08 13:50:50 UTC
(In reply to Alex Thurgood from comment #0)
> Description:
> The latest release of mysql community server implements SHA2 caching for
> passwordk encryption when connecting to the server.
> 
> This is not supported by the libmysqlconnector.
> 
> Attempting to create an ODB file connecting directly to a 8.0 mysql server
> using SHA2 caching leads to the error :
> 
> Statut SQL: HY000
> Code d'erreur: 2058
> 
> Plugin caching_sha2_password could not be loaded:
> 
> The ODB file can not be created.
> 
> 
> Steps to Reproduce:
> 1. Try to create an ODB file connecting directly to a 8.0 mysql server
> instance that uses SHA2 caching for password management (default setting on
> 8.x servers) 
> 
> 2. Enter IP address, user name and click on password required box in the
> relevant dialogs using the wizard.
> 
> 3. Click on Test connection. Enter the user password.
> 
> 4) Error message : Statut SQL: HY000
> Code d'erreur: 2058
> 
> Plugin caching_sha2_password could not be loaded:
> 
> 5) No ODB file can be created.
> 

Actually, point 5 above is incorrect, the file can be createdby ignoring the test, clicking on Next and saving the ODB file, but no connection to the server will ever be established to read the databases/tables when that ODB file is reloaded into LO.
Comment 4 Julien Nabet 2019-01-08 13:53:39 UTC
Sorry Tamas, I should have read until the end of the thread.

The problem seems to be due to MariaDb C connector.
Version 3 is fixed but the fix hasn't been backported yet (at least in 06/2018)
Comment 5 Julien Nabet 2019-01-08 13:58:22 UTC
MariaDB C connector 2.0.0 has been released is from 04/2014, it could worth it to upgrade to a more recent version perhaps last one 3.0.8 released in 12/2018?
Comment 6 Drew Jensen 2019-01-10 16:27:00 UTC
(In reply to Julien Nabet from comment #5)
> MariaDB C connector 2.0.0 has been released is from 04/2014, it could worth
> it to upgrade to a more recent version perhaps last one 3.0.8 released in
> 12/2018?

Seems like it. According the MariaDB connector 3.0.8 release notes, https://mariadb.com/kb/en/library/mariadb-connector-c-308-release-notes/ it added only one new feature; CONC-312: Added new caching_sha2_password authentication plugin for authentication with MySQL 8.0
Comment 7 Drew Jensen 2019-01-12 18:01:00 UTC
*** Bug 122675 has been marked as a duplicate of this bug. ***
Comment 8 Drew Jensen 2019-01-12 18:01:49 UTC
A duplicate was just opened so setting this to new.
Comment 9 Julien Nabet 2020-09-03 15:34:32 UTC
It seems it hasn't been implemented yet, see:
- https://mariadb.com/kb/en/authentication-plugin-sha-256/ (Authentication Plugin - SHA-256)
 which quotes: https://jira.mariadb.org/browse/MDEV-9804 (sha256_password plugin)

This is dependent on 2 elements:
- https://jira.mariadb.org/browse/CONJS-76 (Implement sha256_password support)
- https://jira.mariadb.org/browse/CONJS-77 (Implement caching_sha256_password support)
Comment 10 Julien Nabet 2020-10-10 16:42:33 UTC
(In reply to Julien Nabet from comment #9)
> It seems it hasn't been implemented yet, see:
> - https://mariadb.com/kb/en/authentication-plugin-sha-256/ (Authentication
> Plugin - SHA-256)
>  which quotes: https://jira.mariadb.org/browse/MDEV-9804 (sha256_password
> plugin)
> 
> This is dependent on 2 elements:
> - https://jira.mariadb.org/browse/CONJS-76 (Implement sha256_password
> support)
> - https://jira.mariadb.org/browse/CONJS-77 (Implement
> caching_sha256_password support)

Just to correct myself.
https://mariadb.com/kb/en/authentication-plugin-sha-256/ is about implementing SHA-256 for MariaDB server. So not concerning MariaDb C connector.
The 2 quoted jiras concern MariaDB nodeJS connector.

So https://gerrit.libreoffice.org/c/core/+/104172 may help here.
Comment 11 Commit Notification 2020-10-11 08:27:41 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ee8d735f0a59f41fb1f5cbabfe089c222ca948e3

Related tdf#122560 tdf#135202: build plugin caching_sha2_pw for MariaDb/Mysql

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2020-10-12 09:23:39 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/e3c2dcceb0e885a5a2c76bb69eac6e2dbba98d6d

Related tdf#122560 tdf#135202: build plugin caching_sha2_pw for MariaDb/Mysql

It will be available in 7.0.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Julien Nabet 2020-11-15 10:51:10 UTC
Alex: would you have some time to give it a try on a Mac with a recent daily build? (it must include https://cgit.freedesktop.org/libreoffice/core/commit/?id=8c9b8c5970a08c2ef0ccddb7a691f3731d39175a)
Comment 14 Alex Thurgood 2020-12-21 09:46:47 UTC
(In reply to Julien Nabet from comment #13)
> Alex: would you have some time to give it a try on a Mac with a recent daily
> build? (it must include
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=8c9b8c5970a08c2ef0ccddb7a691f3731d39175a)

Hi Julien,

I need to find a mysql 8 server to connect to, and don't have one to hand, currently.

My old test Linux VMs that had mysql 8 servers don't currently run on Apple Silicon because VirtualBox uses un-notarized kernel extensions that macOS refuses to install. It may take a while before I can sort something out to test the bug fix.
Comment 15 QA Administrators 2020-12-22 03:43:40 UTC Comment hidden (obsolete)
Comment 16 Alex Thurgood 2021-01-08 15:05:21 UTC
Verified fixed in

Version: 7.1.0.1
Build ID: b585d7d90ab863bf29b2d110c174c0c2a98f3ee4
CPU threads: 8; OS: Mac OS X 10.16; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded

Thanks a lot Julien, very much appreciated !
Comment 17 Julien Nabet 2021-01-08 17:25:51 UTC
Great to hear! :-)
Let's put this one to VERIFIED then.