Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactorings to the PAM conversation handling #961

Merged
merged 7 commits into from
Jan 21, 2025

Conversation

bjorn3
Copy link
Collaborator

@bjorn3 bjorn3 commented Jan 20, 2025

This removes some unnecessary abstraction as well as fixes what is technically a soundness issue in the api. None of the existing users of the PAM module currently hit this soundness issue.

@bjorn3 bjorn3 mentioned this pull request Jan 20, 2025
@bjorn3 bjorn3 requested a review from squell January 20, 2025 13:32
@squell
Copy link
Member

squell commented Jan 21, 2025

I love the fact that this 2fdc5a2 fixes the second higgs-bugson that was caught by the pam_gpt Miri test.

…ly sized one

Doing so would cause UB. None of the existing Converser impls do this
and it is also hard to accidentally do, but it can't hurt to be a bit
more strict either.
A Converser doesn't need to distinguish between a single conversation
with multiple messages and multiple conversations with a single message
each.
This simplifies the code and makes it easier to directly return the
response from Converser::handle_message in the future.

This will leak some memory when there are multiple messages in a single
conversation and handling one of the messages returns an error. This
shouldn't matter for sudo-rs however as we would exit shortly after the
error anyway.
Rather than storing it in PamMessage.
And pass it's fields directly to Converser::handle_message instead.
And rename SequentialConverser to Converser to reduce the amount of
changes in the rest of the code.
@squell squell merged commit 00d0d3d into trifectatechfoundation:main Jan 21, 2025
14 checks passed
@bjorn3 bjorn3 deleted the pam_refactor branch January 21, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants