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

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

Conversation

@3v1n0

@3v1n0 3v1n0 commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

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

squell commented May 22, 2026

Copy link
Copy Markdown
Member

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

squell commented May 22, 2026

Copy link
Copy Markdown
Member

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

3v1n0 commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Ok, issues should be all there now.

@squell squell added the C-pam PAM library label May 29, 2026
@squell
squell self-requested a review June 14, 2026 23:59
@squell squell assigned squell and unassigned squell Jun 14, 2026
@squell
squell removed their request for review June 15, 2026 00:00
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

Closes: trifectatechfoundation#1595
@3v1n0
3v1n0 force-pushed the no-tty-conversation-handling branch from 1a0b28d to 283b534 Compare September 23, 2026 23:00
@3v1n0

3v1n0 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

@squell I've finally rebased this, not sure if someone in the team has time for it :)

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 283b534 to 36901e3 Compare September 23, 2026 23:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-pam PAM library

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