From c7d9b8245a19e203a3a11658038f8e603dad31a3 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sat, 28 Sep 2013 10:53:36 +0000 Subject: -pseu shorten test, fails --- src/gns/Makefile.am | 1 + src/gns/egos/short-zone | Bin 0 -> 827 bytes src/gns/gnunet-gns.c | 4 ++-- src/gns/test_gns_pseu_shorten.sh | 43 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/gns/egos/short-zone create mode 100755 src/gns/test_gns_pseu_shorten.sh diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 1684f6253..25061d023 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am @@ -203,6 +203,7 @@ check_SCRIPTS = \ test_gns_mx_lookup.sh \ test_gns_ns_lookup.sh \ test_gns_dht_lookup.sh\ + test_gns_pseu_shorten.sh\ test_gns_cname_lookup.sh if ENABLE_TEST_RUN diff --git a/src/gns/egos/short-zone b/src/gns/egos/short-zone new file mode 100644 index 000000000..895946037 Binary files /dev/null and b/src/gns/egos/short-zone differ diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 460626628..f57cf79a9 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -241,7 +241,7 @@ identity_shorten_cb (void *cls, struct GNUNET_CRYPTO_EccPublicSignKey *pkeym = cls; id_op = NULL; - if (NULL == ego) + if (NULL == ego) lookup_with_keys (pkeym, NULL); else lookup_with_keys (pkeym, @@ -265,7 +265,7 @@ lookup_with_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey) pkeym = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey); *pkeym = *pkey; id_op = GNUNET_IDENTITY_get (identity, - "shorten-zone", + "short-zone", &identity_shorten_cb, pkeym); if (NULL == id_op) diff --git a/src/gns/test_gns_pseu_shorten.sh b/src/gns/test_gns_pseu_shorten.sh new file mode 100755 index 000000000..c5aa44247 --- /dev/null +++ b/src/gns/test_gns_pseu_shorten.sh @@ -0,0 +1,43 @@ +#!/bin/bash +trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT +which timeout &> /dev/null && DO_TIMEOUT="timeout 5" + +TEST_IP="127.0.0.1" +TEST_PSEU="alice" +TEST_NAME="www.mybestfriendalice.gnu" +TEST_NAME_SHORT="www.alice.short.gnu" +gnunet-arm -s -c test_gns_lookup.conf +DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') +SHORT=$(gnunet-identity -c test_gns_lookup.conf -d | grep short-zone | awk '{print $3}') +gnunet-identity -C short-zone -c test_gns_lookup.conf +gnunet-identity -C delegatedego -c test_gns_lookup.conf +gnunet-identity -e short-zone -s gns-short -c test_gns_lookup.conf +gnunet-identity -C testego -c test_gns_lookup.conf -c test_gns_lookup.conf +DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') +SHORT=$(gnunet-identity -c test_gns_lookup.conf -d | grep short-zone | awk '{print $3}') +gnunet-namestore -p -z testego -a -n mybestfriendalice -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf +gnunet-namestore -p -z testego -a -n short -t PKEY -V $SHORT -e never -c test_gns_lookup.conf +gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf +gnunet-namestore -p -z delegatedego -a -n "+" -t PSEU -V $TEST_PSEU -e never -c test_gns_lookup.conf +RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_NAME -t A -c test_gns_lookup.conf` +RES_IP_PSEU=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.alice.short.gnu -t A -c test_gns_lookup.conf` +gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf +gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf +gnunet-arm -e -c test_gns_lookup.conf + +if [ "$RES_IP" == "$TEST_IP" ] +then + echo "$TEST_NAME resolved , got $RES_IP." +else + echo "Failed to resolve $TEST_NAME to proper IP, got $RES_IP." + exit 1 +fi + +if [ "$RES_IP_PSEU" == "$TEST_IP" ] +then + echo "$TEST_NAME_SHORT resolved , got $RES_IP." + exit 0 +else + echo "Failed to resolve $TEST_NAME_SHORT to proper IP, got $RES_IP_PSEU." + exit 1 +fi -- cgit v1.2.3