test_gns_revocation.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # This file is in the public domain.
  3. trap "gnunet-arm -e -c test_gns_lookup.conf" INT
  4. which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
  5. LOCATION=$(which gnunet-config)
  6. if [ -z $LOCATION ]
  7. then
  8. LOCATION="gnunet-config"
  9. fi
  10. $LOCATION --version 1> /dev/null
  11. if test $? != 0
  12. then
  13. echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
  14. exit 77
  15. fi
  16. rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
  17. MY_EGO="myego"
  18. OTHER_EGO="delegatedego"
  19. TEST_IP="127.0.0.1"
  20. gnunet-arm -s -c test_gns_lookup.conf
  21. gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf
  22. DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}')
  23. gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
  24. gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
  25. gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
  26. RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
  27. gnunet-revocation -R $OTHER_EGO -p -c test_gns_lookup.conf
  28. RES_IP_REV=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
  29. gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
  30. gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
  31. gnunet-arm -e -c test_gns_lookup.conf
  32. rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
  33. if [ "$RES_IP" != "$TEST_IP" ]
  34. then
  35. echo "Failed to resolve to proper IP, got $RES_IP."
  36. exit 1
  37. fi
  38. if [ "x$RES_IP_REV" = "x" ]
  39. then
  40. exit 0
  41. else
  42. echo "Failed to revoke zone, got $RES_IP_REV."
  43. exit 1
  44. fi