gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [ascension] branch master updated (ff3c9c4 -> d7820ef)


From: gnunet
Subject: [GNUnet-SVN] [ascension] branch master updated (ff3c9c4 -> d7820ef)
Date: Wed, 22 May 2019 20:10:19 +0200

This is an automated email from the git hooks/post-receive script.

rexxnor pushed a change to branch master
in repository ascension.

    from ff3c9c4  implemented DNSCurve support and sub-sub-zone handling 
correctly, hopefully
     new 0bef022  added check for obsolete records, addded SOA to supported ones
     new 195317e  Merge remote-tracking branch 'gnunet/master'
     new 1859a81  fixed style and logic issues, added some comments
     new d7820ef  hotfix for a bug with labels

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ascension/ascension.py     | 71 ++++++++++++++++++++++++----------------------
 ascension/test/gnunet.zone |  2 --
 2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/ascension/ascension.py b/ascension/ascension.py
index d6bc69c..13c3192 100644
--- a/ascension/ascension.py
+++ b/ascension/ascension.py
@@ -21,7 +21,7 @@
 """
 Usage:
     ascension <domain> [-d] [-p] [-s] [--minimum-ttl=<ttl>] [--dry-run]
-    ascension <domain> <port> [-d] [-p] [-s] [--minimum-ttl=<ttl>]
+    ascension <domain> <port> [-d] [-p] [-s] [--minimum-ttl=<ttl>] [--dry-run]
     ascension <domain> -n <transferns> [-d] [-p] [-s] [--minimum-ttl=<ttl>] 
[--dry-run]
     ascension <domain> -n <transferns> <port> [-d] [-p] [-s] 
[--minimum-ttl=<ttl>] [--dry-run]
     ascension -p | --public
@@ -67,7 +67,7 @@ GNUNET_ARM_COMMAND = 'gnunet-arm'
 # in this list and not in the OBSOLETE_RECORD_TYPES list will
 # create a warning (information loss during migration).
 SUPPORTED_RECORD_TYPES = [
-    "A", "AAAA", "NS", "MX", "SRV", "TXT", "CNAME",
+    "A", "AAAA", "NS", "MX", "SRV", "TXT", "CNAME", "SOA"
 ]
 # Record types that exist in DNS but that won't ever exist in GNS
 # as they are not needed anymore (so we should not create a warning
@@ -194,7 +194,7 @@ class Ascender():
 
                 # execute thing to run on item
                 label, listofrdatasets = labelrecords
-                subzones = label.split('.')
+                subzones = str(label).split('.')
                 domain = self.domain
 
                 if len(subzones) > 1:
@@ -211,7 +211,12 @@ class Ascender():
                 for rdataset in listofrdatasets:
                     for record in rdataset:
                         rdtype = dns.rdatatype.to_text(record.rdtype)
+                        if rdtype == "SOA":
+                            continue
                         if rdtype not in SUPPORTED_RECORD_TYPES:
+                            if rdtype not in OBSOLETE_RECORD_TYPES:
+                                logging.critical("%s records not supported!",
+                                                 rdtype)
                             continue
 
                         try:
@@ -231,9 +236,9 @@ class Ascender():
                         # modify value to fit gns syntax
                         rdtype, value, label = \
                             self.transform_to_gns_format(record,
-                                                        rdtype,
-                                                        domain,
-                                                        label)
+                                                         rdtype,
+                                                         domain,
+                                                         label)
                         # skip record if value is none
                         if value is None:
                             continue
@@ -250,10 +255,6 @@ class Ascender():
                         else:
                             # build recordline
                             recordline.append("-R")
-
-                            # TODO possible regression here; maybe use a 
separate
-                            # list to pass those arguments to prevent quoting
-                            # issues in the future.
                             recordline.append('%d %s %s %s' %
                                               (int(ttl),
                                                rdtype,
@@ -269,20 +270,19 @@ class Ascender():
                 taskqueue.task_done()
         # End of worker
 
-
-
         self.create_zone_hierarchy()
 
-
         # Create one thread
         thread = threading.Thread(target=worker)
         thread.start()
 
         # add records
-        for label, value in customrdataset.items():
-            if value is None:
+        for name, rdatasets in self.zone.nodes.items():
+            # log if the rdataset is empty for some reason
+            if not rdatasets:
+                logging.warning("Empty Rdataset!")
                 continue
-            taskqueue.put((label, value))
+            taskqueue.put((name, rdatasets))
 
         # Block until all tasks are done
         taskqueue.join()
@@ -380,7 +380,7 @@ class Ascender():
             else:
                 value = "%s.%s" % (value, self.domain)
         elif rdtype == 'NS':
-            if self.subzonedict(str(label) + "." + zonename):
+            if self.subzonedict.get(str(label) + "." + zonename):
                 return (None, None, None)
             nameserver = str(record.target)
             if nameserver[-1] == ".":
@@ -583,7 +583,6 @@ class Ascender():
         """
         Creates the zone hierarchy in GNS for label
         """
-
         # Extend Dictionary using GNS identities that already exist,
         # checking for conflicts with information in DNS
         ids = sp.run([GNUNET_ZONE_CREATION_COMMAND, '-d'], stdout=sp.PIPE)
@@ -592,25 +591,29 @@ class Ascender():
         altdomainlist = [e for e in domainlist if self.domain + " " in e]
         for zone in altdomainlist:
             zonename, _, pkey = zone.split(" ")
-            if not self.subzonedict[zonename]:
+            if self.subzonedict.get(zonename) is None:
                 self.subzonedict[zonename] = (pkey, self.minimum)
             else:
+                # FIXME Christian what was that?
                 pkey_ttl = self.subzonedict[zonename]
                 self.subzonedict[zonename] = (pkey, self.minimum)
 
         # Create missing zones (and add to dict) for GNS zones that are NOT 
DNS zones
         # ("." is not a zone-cut in DNS, but always in GNS).
-        for name in self.zone.nodes():
-            # FIXME: name not right!
-            subzones = name.split('.')
-            for i in xrange(1,length(subzones)-1):
+        for name in self.zone.nodes.keys():
+            subzones = str(name).split('.')
+            # FIXME Christian: For some reason this fails spectacularly
+            for i in range(1, len(subzones)-1):
                 subdomain = ".".join(subzones[i:])
+                # FIXME Christian this seems superfluous
                 zonename = "%s.%s" % (subdomain, self.domain)
                 ttl = self.minimum # new record, cannot use existing one, 
might want to use larger value
-                if not self.subzonedict[zonename]:
-                    pkey = self.create_zone_and_get_pkey(zonename + "." + 
self.domain)
+                if self.subzonedict.get(zonename) is None:
+                    pkey = self.create_zone_and_get_pkey("%s.%s" %
+                                                         (zonename,
+                                                          self.domain))
                     self.subzonedict[zonename] = (pkey, ttl)
-                    
+
         # Check if a delegated zone is available in GNS as per NS record
         # Adds NS records that contain "gns--pkey--" to dictionary
         nsrecords = self.zone.iterate_rdatasets(dns.rdatatype.NS)
@@ -629,13 +632,14 @@ class Ascender():
             if num_gnspkeys > 1:
                 logging.critical("Detected ambiguous PKEY records for label \
                                   %s (not generating PKEY record)", name)
-                continue           
+                continue
             gnspkey = str(gnspkeys[0])
-            
-            # FIXME: test strlen(gnspkey) "right length", theoretically: 
Crockford base32 decoder...
-            zone = name + "." + self.domain
-            if not self.subzonedict[zone]:
-                self.subzonedict[zone] = (gnspkey[11:],ttl)
+
+            # FIXME: test strlen(gnspkey) "right length", theoretically:
+            # Crockford base32 decoder... -> base32-crockford looks promising
+            zone = "%s.%s" % (name, self.domain)
+            if not self.subzonedict.get(zone):
+                self.subzonedict[zone] = (gnspkey[11:], ttl)
             else:
                 # This should be impossible!!?
                 pkey_ttl = self.subzonedict[zone]
@@ -645,8 +649,7 @@ class Ascender():
                     continue
 
         # Generate PKEY records for all entries in subzonedict
-                    
-        for zone, pkeyttltuple in self.subzonedict:
+        for zone, pkeyttltuple in self.subzonedict.items():
             pkey, ttl = pkeyttltuple
             domain = ".".join(zone.split('.')[1::])
             label = zone.split('.')[0]
diff --git a/ascension/test/gnunet.zone b/ascension/test/gnunet.zone
index e44173a..a5697ec 100644
--- a/ascension/test/gnunet.zone
+++ b/ascension/test/gnunet.zone
@@ -6,9 +6,7 @@ $TTL    3600
                        604800          ; Expire
                         3600 )         ; Negative Cache TTL
 @      IN      NS      ns1.gnunet.gnu.
-@      IN      NS      
gns--pkey--7h4hfww26fmdamt243dhssens2w5qevphbm9bhv54sz3cz1053ng.gnunet.gnu.
 @      IN      A       127.0.0.1
-gns--pkey--7h4hfww26fmdamt243dhssens2w5qevphbm9bhv54sz3cz1053ng IN  A 0.0.0.0
 foo    IN      AAAA    2002::
 asdf   IN      CNAME   www
 $TTL   300

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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