-
Notifications
You must be signed in to change notification settings - Fork 453
fix macos drop privs #231
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
fix macos drop privs #231
Conversation
1cbede1
to
0a332e5
Compare
@phillyqueso run |
0a332e5
to
4b67aa1
Compare
@phillyqueso so I have good news and bad news. The good news is that we fixed the CI issues on the master branch, and all you need to do here is merge in those changes. The bad news is that there are some mean merge conflicts here, as we just split the crate into a workspace, which should have been done long ago. |
No problem @Noah-Kennedy! I'll rebase and push the fix soon. |
4b67aa1
to
5c6c137
Compare
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.
Thanks for the PR!
return Err(Error::DropPrivileges("NULL from getlogin".to_owned())); | ||
#[cfg(target_os = "macos")] | ||
{ | ||
let uname: &'static str = env!("USER"); |
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.
env!() retrieves the environment variable at compile time, is it expected? If I compile the code in one user, and use the binary in another user(or machine), the behavior is incorrect.
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.
Ahh crap, thanks for catching this.
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'll open up a PR after I eat breakfast.
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.
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.
Also, next time, it's much easier to track this if you create an issue to track the problem.
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.
Fixed
…to get user In #231 we accidentally started using a compile-time environment environment variable instead of a runtime one for dropping privileges on macos. This causes privilege drops to fail when the user who is running the program does not have the same username as the user who compiled the program. The solution here is to use the runtime variable instead.
… drop privileges (#297) In #231 we accidentally started using a compile-time environment environment variable instead of a runtime one for dropping privileges on macos. This causes privilege drops to fail when the user who is running the program does not have the same username as the user who compiled the program. The solution here is to use the runtime variable instead.
… drop privileges (cloudflare#297) In cloudflare#231 we accidentally started using a compile-time environment environment variable instead of a runtime one for dropping privileges on macos. This causes privilege drops to fail when the user who is running the program does not have the same username as the user who compiled the program. The solution here is to use the runtime variable instead.
fixes #205
references: