1 #!/bin/sh 2 3 . "`dirname \"$0\"`/common.sh" 4 5 USER="mailto:vincent.vole@example.com" 6 IMPOSTER="mailto:oliver.otter@example.com" 7 SENDER="mailto:paul.boddie@example.com" 8 FBFILE="$STORE/$USER/freebusy" 9 FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER" 10 FBIMPOSTERFILE="$STORE/$SENDER/freebusy-other/$IMPOSTER" 11 12 mkdir -p "$PREFS/$USER" 13 echo 'no' > "$PREFS/$USER/participating" 14 15 mkdir -p "$PREFS/$SENDER" 16 echo 'yes' > "$PREFS/$SENDER/participating" 17 18 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \ 19 | "$SHOWMAIL" \ 20 > out0.tmp 21 22 ! grep -q 'METHOD:REPLY' out0.tmp \ 23 && echo "Success" \ 24 || echo "Failed" 25 26 # Show the request to the outgoing handler first. 27 28 "$OUTGOING_SCRIPT" < "$TEMPLATES/event-request-person.txt" $ARGS 2>> $ERROR 29 30 [ -e "$STORE/$SENDER/objects/event6@example.com" ] \ 31 && echo "Success" \ 32 || echo "Failed" 33 34 # Send a request to the recipient. 35 36 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \ 37 | "$SHOWMAIL" \ 38 > out2.tmp 39 40 ! grep -q 'METHOD:REPLY' out2.tmp \ 41 && echo "Success" \ 42 || echo "Failed" 43 44 ! [ -e "$FBFILE" ] \ 45 && echo "Success" \ 46 || echo "Failed" 47 48 ! [ -e "$FBOTHERFILE" ] \ 49 && echo "Success" \ 50 || echo "Failed" 51 52 # Make sure that the recipient ignored it. 53 54 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" < "$TEMPLATES/event-request-person-object.txt" 2>> $ERROR \ 55 | tee out3.tmp \ 56 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 57 58 ! [ -e "$FBFILE" ] \ 59 || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \ 60 && echo "Success" \ 61 || echo "Failed" 62 63 # Now see if an imposter can invite themself to the event. 64 65 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$IMPOSTER" < "$TEMPLATES/event-request-person-imposter-object.txt" 2>> $ERROR \ 66 | tee out4.tmp \ 67 | "$PERSON_SCRIPT" $ARGS 2>> $ERROR \ 68 | "$SHOWMAIL" \ 69 > out5.tmp 70 71 [ -e "$STORE/$SENDER/objects/event6@example.com" ] \ 72 && ! grep -q "otter" "$STORE/$SENDER/objects/event6@example.com" \ 73 && echo "Success" \ 74 || echo "Failed" 75 76 ( ! [ -e "$FBIMPOSTERFILE" ] \ 77 || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBIMPOSTERFILE") \ 78 && echo "Success" \ 79 || echo "Failed"