[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [ascension] 19/57: fixed some minor bugs
From: |
gnunet |
Subject: |
[GNUnet-SVN] [ascension] 19/57: fixed some minor bugs |
Date: |
Sat, 13 Apr 2019 13:32:16 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository ascension.
commit 1fb4d54b0140366e8709eb28f02edda9008e8c15
Author: rexxnor <address@hidden>
AuthorDate: Thu Oct 11 23:23:18 2018 +0200
fixed some minor bugs
---
gnsmigrator/gnsmigrator.py | 49 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 39 insertions(+), 10 deletions(-)
diff --git a/gnsmigrator/gnsmigrator.py b/gnsmigrator/gnsmigrator.py
index 00e9bd7..f11c211 100644
--- a/gnsmigrator/gnsmigrator.py
+++ b/gnsmigrator/gnsmigrator.py
@@ -203,23 +203,21 @@ class BaseMigrator():
:param domain: full domain of zone
"""
for record in zone.iterate_rdatas():
- # fancy dictionary because switch case does not exist in python
dnsname_str = str(record[0])
rtype_str = dns.rdatatype.to_text(record[2].rdtype)
- print(dnsname_str)
- print(rtype_str)
if dnsname_str == '@':
if rtype_str == 'SOA':
BaseMigrator.add_soa_record_to_gns(record, zonename,
domain)
- print("Record type %s is not yet supported" % rtype_str)
else:
if rtype_str == 'NS' and dnsname_str != '@':
BaseMigrator.add_ns_record_to_gns(record, zonename, domain)
elif rtype_str == 'MX':
BaseMigrator.add_mx_record_to_gns(record, zonename)
+ #elif rtype_str == 'SRV':
+ # BaseMigrator.add_srv_record_to_gns(record, zonename)
elif rtype_str in ['A', 'AAAA']:
BaseMigrator.add_a_aaaa_record_to_gns(record, zonename,
domain)
- elif rtype_str in ['TXT', 'SRV', 'CNAME']:
+ elif rtype_str in ['TXT', 'CNAME']:
BaseMigrator.add_gen_record_to_gns(record, zonename)
else:
print("Record type %s is not yet supported" % rtype_str)
@@ -232,13 +230,38 @@ class BaseMigrator():
"""
if not BaseMigrator.check_if_record_exists_in_zone(record, zonename):
dnsname, ttl, rdata = record
+ rtype_str = str(dns.rdatatype.to_text(rdata.rdtype))
sp.run([GNUNET_NAMESTORE_COMMAND,
'-z', zonename,
'-a', '-n', str(dnsname),
- '-t', dns.rdatatype.to_text(rdata.rdtype),
+ '-t', rtype_str,
'-V', str(rdata),
'-e', '%ds' % ttl])
+ @staticmethod
+ def add_srv_record_to_gns(record, zonename):
+ # TODO Add support for SRV records
+ """
+ Adds a SRV record to GNS
+ """
+ if not BaseMigrator.check_if_record_exists_in_zone(record, zonename):
+ value, ttl, rdata = record
+ rtype_str = str(dns.rdatatype.to_text(rdata.rdtype))
+ dnsname_str = str(rdata).split(' ')[3]
+ debug = " ".join([GNUNET_NAMESTORE_COMMAND,
+ '-z', zonename,
+ '-a', '-n', dnsname_str,
+ '-t', rtype_str,
+ '-V', str(value),
+ '-e', '%ds' % ttl])
+ print(debug)
+ sp.run([GNUNET_NAMESTORE_COMMAND,
+ '-z', zonename,
+ '-a', '-n', dnsname_str,
+ '-t', rtype_str,
+ '-V', str(value),
+ '-e', '%ds' % ttl])
+
@staticmethod
def add_a_aaaa_record_to_gns(record, zonename, domain):
"""
@@ -246,10 +269,11 @@ class BaseMigrator():
"""
if not BaseMigrator.check_if_record_exists_in_zone(record, zonename):
dnsname, ttl, rdata = record
+ rtype_str = str(dns.rdatatype.to_text(rdata.rdtype))
sp.run([GNUNET_NAMESTORE_COMMAND,
'-z', zonename,
'-a', '-n', str(dnsname),
- '-t', str(dns.rdatatype.to_text(rdata.rdtype)),
+ '-t', rtype_str,
'-V', str(rdata),
'-e', '%ds' % ttl])
sp.run([GNUNET_NAMESTORE_COMMAND,
@@ -270,6 +294,10 @@ class BaseMigrator():
zonetuple = str(rdata).split(' ')
domain = str(".".join(domain.split('.')[:-1]))
authns, owner, serial, refresh, retry, expiry, irefresh = zonetuple
+ if authns[-1] == '.':
+ authns = authns[:-1]
+ if owner[-1] == '.':
+ owner = owner[:-1]
sp.call([GNUNET_NAMESTORE_COMMAND,
'-z', zonename,
'-a', '-n', '@',
@@ -344,13 +372,14 @@ class BaseMigrator():
"""
Checks if the given record exists in GNS
"""
- dnsname, _, rtype = record
+ dnsname, _, rdata = record
+ rtype_str = str(dns.rdatatype.to_text(rdata.rdtype))
ret = sp.check_output([GNUNET_GNS_COMMAND,
- '-t', str(rtype),
+ '-t', rtype_str,
'-u', '%s.%s' %
(dnsname, zonename)]
)
- if 'Got:'.encode() in ret:
+ if 'Got '.encode() in ret:
return True
return False
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [ascension] 06/57: working prototype for A, AAAA, MX, CNAME, TXT and more records, (continued)
- [GNUnet-SVN] [ascension] 06/57: working prototype for A, AAAA, MX, CNAME, TXT and more records, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 20/57: fixed zonemaster to zonedata in README, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 12/57: bumped version to 0.1.0, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 16/57: fixed special cases with GNS2DNS, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 14/57: reworked the incremental zone transfer, added notice for bind, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 11/57: added ttl of SOA to zone for later implementation of timer, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 05/57: initial prototype, bootstrapping zones and zone transfer, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 24/57: fixed zone serialisation, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 17/57: updated requirements and README, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 36/57: some experimental fixes, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 19/57: fixed some minor bugs,
gnunet <=
- [GNUnet-SVN] [ascension] 15/57: created baseclass and separated small from big zones, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 21/57: fixed serial fetching and added serialization of zone, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 13/57: added zone merging of full and incremental zones, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 29/57: added warnings to logging if records failed to be added, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 27/57: unstable version, port specification possible, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 02/57: Added LICENSE, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 18/57: refactored adding of records, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 08/57: added GNS2DNS support and rudimentary Unittests (incomplete), gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 23/57: fixed non existing file, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 42/57: added dnscurve detection and log it, fix ttl bug with hierarchy, gnunet, 2019/04/13