src/openrc-user/openrc-user.c: Preserve struct passwd from PAM#984
src/openrc-user/openrc-user.c: Preserve struct passwd from PAM#984navi-desu merged 1 commit intoOpenRC:masterfrom
Conversation
6b0cd04 to
fb2a25e
Compare
|
a) in truth, this is a sssd bug (and a bad one), no library should be using global storage, we have to report it to them b) this does not handle ERANGE, opting to abort on any error instead c) after initializing the environment, we only need uid, gid, and pw_shell -- the former two are trivially copiable, so, like i mentioned on the gentoo bug, we want to xstrdup pw_shell and pass that directly instead |
fb2a25e to
134c2b3
Compare
|
Ok, I respun the patch to use the copy/xstrdup approach instead. Or am I barking up the wrong tree here, and is really a bug with sssd? |
…sswd If something else uses PAM (like openrc, see OpenRC/openrc#984) and getpwnam, and calls something like pam_open_session, sssd's call to getpwnam in init_sssd_ids clobbers the cached value by the other program. Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
…sswd If something else uses PAM (like openrc, see OpenRC/openrc#984) and getpwnam, and calls something like pam_open_session, sssd's call to getpwnam in init_sssd_ids clobbers the cached value by the other program. Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
…sswd If something else uses PAM (like openrc, see OpenRC/openrc#984) and getpwnam, and calls something like pam_open_session, sssd's call to getpwnam in init_sssd_ids clobbers the cached value by the other program. Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
…sswd If something else uses PAM (like openrc, see OpenRC/openrc#984) and getpwnam, and calls something like pam_open_session, sssd's call to getpwnam in init_sssd_ids clobbers the cached value by the other program. Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
src/openrc-user/openrc-user.c
Outdated
| parts we need */ | ||
| pwd.pw_uid = user->pw_uid; | ||
| pwd.pw_gid = user->pw_gid; | ||
| pwd.pw_shell = xstrdup(user->pw_shell); |
There was a problem hiding this comment.
I would store them in different variables instead and change spawn_openrc to accept them separately, instead of a dummy passwd struct.
Having a struct only partially initialized like this is planting a footgun.
There was a problem hiding this comment.
i'm just going to split that when merging this, because agree
it is a bug with sssd -- i'll merge this as a workaround but sssd really should not be using getpwnam in a dynamically loaded module, that's dangerous and we really should open a bug with them |
134c2b3 to
37ed847
Compare
sssd's pam module seems to call getpwnam, clobbering the global struct. while this is a bug on sssd, let's copy the data out of it as a workaround Closes: github.com/OpenRC/issues/979 Bug: https://bugs.gentoo.org/970235 Signed-off-by: Christopher Byrne <salah.coronya@gmail.com> Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
37ed847 to
cf3eef0
Compare
…sswd If something else uses PAM (like openrc, see OpenRC/openrc#984) and getpwnam, and calls something like pam_open_session, sssd's call to getpwnam in init_sssd_ids clobbers the cached value by the other program. Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
…sswd If something else uses PAM (like openrc, see OpenRC/openrc#984) and getpwnam, and calls something like pam_open_session, sssd's call to getpwnam in init_sssd_ids clobbers the cached value by the other program. Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
…sswd If something else uses PAM (like openrc, see OpenRC/openrc#984) and getpwnam, and calls something like pam_open_session, sssd's call to getpwnam in init_sssd_ids clobbers the cached value by the other program. Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
Some PAM modules call getpwnam(), so pam_open_session can clobber our copy. Use getpwnam_r instead.
Closes: #979