aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2013-09-28 10:53:36 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2013-09-28 10:53:36 +0000
commitc7d9b8245a19e203a3a11658038f8e603dad31a3 (patch)
tree5cdb2bb4adba1e94cf7f4f229cc4eacacee606af
parentae4f506a574161c3baaf071d491f8c4987bc0623 (diff)
downloadgnunet-c7d9b8245a19e203a3a11658038f8e603dad31a3.tar.gz
gnunet-c7d9b8245a19e203a3a11658038f8e603dad31a3.zip
-pseu shorten test, fails
-rw-r--r--src/gns/Makefile.am1
-rw-r--r--src/gns/egos/short-zonebin0 -> 827 bytes
-rw-r--r--src/gns/gnunet-gns.c4
-rwxr-xr-xsrc/gns/test_gns_pseu_shorten.sh43
4 files changed, 46 insertions, 2 deletions
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 = \
203 test_gns_mx_lookup.sh \ 203 test_gns_mx_lookup.sh \
204 test_gns_ns_lookup.sh \ 204 test_gns_ns_lookup.sh \
205 test_gns_dht_lookup.sh\ 205 test_gns_dht_lookup.sh\
206 test_gns_pseu_shorten.sh\
206 test_gns_cname_lookup.sh 207 test_gns_cname_lookup.sh
207 208
208if ENABLE_TEST_RUN 209if ENABLE_TEST_RUN
diff --git a/src/gns/egos/short-zone b/src/gns/egos/short-zone
new file mode 100644
index 000000000..895946037
--- /dev/null
+++ b/src/gns/egos/short-zone
Binary files 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,
241 struct GNUNET_CRYPTO_EccPublicSignKey *pkeym = cls; 241 struct GNUNET_CRYPTO_EccPublicSignKey *pkeym = cls;
242 242
243 id_op = NULL; 243 id_op = NULL;
244 if (NULL == ego) 244 if (NULL == ego)
245 lookup_with_keys (pkeym, NULL); 245 lookup_with_keys (pkeym, NULL);
246 else 246 else
247 lookup_with_keys (pkeym, 247 lookup_with_keys (pkeym,
@@ -265,7 +265,7 @@ lookup_with_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey)
265 pkeym = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey); 265 pkeym = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey);
266 *pkeym = *pkey; 266 *pkeym = *pkey;
267 id_op = GNUNET_IDENTITY_get (identity, 267 id_op = GNUNET_IDENTITY_get (identity,
268 "shorten-zone", 268 "short-zone",
269 &identity_shorten_cb, 269 &identity_shorten_cb,
270 pkeym); 270 pkeym);
271 if (NULL == id_op) 271 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 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
3which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
4
5TEST_IP="127.0.0.1"
6TEST_PSEU="alice"
7TEST_NAME="www.mybestfriendalice.gnu"
8TEST_NAME_SHORT="www.alice.short.gnu"
9gnunet-arm -s -c test_gns_lookup.conf
10DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
11SHORT=$(gnunet-identity -c test_gns_lookup.conf -d | grep short-zone | awk '{print $3}')
12gnunet-identity -C short-zone -c test_gns_lookup.conf
13gnunet-identity -C delegatedego -c test_gns_lookup.conf
14gnunet-identity -e short-zone -s gns-short -c test_gns_lookup.conf
15gnunet-identity -C testego -c test_gns_lookup.conf -c test_gns_lookup.conf
16DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
17SHORT=$(gnunet-identity -c test_gns_lookup.conf -d | grep short-zone | awk '{print $3}')
18gnunet-namestore -p -z testego -a -n mybestfriendalice -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
19gnunet-namestore -p -z testego -a -n short -t PKEY -V $SHORT -e never -c test_gns_lookup.conf
20gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
21gnunet-namestore -p -z delegatedego -a -n "+" -t PSEU -V $TEST_PSEU -e never -c test_gns_lookup.conf
22RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_NAME -t A -c test_gns_lookup.conf`
23RES_IP_PSEU=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.alice.short.gnu -t A -c test_gns_lookup.conf`
24gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
25gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
26gnunet-arm -e -c test_gns_lookup.conf
27
28if [ "$RES_IP" == "$TEST_IP" ]
29then
30 echo "$TEST_NAME resolved , got $RES_IP."
31else
32 echo "Failed to resolve $TEST_NAME to proper IP, got $RES_IP."
33 exit 1
34fi
35
36if [ "$RES_IP_PSEU" == "$TEST_IP" ]
37then
38 echo "$TEST_NAME_SHORT resolved , got $RES_IP."
39 exit 0
40else
41 echo "Failed to resolve $TEST_NAME_SHORT to proper IP, got $RES_IP_PSEU."
42 exit 1
43fi