##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2006-2009 Apple Inc. All rights reserved.
#
# @APPLE_LICENSE_HEADER_START@
#
#
# @APPLE_LICENSE_HEADER_END@
##
-TESTROOT = ../..
+PWD = $(shell pwd)
+TESTROOT = $(PWD)/../..
include ${TESTROOT}/include/common.makefile
-run: all
- export HOME="`pwd`/hide" && ./main user
- export HOME="`pwd`/hide" && ./main-suid root
+ifeq "$(OS_NAME)" "iPhoneOS"
+ RUN_AS_USER = login -f -l mobile
+else
+ RUN_AS_USER =
+endif
-all: main main-suid
+all-check: all check
-main: main.c hide/lib/libfoo.dylib
- ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c
+check:
+ ${RUN_AS_USER} ${PASS_IFF_FAILURE} "fallback-with-suid" "fallback-with-suid" $(PWD)/main-suid
+
+all: main-suid
+
+main: main.c libfoo.dylib
+ ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c libfoo.dylib
main-suid: main
cp main main-suid
sudo chown root main-suid
sudo chmod 4755 main-suid
-hide/lib/libfoo.dylib : foo.c
- mkdir -p hide/lib
- ${CC} ${CCFLAGS} foo.c -dynamiclib -o hide/lib/libfoo.dylib
+libfoo.dylib : foo.c
+ ${CC} ${CCFLAGS} foo.c -dynamiclib -o libfoo.dylib -install_name /bogus/libz.dylib
clean:
- ${RM} ${RMFLAGS} *~ main main-suid hide
+ ${RM} ${RMFLAGS} *~ main main-suid libfoo.dylib