Skip to content

PAM: Improve error messages and align them with sudo.ws when no tty is available#1592

Open
3v1n0 wants to merge 4 commits into
trifectatechfoundation:mainfrom
3v1n0:no-tty-conversation-handling
Open

PAM: Improve error messages and align them with sudo.ws when no tty is available#1592
3v1n0 wants to merge 4 commits into
trifectatechfoundation:mainfrom
3v1n0:no-tty-conversation-handling

Conversation

@3v1n0
Copy link
Copy Markdown
Contributor

@3v1n0 3v1n0 commented May 21, 2026

Adjust the logic to pick a TTY and to warn if none is found with sudo.ws

See each commits for details.

Closes: #1595

@3v1n0 3v1n0 force-pushed the no-tty-conversation-handling branch from 0759714 to ef28e5a Compare May 21, 2026 19:49
@squell
Copy link
Copy Markdown
Member

squell commented May 22, 2026

Because this is a substantial change, could you open an issue for it as well with an explanation and link it to this PR? Thanks!

@squell
Copy link
Copy Markdown
Member

squell commented May 22, 2026

Similarly for the other two PR's. We track this project using the issue tracker; e.g. it is used to create the release notes and to categorise and prioritise work; see https://github.com/trifectatechfoundation/sudo-rs/blob/main/CONTRIBUTING.md#working-on-a-bigger-issue.

Because the two other PR's already have an extensive description, it's OK to simply refer to them and the problem description doesn't need to be cut-and-pasted, of course :-)

Thanks again for your efforts!

3v1n0 added 4 commits May 22, 2026 12:05
When `/dev/tty` is unavailable, sudo-rs conversation handling could fail
in cases where sudo.ws still has a valid fallback path.
In particular:
 - Password prompt: when askpass and a DISPLAY are set
 - Non hidden conversation without a tty.
This made behavior less predictable in headless/no-tty environments and
diverged from sudo.ws.

Refactor the PAM CLI converser I/O open path to mirror sudo's
conversation behavior when `/dev/tty` is unavailable.

Add coverage for the new behavior
In case no TTY is available, sudo suggests using `-S` option, while we
do not do it in sudo-rs.

Use the same logic of sudo.ws here.
The current error does not provide any relevant information to the user,
so use the same hint that sudo.ws does.

Mimic original sudo commit 516f7296.
@3v1n0 3v1n0 force-pushed the no-tty-conversation-handling branch from ef28e5a to 1a0b28d Compare May 22, 2026 10:10
@3v1n0
Copy link
Copy Markdown
Contributor Author

3v1n0 commented May 22, 2026

Ok, issues should be all there now.

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.

Error messages and askpass logic differs from sudo.ws when no tty is available

2 participants