update to xinit 1.1.0.

This commit is contained in:
matthieu 2008-06-18 20:31:51 +00:00
parent 08ba1c99bd
commit 1420b92429
19 changed files with 3119 additions and 239 deletions

View File

@ -1,3 +1,162 @@
commit 44e2ee01b456deb2630d21786d19ee2734d2f40a
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Wed May 28 12:01:35 2008 -0700
Apple: Don't use launchd on Tiger since it doesn't support the features we need.
https://bugs.freedesktop.org/show_bug.cgi?id=15893
commit d315445cb85876cda56f46cb657167d4eb906ba0
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Wed May 28 11:54:22 2008 -0700
Properly handle using xserverrc
commit 3c5e2ed686bd3ab39e2c1e87feffb5990603cf3c
Author: Adam Jackson <ajax@redhat.com>
Date: Wed May 21 14:34:52 2008 -0400
xinit 1.0.9
commit c07501f69239e9c1448736ad7e689a2c3da49af9
Author: Adam Jackson <ajax@redhat.com>
Date: Wed May 21 14:29:55 2008 -0400
Unset session environment variables so startx works within a running session.
commit ef2610f44c7cf40489203fddc77ddcdfb7764eed
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Tue May 13 16:28:33 2008 -0700
Use /bin/ksh instead of /bin/sh on Solaris
commit d3bc7001315a8ba13be073af86fe710740b2d4c3
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Tue May 13 16:25:49 2008 -0700
Check for proper cookie creation on all platforms
commit ef7abe2e72074f8252f0812ab2ca05dff7e76a38
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Tue May 13 16:25:22 2008 -0700
Use od on /dev/random to generate cookie on Solaris
commit e0e89545db1fc08ffe49b2b24455bb30137da671
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Mon May 12 13:17:46 2008 -0700
Apple: Don't need to spew unneccessary 'directory exists' messages.
commit 85561f8347b33422dd4b0ea11911347c0666e409
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Tue May 6 00:07:18 2008 -0700
Apple: No need for these bits being here in xinit as of xserver-1.4.0-apple9
commit 280774466dc9f57b4b46c618345f7938290dbb2c
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Fri Apr 25 19:00:23 2008 -0700
Apple: Added some OSX version protection, so this will still compile on Tiger and below.
commit 0806ae2ecfdcb4ad5f3b7a66dcc9bc5d29d72649
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Fri Apr 25 15:12:54 2008 -0700
Apple: Use CFProcessPath instead of argv[0] trick.
commit edc3112679af749f0c6fc54b2eec1b89aaf0d0c8
Author: Matthieu Herrb <matthieu.herrb@laas.fr>
Date: Sun Apr 20 17:30:14 2008 +0200
Replace sprintf() and strcpy() with snprintf().
commit 47d561fd6efb8923cfbace6fea40dfeb314b4662
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sat Apr 19 08:50:45 2008 -0700
Cleaned up handling of defaultserver{,args}
Per comments from Jeremy Reed on the list... basically doing for everyone what I do for Apple
commit f6e75ebf5f7f245e1cdeb883a1d2db74f2451fd4
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sat Apr 19 08:47:20 2008 -0700
Apple: Fixed make dist to include a missing header and not include generated sources
commit 2b06b58a328e13df4704df8a48d4cd0b1100ba7e
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Thu Apr 17 17:19:41 2008 -0700
Apple: Added privileged_startx
commit fe5af014f2645d1ecf981d40d3c10a3621e9ec56
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Mon Apr 14 13:05:26 2008 -0700
Apple: Wait for privileged_startx to finish, so we don't race to create /tmp/.X11-unix
commit d5590dba3cce39367762d39822094ca51000142b
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sun Apr 13 23:15:27 2008 -0700
Apple: We renamed font_cache.sh to font_cache for better consistency... Changing startx to work with this
commit 5ef443bb6bff0a03ee00105d9bf95bc3f6f82b11
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sun Apr 13 19:51:18 2008 -0700
Apple: privileged_startx is in XINITDIR
commit c1b70ca67ecd12d6837584e7ef4abd01ee3b7ad9
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Tue Apr 8 17:25:54 2008 -0700
Correctly handle users with spaces in $HOME
commit 1cb4bb208d481967fb736acf10c6ac2b66bf3181
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sat Apr 5 17:23:02 2008 -0700
Apple: Renamed LaunchAgent to org.x.startx to distinguish it from the org.x.X11 application
commit f7c706ff46d4a2364d65731cd1c3135ef7987380
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Fri Apr 4 22:49:51 2008 -0700
Apple: Execute /usr/X11/bin/privileged_startx if it's present
commit ca08a36d10f15be6d230a9af92288da4cb24cd43
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Fri Apr 4 02:31:10 2008 -0700
Apple: Fixed issue where display would not be passed correctly to the server if nolisten tcp was enabled.
commit 8c52bd4509b7fe5a74026b5bc638d59add9e8945
Author: Jeremy C. Reed <reed@tx.reedmedia.net>
Date: Sat Mar 15 18:23:45 2008 -0500
Use /dev/urandom for cookie it it exists
else fall back to /dev/random.
Not doing in configure.ac because can't easily check for
existence when doing cross-builds.
(Alternative would be to define this for every operating system
in configure.ac. Currently only is defined for OpenBSD.
Systems that have mcookie also will not be effected.)
commit 062524614fdd4f11f32ba3d054f7fc16b9bc5f12
Author: Matthieu Herrb <matthieu@bluenote.herrb.net>
Date: Sat Mar 8 19:02:05 2008 +0100
OpenBSD: use openssl rand -hex 16 to generate the cookie.
commit 3eaee22196a03d88c419c42470baf562552c1a3b
Author: Adam Jackson <ajax@redhat.com>
Date: Thu Mar 6 17:09:45 2008 -0500
xinit 1.0.8
commit 96c8650369a99e344b4e3510f713b331d83c4272
Author: Jeremy Huddleston <jeremy@tifa.local>
Date: Sun Mar 2 10:32:58 2008 -0800

