From faa71fe09c4ab56b15d664de2fba62f008432e85 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 21 Aug 2013 15:19:50 +0000 Subject: -towards .+ expansion, planning and documenting how and where --- src/gns/gnunet-service-gns_resolver.c | 47 ++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'src/gns/gnunet-service-gns_resolver.c') diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index fe9f70a1a..b131a4750 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -27,6 +27,8 @@ * TODO: * - GNS: handle special SRV names --- no delegation, direct lookup; * can likely be done in 'resolver_lookup_get_next_label'. + * - GNS: expand ".+" in returned values to the respective absolute + * name using '.zkey' * - recursive DNS resolution * - shortening triggers * - revocation checks (make optional: privacy!) @@ -1533,7 +1535,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, nlen = strlen (cname); if ( (nlen > 2) && (0 == strcmp (".+", - cname[nlen - 2])) ) + &cname[nlen - 2])) ) { /* CNAME resolution continues relative to current domain */ if (0 == rh->name_resolution_pos) @@ -1669,6 +1671,8 @@ handle_gns_resolution_result (void *cls, const char *vname; struct GNUNET_HashCode vhash; int af; + char **scratch; + unsigned int scratch_len; if (0 == rh->name_resolution_pos) { @@ -1684,8 +1688,8 @@ handle_gns_resolution_result (void *cls, GNUNET_free (cname); return; } - /* FIXME: if A/AAAA was requested, but we got a VPN - record, we should interact with GNUnet VPN here */ + /* If A/AAAA was requested, but we got a VPN + record, we convert it to A/AAAA using GNUnet VPN */ if ( (GNUNET_DNSPARSER_TYPE_A == rh->record_type) || (GNUNET_DNSPARSER_TYPE_AAAA == rh->record_type) ) { @@ -1737,10 +1741,45 @@ handle_gns_resolution_result (void *cls, } } } + /* convert relative names in record values to absolute names, + using 'scratch' array for memory allocations */ + scratch = NULL; + scratch_len = 0; + for (i=0;iproc (rh->proc_cls, rd_count, rd); GNS_resolver_lookup_cancel (rh); + for (i=0;i