aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2014-02-08 16:46:25 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2014-02-08 16:46:25 +0000
commit5caf86f236b1a819abdfdc5c2515bdc087b56a69 (patch)
tree56b206d4f40266a09382723f9548b25378707dfd
parentea14803789efc976c0f9d89097b1785a9325968d (diff)
-no reverse GNS
-rw-r--r--src/gns/nss/nss_gns.c98
-rw-r--r--src/gns/nss/nss_gns_query.c34
-rw-r--r--src/gns/nss/nss_gns_query.h28
3 files changed, 2 insertions, 158 deletions
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c
index d97d51fb56..77fdc26f76 100644
--- a/src/gns/nss/nss_gns.c
+++ b/src/gns/nss/nss_gns.c
@@ -253,103 +253,9 @@ enum nss_status _nss_gns_gethostbyaddr_r(
int *errnop,
int *h_errnop) {
- struct userdata u;
- enum nss_status status = NSS_STATUS_UNAVAIL;
- int r;
- size_t addr_len, idx, astart;
-
*errnop = EINVAL;
*h_errnop = NO_RECOVERY;
-
- u.count = 0;
- u.data_len = 0;
-
- addr_len = af == AF_INET ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t);
-
- if (len < (int) addr_len ||
-#ifdef NSS_IPV4_ONLY
- af != AF_INET
-#elif NSS_IPV6_ONLY
- af != AF_INET6
-#else
- (af != AF_INET && af != AF_INET6)
-#endif
- ) {
- *errnop = EINVAL;
- *h_errnop = NO_RECOVERY;
-
- goto finish;
- }
-
- if (buflen < sizeof((char*) addr_len)) {
- *errnop = ERANGE;
- *h_errnop = NO_RECOVERY;
- status = NSS_STATUS_TRYAGAIN;
- goto finish;
- }
-
-#if ! defined(NSS_IPV6_ONLY) && ! defined(NSS_IPV4_ONLY)
- if (af == AF_INET)
-#endif
-#ifndef NSS_IPV6_ONLY
- r = namecache_resolve_ip4((const ipv4_address_t*) addr, &u);
-#endif
-#if ! defined(NSS_IPV6_ONLY) && ! defined(NSS_IPV4_ONLY)
- else
-#endif
-#ifndef NSS_IPV4_ONLY
- r = namecache_resolve_ip6((const ipv6_address_t*) addr, &u);
-#endif
- if (0 > r) {
- *errnop = ETIMEDOUT;
- *h_errnop = HOST_NOT_FOUND;
- //NODE we allow to leak this into DNS so no NOTFOUND
- status = NSS_STATUS_UNAVAIL;
- goto finish;
- }
-
- *((char**) buffer) = NULL;
- result->h_aliases = (char**) buffer;
- idx = sizeof(char*);
-
- assert(u.count > 0);
- assert(u.data.name[0]);
-
- if (buflen <
- strlen(u.data.name[0])+1+ /* official names */
- sizeof(char*)+ /* alias names */
- addr_len+ /* address */
- sizeof(void*)*2 + /* address list */
- sizeof(void*)) { /* padding to get the alignment right */
- *errnop = ERANGE;
- *h_errnop = NO_RECOVERY;
- status = NSS_STATUS_TRYAGAIN;
- goto finish;
- }
-
- /* Official name */
- strcpy(buffer+idx, u.data.name[0]);
- result->h_name = buffer+idx;
- idx += strlen(u.data.name[0])+1;
-
- result->h_addrtype = af;
- result->h_length = addr_len;
-
- /* Address */
- astart = idx;
- memcpy(buffer+astart, addr, addr_len);
- idx += addr_len;
-
- /* Address array, idx might not be at pointer alignment anymore, so we need
- * to ensure it is*/
- ALIGN(idx);
-
- ((char**) (buffer+idx))[0] = buffer+astart;
- ((char**) (buffer+idx))[1] = NULL;
- result->h_addr_list = (char**) (buffer+idx);
-
- status = NSS_STATUS_SUCCESS;
-finish:
- return status;
+ //NOTE we allow to leak this into DNS so no NOTFOUND
+ return NSS_STATUS_UNAVAIL;
}
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index 9e1cdde349..91d85e88e0 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -105,38 +105,4 @@ gns_resolve_name (int af,
free (cmd);
return 0;
}
-
-#ifndef NSS_IPV6_ONLY
-/**
- * Wrapper function that uses gnunet-namecache cli tool to resolve
- * an hostnames from IPv4/6 addresses.
- *
- * @param addr the ip to resolve
- * @param u the userdata (result struct)
- * @return -1 on error else 0
- */
-int
-namecache_resolve_ip4 (const ipv4_address_t* addr,
- struct userdata *u)
-{
- return -1;
-}
-#endif
-
-#ifndef NSS_IPV4_ONLY
-/**
- * Wrapper function that uses gnunet-namecache cli tool to resolve
- * an hostnames from IPv4/6 addresses.
- *
- * @param addr the ip to resolve
- * @param u the userdata (result struct)
- * @return -1 on error else 0
- */
-int
-namecache_resolve_ip6 (const ipv6_address_t* addr,
- struct userdata *u)
-{
- return -1;
-}
-#endif
/* end of nss_gns_query.c */
diff --git a/src/gns/nss/nss_gns_query.h b/src/gns/nss/nss_gns_query.h
index 95c0d2f296..65b0311fe3 100644
--- a/src/gns/nss/nss_gns_query.h
+++ b/src/gns/nss/nss_gns_query.h
@@ -60,32 +60,4 @@ int gns_resolve_name(int af,
const char *name,
struct userdata *userdata);
-#ifndef NSS_IPV6_ONLY
-/**
- * Wrapper function that uses gnunet-namecache cli tool to resolve
- * an hostnames from IPv4/6 addresses.
- *
- * @param addr the ip to resolve
- * @param u the userdata (result struct)
- * @return -1 on error else 0
- */
-int
-namecache_resolve_ip4 (const ipv4_address_t* addr,
- struct userdata *u);
-#endif
-
-#ifndef NSS_IPV4_ONLY
-/**
- * Wrapper function that uses gnunet-namecache cli tool to resolve
- * an hostnames from IPv4/6 addresses.
- *
- * @param addr the ip to resolve
- * @param u the userdata (result struct)
- * @return -1 on error else 0
- */
-int
-namecache_resolve_ip6 (const ipv6_address_t* addr,
- struct userdata *u);
-#endif
-
#endif