View File

@ -27,10 +27,6 @@ bin_SCRIPTS = startx
xinit_CFLAGS = $(XINIT_CFLAGS) -DXINITDIR=\"$(XINITDIR)\" -DBINDIR=\"$(bindir)\"
xinit_LDADD = $(XINIT_LIBS)
if APPLE
xinit_LDFLAGS = -framework CoreServices
endif
xinit_SOURCES = \
xinit.c
@ -65,10 +61,14 @@ CPP_FILES_FLAGS = \
-D__bindir__="$(bindir)"
if LAUNCHD
launchagents_PRE = org.x.X11.plist.pre
launchagents_DATA = $(launchagents_PRE:plist.pre=plist)
launchagents_PRE = org.x.startx.plist.cpp
launchagents_DATA = $(launchagents_PRE:plist.cpp=plist)
SUBDIRS = privileged_startx
endif
DIST_SUBDIRS = privileged_startx
xinitrc: xinitrc.cpp Makefile
startx: startx.cpp Makefile
@ -76,7 +76,7 @@ xinitrc_DATA = xinitrc
CLEANFILES = xinitrc startx $(appman_DATA) $(launchagents_DATA)
EXTRA_DIST = xinitrc.cpp startx.cpp org.x.X11.plist.cpp $(appman_PRE) \
EXTRA_DIST = xinitrc.cpp startx.cpp org.x.startx.plist.cpp $(appman_PRE) \
startx.cmd xinitrc.cmd xinit.def ChangeLog autogen.sh
.PHONY: ChangeLog

View File

