diff options
author | Han Ming Ong <hanming@apple.com> | 2013-12-19 00:35:40 +0000 |
---|---|---|
committer | Han Ming Ong <hanming@apple.com> | 2013-12-19 00:35:40 +0000 |
commit | 4b5a63cd5422504b5abf60eb39c806683c218987 (patch) | |
tree | 807fa5aa445915f9d96694b3b5a88fa350cefe4f | |
parent | bb6a477131a7f23a6df66f4005b932e6fd34a718 (diff) | |
download | bcm5719-llvm-4b5a63cd5422504b5abf60eb39c806683c218987.tar.gz bcm5719-llvm-4b5a63cd5422504b5abf60eb39c806683c218987.zip |
<rdar://problem/15639995>
Allow the root XPC launcher to launch any target as root.
llvm-svn: 197634
-rw-r--r-- | lldb/source/Host/macosx/Host.mm | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index b495206eb6d..8923c745d6e 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -1728,29 +1728,18 @@ LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, : } static bool -ShouldLaunchUsingXPC(const char *exe_path, ProcessLaunchInfo &launch_info) +ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) { bool result = false; #if !NO_XPC_SERVICES - const char *debugserver = "/debugserver"; - int len = strlen(debugserver); - int exe_len = strlen(exe_path); - if (exe_len >= len) + bool launchingAsRoot = launch_info.GetUserID() == 0; + bool currentUserIsRoot = Host::GetEffectiveUserID() == 0; + + if (launchingAsRoot && !currentUserIsRoot) { - const char *part = exe_path + (exe_len - len); - if (strcmp(part, debugserver) == 0) - { - // We are dealing with debugserver. - bool launchingAsRoot = launch_info.GetUserID() == 0; - bool currentUserIsRoot = Host::GetEffectiveUserID() == 0; - - if (launchingAsRoot && !currentUserIsRoot) - { - // If current user is already root, we don't need XPC's help. - result = true; - } - } + // If current user is already root, we don't need XPC's help. + result = true; } #endif @@ -1807,7 +1796,7 @@ Host::LaunchProcess (ProcessLaunchInfo &launch_info) ::pid_t pid = LLDB_INVALID_PROCESS_ID; - if (ShouldLaunchUsingXPC(exe_path, launch_info)) + if (ShouldLaunchUsingXPC(launch_info)) { error = LaunchProcessXPC(exe_path, launch_info, pid); } |