Schanzenbach, Martin 5 years ago
parent
commit
e3a229625e

+ 1 - 0
src/gns/Makefile.am

@@ -280,6 +280,7 @@ check_SCRIPTS = \
   test_gns_config_lookup.sh \
   test_gns_ipv6_lookup.sh\
   test_gns_txt_lookup.sh\
+  test_gns_caa_lookup.sh\
   test_gns_mx_lookup.sh \
   test_gns_gns2dns_lookup.sh \
   test_gns_gns2dns_cname_lookup.sh \

+ 37 - 0
src/gns/test_gns_caa_lookup.sh

@@ -0,0 +1,37 @@
+#!/bin/sh
+# This file is in the public domain.
+trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
+
+LOCATION=$(which gnunet-config)
+if [ -z $LOCATION ]
+then
+  LOCATION="gnunet-config"
+fi
+$LOCATION --version 1> /dev/null
+if test $? != 0
+then
+	echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
+	exit 77
+fi
+
+rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
+which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
+TEST_CAA="0 issue ca.example.net; policy=ev"
+MY_EGO="myego"
+LABEL="testcaa"
+gnunet-arm -s -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t CAA -V "$TEST_CAA" -e never -c test_gns_lookup.conf
+RES_CAA=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t CAA -c test_gns_lookup.conf`
+gnunet-namestore -z $MY_EGO -d -n $LABEL -t CAA -V "$TEST_CAA" -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
+gnunet-arm -e -c test_gns_lookup.conf
+rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
+
+if [ "$RES_CAA" = "$TEST_CAA" ]
+then
+  exit 0
+else
+  echo "Failed to resolve to proper CAA, got '$RES_CAA'."
+  exit 1
+fi

File diff suppressed because it is too large
+ 477 - 507
src/gnsrecord/plugin_gnsrecord_dns.c


+ 22 - 1
src/include/gnunet_dnsparser_lib.h

@@ -11,7 +11,7 @@
       WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       Affero General Public License for more details.
-     
+
       You should have received a copy of the GNU Affero General Public License
       along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -86,6 +86,7 @@
 #define GNUNET_DNSPARSER_TYPE_TSIG 250
 #define GNUNET_DNSPARSER_TYPE_ALL 255
 #define GNUNET_DNSPARSER_TYPE_URI 256
+#define GNUNET_DNSPARSER_TYPE_CAA 257
 #define GNUNET_DNSPARSER_TYPE_TA 32768
 
 /**
@@ -398,6 +399,26 @@ struct GNUNET_DNSPARSER_SoaRecord
 };
 
 
+/**
+ * Information from CAA records (RFC 6844).
+ * The tag is followed by the tag_len.
+ * The value is followed by the tag for (d - tag_len - 2) bytes
+ */
+struct GNUNET_DNSPARSER_CaaRecord
+{
+  /**
+   * The flags of the CAA record.
+   */
+  uint8_t flags;
+
+  /**
+   * The length of the tag.
+   */
+  uint8_t tag_len;
+};
+
+
+
 /**
  * Binary record information (unparsed).
  */

Some files were not shown because too many files changed in this diff