summaryrefslogtreecommitdiffstats
path: root/plugins/check_dns.c
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2018-07-25 20:18:47 +0200
committerRolf Eike Beer <eike@sf-mail.de>2018-07-25 20:18:47 +0200
commita03068743f3694cbdbe84bb6e802a41f270cc105 (patch)
treeffaa9b710f087ec44d5f2cf1db1d04f3379c33c7 /plugins/check_dns.c
parente60c6c04f04022a72bf3a1074402342e948c8c0f (diff)
downloadmonitoring-plugins-a03068743f3694cbdbe84bb6e802a41f270cc105.tar.gz
check_dns: allow returned addresses to be in any order
Diffstat (limited to 'plugins/check_dns.c')
-rw-r--r--plugins/check_dns.c14
1 files changed, 9 insertions, 5 deletions
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)
230 temp_buffer = ""; 230 temp_buffer = "";
231 231
232 for (i=0; i<expected_address_cnt; i++) { 232 for (i=0; i<expected_address_cnt; i++) {
233 int j;
233 /* check if we get a match on 'raw' ip or cidr */ 234 /* check if we get a match on 'raw' ip or cidr */
234 if ( strcmp(address, expected_address[i]) == 0 235 for (j=0; j<n_addresses; j++) {
235 || ip_match_cidr(address, expected_address[i]) ) 236 if ( strcmp(addresses[j], expected_address[i]) == 0
236 result = STATE_OK; 237 || ip_match_cidr(addresses[j], expected_address[i]) ) {
238 result = STATE_OK;
239 break;
240 }
241 }
237 242
238 /* prepare an error string */ 243 /* prepare an error string */
239 xasprintf(&temp_buffer, "%s%s; ", temp_buffer, expected_address[i]); 244 xasprintf(&temp_buffer, "%s%s; ", temp_buffer, expected_address[i]);
@@ -530,8 +535,7 @@ print_help (void)
530 printf (" -a, --expected-address=IP-ADDRESS|CIDR|HOST\n"); 535 printf (" -a, --expected-address=IP-ADDRESS|CIDR|HOST\n");
531 printf (" %s\n", _("Optional IP-ADDRESS/CIDR you expect the DNS server to return. HOST must end")); 536 printf (" %s\n", _("Optional IP-ADDRESS/CIDR you expect the DNS server to return. HOST must end"));
532 printf (" %s\n", _("with a dot (.). This option can be repeated multiple times (Returns OK if any")); 537 printf (" %s\n", _("with a dot (.). This option can be repeated multiple times (Returns OK if any"));
533 printf (" %s\n", _("value match). If multiple addresses are returned at once, you have to match")); 538 printf (" %s\n", _("value matches)."));
534 printf (" %s\n", _("the whole string of addresses separated with commas (sorted alphabetically)."));
535 printf (" -A, --expect-authority\n"); 539 printf (" -A, --expect-authority\n");
536 printf (" %s\n", _("Optionally expect the DNS server to be authoritative for the lookup")); 540 printf (" %s\n", _("Optionally expect the DNS server to be authoritative for the lookup"));
537 printf (" -w, --warning=seconds\n"); 541 printf (" -w, --warning=seconds\n");