]> git.ipfire.org Git - thirdparty/systemd.git/commit
execute: make sure Type=exec and PAMName= work together
authorLennart Poettering <lennart@poettering.net>
Wed, 29 Nov 2023 11:49:37 +0000 (12:49 +0100)
committerMike Yuan <me@yhndnzj.com>
Thu, 4 Jan 2024 13:03:51 +0000 (21:03 +0800)
commit5863f1da4283f77a231ad3658306cad3716e4b44
tree30583f8bdceb6b6676af62606a775a227c6b7987
parent59fe7e6ef1dc6a2094f4cde34f61e4eb5bb7d864
execute: make sure Type=exec and PAMName= work together

If PAMName= is used we'll spawn a PAM session for the service, and leave
a process around that closes the PAM session eventually. That process
must close the "exec_fd" that we use to implement Type=exec. After all
the logic relies on the fact that execve() will implicitly close the
exec_fd, and the EOF seen on it is hence indication for the service
manager that execve() has worked. But if we keep an fd open in the PAM
service process, then this is not going to work.

Hence close the fd explicitly so that it definitely doesn't stay pinned
in the child.
src/core/exec-invoke.c