add changelog
[oweals/gnunet.git] / src / reclaim / test_reclaim_revoke.sh
1 #!/bin/bash
2 trap "gnunet-arm -e -c test_reclaim.conf" SIGINT
3
4 LOCATION=$(which gnunet-config)
5 if [ -z $LOCATION ]
6 then
7   LOCATION="gnunet-config"
8 fi
9 $LOCATION --version 1> /dev/null
10 if test $? != 0
11 then
12         echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13         exit 77
14 fi
15
16 rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
17
18 #  (1) PKEY1.user -> PKEY2.resu.user
19 #  (2) PKEY2.resu -> PKEY3
20 #  (3) PKEY3.user -> PKEY4
21
22
23 which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25 TEST_ATTR="test"
26 gnunet-arm -s -c test_reclaim.conf 2&>1 > /dev/null
27 gnunet-identity -C alice -c test_reclaim.conf
28 gnunet-identity -C bob -c test_reclaim.conf
29 gnunet-identity -C eve -c test_reclaim.conf
30 ALICE_KEY=$(gnunet-identity -d -e alice -q -c test_reclaim.conf)
31 BOB_KEY=$(gnunet-identity -d -e bob -q -c test_reclaim.conf)
32 EVE_KEY=$(gnunet-identity -d -e eve -q -c test_reclaim.conf)
33 gnunet-reclaim -e alice -E 15s -a email -V john@doe.gnu -c test_reclaim.conf
34 gnunet-reclaim -e alice -E 15s -a name -V John -c test_reclaim.conf
35 TICKET_BOB=$(gnunet-reclaim -e alice -i "email,name" -r $BOB_KEY -c test_reclaim.conf | awk '{print $1}')
36 #gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf
37 TICKET_EVE=$(gnunet-reclaim -e alice -i "email" -r $EVE_KEY -c test_reclaim.conf | awk '{print $1}')
38 gnunet-namestore -z alice -D
39 echo "Revoking $TICKET"
40 gnunet-reclaim -e alice -R $TICKET_EVE -c test_reclaim.conf
41 gnunet-namestore -z alice -D
42 sleep 16
43 echo "Consuming $TICKET"
44
45 gnunet-reclaim -e eve -C $TICKET_EVE -c test_reclaim.conf
46 if test $? == 0
47 then
48   echo "Eve can still resolve attributes..."
49   gnunet-arm -e -c test_reclaim.conf
50   exit 1
51 fi
52
53 gnunet-arm -e -c test_reclaim.conf
54 gnunet-arm -s -c test_reclaim.conf 2&>1 > /dev/null
55
56 gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf
57 #gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf 2&>1 >/dev/null
58 if test $? != 0
59 then
60   echo "Bob cannot resolve attributes..."
61   gnunet-arm -e -c test_reclaim.conf
62   exit 1
63 fi
64
65 gnunet-arm -e -c test_reclaim.conf