diff options
author | Matthias Eble <psychotrahe@users.sourceforge.net> | 2008-01-08 23:08:46 +0000 |
---|---|---|
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | 2008-01-08 23:08:46 +0000 |
commit | 7ef7071affd2d40def5b0737a7dec3e0982208a0 (patch) | |
tree | 676745309a9e035beaa95eab67c5c320f2a57d89 | |
parent | 8a4f1385270d8d7700a90f0705683187a10a664f (diff) | |
download | monitoring-plugins-7ef7071affd2d40def5b0737a7dec3e0982208a0.tar.gz |
Fixed reverse lookup damaged by previous commit
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1903 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins/check_dns.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 8ae48cd4..35658028 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -77,7 +77,7 @@ main (int argc, char **argv) { char *command_line = NULL; char input_buffer[MAX_INPUT_BUFFER]; - char *address = NULL; + char *address = NULL; /* comma seperated str with addrs/ptrs (sorted) */ char **addresses = NULL; int n_addresses = 0; char *msg = NULL; @@ -122,12 +122,17 @@ main (int argc, char **argv) /* scan stdout */ for(i = 0; i < chld_out.lines; i++) { + if (addresses == NULL) + addresses = malloc(sizeof(*addresses)*10); + else if (!(n_addresses % 10)) + addresses = realloc(addresses,sizeof(*addresses) * (n_addresses + 10)); + if (verbose) puts(chld_out.line[i]); if (strstr (chld_out.line[i], ".in-addr.arpa")) { if ((temp_buffer = strstr (chld_out.line[i], "name = "))) - address = strdup (temp_buffer + 7); + addresses[n_addresses++] = strdup (temp_buffer + 7); else { msg = (char *)_("Warning plugin error"); result = STATE_WARNING; @@ -153,10 +158,6 @@ main (int argc, char **argv) NSLOOKUP_COMMAND); } - if (addresses == NULL) - addresses = malloc(sizeof(*addresses)*10); - else if (!(n_addresses % 10)) - addresses = realloc(addresses,sizeof(*addresses) * (n_addresses + 10)); addresses[n_addresses++] = strdup(temp_buffer); } else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { |