diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-09-14 09:16:27 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-09-14 09:16:27 +0000 |
commit | b6d45f75e658a866f3f708ae182c23fc742d38eb (patch) | |
tree | 9f299d9b18b3df1be202edd535bb1c01a5110ed6 /app/xinit/launchd | |
parent | 9f354802375e605e51f086e833a570df1993271a (diff) |
Update to xinit 1.3.3
Diffstat (limited to 'app/xinit/launchd')
-rw-r--r-- | app/xinit/launchd/Makefile.am | 7 | ||||
-rw-r--r-- | app/xinit/launchd/Makefile.in | 8 | ||||
-rw-r--r-- | app/xinit/launchd/privileged_startx/10-tmpdirs.cpp | 34 | ||||
-rw-r--r-- | app/xinit/launchd/privileged_startx/Makefile.in | 4 | ||||
-rw-r--r-- | app/xinit/launchd/privileged_startx/privileged_startx.plist.cpp | 4 | ||||
-rw-r--r-- | app/xinit/launchd/privileged_startx/server.c | 14 | ||||
-rw-r--r-- | app/xinit/launchd/user_startx/Makefile.in | 4 | ||||
-rw-r--r-- | app/xinit/launchd/user_startx/launchd_startx.c | 23 |
8 files changed, 63 insertions, 35 deletions
diff --git a/app/xinit/launchd/Makefile.am b/app/xinit/launchd/Makefile.am index f8781ed54..0135b7fcf 100644 --- a/app/xinit/launchd/Makefile.am +++ b/app/xinit/launchd/Makefile.am @@ -1,3 +1,8 @@ -SUBDIRS = privileged_startx user_startx +DIST_SUBDIRS = privileged_startx user_startx +SUBDIRS = privileged_startx + +if !TIGER_LAUNCHD +SUBDIRS += user_startx +endif EXTRA_DIST = console_redirect.h diff --git a/app/xinit/launchd/Makefile.in b/app/xinit/launchd/Makefile.in index a1e44423b..5d87a4d7c 100644 --- a/app/xinit/launchd/Makefile.in +++ b/app/xinit/launchd/Makefile.in @@ -49,6 +49,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@TIGER_LAUNCHD_FALSE@am__append_1 = user_startx subdir = launchd DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -92,7 +93,6 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ distdir ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -172,6 +172,7 @@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -181,6 +182,8 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ SCOMAN = @SCOMAN@ @@ -263,7 +266,8 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = privileged_startx user_startx +DIST_SUBDIRS = privileged_startx user_startx +SUBDIRS = privileged_startx $(am__append_1) EXTRA_DIST = console_redirect.h all: all-recursive diff --git a/app/xinit/launchd/privileged_startx/10-tmpdirs.cpp b/app/xinit/launchd/privileged_startx/10-tmpdirs.cpp index 8012597f9..4366696ab 100644 --- a/app/xinit/launchd/privileged_startx/10-tmpdirs.cpp +++ b/app/xinit/launchd/privileged_startx/10-tmpdirs.cpp @@ -1,5 +1,5 @@ XCOMM!/bin/sh -XCOMM Copyright (c) 2008 Apple Inc. +XCOMM Copyright (c) 2008-2012 Apple Inc. XCOMM XCOMM Permission is hereby granted, free of charge, to any person XCOMM obtaining a copy of this software and associated documentation files @@ -36,11 +36,33 @@ else MKTEMP=mktemp fi +STAT=/usr/bin/stat + for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do - XCOMM Use mktemp rather than mkdir to avoid possible security issue - XCOMM if $dir exists and is a symlink - if ${MKTEMP} -d ${dir} >& /dev/null ; then - chmod 1777 $dir - chown root:wheel $dir + success=0 + for attempt in 1 2 3 4 5 ; do + check=`${STAT} -f '%#p %u %g' ${dir} 2> /dev/null` + if [ "${check}" = "041777 0 0" ] ; then + success=1 + break + elif [ -n "${check}" ] ; then + saved=$(${MKTEMP} -d ${dir}-XXXXXXXX) + mv ${dir} ${saved} + echo "${dir} exists but is insecure. It has been moved into ${saved}" >&2 + fi + + # Use mktemp rather than mkdir to avoid possible security issue + # if $dir exists and is a symlink (ie protect against a race + # against the above check) + if ${MKTEMP} -d ${dir} >& /dev/null ; then + chmod 1777 $dir + chown root:wheel $dir + success=1 + break + fi + done + + if [ "${success}" -eq 0 ] ; then + echo "Could not successfully create ${dir}" >&2 fi done diff --git a/app/xinit/launchd/privileged_startx/Makefile.in b/app/xinit/launchd/privileged_startx/Makefile.in index 35d3bf370..5c738b94c 100644 --- a/app/xinit/launchd/privileged_startx/Makefile.in +++ b/app/xinit/launchd/privileged_startx/Makefile.in @@ -234,6 +234,7 @@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -243,6 +244,8 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ SCOMAN = @SCOMAN@ @@ -330,7 +333,6 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ -e '/^[ ]*XHASH/s/XHASH/\#/' \ - -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \ -e '/\@\@$$/s/\@\@$$/\\/' SUFFIXES = .cpp diff --git a/app/xinit/launchd/privileged_startx/privileged_startx.plist.cpp b/app/xinit/launchd/privileged_startx/privileged_startx.plist.cpp index 533fc32b2..e23e892a6 100644 --- a/app/xinit/launchd/privileged_startx/privileged_startx.plist.cpp +++ b/app/xinit/launchd/privileged_startx/privileged_startx.plist.cpp @@ -11,8 +11,12 @@ <string>SCRIPTDIR</string> </array> #ifdef TIGER_LAUNCHD + <key>RunAtLoad</key> + <true/> <key>KeepAlive</key> <true/> + <key>ServiceIPC</key> + <true/> #else <key>MachServices</key> <dict> diff --git a/app/xinit/launchd/privileged_startx/server.c b/app/xinit/launchd/privileged_startx/server.c index cfbb62311..a93cae3bc 100644 --- a/app/xinit/launchd/privileged_startx/server.c +++ b/app/xinit/launchd/privileged_startx/server.c @@ -125,9 +125,19 @@ int server_main(const char *dir) { aslclient aslc; checkin = launch_data_new_string(LAUNCH_KEY_CHECKIN); + if (!checkin) { + asl_log(NULL, NULL, ASL_LEVEL_ERR, "unable to create launchd checkin string"); + exit(EXIT_FAILURE); + } + config = launch_msg(checkin); - if (!config || launch_data_get_type(config) == LAUNCH_DATA_ERRNO) { - asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed"); + if (!config) { + asl_log(NULL, NULL, ASL_LEVEL_ERR, "could not send a message to launchd"); + exit(EXIT_FAILURE); + } + + if (launch_data_get_type(config) == LAUNCH_DATA_ERRNO) { + asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed eith error: %d %s", launch_data_get_errno(config), strerror(launch_data_get_errno(config))); exit(EXIT_FAILURE); } diff --git a/app/xinit/launchd/user_startx/Makefile.in b/app/xinit/launchd/user_startx/Makefile.in index 4eaa873e2..beaf9c44f 100644 --- a/app/xinit/launchd/user_startx/Makefile.in +++ b/app/xinit/launchd/user_startx/Makefile.in @@ -222,6 +222,7 @@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -231,6 +232,8 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ SCOMAN = @SCOMAN@ @@ -318,7 +321,6 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ -e '/^[ ]*XHASH/s/XHASH/\#/' \ - -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \ -e '/\@\@$$/s/\@\@$$/\\/' SUFFIXES = .cpp diff --git a/app/xinit/launchd/user_startx/launchd_startx.c b/app/xinit/launchd/user_startx/launchd_startx.c index f83cd6140..67419a4b6 100644 --- a/app/xinit/launchd/user_startx/launchd_startx.c +++ b/app/xinit/launchd/user_startx/launchd_startx.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 Apple Inc. +/* Copyright (c) 2011-2012 Apple Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files @@ -37,15 +37,7 @@ #include <sys/wait.h> #include <string.h> #include <stdlib.h> - -/* Using MIN_REQUIRED instead of MAX_ALLOWED logic due to posix_spawn not - * being marked with availability macros until 10.7 - */ -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 #include <spawn.h> -#else -#include <errno.h> -#endif #include "console_redirect.h" @@ -64,20 +56,7 @@ int main(int argc, char **argv, char **envp) { xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO); xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 assert(posix_spawnp(&child, argv[1], NULL, NULL, &argv[1], envp) == 0); -#else - switch(child = fork()) { - case -1: - perror("fork"); - return errno; - case 0: - return execvp(argv[1], &argv[1]); - default: - break; - } -#endif - wait4(child, &pstat, 0, (struct rusage *)0); return pstat; |