]> git.saurik.com Git - apple/launchd.git/commitdiff
launchd-392.38.tar.gz mac-os-x-1074 v392.38
authorApple <opensource@apple.com>
Thu, 17 May 2012 20:31:20 +0000 (20:31 +0000)
committerApple <opensource@apple.com>
Thu, 17 May 2012 20:31:20 +0000 (20:31 +0000)
launchd/src/launchctl.c
launchd/src/launchd_core_logic.c

index 25b3b3f52298a0a86eee792357e1cd733b5a90bb..8510c9fff18e995eee337ac2dd6c1c2397540be0 100644 (file)
@@ -18,7 +18,7 @@
  * @APPLE_APACHE_LICENSE_HEADER_END@
  */
 
-static const char *const __rcs_file_version__ = "$Revision: 25182 $";
+static const char *const __rcs_file_version__ = "$Revision: 25957 $";
 
 #include "config.h"
 #include "launch.h"
@@ -479,6 +479,16 @@ CFPropertyListRef CFPropertyListCreateFromFile(CFURLRef plistURL)
        return plist;
 }
 
+static void
+sanitize_environment_dot_plist(const launch_data_t val, const char *key, void *ctx)
+{
+       launch_data_t copy = (launch_data_t)ctx;
+       if (strncmp("DYLD_", key, sizeof("DYLD_") - 1) != 0) {
+               launch_data_t copyi = launch_data_copy(val);
+               launch_data_dict_insert(copy, copyi, key);
+       }
+}
+
 #define CFReleaseIfNotNULL(cf) if (cf) CFRelease(cf);
 void
 read_environment_dot_plist(void)
@@ -516,13 +526,22 @@ read_environment_dot_plist(void)
        if (!assumes(launch_env_dict != NULL)) {
                goto out;
        }
+
+       launch_data_t sanitized = launch_data_alloc(LAUNCH_DATA_DICTIONARY);
+       if (!assumes(sanitized != NULL)) {
+               goto out;
+       }
+
+       launch_data_dict_iterate(launch_env_dict, sanitize_environment_dot_plist, sanitized);
+       launch_data_free(launch_env_dict);
        
        req = launch_data_alloc(LAUNCH_DATA_DICTIONARY);
        if (!assumes(req != NULL)) {
                goto out;
        }
        
-       launch_data_dict_insert(req, launch_env_dict, LAUNCH_KEY_SETUSERENVIRONMENT);
+       launch_data_dict_insert(req, sanitized, LAUNCH_KEY_SETUSERENVIRONMENT);
+
        resp = launch_msg(req);
        if (!assumes(resp != NULL)) {
                goto out;
index d1023a774cb15c223034ec071a1d2ca8ab09ec5c..3b86e0ffbd20b1fff6543f90b43a4a0febb8d871 100644 (file)
@@ -16,7 +16,7 @@
  * @APPLE_APACHE_LICENSE_HEADER_END@
  */
 
-static const char *const __rcs_file_version__ = "$Revision: 25397 $";
+static const char *const __rcs_file_version__ = "$Revision: 25693 $";
 
 #include "config.h"
 #include "launchd_core_logic.h"
@@ -10061,7 +10061,16 @@ xpc_events_find_channel(job_t j, event_name_t stream, mach_port_t *p)
                        msi->event_channel = true;
                        *p = sp;
 
-                       (void)job_dispatch(j, false);
+                       /* If we call job_dispatch() here before the audit session for the
+                        * job has been set, we'll end up not watching this service. But we
+                        * also have to take care not to watch the port if the job is
+                        * active.
+                        *
+                        * See <rdar://problem/10357855>.
+                        */
+                       if (!j->currently_ignored) {
+                               machservice_watch(j, msi);
+                       }
                } else {
                        errno = BOOTSTRAP_NO_MEMORY;
                }