-
Notifications
You must be signed in to change notification settings - Fork 346
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 test process user #2978
base: main
Are you sure you want to change the base?
Add test process user #2978
Conversation
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
… add-test-process-user
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
let current_umask = unsafe { libc::umask(0) }; | ||
unsafe { libc::umask(current_umask) }; | ||
|
||
if process.user().uid().ne(&uid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be able to directly use !=
operator. Same for below.
@@ -471,3 +472,37 @@ pub fn test_mount_rsuid_option(path: &str) -> Result<(), std::io::Error> { | |||
format!("rsuid error {path:?}"), | |||
)) | |||
} | |||
|
|||
pub fn test_additional_gids(gids: &Vec<u32>) -> Result<(), std::io::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can move this to the test file itself, I don't think we will be using this anywhere else.
Also please use safe alternatives from nix instead of unsafe from libc.
Can you add comments explaining what this is trying to do? The original go does not have comments, so it would be good to have explanation here.
ProcessBuilder::default() | ||
.user(user) | ||
.build() | ||
.expect("error in creating process config"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to set the process cmd to the runtimetest to actually run the internal test
This implements the process_user validation in #361