@ -102,6 +102,12 @@ CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(xinit_SOURCES)
DIST_SOURCES = $(xinit_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -131,8 +137,6 @@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
APPLE_FALSE = @APPLE_FALSE@
APPLE_TRUE = @APPLE_TRUE@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
ARCHMANDEFS = @ARCHMANDEFS@
@ -234,6 +238,7 @@ includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
launchagentsdir = @launchagentsdir@
launchdaemonsdir = @launchdaemonsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
@ -250,7 +255,6 @@ XINITDIR = $(datadir)/X11/xinit
bin_SCRIPTS = startx
xinit_CFLAGS = $(XINIT_CFLAGS) -DXINITDIR=\"$(XINITDIR)\" -DBINDIR=\"$(bindir)\"
xinit_LDADD = $(XINIT_LIBS)
@APPLE_TRUE@xinit_LDFLAGS = -framework CoreServices
xinit_SOURCES = \
xinit.c
@ -303,15 +307,17 @@ CPP_FILES_FLAGS = \
-D__libexecdir__="$(libexecdir)" \
-D__bindir__="$(bindir)"
@LAUNCHD_TRUE@launchagents_PRE = org.x.X11.plist.pre
@LAUNCHD_TRUE@launchagents_DATA = $(launchagents_PRE:plist.pre=plist)
@LAUNCHD_TRUE@launchagents_PRE = org.x.startx.plist.cpp
@LAUNCHD_TRUE@launchagents_DATA = $(launchagents_PRE:plist.cpp=plist)
@LAUNCHD_TRUE@SUBDIRS = privileged_startx
DIST_SUBDIRS = privileged_startx
xinitrc_DATA = xinitrc
CLEANFILES = xinitrc startx $(appman_DATA) $(launchagents_DATA)
EXTRA_DIST = xinitrc.cpp startx.cpp org.x.X11.plist.cpp $(appman_PRE) \
EXTRA_DIST = xinitrc.cpp startx.cpp org.x.startx.plist.cpp $(appman_PRE) \
startx.cmd xinitrc.cmd xinit.def ChangeLog autogen.sh
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .$(APP_MAN_SUFFIX) .man .cpp .c .o .obj
@ -499,6 +505,77 @@ uninstall-xinitrcDATA:
rm -f "$(DESTDIR)$(xinitrcdir)/$$f"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@ -509,10 +586,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@ -525,7 +615,7 @@ TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
@ -576,6 +666,21 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
@ -677,21 +782,22 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
check: check-recursive
all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) config.h
installdirs:
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(launchagentsdir)" "$(DESTDIR)$(xinitrcdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@ -708,24 +814,24 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean: clean-recursive
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi: dvi-recursive
dvi-am:
html: html-am
html: html-recursive
info: info-am
info: info-recursive
info-am:
@ -734,28 +840,28 @@ install-data-am: install-appmanDATA install-launchagentsDATA \
install-exec-am: install-binPROGRAMS install-binSCRIPTS
install-info: install-info-am
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf: pdf-recursive
pdf-am:
ps: ps-am
ps: ps-recursive
ps-am:
@ -763,20 +869,25 @@ uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS \
uninstall-binSCRIPTS uninstall-info-am \
uninstall-launchagentsDATA uninstall-xinitrcDATA
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-shar dist-tarZ dist-zip distcheck \
distclean distclean-compile distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-appmanDATA install-binPROGRAMS install-binSCRIPTS \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-launchagentsDATA \
install-man install-strip install-xinitrcDATA installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-appmanDATA uninstall-binPROGRAMS \
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-binPROGRAMS clean-generic clean-recursive \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-appmanDATA install-binPROGRAMS \
install-binSCRIPTS install-data install-data-am install-exec \
install-exec-am install-info install-info-am \
install-launchagentsDATA install-man install-strip \
install-xinitrcDATA installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am \
uninstall-appmanDATA uninstall-binPROGRAMS \
uninstall-binSCRIPTS uninstall-info-am \
uninstall-launchagentsDATA uninstall-xinitrcDATA

1580
app/xinit/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ([2.57])
AC_INIT(xinit,[1.0.8], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
AC_INIT(xinit,[1.1.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
@ -104,37 +104,34 @@ AC_ARG_WITH(xconsole,
[XCONSOLE="$withval"],
[XCONSOLE="$DEFAULT_XCONSOLE"])
AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with suppo
rt for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
AC_ARG_WITH(launchagents-dir,AS_HELP_STRING([--with-launchagents-dir=PATH], [Pat
h to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
AC_ARG_WITH(launchagents-dir, AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
[ launchagentsdir="${withval}" ],
[ launchagentsdir="/Library/LaunchAgents" ])
AC_ARG_WITH(launchdaemons-dir, AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
[ launchdaemonsdir="${withval}" ],
[ launchdaemonsdir="/Library/LaunchDaemons" ])
if test "x$LAUNCHD" = "xauto"; then
unset LAUNCHD
AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
case $host_os in
darwin8*)
LAUNCHD=no
;;
*)
AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
;;
esac
fi
if test "x$LAUNCHD" = "xyes" ; then
AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
case $host_os in
darwin*)
# For now, this is how we find X11.app on OS-X...
# A future version of launchd should let us do this cleaner
#XSERVER=\'\`'$(libexecdir)/x11-exec'\`\'
AM_CONDITIONAL(APPLE, true)
;;
*)
AM_CONDITIONAL(APPLE, false)
;;
esac
else
AM_CONDITIONAL(APPLE,false)
launchagentsdir=""
launchdaemonsdir=""
fi
AC_SUBST([launchagentsdir])
AC_SUBST([launchdaemonsdir])
AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
# Checks for pkg-config packages
@ -156,6 +153,9 @@ case $host_os in
*openbsd*)
MCOOKIE='/usr/sbin/openssl rand -hex 16'
;;
*solaris*)
MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
;;
esac
if test "x$MCOOKIE" != x ; then
@ -163,9 +163,13 @@ if test "x$MCOOKIE" != x ; then
fi
AC_SUBST(STARTX_COOKIE_FLAGS)
# Additional substitutions in xinitrc & man pages
# Additional substitutions in startx, xinitrc & man pages
case $host_os in
*sco*)
*solaris*)
SHELL_CMD="/bin/ksh"
ARCHMANDEFS=""
;;
*sco*)
SHELL_CMD="/bin/ksh"
ARCHMANDEFS="-D__SCOMAN__"
;;
@ -196,3 +200,4 @@ XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
AC_OUTPUT([Makefile])
AC_OUTPUT([privileged_startx/Makefile])

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.x.startx</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>--login</string>
<string>-c</string>
<string>__bindir__/startx</string>
</array>
<key>Sockets</key>
<dict>
<key>:0</key>
<dict>
<key>SecureSocketWithKey</key>
<string>DISPLAY</string>
</dict>
</dict>
<key>ServiceIPC</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,37 @@
XCOMM!/bin/sh
XCOMM Copyright (c) 2008 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
XCOMM (the "Software"), to deal in the Software without restriction,
XCOMM including without limitation the rights to use, copy, modify, merge,
XCOMM publish, distribute, sublicense, and/or sell copies of the Software,
XCOMM and to permit persons to whom the Software is furnished to do so,
XCOMM subject to the following conditions:
XCOMM
XCOMM The above copyright notice and this permission notice shall be
XCOMM included in all copies or substantial portions of the Software.
XCOMM
XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
XCOMM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
XCOMM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
XCOMM NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
XCOMM HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
XCOMM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
XCOMM DEALINGS IN THE SOFTWARE.
XCOMM
XCOMM Except as contained in this notice, the name(s) of the above
XCOMM copyright holders shall not be used in advertising or otherwise to
XCOMM promote the sale, use or other dealings in this Software without
XCOMM prior written authorization.
XCOMM Make sure these are owned by root
for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do
# Use mktemp rather than mkdir to avoid possible security issue
# if $dir exists and is a symlink
if mktemp -d ${dir} >& /dev/null ; then
chmod 1777 $dir
chown root:wheel $dir
fi
done

View File

@ -0,0 +1,35 @@
XCOMM!/bin/sh
XCOMM Copyright (c) 2008 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
XCOMM (the "Software"), to deal in the Software without restriction,
XCOMM including without limitation the rights to use, copy, modify, merge,
XCOMM publish, distribute, sublicense, and/or sell copies of the Software,
XCOMM and to permit persons to whom the Software is furnished to do so,
XCOMM subject to the following conditions:
XCOMM
XCOMM The above copyright notice and this permission notice shall be
XCOMM included in all copies or substantial portions of the Software.
XCOMM
XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
XCOMM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
XCOMM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
XCOMM NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
XCOMM HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
XCOMM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
XCOMM DEALINGS IN THE SOFTWARE.
XCOMM
XCOMM Except as contained in this notice, the name(s) of the above
XCOMM copyright holders shall not be used in advertising or otherwise to
XCOMM promote the sale, use or other dealings in this Software without
XCOMM prior written authorization.
if [ -x BINDIR/font_cache ] ; then
BINDIR/font_cache &
elif [ -x BINDIR/font_cache.sh ] ; then
BINDIR/font_cache.sh -s &
elif [ -x /usr/X11/bin/fc-cache ] ; then
BINDIR/fc-cache &
fi

View File

