diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-06 11:47:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-06 11:47:30 +0000 |
commit | f92f3f8a717f1a3b332bec4f162ad8da237f2e89 (patch) | |
tree | 9a7b78ebfd672ffefab4261748fc93c963d4a3c7 /src | |
parent | 993d64d9c8541acfe6c98b72ec286ab5c9ad674d (diff) | |
download | gnunet-f92f3f8a717f1a3b332bec4f162ad8da237f2e89.tar.gz gnunet-f92f3f8a717f1a3b332bec4f162ad8da237f2e89.zip |
handle box records in gns proxy
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 36 | ||||
-rw-r--r-- | src/gns/plugin_gnsrecord_gns.c | 3 |
2 files changed, 26 insertions, 13 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index e65cd6110..93aee2004 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2012-2013 Christian Grothoff (and other contributing authors) | 3 | (C) 2012-2014 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -1687,7 +1687,7 @@ create_response (void *cls, | |||
1687 | * @param cls NULL | 1687 | * @param cls NULL |
1688 | * @param connection connection handle | 1688 | * @param connection connection handle |
1689 | * @param con_cls value as set by the last call to | 1689 | * @param con_cls value as set by the last call to |
1690 | * the MHD_AccessHandlerCallback, should be our `struct Socks5Request` | 1690 | * the MHD_AccessHandlerCallback, should be our `struct Socks5Request *` |
1691 | * @param toe reason for request termination (ignored) | 1691 | * @param toe reason for request termination (ignored) |
1692 | */ | 1692 | */ |
1693 | static void | 1693 | static void |
@@ -2325,7 +2325,7 @@ signal_socks_success (struct Socks5Request *s5r) | |||
2325 | /** | 2325 | /** |
2326 | * Process GNS results for target domain. | 2326 | * Process GNS results for target domain. |
2327 | * | 2327 | * |
2328 | * @param cls the `struct Socks5Request` | 2328 | * @param cls the `struct Socks5Request *` |
2329 | * @param rd_count number of records returned | 2329 | * @param rd_count number of records returned |
2330 | * @param rd record data | 2330 | * @param rd record data |
2331 | */ | 2331 | */ |
@@ -2407,14 +2407,28 @@ handle_gns_result (void *cls, | |||
2407 | s5r->leho = GNUNET_strndup (r->data, | 2407 | s5r->leho = GNUNET_strndup (r->data, |
2408 | r->data_size); | 2408 | r->data_size); |
2409 | break; | 2409 | break; |
2410 | case GNUNET_DNSPARSER_TYPE_TLSA: | 2410 | case GNUNET_GNSRECORD_TYPE_BOX: |
2411 | GNUNET_free_non_null (s5r->dane_data); | 2411 | { |
2412 | s5r->dane_data_len = r->data_size; | 2412 | const struct GNUNET_GNSRECORD_BoxRecord *box; |
2413 | s5r->dane_data = GNUNET_malloc (r->data_size); | 2413 | |
2414 | memcpy (s5r->dane_data, | 2414 | if (r->data_size < sizeof (struct GNUNET_GNSRECORD_BoxRecord)) |
2415 | r->data, | 2415 | { |
2416 | r->data_size); | 2416 | GNUNET_break_op (0); |
2417 | break; | 2417 | break; |
2418 | } | ||
2419 | box = r->data; | ||
2420 | if ( (ntohl (box->record_type) != GNUNET_DNSPARSER_TYPE_TLSA) || | ||
2421 | (ntohs (box->protocol) != IPPROTO_TCP) || | ||
2422 | (ntohs (box->service) != s5r->port) ) | ||
2423 | break; /* BOX record does not apply */ | ||
2424 | GNUNET_free_non_null (s5r->dane_data); | ||
2425 | s5r->dane_data_len = r->data_size - sizeof (struct GNUNET_GNSRECORD_BoxRecord); | ||
2426 | s5r->dane_data = GNUNET_malloc (s5r->dane_data_len); | ||
2427 | memcpy (s5r->dane_data, | ||
2428 | &box[1], | ||
2429 | s5r->dane_data_len); | ||
2430 | break; | ||
2431 | } | ||
2418 | default: | 2432 | default: |
2419 | /* don't care */ | 2433 | /* don't care */ |
2420 | break; | 2434 | break; |
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c index d8fe3c649..5675599dd 100644 --- a/src/gns/plugin_gnsrecord_gns.c +++ b/src/gns/plugin_gnsrecord_gns.c | |||
@@ -26,7 +26,6 @@ | |||
26 | * map the result to A/AAAA. | 26 | * map the result to A/AAAA. |
27 | * @author Christian Grothoff | 27 | * @author Christian Grothoff |
28 | */ | 28 | */ |
29 | |||
30 | #include "platform.h" | 29 | #include "platform.h" |
31 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
32 | #include "gnunet_gnsrecord_lib.h" | 31 | #include "gnunet_gnsrecord_lib.h" |
@@ -390,7 +389,7 @@ libgnunet_plugin_gnsrecord_gns_init (void *cls) | |||
390 | /** | 389 | /** |
391 | * Exit point from the plugin. | 390 | * Exit point from the plugin. |
392 | * | 391 | * |
393 | * @param cls the return value from #libgnunet_plugin_block_test_init | 392 | * @param cls the return value from #libgnunet_plugin_block_test_init() |
394 | * @return NULL | 393 | * @return NULL |
395 | */ | 394 | */ |
396 | void * | 395 | void * |