{
size_t nlen;
char *res;
+ const char *tld;
struct AuthorityChain *ac;
int af;
+ struct GNUNET_CRYPTO_EcdsaPublicKey zone;
nlen = strlen (cname);
- if ((nlen > 2) &&
- (0 == strcmp (".+",
- &cname[nlen - 2])))
+ tld = GNS_get_tld (cname);
+ if (0 == strcmp ("+", tld))
{
/* CNAME resolution continues relative to current domain */
if (0 == rh->name_resolution_pos)
rh);
return;
}
+ if (GNUNET_OK == GNUNET_GNSRECORD_zkey_to_pkey (tld, &zone))
+ {
+ /* CNAME resolution continues relative to current domain */
+ if (0 == rh->name_resolution_pos)
+ {
+ GNUNET_asprintf (&res,
+ "%.*s",
+ strlen (cname) - (strlen (tld) + 1),
+ cname);
+ }
+ else
+ {
+ GNUNET_asprintf (&res,
+ "%.*s.%.*s",
+ (int) rh->name_resolution_pos,
+ rh->name,
+ (int) strlen (cname) - (strlen(tld)+1),
+ cname);
+ }
+ rh->name_resolution_pos = strlen (res);
+ GNUNET_free (rh->name);
+ rh->name = res;
+ ac = GNUNET_new (struct AuthorityChain);
+ ac->rh = rh;
+ ac->gns_authority = GNUNET_YES;
+ ac->authority_info.gns_authority = zone;
+ ac->label = resolver_lookup_get_next_label (rh);
+ /* add AC to tail */
+ GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
+ rh->ac_tail,
+ ac);
+ rh->task_id = GNUNET_SCHEDULER_add_now (&recursive_resolution,
+ rh);
+ return;
+ }
+
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Got CNAME `%s' from GNS for `%s'\n",
cname,
TEST_RECORD_CNAME_DNS="gnunet.org"
TEST_RECORD_NAME_SERVER="server"
TEST_RECORD_NAME_PLUS="www"
+TEST_RECORD_NAME_ZKEY="www2"
TEST_RECORD_NAME_DNS="www3"
MY_EGO="myego"
TEST_DOMAIN_PLUS="www.$MY_EGO"
+TEST_DOMAIN_ZKEY="www2.$MY_EGO"
TEST_DOMAIN_DNS="www3.$MY_EGO"
which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+MY_EGO_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep ${MY_EGO} | awk '{print $3}')
+TEST_RECORD_CNAME_ZKEY="server.${MY_EGO_PKEY}"
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_ZKEY -t CNAME -V $TEST_RECORD_CNAME_ZKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf
RES_CNAME=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t A -c test_gns_lookup.conf`
RES_CNAME_RAW=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t CNAME -c test_gns_lookup.conf`
+RES_CNAME_ZKEY=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ZKEY -t A -c test_gns_lookup.conf`
RES_CNAME_DNS=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_DNS -t A -c test_gns_lookup.conf | grep $TEST_IP_DNS`
-echo NOW
-gnunet-gns --raw -u $TEST_DOMAIN_DNS -t A -c test_gns_lookup.conf
-echo WON
+
TESTEGOZONE=`gnunet-identity -c test_gns_lookup.conf -d | awk '{print $3}'`
gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_NAME_ZKEY -t CNAME -V $TEST_RECORD_CNAME_ZKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf
gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
if [ "$RES_CNAME" = "$TEST_IP_PLUS" ]
then
- echo "PASS: IP resolution from GNS"
+ echo "PASS: IP resolution from GNS (.+)"
+else
+ echo "FAIL: IP resolution from GNS (.+), got $RES_CNAME, expected $TEST_IP_PLUS."
+ exit 1
+fi
+
+if [ "$RES_CNAME_ZKEY" = "$TEST_IP_PLUS" ]
+then
+ echo "PASS: IP resolution from GNS (.zkey)"
else
- echo "FAIL: IP resolution from GNS, got $RES_CNAME, expected $TEST_IP_PLUS."
+ echo "FAIL: IP resolution from GNS (.zkey), got $RES_CNAME, expected $TEST_IP_PLUS."
exit 1
fi