[22941] trunk/launchd/src/launchd_core_logic.c
Revision: 22941 http://trac.macosforge.org/projects/launchd/changeset/22941 Author: zarzycki@apple.com Date: 2006-11-13 09:53:16 -0800 (Mon, 13 Nov 2006) Log Message: ----------- <rdar://problem/4829691> Applications 'open'ed in 'ssh' session belong to 'root' Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2006-11-09 22:10:17 UTC (rev 22940) +++ trunk/launchd/src/launchd_core_logic.c 2006-11-13 17:53:16 UTC (rev 22941) @@ -441,6 +441,10 @@ launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_PROGRAMARGUMENTS); } + if (j->session_create && (tmp = launch_data_new_bool(true))) { + launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_SESSIONCREATE); + } + if (j->inetcompat && (tmp = launch_data_alloc(LAUNCH_DATA_DICTIONARY))) { if ((tmp2 = launch_data_new_bool(j->inetcompat_wait))) { launch_data_dict_insert(tmp, tmp2, LAUNCH_JOBINETDCOMPATIBILITY_WAIT); @@ -781,6 +785,13 @@ return NULL; } + if (getpid() == 1) { + struct ldcred ldc; + + runtime_get_caller_creds(&ldc); + jr->mach_uid = ldc.uid; + } + jr->unload_at_exit = true; jr->stall_before_exec = w4d; jr->force_ppc = fppc; @@ -4084,7 +4095,6 @@ pid_t *child_pid, mach_port_t *obsvr_port) { job_t jr; - struct ldcred ldc; size_t offset = 0; char *tmpp; const char **argv = NULL, **env = NULL; @@ -4093,8 +4103,6 @@ const char *workingdir = NULL; size_t argv_i = 0, env_i = 0; - runtime_get_caller_creds(&ldc); - #if 0 if (ldc.asid != inherited_asid) { job_log(j, LOG_ERR, "Security: PID %d (ASID %d) was denied a request to spawn a process in this session (ASID %d)", @@ -4143,10 +4151,6 @@ return BOOTSTRAP_NO_MEMORY; } - if (getuid() == 0) { - jr->mach_uid = ldc.uid; - } - if (!job_setup_machport(jr)) { job_remove(jr); return BOOTSTRAP_NO_MEMORY;
participants (1)
-
source_changes@macosforge.org