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 diff --git a/plugins/check_dns.c b/plugins/check_dns.c index f206163..ae4123b 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 v0.10-9-g596f 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 diff --git a/NEWS b/NEWS index 2db2a2c..ac06aa6 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 ebc8155..9bb4382 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 ae4123b..75a9dca 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 diff --git a/NEWS b/NEWS index ac06aa6..0848705 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 75a9dca..25bd31d 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