]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/newCmsTool/blobs/cmstestHandsoff
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / clxutils / newCmsTool / blobs / cmstestHandsoff
1 #! /bin/csh -f
2 #
3 # Run cmstest, handsoff, any user, any environment.
4 # This uses a keychain we have right here for this purpose. It's insecure - we
5 # know its passphrase and use it here in the clear to unlock - and its private
6 # keys have wide-open ACLs to avoid UI. We use the root used to generate the
7 # certs in that keychain in the -A option to newCmsTool.
8 #
9 # We copy the test's keychain to ${BUILD_DIR}/cmsKeychain just to keep the UI spew to
10 # a minimum.
11 #
12
13 #
14 # safely look for this required env var
15 #
16 setenv | /usr/bin/grep LOCAL_BUILD_DIR > /dev/null
17 if($status != 0) then
18 echo Please set env var LOCAL_BUILD_DIR.
19 exit(1)
20 endif
21 set BUILD_DIR=$LOCAL_BUILD_DIR
22
23 set TESTDIR=`pwd`
24 set CMS_KEYCHAIN_SRC=cmsKeychain
25 set CMS_KEYCHAIN_DST=${BUILD_DIR}/cmsKeychain
26 set CMS_KEYCHAIN_PASSWORD=cmsKeychain
27 set CMS_KEYCHAIN_ROOT=cmsRoot.cer
28 set USER1=user1@debug.apple.com
29 set USER2=user2@debug.apple.com
30 set QUIET=
31 set OUR_QUIET=NO
32
33 while ( $#argv > 0 )
34 switch ( "$argv[1]" )
35 case -q:
36 set QUIET="-q"
37 set OUR_QUIET=YES
38 shift
39 breaksw
40 default:
41 echo "Usage: cmstestHandsoff [-q(uiet)]"
42 exit(1)
43 endsw
44 end
45
46 echo Starting cmstestHandsoff
47
48 set cmd="cp $CMS_KEYCHAIN_SRC $CMS_KEYCHAIN_DST"
49 if($OUR_QUIET == NO) then
50 echo $cmd
51 endif
52 # ignore errors here...we'll soon fail if this does
53 $cmd
54
55 set cmd="/usr/bin/security unlock -p $CMS_KEYCHAIN_PASSWORD $CMS_KEYCHAIN_DST"
56 if($OUR_QUIET == NO) then
57 echo $cmd
58 endif
59 $cmd || exit(1)
60
61 set cmd="./cmstest -s $USER1 -S $USER2 -k $CMS_KEYCHAIN_DST -a $CMS_KEYCHAIN_ROOT $QUIET"
62 if($OUR_QUIET == NO) then
63 echo $cmd
64 endif
65 $cmd || exit(1)
66
67 # and try to be nice
68 set cmd="rm $CMS_KEYCHAIN_DST"
69 if($OUR_QUIET == NO) then
70 echo $cmd
71 endif
72 $cmd || exit(1)
73
74 if($OUR_QUIET == NO) then
75 echo === cmstestHandsoff Succeeded ===
76 endif
77