Revision: 1903
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1903&view=rev
Author: psychotrahe
Date: 2008-01-08 15:08:46 -0800 (Tue, 08 Jan 2008)
Log Message:
-----------
Fixed reverse lookup damaged by previous commit
Modified Paths:
--------------
nagiosplug/trunk/plugins/check_dns.c
Modified: nagiosplug/trunk/plugins/check_dns.c
===================================================================
--- nagiosplug/trunk/plugins/check_dns.c 2008-01-08 16:05:36 UTC (rev 1902)
+++ nagiosplug/trunk/plugins/check_dns.c 2008-01-08 23:08:46 UTC (rev 1903)
@@ -77,7 +77,7 @@
{
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 @@
/* 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 @@
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:"))) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.