@ -0,0 +1,74 @@
# Copyright (c) 2008 Apple Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
# HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name(s) of the above
# copyright holders shall not be used in advertising or otherwise to
# promote the sale, use or other dealings in this Software without
# prior written authorization.
include $(top_srcdir)/cpprules.in
xinitrcdir = $(libdir)/X11/xinit
privstartxdir = $(xinitrcdir)/privileged_startx.d
xinitrc_PROGRAMS = privileged_startx
privstartx_SCRIPTS = 10-tmpdirs 20-font_cache
AM_CPPFLAGS = -DXINITDIR=\"$(xinitrcdir)\" -DSCRIPTDIR=\"$(privstartxdir)\" -DBINDIR=\"$(bindir)\"
CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)"
dist_privileged_startx_SOURCES = \
server.c \
client.c \
privileged_startx.c
nodist_privileged_startx_SOURCES = \
privileged_startxServer.c \
privileged_startxUser.c
BUILT_SOURCES = \
privileged_startxServer.c \
privileged_startxUser.c \
privileged_startxServer.h \
privileged_startx.h
launchdaemons_PRE = org.x.privileged_startx.plist.cpp
launchdaemons_DATA = $(launchdaemons_PRE:plist.cpp=plist)
10-tmpdirs: 10-tmpdirs.cpp Makefile
20-font_cache: 20-font_cache.cpp Makefile
CLEANFILES = \
$(privstartx_SCRIPTS) \
$(BUILT_SOURCES) \
$(launchdaemons_DATA)
EXTRA_DIST = \
10-tmpdirs.cpp \
20-font_cache.cpp \
org.x.privileged_startx.plist.cpp \
privileged_startx.defs \
privileged_startx_types.h
$(BUILT_SOURCES): privileged_startx.defs
mig -sheader privileged_startxServer.h privileged_startx.defs

View File

