diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-05-31 14:04:05 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-05-31 14:04:05 +0000 |
commit | a88f40d7e39a46dc10c4aaf42f4c1b2301caec33 (patch) | |
tree | 723d615326050f9a19d1f56b311ad4c3539c7ae3 /plugins | |
parent | 494c6b1fbefbcf79697ba8c4c158c0022ff97803 (diff) | |
download | monitoring-plugins-a88f40d7e39a46dc10c4aaf42f4c1b2301caec33.tar.gz |
trap null or empty returns from nslookup
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@524 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_dns.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 19649f50..df8359ca 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -136,12 +136,14 @@ main (int argc, char **argv) | |||
136 | /* Strip leading spaces */ | 136 | /* Strip leading spaces */ |
137 | for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | 137 | for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) |
138 | /* NOOP */; | 138 | /* NOOP */; |
139 | address = strscpy (address, temp_buffer); | 139 | address = strdup (temp_buffer); |
140 | strip (address); | 140 | strip (address); |
141 | if (address==NULL || strlen(address)==0) | ||
142 | terminate (STATE_CRITICAL, "DNS CRITICAL - '%s' returned empty host name string", %s); | ||
141 | result = STATE_OK; | 143 | result = STATE_OK; |
142 | } | 144 | } |
143 | else { | 145 | else { |
144 | output = strscpy (output, "Unknown error (plugin)"); | 146 | output = strdup ("Unknown error (plugin)"); |
145 | result = STATE_WARNING; | 147 | result = STATE_WARNING; |
146 | } | 148 | } |
147 | 149 | ||
@@ -176,9 +178,9 @@ main (int argc, char **argv) | |||
176 | 178 | ||
177 | /* compare to expected address */ | 179 | /* compare to expected address */ |
178 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | 180 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { |
179 | result = STATE_CRITICAL; | 181 | result = STATE_CRITICAL; |
180 | asprintf(&output, "expected %s but got %s", expected_address, address); | 182 | asprintf(&output, "expected %s but got %s", expected_address, address); |
181 | } | 183 | } |
182 | 184 | ||
183 | (void) time (&end_time); | 185 | (void) time (&end_time); |
184 | 186 | ||