#include <stdbool.h>
#include <paths.h>
#include <string.h>
-#include <assumes.h>
+#include <os/assumes.h>
#include "launch.h"
#include "launch_priv.h"
return;
}
+ if (geteuid() == 0) {
+ uid_t euid, guid;
+ if (getpeereid(cfd, &euid, &guid) == -1) {
+ launchd_syslog(LOG_NOTICE | LOG_CONSOLE, "*** launchd[%d] failed to getpeereid on incoming caller (%d)", getpid(), errno);
+ (void)runtime_close(cfd);
+ return;
+ }
+
+ if (euid != geteuid()) {
+ launchd_syslog(LOG_NOTICE | LOG_CONSOLE, "*** launchd[%d] failed to euid check on incoming caller (%d != %d)", getpid(), euid, geteuid());
+ (void)runtime_close(cfd);
+ return;
+ }
+ }
+
ipc_open(cfd, NULL);
}
resp = job_export(j);
ipc_revoke_fds(resp);
}
- } else if (!strcmp(cmd, LAUNCH_KEY_SETPRIORITYLIST)) {
-#if TARGET_OS_EMBEDDED
- resp = launch_data_new_errno(launchd_set_jetsam_priorities(data));
-#else
- resp = launch_data_new_errno(ENOTSUP);
-#endif
}
}
#if TARGET_OS_EMBEDDED