From e60c6c04f04022a72bf3a1074402342e948c8c0f Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 25 Jul 2018 19:05:16 +0200 Subject: check_dns: simplify loop --- plugins/check_dns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/check_dns.c') diff --git a/plugins/check_dns.c b/plugins/check_dns.c index f2061636..ae4123bf 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -168,8 +168,8 @@ main (int argc, char **argv) temp_buffer++; /* Strip leading spaces */ - for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) - /* NOOP */; + while (*temp_buffer == ' ') + temp_buffer++; strip(temp_buffer); if (temp_buffer==NULL || strlen(temp_buffer)==0) { -- cgit v1.2.3 From a03068743f3694cbdbe84bb6e802a41f270cc105 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 25 Jul 2018 20:18:47 +0200 Subject: check_dns: allow returned addresses to be in any order --- NEWS | 1 + THANKS.in | 1 + plugins/check_dns.c | 14 +++++++++----- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'plugins/check_dns.c') diff --git a/NEWS b/NEWS index 2db2a2cb..ac06aa67 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ This file documents the major additions and syntax changes between releases. check_dns: allow 'expected address' (-a) to be specified in CIDR notation (IPv4 only). check_dns: allow for IPv6 RDNS + check_dns: allow unsorted addresses check_apt: add --only-critical switch check_apt: add -l/--list option to print packages diff --git a/THANKS.in b/THANKS.in index ebc81556..9bb43828 100644 --- a/THANKS.in +++ b/THANKS.in @@ -356,3 +356,4 @@ Sven Geggus Thomas Kurschel Yannick Charton Nicolai Søborg +Rolf Eike Beer diff --git a/plugins/check_dns.c b/plugins/check_dns.c index ae4123bf..75a9dcaa 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -230,10 +230,15 @@ main (int argc, char **argv) temp_buffer = ""; for (i=0; i Date: Wed, 25 Jul 2018 21:14:47 +0200 Subject: check_dns: allow forcing complete match of all addresses --- NEWS | 1 + plugins/check_dns.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'plugins/check_dns.c') diff --git a/NEWS b/NEWS index ac06aa67..0848705c 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ This file documents the major additions and syntax changes between releases. (IPv4 only). check_dns: allow for IPv6 RDNS check_dns: allow unsorted addresses + check_dns: allow forcing complete match of all addresses check_apt: add --only-critical switch check_apt: add -l/--list option to print packages diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 75a9dcaa..25bd31dc 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -56,6 +56,7 @@ char **expected_address = NULL; int expected_address_cnt = 0; int expect_authority = FALSE; +int all_match = FALSE; thresholds *time_thresholds = NULL; static int @@ -228,6 +229,8 @@ main (int argc, char **argv) if (result == STATE_OK && expected_address_cnt > 0) { result = STATE_CRITICAL; temp_buffer = ""; + unsigned long expect_match = (1 << expected_address_cnt) - 1; + unsigned long addr_match = (1 << n_addresses) - 1; for (i=0; i