184 lines
7.8 KiB
Diff
184 lines
7.8 KiB
Diff
|
From 17384c3ec2eb1d11dc430765890397679699fce1 Mon Sep 17 00:00:00 2001
|
||
|
From: Tomas Hozza <thozza@redhat.com>
|
||
|
Date: Tue, 14 Apr 2015 12:05:50 +0200
|
||
|
Subject: [PATCH 2/4] libunbound examples: produce sorted output
|
||
|
|
||
|
Signed-off-by: Tomas Hozza <thozza@redhat.com>
|
||
|
---
|
||
|
libunbound/python/examples/async-lookup.py | 4 ++--
|
||
|
libunbound/python/examples/dns-lookup.py | 2 +-
|
||
|
libunbound/python/examples/dnssec-valid.py | 2 +-
|
||
|
libunbound/python/examples/dnssec_test.py | 8 ++++----
|
||
|
libunbound/python/examples/example8-1.py | 6 +++---
|
||
|
libunbound/python/examples/idn-lookup.py | 6 +++---
|
||
|
libunbound/python/examples/mx-lookup.py | 4 ++--
|
||
|
libunbound/python/examples/ns-lookup.py | 2 +-
|
||
|
libunbound/python/examples/reverse-lookup.py | 2 +-
|
||
|
9 files changed, 18 insertions(+), 18 deletions(-)
|
||
|
|
||
|
diff --git a/libunbound/python/examples/async-lookup.py b/libunbound/python/examples/async-lookup.py
|
||
|
index 81ba447..936be32 100644
|
||
|
--- a/libunbound/python/examples/async-lookup.py
|
||
|
+++ b/libunbound/python/examples/async-lookup.py
|
||
|
@@ -40,9 +40,9 @@ ctx = unbound.ub_ctx()
|
||
|
ctx.resolvconf("/etc/resolv.conf")
|
||
|
|
||
|
def call_back(my_data,status,result):
|
||
|
- print("Call_back:", my_data)
|
||
|
+ print("Call_back:", sorted(my_data))
|
||
|
if status == 0 and result.havedata:
|
||
|
- print("Result:", result.data.address_list)
|
||
|
+ print("Result:", sorted(result.data.address_list))
|
||
|
my_data['done_flag'] = True
|
||
|
|
||
|
|
||
|
diff --git a/libunbound/python/examples/dns-lookup.py b/libunbound/python/examples/dns-lookup.py
|
||
|
index ec85673..a175dfb 100644
|
||
|
--- a/libunbound/python/examples/dns-lookup.py
|
||
|
+++ b/libunbound/python/examples/dns-lookup.py
|
||
|
@@ -40,6 +40,6 @@ ctx.resolvconf("/etc/resolv.conf")
|
||
|
|
||
|
status, result = ctx.resolve("www.nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
- print("Result:", result.data.address_list)
|
||
|
+ print("Result:", sorted(result.data.address_list))
|
||
|
elif status != 0:
|
||
|
print("Error:", unbound.ub_strerror(status))
|
||
|
diff --git a/libunbound/python/examples/dnssec-valid.py b/libunbound/python/examples/dnssec-valid.py
|
||
|
index e613fd2..386f4c2 100644
|
||
|
--- a/libunbound/python/examples/dnssec-valid.py
|
||
|
+++ b/libunbound/python/examples/dnssec-valid.py
|
||
|
@@ -49,7 +49,7 @@ if os.path.isfile("keys"):
|
||
|
status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
|
||
|
- print("Result:", result.data.address_list)
|
||
|
+ print("Result:", sorted(result.data.address_list))
|
||
|
|
||
|
if result.secure:
|
||
|
print("Result is secure")
|
||
|
diff --git a/libunbound/python/examples/dnssec_test.py b/libunbound/python/examples/dnssec_test.py
|
||
|
index a90ac0c..430e51a 100644
|
||
|
--- a/libunbound/python/examples/dnssec_test.py
|
||
|
+++ b/libunbound/python/examples/dnssec_test.py
|
||
|
@@ -13,16 +13,16 @@ def dnssecParse(domain, rrType=RR_TYPE_A):
|
||
|
raise RuntimeError("Error parsing DNS packet")
|
||
|
|
||
|
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_ANSWER)
|
||
|
- print("RRSIGs from answer:", rrsigs)
|
||
|
+ print("RRSIGs from answer:", sorted(rrsigs))
|
||
|
|
||
|
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_AUTHORITY)
|
||
|
- print("RRSIGs from authority:", rrsigs)
|
||
|
+ print("RRSIGs from authority:", sorted(rrsigs))
|
||
|
|
||
|
nsecs = pkt.rr_list_by_type(RR_TYPE_NSEC, ldns.LDNS_SECTION_AUTHORITY)
|
||
|
- print("NSECs:", nsecs)
|
||
|
+ print("NSECs:", sorted(nsecs))
|
||
|
|
||
|
nsec3s = pkt.rr_list_by_type(RR_TYPE_NSEC3, ldns.LDNS_SECTION_AUTHORITY)
|
||
|
- print("NSEC3s:", nsec3s)
|
||
|
+ print("NSEC3s:", sorted(nsec3s))
|
||
|
|
||
|
print("---")
|
||
|
|
||
|
diff --git a/libunbound/python/examples/example8-1.py b/libunbound/python/examples/example8-1.py
|
||
|
index ba093d9..723c406 100644
|
||
|
--- a/libunbound/python/examples/example8-1.py
|
||
|
+++ b/libunbound/python/examples/example8-1.py
|
||
|
@@ -43,20 +43,20 @@ status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.mx_list:
|
||
|
+ for k in sorted(result.data.mx_list):
|
||
|
print(" priority:%d address:%s" % k)
|
||
|
|
||
|
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.address_list:
|
||
|
+ for k in sorted(result.data.address_list):
|
||
|
print(" address:%s" % k)
|
||
|
|
||
|
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.domain_list:
|
||
|
+ for k in sorted(result.data.domain_list):
|
||
|
print(" host: %s" % k)
|
||
|
|
||
|
diff --git a/libunbound/python/examples/idn-lookup.py b/libunbound/python/examples/idn-lookup.py
|
||
|
index 8cc63e0..f283150 100644
|
||
|
--- a/libunbound/python/examples/idn-lookup.py
|
||
|
+++ b/libunbound/python/examples/idn-lookup.py
|
||
|
@@ -46,18 +46,18 @@ status, result = ctx.resolve(u"www.háčkyčárky.cz", unbound.RR_TYPE_A, unboun
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.address_list:
|
||
|
+ for k in sorted(result.data.address_list):
|
||
|
print(" address:%s" % k)
|
||
|
|
||
|
status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.mx_list_idn:
|
||
|
+ for k in sorted(result.data.mx_list_idn):
|
||
|
print(" priority:%d address:%s" % k)
|
||
|
|
||
|
status, result = ctx.resolve(unbound.reverse('217.31.204.66')+'.in-addr.arpa', unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result.data:", result.data)
|
||
|
- for k in result.data.domain_list_idn:
|
||
|
+ for k in sorted(result.data.domain_list_idn):
|
||
|
print(" dname:%s" % k)
|
||
|
diff --git a/libunbound/python/examples/mx-lookup.py b/libunbound/python/examples/mx-lookup.py
|
||
|
index f3c4e5f..e9394b3 100644
|
||
|
--- a/libunbound/python/examples/mx-lookup.py
|
||
|
+++ b/libunbound/python/examples/mx-lookup.py
|
||
|
@@ -43,12 +43,12 @@ status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.mx_list:
|
||
|
+ for k in sorted(result.data.mx_list):
|
||
|
print(" priority:%d address:%s" % k)
|
||
|
|
||
|
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.address_list:
|
||
|
+ for k in sorted(result.data.address_list):
|
||
|
print(" address:%s" % k)
|
||
|
diff --git a/libunbound/python/examples/ns-lookup.py b/libunbound/python/examples/ns-lookup.py
|
||
|
index 5acf2a3..49f5672 100644
|
||
|
--- a/libunbound/python/examples/ns-lookup.py
|
||
|
+++ b/libunbound/python/examples/ns-lookup.py
|
||
|
@@ -43,6 +43,6 @@ status, result = ctx.resolve("vutbr.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN
|
||
|
if status == 0 and result.havedata:
|
||
|
print("Result:")
|
||
|
print(" raw data:", result.data)
|
||
|
- for k in result.data.domain_list:
|
||
|
+ for k in sorted(result.data.domain_list):
|
||
|
print(" host: %s" % k)
|
||
|
|
||
|
diff --git a/libunbound/python/examples/reverse-lookup.py b/libunbound/python/examples/reverse-lookup.py
|
||
|
index da8ab1a..c9a13fe 100644
|
||
|
--- a/libunbound/python/examples/reverse-lookup.py
|
||
|
+++ b/libunbound/python/examples/reverse-lookup.py
|
||
|
@@ -40,5 +40,5 @@ ctx.resolvconf("/etc/resolv.conf")
|
||
|
|
||
|
status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
|
||
|
if status == 0 and result.havedata:
|
||
|
- print("Result.data:", result.data, result.data.domain_list)
|
||
|
+ print("Result.data:", result.data, sorted(result.data.domain_list))
|
||
|
|
||
|
--
|
||
|
2.1.0
|
||
|
|