Revision
23288
Author
zarzycki@apple.com
Date
2007-07-02 09:29:12 -0700 (Mon, 02 Jul 2007)

Log Message

<rdar://problem/5284661> Per-user agents run in root security context

Modified Paths

Diff

Modified: trunk/launchd/src/Makefile.am (23287 => 23288)


--- trunk/launchd/src/Makefile.am	2007-06-29 20:24:46 UTC (rev 23287)
+++ trunk/launchd/src/Makefile.am	2007-07-02 16:29:12 UTC (rev 23288)
@@ -40,7 +40,7 @@
 sysconf_DATA = hostconfig rc.common rc.netboot
 
 launchctl_CFLAGS = $(AM_CFLAGS) -I/System/Library/Frameworks/System.framework/PrivateHeaders
-launchctl_LDFLAGS = -framework CoreFoundation -framework IOKit -weak_library /usr/lib/libedit.dylib
+launchctl_LDFLAGS = -framework CoreFoundation -framework IOKit -framework Security -weak_library /usr/lib/libedit.dylib
 
 SystemStarter_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS)
 SystemStarter_LDFLAGS = -framework CoreFoundation -framework IOKit

Modified: trunk/launchd/src/Makefile.in (23287 => 23288)


--- trunk/launchd/src/Makefile.in	2007-06-29 20:24:46 UTC (rev 23287)
+++ trunk/launchd/src/Makefile.in	2007-07-02 16:29:12 UTC (rev 23288)
@@ -246,7 +246,7 @@
 @LIBS_ONLY_TRUE@liblaunch_profile_a_SOURCES = liblaunch.c libvproc.c libbootstrap.c protocol_vprocUser.c __version.c
 @LIBS_ONLY_FALSE@sysconf_DATA = hostconfig rc.common rc.netboot
 @LIBS_ONLY_FALSE@launchctl_CFLAGS = $(AM_CFLAGS) -I/System/Library/Frameworks/System.framework/PrivateHeaders
-@LIBS_ONLY_FALSE@launchctl_LDFLAGS = -framework CoreFoundation -framework IOKit -weak_library /usr/lib/libedit.dylib
+@LIBS_ONLY_FALSE@launchctl_LDFLAGS = -framework CoreFoundation -framework IOKit -framework Security -weak_library /usr/lib/libedit.dylib
 @LIBS_ONLY_FALSE@SystemStarter_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS)
 @LIBS_ONLY_FALSE@SystemStarter_LDFLAGS = -framework CoreFoundation -framework IOKit
 @LIBS_ONLY_FALSE@SystemStarter_SOURCES = StartupItems.c IPC.c SystemStarter.c

Modified: trunk/launchd/src/launchctl.c (23287 => 23288)


--- trunk/launchd/src/launchctl.c	2007-06-29 20:24:46 UTC (rev 23287)
+++ trunk/launchd/src/launchctl.c	2007-07-02 16:29:12 UTC (rev 23288)
@@ -22,6 +22,8 @@
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFPriv.h>
+#include <Security/Security.h>
+#include <Security/AuthSession.h>
 #include <IOKit/IOKitLib.h>
 #include <NSSystemDirectories.h>
 #include <mach/mach.h>
@@ -1553,6 +1555,10 @@
 			the_argc += 1;
 		}
 
+		if (strcasecmp(session_type, "Background") == 0) {
+			assumes(SessionCreate(sessionKeepCurrentBootstrap, 0) == 0);
+		}
+
 		assumes(load_and_unload_cmd(the_argc, load_launchd_items) == 0);
 	}