]> git.ipfire.org Git - thirdparty/shadow.git/commit
src/login_nopam.c: list_match(): Use iteration instead of recursion
authorTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 16 Jan 2025 20:09:54 +0000 (21:09 +0100)
committerAlejandro Colomar <alx@kernel.org>
Sat, 18 Jan 2025 20:32:20 +0000 (21:32 +0100)
commit3f341290510d222ffbfd9209694374b8b0060e37
tree110f6ff00342b542667b651d30a5922a4ac64539
parentba5bb8742be7779e4fca69781e6f2b2ac8aa78bc
src/login_nopam.c: list_match(): Use iteration instead of recursion

The recursive nature of list_match() triggered regression during
refactoring.  In Linux-PAM, the same code exists which could lead to
stack overflow because <access.conf> could be arbitrarily long.

Use an iterative approach for easier refactoring, to support long
lines in the future and to stay in sync with Linux-PAM.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/login_nopam.c