summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a4f138)
raw | patch | inline | side by side (parent: 8a4f138)
author | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Tue, 8 Jan 2008 23:08:46 +0000 (23:08 +0000) | ||
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Tue, 8 Jan 2008 23:08:46 +0000 (23:08 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1903 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_dns.c | patch | blob | history |
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 8ae48cd4fe94cc687f4d090f749f5f54854121f5..35658028c5f6c249e2c8091f776995c4831b2946 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
{
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;
/* 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;
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:"))) {