Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Process::{effective_user_id, effective_group_id} + user_id & group_id to return real IDs #977

Merged
merged 4 commits into from May 5, 2023

Conversation

zeenix
Copy link
Contributor

@zeenix zeenix commented May 5, 2023

Add API to query effective IDs of a process and make Process::{user_id, group_id} return real IDs on Linux and Apple, so the behavior is as expected and consistent with the FreeBSD implementation.

Fixes #970.


Zeeshan Ali Khan on behalf of MBition GmbH.

Provider Information.

zeenix added 2 commits May 5, 2023 16:41
They were returing the effective IDs, which is unexpected and
inconsistent with FreeBSD impl.
Getting the UID/GID by looking at the ownership of the relevant /proc
file of a process is strange. The UID/GID are provided in the status
file itself that we read anyway if this method fails. Let's always take
the UID/GID from the process' status file.

This also paves way for reliably getting the effective UID/GID of a
process, that we will be adding in a following commit.
src/traits.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Owner

You forgot to implement the new methods on Windows. 😉

@zeenix zeenix force-pushed the effective-ids branch 2 times, most recently from 65295ca to 45fe64a Compare May 5, 2023 15:14
tests/process.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Owner

Looks all good to me, thanks! Just waiting for the CI to finish and then I merge (should fail for "unknown-target", should fix that some day...).

@GuillaumeGomez GuillaumeGomez merged commit 08c6890 into GuillaumeGomez:master May 5, 2023
63 of 68 checks passed
@GuillaumeGomez
Copy link
Owner

Thanks!

@zeenix zeenix deleted the effective-ids branch May 5, 2023 18:00
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.

Wrong userid for process sometimes returned on Linux
2 participants