@ -0,0 +1,612 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Copyright (c) 2008 Apple Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
# HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name(s) of the above
# copyright holders shall not be used in advertising or otherwise to
# promote the sale, use or other dealings in this Software without
# prior written authorization.
# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
# to cpp, because that trick does not work on all ANSI C preprocessors.
# Delete line numbers from the cpp output (-P is not portable, I guess).
# Allow XCOMM to be preceded by whitespace and provide a means of generating
# output lines with trailing backslashes.
# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/cpprules.in
xinitrc_PROGRAMS = privileged_startx$(EXEEXT)
subdir = privileged_startx
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(xinitrcdir)" \
"$(DESTDIR)$(privstartxdir)" "$(DESTDIR)$(launchdaemonsdir)"
xinitrcPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(xinitrc_PROGRAMS)
dist_privileged_startx_OBJECTS = server.$(OBJEXT) client.$(OBJEXT) \
privileged_startx.$(OBJEXT)
nodist_privileged_startx_OBJECTS = privileged_startxServer.$(OBJEXT) \
privileged_startxUser.$(OBJEXT)
privileged_startx_OBJECTS = $(dist_privileged_startx_OBJECTS) \
$(nodist_privileged_startx_OBJECTS)
privileged_startx_LDADD = $(LDADD)
privstartxSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(privstartx_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(dist_privileged_startx_SOURCES) \
$(nodist_privileged_startx_SOURCES)
DIST_SOURCES = $(dist_privileged_startx_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
launchdaemonsDATA_INSTALL = $(INSTALL_DATA)
DATA = $(launchdaemons_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
ARCHMANDEFS = @ARCHMANDEFS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LAUNCHD = @LAUNCHD@
LAUNCHD_FALSE = @LAUNCHD_FALSE@
LAUNCHD_TRUE = @LAUNCHD_TRUE@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MCOOKIE = @MCOOKIE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHELL_CMD = @SHELL_CMD@
STARTX_COOKIE_FLAGS = @STARTX_COOKIE_FLAGS@
STRIP = @STRIP@
TWM = @TWM@
VERSION = @VERSION@
WM = @WM@
XAUTH = @XAUTH@
XCLOCK = @XCLOCK@
XCONSOLE = @XCONSOLE@
XINIT = @XINIT@
XINIT_CFLAGS = @XINIT_CFLAGS@
XINIT_LIBS = @XINIT_LIBS@
XMODMAP = @XMODMAP@
XRDB = @XRDB@
XSERVER = @XSERVER@
XTERM = @XTERM@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
launchagentsdir = @launchagentsdir@
launchdaemonsdir = @launchdaemonsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
-e '/^\#line *[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/\@\@$$/\\/'
# Strings to replace in man pages
XORGRELSTRING = @PACKAGE_STRING@
XORGMANNAME = X Version 11
MANDEFS = \
-D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
-D__appmansuffix__=$(APP_MAN_SUFFIX) \
-D__filemansuffix__=$(FILE_MAN_SUFFIX) \
-D__libmansuffix__=$(LIB_MAN_SUFFIX) \
-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
-D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \
-D__xinitdir__=$(XINITDIR) \
-D__bindir__=$(bindir) \
-DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS)
SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp
xinitrcdir = $(libdir)/X11/xinit
privstartxdir = $(xinitrcdir)/privileged_startx.d
privstartx_SCRIPTS = 10-tmpdirs 20-font_cache
AM_CPPFLAGS = -DXINITDIR=\"$(xinitrcdir)\" -DSCRIPTDIR=\"$(privstartxdir)\" -DBINDIR=\"$(bindir)\"
CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)"
dist_privileged_startx_SOURCES = \
server.c \
client.c \
privileged_startx.c
nodist_privileged_startx_SOURCES = \
privileged_startxServer.c \
privileged_startxUser.c
BUILT_SOURCES = \
privileged_startxServer.c \
privileged_startxUser.c \
privileged_startxServer.h \
privileged_startx.h
launchdaemons_PRE = org.x.privileged_startx.plist.cpp
launchdaemons_DATA = $(launchdaemons_PRE:plist.cpp=plist)
CLEANFILES = \
$(privstartx_SCRIPTS) \
$(BUILT_SOURCES) \
$(launchdaemons_DATA)
EXTRA_DIST = \
10-tmpdirs.cpp \
20-font_cache.cpp \
org.x.privileged_startx.plist.cpp \
privileged_startx.defs \
privileged_startx_types.h
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .$(APP_MAN_SUFFIX) .man .cpp .c .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu privileged_startx/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu privileged_startx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-xinitrcPROGRAMS: $(xinitrc_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(xinitrcdir)" || $(mkdir_p) "$(DESTDIR)$(xinitrcdir)"
@list='$(xinitrc_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(xinitrcPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(xinitrcdir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(xinitrcPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(xinitrcdir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-xinitrcPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(xinitrc_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(xinitrcdir)/$$f'"; \
rm -f "$(DESTDIR)$(xinitrcdir)/$$f"; \
done
clean-xinitrcPROGRAMS:
-test -z "$(xinitrc_PROGRAMS)" || rm -f $(xinitrc_PROGRAMS)
privileged_startx$(EXEEXT): $(privileged_startx_OBJECTS) $(privileged_startx_DEPENDENCIES)
@rm -f privileged_startx$(EXEEXT)
$(LINK) $(privileged_startx_LDFLAGS) $(privileged_startx_OBJECTS) $(privileged_startx_LDADD) $(LIBS)
install-privstartxSCRIPTS: $(privstartx_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(privstartxdir)" || $(mkdir_p) "$(DESTDIR)$(privstartxdir)"
@list='$(privstartx_SCRIPTS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f $$d$$p; then \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " $(privstartxSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(privstartxdir)/$$f'"; \
$(privstartxSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(privstartxdir)/$$f"; \
else :; fi; \
done
uninstall-privstartxSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(privstartx_SCRIPTS)'; for p in $$list; do \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " rm -f '$(DESTDIR)$(privstartxdir)/$$f'"; \
rm -f "$(DESTDIR)$(privstartxdir)/$$f"; \
done
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privileged_startx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privileged_startxServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privileged_startxUser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
install-launchdaemonsDATA: $(launchdaemons_DATA)
@$(NORMAL_INSTALL)
test -z "$(launchdaemonsdir)" || $(mkdir_p) "$(DESTDIR)$(launchdaemonsdir)"
@list='$(launchdaemons_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(launchdaemonsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(launchdaemonsdir)/$$f'"; \
$(launchdaemonsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(launchdaemonsdir)/$$f"; \
done
uninstall-launchdaemonsDATA:
@$(NORMAL_UNINSTALL)
@list='$(launchdaemons_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(launchdaemonsdir)/$$f'"; \
rm -f "$(DESTDIR)$(launchdaemonsdir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/..
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(xinitrcdir)" "$(DESTDIR)$(privstartxdir)" "$(DESTDIR)$(launchdaemonsdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean-am: clean-generic clean-xinitrcPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-launchdaemonsDATA install-privstartxSCRIPTS \
install-xinitrcPROGRAMS
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-launchdaemonsDATA \
uninstall-privstartxSCRIPTS uninstall-xinitrcPROGRAMS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-xinitrcPROGRAMS ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-launchdaemonsDATA install-man \
install-privstartxSCRIPTS install-strip \
install-xinitrcPROGRAMS installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-info-am \
uninstall-launchdaemonsDATA uninstall-privstartxSCRIPTS \
uninstall-xinitrcPROGRAMS
.cpp:
$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
.man.$(APP_MAN_SUFFIX):
$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
10-tmpdirs: 10-tmpdirs.cpp Makefile
20-font_cache: 20-font_cache.cpp Makefile
$(BUILT_SOURCES): privileged_startx.defs
mig -sheader privileged_startxServer.h privileged_startx.defs
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,56 @@
/* Copyright (c) 2008 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <servers/bootstrap.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "privileged_startx.h"
int client_main(void) {
kern_return_t kr;
mach_port_t mp;
kr = bootstrap_look_up(bootstrap_port, BOOTSTRAP_NAME, &mp);
if (kr != KERN_SUCCESS) {
fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
exit(EXIT_FAILURE);
}
kr = privileged_startx(mp);
if (kr != KERN_SUCCESS) {
fprintf(stderr, "privileged_startx client: %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.x.privileged_startx</string>
<key>MachServices</key>
<dict>
<key>org.x.privileged_startx</key>
<true/>
</dict>
<key>ProgramArguments</key>
<array>
<string>XINITDIR/privileged_startx</string>
<string>-d</string>
<string>SCRIPTDIR</string>
</array>
<key>TimeOut</key>
<integer>60</integer>
</dict>
</plist>

View File

@ -0,0 +1,59 @@
/* Copyright (c) 2008 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#include <string.h>
#include <stdio.h>
#ifndef SCRIPTDIR
#define SCRIPTDIR="/usr/X11/lib/X11/xinit/privileged_startx.d"
#endif
static void usage(const char *prog) {
fprintf(stderr, "%s: usage\n", prog);
fprintf(stderr, " %s [-d [<script dir>]]\n\n", prog);
fprintf(stderr, " -d: Passed when called from launchd to denote server-mode.\n");
fprintf(stderr, " <script dir>: Directory to use instead of %s\n", SCRIPTDIR);
}
int client_main(void);
int server_main(const char *dir);
int main(int argc, char *argv[]) {
if(argc == 1) {
return client_main();
} else if(!strncmp(argv[1], "-d", 2)) {
if(argc == 2)
return server_main(NULL);
else if(argc == 3)
return server_main(argv[2]);
}
usage(argv[0]);
return 1;
}

View File

@ -0,0 +1,40 @@
/* Copyright (c) 2008 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
import "privileged_startx_types.h";
subsystem privileged_startx 12345;
serverprefix do_;
routine privileged_startx(
port : mach_port_t);
routine idle_exit(
port : mach_port_t);

View File

@ -0,0 +1,6 @@
#ifndef _PRIV_STARTX_TYPES_H_
#define _PRIV_STARTX_TYPES_H_
#define BOOTSTRAP_NAME "org.x.privileged_startx"
#endif

View File

@ -0,0 +1,250 @@
/* Copyright (c) 2008 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <servers/bootstrap.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fts.h>
#include <limits.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sys/time.h>
#include <launch.h>
#include <asl.h>
#include <pthread.h>
#include <errno.h>
#include "privileged_startx.h"
#include "privileged_startxServer.h"
union MaxMsgSize {
union __RequestUnion__privileged_startx_subsystem req;
union __ReplyUnion__privileged_startx_subsystem rep;
};
/* globals to trigger idle exit */
#define DEFAULT_IDLE_TIMEOUT 60 /* 60 second timeout, then the server exits */
struct idle_globals {
mach_port_t mp;
long timeout;
struct timeval lastmsg;
};
struct idle_globals idle_globals;
#ifndef SCRIPTDIR
#define SCRIPTDIR="/usr/X11/lib/X11/xinit/privileged_startx.d"
#endif
/* Default script dir */
const char *script_dir = SCRIPTDIR;
static void* idle_thread(void* param __attribute__((unused)));
int server_main(const char *dir) {
mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE;
mach_port_t mp;
kern_return_t kr;
long idle_timeout = DEFAULT_IDLE_TIMEOUT;
launch_data_t config = NULL, checkin = NULL;
checkin = launch_data_new_string(LAUNCH_KEY_CHECKIN);
config = launch_msg(checkin);
if (!config || launch_data_get_type(config) == LAUNCH_DATA_ERRNO) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed");
exit(EXIT_FAILURE);
}
launch_data_t tmv;
tmv = launch_data_dict_lookup(config, LAUNCH_JOBKEY_TIMEOUT);
if (tmv) {
idle_timeout = launch_data_get_integer(tmv);
asl_log(NULL, NULL, ASL_LEVEL_DEBUG,
"idle timeout set: %ld seconds", idle_timeout);
}
if(dir) {
script_dir = dir;
asl_log(NULL, NULL, ASL_LEVEL_DEBUG,
"script directory set: %s", script_dir);
}
launch_data_t svc;
svc = launch_data_dict_lookup(config, LAUNCH_JOBKEY_MACHSERVICES);
if (!svc) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "no mach services");
exit(EXIT_FAILURE);
}
svc = launch_data_dict_lookup(svc, BOOTSTRAP_NAME);
if (!svc) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "no mach service: %s",
BOOTSTRAP_NAME);
exit(EXIT_FAILURE);
}
mp = launch_data_get_machport(svc);
if (mp == MACH_PORT_NULL) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "NULL mach service: %s",
BOOTSTRAP_NAME);
exit(EXIT_FAILURE);
}
/* insert a send right so we can send our idle exit message */
kr = mach_port_insert_right(mach_task_self(), mp, mp,
MACH_MSG_TYPE_MAKE_SEND);
if (kr != KERN_SUCCESS) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "send right failed: %s",
mach_error_string(kr));
exit(EXIT_FAILURE);
}
/* spawn a thread to monitor our idle timeout */
pthread_t thread;
idle_globals.mp = mp;
idle_globals.timeout = idle_timeout;
gettimeofday(&idle_globals.lastmsg, NULL);
pthread_create(&thread, NULL, &idle_thread, NULL);
/* Main event loop */
kr = mach_msg_server(privileged_startx_server, mxmsgsz, mp, 0);
if (kr != KERN_SUCCESS) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
"mach_msg_server(mp): %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
static int ftscmp(const FTSENT **a, const FTSENT **b) {
return strcmp((**a).fts_name, (**b).fts_name);
}
kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))) {
kern_return_t retval = KERN_SUCCESS;
char fn_buf[PATH_MAX + 1];
char *s;
int error_code;
FTS *ftsp;
FTSENT *ftsent;
const char * path_argv[2] = {script_dir, NULL};
/* Store that we were called, so the idle timer will reset */
gettimeofday(&idle_globals.lastmsg, NULL);
/* script_dir contains a set of files to run with root privs when X11 starts */
ftsp = fts_open(path_argv, FTS_PHYSICAL, ftscmp);
if(!ftsp) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
"do_privileged_startx: fts_open(%s): %s\n",
script_dir, strerror(errno));
return KERN_FAILURE;
}
/* Grab our dir */
ftsent = fts_read(ftsp);
if(!ftsent) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
"do_privileged_startx: fts_read(): %s\n", strerror(errno));
fts_close(ftsp);
return KERN_FAILURE;
}
/* Get a list of the files in this directory */
ftsent = fts_children(ftsp, 0);
if(!ftsent) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
"do_privileged_startx: fts_children(): %s\n", strerror(errno));
fts_close(ftsp);
return KERN_FAILURE;
}
/* Setup the buffer to have the path to the script dir */
strncpy(fn_buf, script_dir, PATH_MAX-1);
strcat(fn_buf, "/");
s = strrchr(fn_buf, 0);
/* Itterate over these files in alphabetical order */
for(; ftsent; ftsent = ftsent->fts_link) {
/* We only source regular files that are executable */
/* Note: This assumes we own them, which should always be the case */
if((ftsent->fts_statp->st_mode & S_IFREG) &&
(ftsent->fts_statp->st_mode & S_IXUSR)) {
/* Complete the full path filename in fn_buf */
strcpy(s, ftsent->fts_name);
/* Run it */
error_code = system(fn_buf);
if(error_code != 0) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
"do_privileged_startx: %s: exited with status %d\n",
fn_buf, error_code);
retval = KERN_FAILURE;
}
}
}
fts_close(ftsp);
return retval;
}
kern_return_t do_idle_exit(mach_port_t test_port __attribute__((unused))) {
struct timeval now;
gettimeofday(&now, NULL);
long delta = now.tv_sec - idle_globals.lastmsg.tv_sec;
if (delta >= idle_globals.timeout) {
exit(EXIT_SUCCESS);
}
return KERN_SUCCESS;
}
static void *idle_thread(void* param __attribute__((unused))) {
for(;;) {
struct timeval now;
gettimeofday(&now, NULL);
long delta = (now.tv_sec - idle_globals.lastmsg.tv_sec);
if (delta < idle_globals.timeout) {
/* sleep for remainder of timeout */
sleep(idle_globals.timeout - delta);
} else {
/* timeout has elapsed, attempt to idle exit */
idle_exit(idle_globals.mp);
}
}
return NULL;
}

