MDEV-40141 PAM authentication fails when started with --default-auth=dialog#5348
Open
vaintroub wants to merge 1 commit into
Open
MDEV-40141 PAM authentication fails when started with --default-auth=dialog#5348vaintroub wants to merge 1 commit into
vaintroub wants to merge 1 commit into
Conversation
…dialog The pam plugin reused the client's initial reply as the password when its first byte was non-zero, but with --default-auth=dialog that reply is empty and the byte is stale buffer data. Check the reply length too.
There was a problem hiding this comment.
Pull request overview
Fixes MDEV-40141 where PAM authentication could incorrectly treat an empty initial client reply (when the client starts with --default-auth=dialog) as already containing password data due to inspecting only the first byte, leading to an empty password being sent to PAM instead of prompting.
Changes:
- Add explicit length checks before interpreting the first byte of the client reply in both PAM plugins (v2 and v1).
- Add regression coverage to ensure
--default-auth=dialogtriggers the expected interactive prompt flow for both plugin variants. - Skip the PAM tests early when the dialog client plugin is unavailable.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| plugin/auth_pam/auth_pam.c | Prevents stale/empty initial reply from being treated as a valid client response by checking pkt_len. |
| plugin/auth_pam/auth_pam_v1.c | Prevents dereferencing/using an empty cached initial packet by checking cached_len. |
| mysql-test/suite/plugins/t/pam.test | Adds regression test case for --default-auth=dialog and skips when dialog client plugin isn’t present. |
| mysql-test/suite/plugins/t/pam_v1.test | Adds the same regression coverage for the v1 PAM plugin and skips when dialog client plugin isn’t present. |
| mysql-test/suite/plugins/r/pam.result | Updates expected output for the new regression scenario. |
| mysql-test/suite/plugins/r/pam_v1.result | Updates expected output for the new regression scenario in v1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://jira.mariadb.org/browse/MDEV-40141
When the client selects the dialog plugin itself (
--default-auth=dialog),the server sends no AuthSwitchRequest and hands the pam plugin the client's
initial reply, which is empty (dialog sends no data upfront). The plugin
decided the client had already supplied a password by testing only the first
byte of that reply, which points at stale buffer data, and so sent an empty
password to PAM instead of prompting.
Fixed by also checking the reply length, in both the v2 (
auth_pam.c) andv1 (
auth_pam_v1.c) pam plugins. Adds a regression test toplugins.pamand
plugins.pam_v1.