diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-21 15:19:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-21 15:19:50 +0000 |
commit | faa71fe09c4ab56b15d664de2fba62f008432e85 (patch) | |
tree | 160da8aaff50ddc89c3a327362bf6d89bbed43be /src/gns/gnunet-service-gns_resolver.c | |
parent | b98e0afd91337dd69af31cc734376675e3c9a610 (diff) | |
download | gnunet-faa71fe09c4ab56b15d664de2fba62f008432e85.tar.gz gnunet-faa71fe09c4ab56b15d664de2fba62f008432e85.zip |
-towards .+ expansion, planning and documenting how and where
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 47 |
1 files changed, 43 insertions, 4 deletions
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 @@ | |||
27 | * TODO: | 27 | * TODO: |
28 | * - GNS: handle special SRV names --- no delegation, direct lookup; | 28 | * - GNS: handle special SRV names --- no delegation, direct lookup; |
29 | * can likely be done in 'resolver_lookup_get_next_label'. | 29 | * can likely be done in 'resolver_lookup_get_next_label'. |
30 | * - GNS: expand ".+" in returned values to the respective absolute | ||
31 | * name using '.zkey' | ||
30 | * - recursive DNS resolution | 32 | * - recursive DNS resolution |
31 | * - shortening triggers | 33 | * - shortening triggers |
32 | * - revocation checks (make optional: privacy!) | 34 | * - revocation checks (make optional: privacy!) |
@@ -1533,7 +1535,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1533 | nlen = strlen (cname); | 1535 | nlen = strlen (cname); |
1534 | if ( (nlen > 2) && | 1536 | if ( (nlen > 2) && |
1535 | (0 == strcmp (".+", | 1537 | (0 == strcmp (".+", |
1536 | cname[nlen - 2])) ) | 1538 | &cname[nlen - 2])) ) |
1537 | { | 1539 | { |
1538 | /* CNAME resolution continues relative to current domain */ | 1540 | /* CNAME resolution continues relative to current domain */ |
1539 | if (0 == rh->name_resolution_pos) | 1541 | if (0 == rh->name_resolution_pos) |
@@ -1669,6 +1671,8 @@ handle_gns_resolution_result (void *cls, | |||
1669 | const char *vname; | 1671 | const char *vname; |
1670 | struct GNUNET_HashCode vhash; | 1672 | struct GNUNET_HashCode vhash; |
1671 | int af; | 1673 | int af; |
1674 | char **scratch; | ||
1675 | unsigned int scratch_len; | ||
1672 | 1676 | ||
1673 | if (0 == rh->name_resolution_pos) | 1677 | if (0 == rh->name_resolution_pos) |
1674 | { | 1678 | { |
@@ -1684,8 +1688,8 @@ handle_gns_resolution_result (void *cls, | |||
1684 | GNUNET_free (cname); | 1688 | GNUNET_free (cname); |
1685 | return; | 1689 | return; |
1686 | } | 1690 | } |
1687 | /* FIXME: if A/AAAA was requested, but we got a VPN | 1691 | /* If A/AAAA was requested, but we got a VPN |
1688 | record, we should interact with GNUnet VPN here */ | 1692 | record, we convert it to A/AAAA using GNUnet VPN */ |
1689 | if ( (GNUNET_DNSPARSER_TYPE_A == rh->record_type) || | 1693 | if ( (GNUNET_DNSPARSER_TYPE_A == rh->record_type) || |
1690 | (GNUNET_DNSPARSER_TYPE_AAAA == rh->record_type) ) | 1694 | (GNUNET_DNSPARSER_TYPE_AAAA == rh->record_type) ) |
1691 | { | 1695 | { |
@@ -1737,10 +1741,45 @@ handle_gns_resolution_result (void *cls, | |||
1737 | } | 1741 | } |
1738 | } | 1742 | } |
1739 | } | 1743 | } |
1744 | /* convert relative names in record values to absolute names, | ||
1745 | using 'scratch' array for memory allocations */ | ||
1746 | scratch = NULL; | ||
1747 | scratch_len = 0; | ||
1748 | for (i=0;i<rd_count;i++) | ||
1749 | { | ||
1750 | /* Strategy: dnsparser should expose API to make it easier | ||
1751 | for us to parse all of these binary record values individually; | ||
1752 | then, we check if the embedded name(s) end in "+", and if so, | ||
1753 | replace the "+" with the zone at "ac_tail", changing the name | ||
1754 | to a ".zkey". The name is allocated on the 'scratch' array, | ||
1755 | so we can free it afterwards. */ | ||
1756 | switch (rd[i].record_type) | ||
1757 | { | ||
1758 | case GNUNET_DNSPARSER_TYPE_CNAME: | ||
1759 | GNUNET_break (0); // FIXME: not implemented | ||
1760 | break; | ||
1761 | case GNUNET_DNSPARSER_TYPE_SOA: | ||
1762 | GNUNET_break (0); // FIXME: not implemented | ||
1763 | break; | ||
1764 | case GNUNET_DNSPARSER_TYPE_MX: | ||
1765 | GNUNET_break (0); // FIXME: not implemented | ||
1766 | break; | ||
1767 | case GNUNET_DNSPARSER_TYPE_SRV: | ||
1768 | GNUNET_break (0); // FIXME: not implemented | ||
1769 | break; | ||
1770 | default: | ||
1771 | break; | ||
1772 | } | ||
1773 | } | ||
1740 | 1774 | ||
1741 | /* yes, we are done, return result */ | 1775 | /* yes, we are done, return result */ |
1742 | rh->proc (rh->proc_cls, rd_count, rd); | 1776 | rh->proc (rh->proc_cls, rd_count, rd); |
1743 | GNS_resolver_lookup_cancel (rh); | 1777 | GNS_resolver_lookup_cancel (rh); |
1778 | for (i=0;i<scratch_len;i++) | ||
1779 | GNUNET_free (scratch[i]); | ||
1780 | GNUNET_array_grow (scratch, | ||
1781 | scratch_len, | ||
1782 | 0); | ||
1744 | return; | 1783 | return; |
1745 | } | 1784 | } |
1746 | /* need to recurse, check if we can */ | 1785 | /* need to recurse, check if we can */ |
@@ -2370,7 +2409,7 @@ GNS_resolver_done () | |||
2370 | /* *************** common helper functions (do not really belong here) *********** */ | 2409 | /* *************** common helper functions (do not really belong here) *********** */ |
2371 | 2410 | ||
2372 | /** | 2411 | /** |
2373 | * Checks if "name" ends in ".tld" | 2412 | * Checks if @a name ends in ".TLD" |
2374 | * | 2413 | * |
2375 | * @param name the name to check | 2414 | * @param name the name to check |
2376 | * @param tld the TLD to check for | 2415 | * @param tld the TLD to check for |