View File

@ -13,6 +13,9 @@ XCOMM Site administrators are STRONGLY urged to write nicer versions.
XCOMM
XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $
unset DBUS_SESSION_BUS_ADDRESS
unset SESSION_MANAGER
#if defined(__SCO__) || defined(__UNIXWARE__) || defined(__APPLE__)
XCOMM Check for /usr/bin/X11 and BINDIR in the path, if not add them.
@ -75,6 +78,7 @@ defaultclient=XTERM
defaultserver=XSERVER
defaultclientargs=""
defaultserverargs=""
defaultdisplay=":0"
clientargs=""
serverargs=""
@ -95,13 +99,21 @@ fi
XCOMM First, start caching fonts
if [ x`defaults read org.x.X11 cache_fonts` = x1 ] ; then
if [ -x /usr/X11/bin/font_cache.sh ] ; then
if [ -x /usr/X11/bin/font_cache ] ; then
/usr/X11/bin/font_cache &
elif [ -x /usr/X11/bin/font_cache.sh ] ; then
/usr/X11/bin/font_cache.sh &
elif [ -x /usr/X11/bin/fc-cache ] ; then
/usr/X11/bin/fc-cache &
fi
fi
if [ -x XINITDIR/privileged_startx ] ; then
# Don't push this into the background becasue it can cause
# a race to create /tmp/.X11-unix
XINITDIR/privileged_startx
fi
if [ x`defaults read org.x.X11 no_auth` = x0 ] ; then
enable_xauth=1
else
@ -149,12 +161,6 @@ case $1 in
esac
#endif
if [ -f $userserverrc ]; then
defaultserverargs=$userserverrc
elif [ -f $sysserverrc ]; then
defaultserverargs=$sysserverrc
fi
whoseargs="client"
while [ x"$1" != x ]; do
case "$1" in
@ -206,14 +212,19 @@ fi
XCOMM process server arguments
if [ x"$server" = x ]; then
XCOMM if no server arguments or display either, use rc file instead
server=$defaultserver
XCOMM if no server arguments or display either, use defaults
if [ x"$serverargs" = x -a x"$display" = x ]; then
server="$defaultserverargs"
#ifdef __APPLE__
display="$defaultdisplay"
#endif
else
server=$defaultserver
XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments
if [ -f $userserverrc ]; then
server=$userserverrc
elif [ -f $sysserverrc ]; then
server=$sysserverrc
fi
serverargs=$defaultserverargs
display=$defaultdisplay
fi
fi
@ -243,12 +254,16 @@ if [ x"$enable_xauth" = x1 ] ; then
#if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
mcookie=`MK_COOKIE`
#else
mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
if [ -r /dev/urandom ]; then
mcookie=`dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
else
mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
fi
#endif
if test x"$mcookie" = x; then
echo "Couldn't create cookie"
exit 1
fi
#endif
dummy=0
XCOMM create a file with auth information for the server. ':0' is a dummy.

View File

@ -1,6 +1,6 @@
/* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */
/* $XdotOrg: xc/programs/xinit/xinit.c,v 1.4 2005/10/04 01:27:34 ajax Exp $ */
/* $OpenBSD: xinit.c,v 1.5 2008/04/20 13:46:02 matthieu Exp $ */
/* $OpenBSD: xinit.c,v 1.6 2008/06/18 20:31:51 matthieu Exp $ */
/*
@ -40,12 +40,6 @@ in this Software without prior written authorization from The Open Group.
#include <ctype.h>
#include <stdint.h>
#ifdef __APPLE__
#include <CoreServices/CoreServices.h>
#define kX11AppBundleId "org.x.X11"
#define kX11AppBundlePath "/Contents/MacOS/X11"
#endif
#ifdef X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
#include <signal.h>
@ -177,9 +171,6 @@ static char **client = clientargv + 2; /* make sure room for sh .xinitrc args *
static char *displayNum = NULL;
static char *program = NULL;
static Display *xd = NULL; /* server connection */
#ifdef __APPLE__
static char x11_path[PATH_MAX];
#endif
#ifndef SYSV
#if defined(__CYGWIN__) || defined(SVR4) || defined(_POSIX_SOURCE) || defined(CSRG_BASED) || defined(__UNIXOS2__) || defined(Lynx) || defined(__APPLE__)
int status;
@ -229,56 +220,11 @@ sigUsr1(int sig)
#endif
}
#ifdef __APPLE__
static void set_x11_path() {
CFURLRef appURL = NULL;
OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
switch (osstatus) {
case noErr:
if (appURL == NULL) {
fprintf(stderr, "xinit: Invalid response from LSFindApplicationForInfo(%s)\n",
kX11AppBundleId);
exit(1);
}
if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
fprintf(stderr, "xinit: Error resolving URL for %s\n", kX11AppBundleId);
exit(2);
}
strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
#ifdef DEBUG
fprintf(stderr, "xinit: X11.app = %s\n", x11_path);
#endif
break;
case kLSApplicationNotFoundErr:
fprintf(stderr, "xinit: Unable to find application for %s\n", kX11AppBundleId);
exit(4);
default:
fprintf(stderr, "xinit: Unable to find application for %s, error code = %d\n",
kX11AppBundleId, (int)osstatus);
exit(5);
}
}
#endif
static void
Execute(char **vec, /* has room from up above */
char **envp)
{
char *file = vec[0];
#ifdef __APPLE__
/* This is ugly, but currently, we need to trick OS-X into thinking X is in
* the X11.app bundle. Hopefully UI, icons, etc will eventually be set
* by Xquartz, but this is how we're doing it for now. -JH
*/
if(!strcmp(file, "/usr/X11/bin/X") || !strcmp(file, "/usr/X11/bin/Xquartz") || !strcmp(file, "X") || !strcmp(file, "Xquartz")) {
vec[0] = x11_path;
fprintf(stderr, "xinit: Detected Xquartz startup, setting file=%s, argv[0]=%s\n", file, vec[0]);
}
#endif
Execvpe (file, vec, envp);
Execvpe (vec[0], vec, envp);
#ifndef __UNIXOS2__
if (access (vec[0], R_OK) == 0) {
vec--; /* back it up to stuff shell in */
@ -306,10 +252,6 @@ main(int argc, char *argv[], char *envp[])
int start_of_client_args, start_of_server_args;
struct sigaction sa;
#ifdef __APPLE__
set_x11_path();
#endif
#ifdef __UNIXOS2__
envsave = envp; /* circumvent an EMX problem */
@ -413,10 +355,11 @@ main(int argc, char *argv[], char *envp[])
xinitrcbuf[0] = '\0';
if ((cp = getenv ("XINITRC")) != NULL) {
strcpy (xinitrcbuf, cp);
(void) snprintf (xinitrcbuf, sizeof(xinitrcbuf), "%s", cp);
required = True;
} else if ((cp = getenv ("HOME")) != NULL) {
(void) sprintf (xinitrcbuf, "%s/%s", cp, XINITRC);
(void) snprintf (xinitrcbuf, sizeof(xinitrcbuf),
"%s/%s", cp, XINITRC);
}
if (xinitrcbuf[0]) {
if (access (xinitrcbuf, F_OK) == 0) {
@ -440,10 +383,11 @@ main(int argc, char *argv[], char *envp[])
xserverrcbuf[0] = '\0';
if ((cp = getenv ("XSERVERRC")) != NULL) {
strcpy (xserverrcbuf, cp);
(void) snprintf (xserverrcbuf, sizeof(xserverrcbuf), "%s", cp);
required = True;
} else if ((cp = getenv ("HOME")) != NULL) {
(void) sprintf (xserverrcbuf, "%s/%s", cp, XSERVERRC);
(void) snprintf (xserverrcbuf, sizeof(xserverrcbuf),
"%s/%s", cp, XSERVERRC);
}
if (xserverrcbuf[0]) {
if (access (xserverrcbuf, F_OK) == 0) {
@ -706,6 +650,7 @@ setWindowPath(void)
unsigned long num;
char nums[10];
int numn;
size_t len;
prop = XInternAtom(xd, "XFree86_VT", False);
if (prop == None) {
#ifdef DEBUG
@ -761,11 +706,18 @@ setWindowPath(void)
windowpath = getenv("WINDOWPATH");
numn = snprintf(nums, sizeof(nums), "%lu", num);
if (!windowpath) {
newwindowpath = malloc(10 + 1 + numn + 1);
sprintf(newwindowpath, "WINDOWPATH=%s", nums);
len = 10 + 1 + numn + 1;
newwindowpath = malloc(len);
if (newwindowpath == NULL)
return;
snprintf(newwindowpath, len, "WINDOWPATH=%s", nums);
} else {
newwindowpath = malloc(10 + 1 + strlen(windowpath) + 1 + numn + 1);
sprintf(newwindowpath, "WINDOWPATH=%s:%s", windowpath, nums);
len = 10 + 1 + strlen(windowpath) + 1 + numn + 1;
newwindowpath = malloc(len);
if (newwindowpath == NULL)
return;
snprintf(newwindowpath, len, "WINDOWPATH=%s:%s",
windowpath, nums);
}
*newenvironlast++ = newwindowpath;
*newenvironlast = NULL;
@ -888,8 +840,7 @@ set_environment(void)
}
/* put DISPLAY=displayname as first element */
strcpy (displaybuf, "DISPLAY=");
strcpy (displaybuf + 8, displayNum);
snprintf (displaybuf, sizeof(displaybuf), "DISPLAY=%s", displayNum);
newPtr = newenviron;
*newPtr++ = displaybuf;

View File

@ -1,6 +1,6 @@
XCOMM!SHELL_CMD
XCOMM $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
XCOMM $OpenBSD: xinitrc.cpp,v 1.3 2008/04/20 13:46:02 matthieu Exp $
XCOMM $OpenBSD: xinitrc.cpp,v 1.4 2008/06/18 20:31:51 matthieu Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
@ -25,20 +25,20 @@ if [ -f $sysmodmap ]; then
XMODMAP $sysmodmap
fi
if [ -f $userresources ]; then
if [ -f "$userresources" ]; then
#ifdef __APPLE__
if [ -x /usr/bin/cpp ] ; then
XRDB -merge $userresources
XRDB -merge "$userresources"
else
XRDB -nocpp -merge $userresources
XRDB -nocpp -merge "$userresources"
fi
#else
XRDB -merge $userresources
XRDB -merge "$userresources"
#endif
fi
if [ -f $usermodmap ]; then
XMODMAP $usermodmap
if [ -f "$usermodmap" ]; then
XMODMAP "$usermodmap"
fi
XCOMM if we have private ssh key(s), start ssh-agent and add the key(s)