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

Organize set*id functions into their own todo module. #117

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 1 addition & 7 deletions c-scape/src/process/egid.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use libc::{c_int, gid_t};
use libc::gid_t;

#[no_mangle]
unsafe extern "C" fn getegid() -> gid_t {
libc!(libc::getegid());
rustix::process::getegid().as_raw()
}

#[no_mangle]
unsafe extern "C" fn setegid(_gid: gid_t) -> c_int {
libc!(libc::setegid(_gid));
todo!("setegid")
}
8 changes: 1 addition & 7 deletions c-scape/src/process/euid.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use libc::{c_int, uid_t};
use libc::uid_t;

#[no_mangle]
unsafe extern "C" fn geteuid() -> uid_t {
libc!(libc::geteuid());
rustix::process::geteuid().as_raw()
}

#[no_mangle]
unsafe extern "C" fn seteuid(_uid: uid_t) -> c_int {
libc!(libc::seteuid(_uid));
todo!("seteuid")
}
17 changes: 1 addition & 16 deletions c-scape/src/todo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod long_double;
mod long_double_complex;
mod pthread_cancel;
mod pthread_spin;
mod set_id;
mod sysv;
mod wchar;

Expand Down Expand Up @@ -838,14 +839,6 @@ unsafe extern "C" fn __isoc99_vsscanf() {
todo!("__isoc99_vsscanf")
}
#[no_mangle]
unsafe extern "C" fn setregid() {
todo!("setregid")
}
#[no_mangle]
unsafe extern "C" fn setreuid() {
todo!("setreuid")
}
#[no_mangle]
unsafe extern "C" fn times() {
todo!("times")
}
Expand Down Expand Up @@ -926,14 +919,6 @@ unsafe extern "C" fn setns() {
todo!("setns")
}
#[no_mangle]
unsafe extern "C" fn setresgid() {
todo!("setresgid")
}
#[no_mangle]
unsafe extern "C" fn setresuid() {
todo!("setresuid")
}
#[no_mangle]
unsafe extern "C" fn mq_close() {
todo!("mq_close")
}
Expand Down
32 changes: 32 additions & 0 deletions c-scape/src/todo/set_id.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//! Linux's system calls for these functions only set the IDs for one thread,
//! and we need to set the IDs for all threads in a process.
//!
//! This would typically entail taking a lock that prevents thread creation,
//! setting the IDs for each thread manually by sending signals to them and
//! having signal handlers that perform the set operation, waitinig for all
//! the handlers to run, and then releasing the lock.

#[no_mangle]
unsafe extern "C" fn seteuid() {
todo!("seteuid")
}
#[no_mangle]
unsafe extern "C" fn setegid() {
todo!("setegid")
}
#[no_mangle]
unsafe extern "C" fn setreuid() {
todo!("setreuid")
}
#[no_mangle]
unsafe extern "C" fn setregid() {
todo!("setregid")
}
#[no_mangle]
unsafe extern "C" fn setresuid() {
todo!("setresuid")
}
#[no_mangle]
unsafe extern "C" fn setresgid() {
todo!("setresgid")
}