diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-03-03 22:05:37 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-03-03 22:05:37 +0100 |
commit | 65377c3d9087635696f66b2444ef1d7eb39d4cd0 (patch) | |
tree | 14ff5999de78cf717e6e7b4541f469d1b24b243d /src/gns/gnunet-service-gns_interceptor.c | |
parent | cd2b8b467b218dfdd2d5124ad2d835161f3a2b1a (diff) | |
download | gnunet-65377c3d9087635696f66b2444ef1d7eb39d4cd0.tar.gz gnunet-65377c3d9087635696f66b2444ef1d7eb39d4cd0.zip |
eliminate .gnu from GNS
Diffstat (limited to 'src/gns/gnunet-service-gns_interceptor.c')
-rw-r--r-- | src/gns/gnunet-service-gns_interceptor.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index 71aa08dc5..0425e9500 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_dns_service.h" | 28 | #include "gnunet_dns_service.h" |
29 | #include "gnunet_dnsparser_lib.h" | 29 | #include "gnunet_dnsparser_lib.h" |
30 | #include "gnunet-service-gns.h" | ||
30 | #include "gnunet-service-gns_resolver.h" | 31 | #include "gnunet-service-gns_resolver.h" |
31 | #include "gnunet-service-gns_interceptor.h" | 32 | #include "gnunet-service-gns_interceptor.h" |
32 | #include "gns.h" | 33 | #include "gns.h" |
@@ -73,11 +74,6 @@ struct InterceptLookupHandle | |||
73 | static struct GNUNET_DNS_Handle *dns_handle; | 74 | static struct GNUNET_DNS_Handle *dns_handle; |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * Key of the zone we start lookups in. | ||
77 | */ | ||
78 | static struct GNUNET_CRYPTO_EcdsaPublicKey zone; | ||
79 | |||
80 | /** | ||
81 | * Head of the DLL. | 77 | * Head of the DLL. |
82 | */ | 78 | */ |
83 | static struct InterceptLookupHandle *ilh_head; | 79 | static struct InterceptLookupHandle *ilh_head; |
@@ -298,6 +294,7 @@ handle_dns_request (void *cls, | |||
298 | { | 294 | { |
299 | struct GNUNET_DNSPARSER_Packet *p; | 295 | struct GNUNET_DNSPARSER_Packet *p; |
300 | struct InterceptLookupHandle *ilh; | 296 | struct InterceptLookupHandle *ilh; |
297 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | ||
301 | 298 | ||
302 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 299 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
303 | "Hijacked a DNS request. Processing.\n"); | 300 | "Hijacked a DNS request. Processing.\n"); |
@@ -321,9 +318,9 @@ handle_dns_request (void *cls, | |||
321 | } | 318 | } |
322 | 319 | ||
323 | /* Check for GNS TLDs. */ | 320 | /* Check for GNS TLDs. */ |
324 | if ( (GNUNET_YES == is_gnu_tld (p->queries[0].name)) || | 321 | if (GNUNET_YES == |
325 | (GNUNET_YES == is_zkey_tld (p->queries[0].name)) || | 322 | GNS_find_tld (GNS_get_tld (p->queries[0].name), |
326 | (0 == strcmp (p->queries[0].name, GNUNET_GNS_TLD)) ) | 323 | &zone)) |
327 | { | 324 | { |
328 | /* Start resolution in GNS */ | 325 | /* Start resolution in GNS */ |
329 | ilh = GNUNET_new (struct InterceptLookupHandle); | 326 | ilh = GNUNET_new (struct InterceptLookupHandle); |
@@ -351,17 +348,14 @@ handle_dns_request (void *cls, | |||
351 | /** | 348 | /** |
352 | * Initialized the interceptor | 349 | * Initialized the interceptor |
353 | * | 350 | * |
354 | * @param gnu_zone the zone to work in | ||
355 | * @param c the configuration | 351 | * @param c the configuration |
356 | * @return #GNUNET_OK on success | 352 | * @return #GNUNET_OK on success |
357 | */ | 353 | */ |
358 | int | 354 | int |
359 | GNS_interceptor_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *gnu_zone, | 355 | GNS_interceptor_init (const struct GNUNET_CONFIGURATION_Handle *c) |
360 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
361 | { | 356 | { |
362 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 357 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
363 | "DNS hijacking enabled. Connecting to DNS service.\n"); | 358 | "DNS hijacking enabled. Connecting to DNS service.\n"); |
364 | zone = *gnu_zone; | ||
365 | dns_handle = GNUNET_DNS_connect (c, | 359 | dns_handle = GNUNET_DNS_connect (c, |
366 | GNUNET_DNS_FLAG_PRE_RESOLUTION, | 360 | GNUNET_DNS_FLAG_PRE_RESOLUTION, |
367 | &handle_dns_request, | 361 | &handle_dns_request, |
@@ -386,7 +380,9 @@ GNS_interceptor_done () | |||
386 | 380 | ||
387 | while (NULL != (ilh = ilh_head)) | 381 | while (NULL != (ilh = ilh_head)) |
388 | { | 382 | { |
389 | GNUNET_CONTAINER_DLL_remove (ilh_head, ilh_tail, ilh); | 383 | GNUNET_CONTAINER_DLL_remove (ilh_head, |
384 | ilh_tail, | ||
385 | ilh); | ||
390 | GNS_resolver_lookup_cancel (ilh->lookup); | 386 | GNS_resolver_lookup_cancel (ilh->lookup); |
391 | GNUNET_DNS_request_drop (ilh->request_handle); | 387 | GNUNET_DNS_request_drop (ilh->request_handle); |
392 | GNUNET_DNSPARSER_free_packet (ilh->packet); | 388 | GNUNET_DNSPARSER_free_packet (ilh->packet); |