forked from Chainfire/libsuperuser
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add utility function create shell command from uid and SELinux context
The shell command is normally just "sh" or "su", but sometimes you need to switch to a specific uid or SELinux context. The Shell.SU.shell(...) method will construct a string in this format: "su[ --context <context>][ <uid>]". Currently only SuperSU v1.90 supports the context parameter, so the code auto-detects if that is the su binary currently being used. Update the command format for other su binaries if/when that feature becomes available. To reduce the chance of issues, the uid is only passed if not 0 (root, this is the default case), and the SELinux context is only passed if SELinux is detected to be in enforcing mode (otherwise it may be useful for development/logging purposes only, but not end-user)
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 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