From 2a6c4b35cb14571520c8aa3295c0c5490f153f1f Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Tue, 2 May 2017 12:14:20 +0200 Subject: [PATCH] Fix unit tests to allow for fixed IPSECKEY --- .../260-conversion-functions.c | 10 ++++++++-- .../260-conversion-functions.good | 2 ++ .../tpkg/265-supported-rrs.tpkg/265-supported-rrs.good | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.c b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.c index 16933760..0e69eb4c 100644 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.c +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.c @@ -70,6 +70,7 @@ int main(int argc, char const * const argv[]) FILE *in; uint8_t wire_buf[8200]; size_t i; + size_t uavailable; int available; char str_buf[10000]; int str_len = sizeof(str_buf); @@ -300,15 +301,20 @@ int main(int argc, char const * const argv[]) * Then fill a string buffer with those rr_dicts. */ available = wire - wire_buf; + if (available < 0) { + fprintf(stderr, "Negative sized buffer!\n"); + exit(EXIT_FAILURE); + } + uavailable = available; wire = wire_buf; str = str_buf; str_len = sizeof(str_buf); - while (available > 0 && str_len > 0) { + while (uavailable > 0 && str_len > 0) { rr_dict = NULL; if ((r = getdns_wire2rr_dict_scan( - (const uint8_t **)&wire, &available, &rr_dict))) + (const uint8_t **)&wire, &uavailable, &rr_dict))) FAIL_r("getdns_wire2rr_dict_scan"); if ((r = getdns_rr_dict2str_scan(rr_dict, &str, &str_len))) diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.good b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.good index 47278b10..9079ef9a 100644 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.good +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.good @@ -1478,6 +1478,7 @@ apl.net-dns.org. 3600 IN APL 1:192.168.42.0/26 1:192.168.42.64/26 !1:192.168.42. "algorithm": 10, "gateway_type": 0, "precedence": 2, + "public_key": , "rdata_raw": }, "ttl": 30, @@ -1536,6 +1537,7 @@ apl.net-dns.org. 3600 IN APL 1:192.168.42.0/26 1:192.168.42.64/26 !1:192.168.42. "algorithm": 10, "gateway_type": 0, "precedence": 2, + "public_key": , "rdata_raw": }, "ttl": 30, diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.good b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.good index c48d3178..4fa8af97 100644 --- a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.good +++ b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.good @@ -395,6 +395,7 @@ "algorithm": 10, "gateway_type": 0, "precedence": 2, + "public_key": , "rdata_raw": }, "ttl": 30, @@ -453,6 +454,7 @@ "algorithm": 10, "gateway_type": 0, "precedence": 2, + "public_key": , "rdata_raw": }, "ttl": 30, @@ -1000,7 +1002,7 @@ } ] ;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 0 -;; flags: ; QUERY: 0, ANSWER: 75, AUTHORITY: 0, ADDITIONAL: 0 +;; flags: ; QUERY: 0, ANSWER: 77, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;; ANSWER SECTION: @@ -1033,9 +1035,11 @@ eui64.net-dns.org. 30 IN EUI64 00-00-5e-ef-10-00-00-2a gpos.net-dns.org. 30 IN GPOS "-32.6882" "116.8652" "10.0" hinfo.net-dns.org. 30 IN HINFO "CPU" "OS" hip.net-dns.org. 30 IN HIP 2 200100107B1A74DF365639CC39F1D578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbWIy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+bSRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D +ipseckey0.net-dns.org. 30 IN IPSECKEY 10 0 2 . AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== ipseckey1.net-dns.org. 30 IN IPSECKEY 10 1 2 192.0.2.38 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== ipseckey2.net-dns.org. 30 IN IPSECKEY 10 2 2 2001:db8:0:8002::2000:1 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== ipseckey3.net-dns.org. 30 IN IPSECKEY 10 3 2 mygateway.example.com. AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== +ipseckey.net-dns.org. 30 IN IPSECKEY 10 0 2 . AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== ipseckey.net-dns.org. 30 IN IPSECKEY 10 1 2 192.0.2.38 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== ipseckey.net-dns.org. 30 IN IPSECKEY 10 2 2 2001:db8:0:8002::2000:1 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== ipseckey.net-dns.org. 30 IN IPSECKEY 10 3 2 mygateway.example.com. AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ== @@ -1083,5 +1087,5 @@ x25.net-dns.org. 30 IN X25 "1234567" ;; AUTHORITY SECTION: ;; ADDITIONAL SECTION: -;; MSG SIZE rcvd: 5189 +;; MSG SIZE rcvd: 5328