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

Change setuid Calls to setreuid, and the Same for setgid. #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions daemonize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl<T> Daemonize<T> {
Ok(Some(first_child_pid)) => {
Outcome::Parent(match waitpid(first_child_pid) {
Err(err) => Err(err.into()),
Ok(first_child_exit_code) => Ok(Parent { first_child_exit_code: first_child_exit_code as i32 }),
Ok(first_child_exit_code) => Ok(Parent { first_child_exit_code }),
ljtpetersen marked this conversation as resolved.
Show resolved Hide resolved
})
},
Err(err) => Outcome::Parent(Err(err.into())),
Expand Down Expand Up @@ -498,7 +498,7 @@ unsafe fn get_group(group: Group) -> Result<libc::gid_t, ErrorKind> {
}

unsafe fn set_group(group: libc::gid_t) -> Result<(), ErrorKind> {
check_err(libc::setgid(group), ErrorKind::SetGroup)?;
check_err(libc::setregid(group, group), ErrorKind::SetGroup)?;
Ok(())
}

Expand All @@ -516,7 +516,7 @@ unsafe fn get_user(user: User) -> Result<libc::uid_t, ErrorKind> {
}

unsafe fn set_user(user: libc::uid_t) -> Result<(), ErrorKind> {
check_err(libc::setuid(user), ErrorKind::SetUser)?;
check_err(libc::setreuid(user, user), ErrorKind::SetUser)?;
Ok(())
}

Expand Down