diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-05-31 14:39:33 (GMT) |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-05-31 14:39:33 (GMT) |
commit | 94e8989a1bdbb8f2c3d519800667828fce6a1f97 (patch) | |
tree | 1fdd1f931811fd8725a43fc6eca50033c8d3beff /plugins/check_dns.c | |
parent | 9e8b03d67d1bfdf9fdce4202a2dc1c287c9925b7 (diff) | |
download | monitoring-plugins-94e8989a1bdbb8f2c3d519800667828fce6a1f97.tar.gz |
first revised patch failed to trap the
"break" in while()
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@527 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_dns.c')
-rw-r--r-- | plugins/check_dns.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index b110f02..88ef7d7 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -139,7 +139,9 @@ main (int argc, char **argv) | |||
139 | address = strdup (temp_buffer); | 139 | address = strdup (temp_buffer); |
140 | strip (address); | 140 | strip (address); |
141 | if (address==NULL || strlen(address)==0) | 141 | if (address==NULL || strlen(address)==0) |
142 | terminate (STATE_CRITICAL, "DNS CRITICAL - '%s' returned empty host name string", NSLOOKUP_COMMAND); | 142 | terminate (STATE_CRITICAL, |
143 | "DNS CRITICAL - '%s' returned empty host name string\n", | ||
144 | NSLOOKUP_COMMAND); | ||
143 | result = STATE_OK; | 145 | result = STATE_OK; |
144 | } | 146 | } |
145 | else { | 147 | else { |
@@ -176,6 +178,13 @@ main (int argc, char **argv) | |||
176 | output = strscpy (output, "nslookup returned error status"); | 178 | output = strscpy (output, "nslookup returned error status"); |
177 | } | 179 | } |
178 | 180 | ||
181 | /* If we got here, we should have an address string, | ||
182 | and we can segfault if we do not */ | ||
183 | if (address==NULL || strlen(address)==0) | ||
184 | terminate (STATE_CRITICAL, | ||
185 | "DNS CRITICAL - '%s' output parsing exited with no address\n", | ||
186 | NSLOOKUP_COMMAND); | ||
187 | |||
179 | /* compare to expected address */ | 188 | /* compare to expected address */ |
180 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | 189 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { |
181 | result = STATE_CRITICAL; | 190 | result = STATE_CRITICAL; |