gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r33561 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r33561 - gnunet/src/gns
Date: Fri, 6 Jun 2014 13:47:30 +0200

Author: grothoff
Date: 2014-06-06 13:47:30 +0200 (Fri, 06 Jun 2014)
New Revision: 33561

Modified:
   gnunet/src/gns/gnunet-gns-proxy.c
   gnunet/src/gns/plugin_gnsrecord_gns.c
Log:
handle box records in gns proxy

Modified: gnunet/src/gns/gnunet-gns-proxy.c
===================================================================
--- gnunet/src/gns/gnunet-gns-proxy.c   2014-06-06 11:41:04 UTC (rev 33560)
+++ gnunet/src/gns/gnunet-gns-proxy.c   2014-06-06 11:47:30 UTC (rev 33561)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2012-2013 Christian Grothoff (and other contributing authors)
+     (C) 2012-2014 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -1687,7 +1687,7 @@
  * @param cls NULL
  * @param connection connection handle
  * @param con_cls value as set by the last call to
- *        the MHD_AccessHandlerCallback, should be our `struct Socks5Request`
+ *        the MHD_AccessHandlerCallback, should be our `struct Socks5Request *`
  * @param toe reason for request termination (ignored)
  */
 static void
@@ -2325,7 +2325,7 @@
 /**
  * Process GNS results for target domain.
  *
- * @param cls the `struct Socks5Request`
+ * @param cls the `struct Socks5Request *`
  * @param rd_count number of records returned
  * @param rd record data
  */
@@ -2407,14 +2407,28 @@
       s5r->leho = GNUNET_strndup (r->data,
                                  r->data_size);
       break;
-    case GNUNET_DNSPARSER_TYPE_TLSA:
-      GNUNET_free_non_null (s5r->dane_data);
-      s5r->dane_data_len = r->data_size;
-      s5r->dane_data = GNUNET_malloc (r->data_size);
-      memcpy (s5r->dane_data,
-              r->data,
-              r->data_size);
-      break;
+    case GNUNET_GNSRECORD_TYPE_BOX:
+      {
+        const struct GNUNET_GNSRECORD_BoxRecord *box;
+
+        if (r->data_size < sizeof (struct GNUNET_GNSRECORD_BoxRecord))
+        {
+          GNUNET_break_op (0);
+          break;
+        }
+        box = r->data;
+        if ( (ntohl (box->record_type) != GNUNET_DNSPARSER_TYPE_TLSA) ||
+             (ntohs (box->protocol) != IPPROTO_TCP) ||
+             (ntohs (box->service) != s5r->port) )
+          break; /* BOX record does not apply */
+        GNUNET_free_non_null (s5r->dane_data);
+        s5r->dane_data_len = r->data_size - sizeof (struct 
GNUNET_GNSRECORD_BoxRecord);
+        s5r->dane_data = GNUNET_malloc (s5r->dane_data_len);
+        memcpy (s5r->dane_data,
+                &box[1],
+                s5r->dane_data_len);
+        break;
+      }
     default:
       /* don't care */
       break;

Modified: gnunet/src/gns/plugin_gnsrecord_gns.c
===================================================================
--- gnunet/src/gns/plugin_gnsrecord_gns.c       2014-06-06 11:41:04 UTC (rev 
33560)
+++ gnunet/src/gns/plugin_gnsrecord_gns.c       2014-06-06 11:47:30 UTC (rev 
33561)
@@ -26,7 +26,6 @@
  *                  map the result to A/AAAA.
  * @author Christian Grothoff
  */
-
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_gnsrecord_lib.h"
@@ -390,7 +389,7 @@
 /**
  * Exit point from the plugin.
  *
- * @param cls the return value from #libgnunet_plugin_block_test_init
+ * @param cls the return value from #libgnunet_plugin_block_test_init()
  * @return NULL
  */
 void *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]