forked from sunfishcode/c-ward
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organize
set*id
functions into their own todo module. (sunfishcode#117
) * Organize `set*id` functions into their own todo module. * Leave `setuid` and `setgid` outside of the todo module. They're depended on by libstd.
- Loading branch information
1 parent
69c38ed
commit 0569f8a
Showing
4 changed files
with
35 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |