Skip to content

testsudoers: keep the shell iterator at its terminator - #606

Merged
millert merged 1 commit into
sudo-project:mainfrom
fQwQf:tsgetusershell-terminator
Nov 25, 2026
Merged

millert merged 1 commit into
sudo-project:mainfrom
fQwQf:tsgetusershell-terminator

Conversation

@fQwQf

@fQwQf fQwQf commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

testsudoers uses a private copy of the getusershell() compatibility code in plugins/sudoers/tsgetusershell.c (moved out of lib/util in b5541b50f).

testsudoers_getusershell() unconditionally incremented current_shell++ on every call. Once it reached and returned the terminating NULL, calling it again without testsudoers_setusershell() advanced current_shell past the end of allowed_shells instead of continuing to return NULL like getusershell(3).

Return NULL immediately when *current_shell == NULL so the iterator remains at the terminator.

Testing: full build and make check pass (testsudoers: 70 tests, 0 errors).

Stop advancing current_shell once testsudoers_getusershell() reaches
the terminating NULL pointer.
@millert
millert merged commit e31094b into sudo-project:main Nov 25, 2026
5 checks passed
@fQwQf
fQwQf deleted the tsgetusershell-terminator branch November 27, 2026 00:12
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