Revision
22874
Author
zarzycki@apple.com
Date
2006-09-23 13:25:10 -0700 (Sat, 23 Sep 2006)

Log Message

Structural and semantic reorganization:

Some jobs, such as configd, are diligent about using bootstrap_unprivileged() before calling bootstrap_register().

Let's detect that and tie their calls to bootstrap_register() back to their job data structure.

Note, this will become free once some future redesign work is done that will turn bootstrap_unprivileged() into a no-op.

Modified Paths

Diff

Modified: trunk/launchd/src/launchd_mach_ipc.c (22873 => 22874)


--- trunk/launchd/src/launchd_mach_ipc.c	2006-09-23 20:17:01 UTC (rev 22873)
+++ trunk/launchd/src/launchd_mach_ipc.c	2006-09-23 20:25:10 UTC (rev 22874)
@@ -244,12 +244,18 @@
 kern_return_t
 x_bootstrap_register(mach_port_t bp, audit_token_t au_tok, name_t servicename, mach_port_t serviceport)
 {
-	job_t j = job_find_by_port(bp);
+	job_t j2, j = job_find_by_port(bp);
 	struct machservice *ms;
 	struct ldcred ldc;
 
 	audit_token_to_launchd_cred(au_tok, &ldc);
 
+	j2 = job_find_by_pid(root_job, ldc.pid);
+
+	if (j2 && job_get_bs(j2) == j) {
+		j = j2;
+	}
+
 	job_log(j, LOG_NOTICE, "bootstrap_register() is deprecated. PID: %u Service: %s", ldc.pid, servicename);
 
 	job_log(j, LOG_DEBUG, "Mach service registration attempt: %s", servicename);