Skip to content

fix setting unix socket authentication on mariadb >= 10.4#62169

Open
Vringe wants to merge 2 commits into
saltstack:masterfrom
Vringe:mariadb-alter-user
Open

fix setting unix socket authentication on mariadb >= 10.4#62169
Vringe wants to merge 2 commits into
saltstack:masterfrom
Vringe:mariadb-alter-user

Conversation

@Vringe

@Vringe Vringe commented Jun 15, 2022

Copy link
Copy Markdown

What does this PR do?

Quote from the MariaDB Docs:

In MariaDB 10.4 and later, the mysql.global_priv table has replaced the mysql.user table, and mysql.user should be considered obsolete. It is now a view into mysql.global_priv created for compatibility with older applications and monitoring scripts.

Example state to reproduce (A user must already exist with an other authentication plugin than unix socket):

sql_root_user:
  mysql_user.present:
    - name: root
    - host: 'localhost'
    - allow_passwordless: True
    - unix_socket: True

Previous Behavior

Salt still uses UPDATE mysql.user when changing a users authentication plugin to unix_socket. This leads to a corrupted View:

          ID: sql_root_user
    Function: mysql_user.present
        Name: root
      Result: False
     Comment: Failed to clear password for user root@localhost (MySQL Error 1356: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them)
     Started: 15:36:08.057118
    Duration: 18.406 ms
     Changes:

New Behavior

User is altered correctly on older and newer MariaDB versions.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

No

@Vringe Vringe requested a review from a team as a code owner June 15, 2022 14:12
@Vringe Vringe requested review from Ch3LL and removed request for a team June 15, 2022 14:12
@welcome

welcome Bot commented Jun 15, 2022

Copy link
Copy Markdown

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@Ch3LL Ch3LL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will require a changelog and test coverage. We do have tests for version 10.4 so we would have caught this if the correct test was added. A good place to add the test is here: tests/pytests/integration/modules/test_mysql.py

@Ch3LL

Ch3LL commented Aug 31, 2022

Copy link
Copy Markdown
Contributor

@Vringe would you be able to loop back to this PR to add changelog and test coverage?

@Vringe

Vringe commented Sep 2, 2022

Copy link
Copy Markdown
Author

@Ch3LL Unfortunately, I do not have the time at the moment. I tried to setup the dev environment a while ago to write and run the test but I could not get it to run properly.

@danel1

danel1 commented Nov 18, 2022

Copy link
Copy Markdown

@garethgreenaway @pprkut Hey guys :) i saw you both did some other work for MariaDB 10.5+ support in other issues / pr's. Any chance you can help this pr out?

@Vringe

Vringe commented Nov 24, 2023

Copy link
Copy Markdown
Author

@cebe I saw you did some MariaDB related work for salt 3006. Unfortunately this issue still persists. Could you maybe help me out with this?

@twangboy twangboy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a changelog and a test for this

@twangboy twangboy added needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases needs-changelog test:full Run the full test suite labels Jul 3, 2025
@twangboy twangboy removed this from the Argon v3008.0 milestone Jun 5, 2026
Vincent Jancso and others added 2 commits June 15, 2026 14:39
Adds the missing changelog fragment and a unit test pinning the new
MariaDB >= 10.4 ``ALTER USER ... IDENTIFIED VIA unix_socket`` code path
in ``_mariadb_user_chpass``. The test also verifies the legacy
``UPDATE mysql.user`` path is still used on MariaDB < 10.4.
@dwoz dwoz force-pushed the mariadb-alter-user branch from 3675105 to 74fd0f4 Compare June 15, 2026 21:40
@dwoz dwoz removed needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases needs-changelog labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants