diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_dns.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index e98c709f..a4c8e9b1 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -140,8 +140,11 @@ int main(int argc, char **argv) { | |||
140 | /* bug ID: 2946553 - Older versions of bind will use all available dns | 140 | /* bug ID: 2946553 - Older versions of bind will use all available dns |
141 | servers, we have to match the one specified */ | 141 | servers, we have to match the one specified */ |
142 | if (strstr(chld_out.line[i], "Server:") && strlen(config.dns_server) > 0) { | 142 | if (strstr(chld_out.line[i], "Server:") && strlen(config.dns_server) > 0) { |
143 | char *temp_buffer = NULL; | 143 | char *temp_buffer = strchr(chld_out.line[i], ':'); |
144 | temp_buffer = strchr(chld_out.line[i], ':'); | 144 | if (temp_buffer == NULL) { |
145 | die(STATE_UNKNOWN, _("'%s' returned a weirdly formatted Server line\n"), NSLOOKUP_COMMAND); | ||
146 | } | ||
147 | |||
145 | temp_buffer++; | 148 | temp_buffer++; |
146 | 149 | ||
147 | /* Strip leading tabs */ | 150 | /* Strip leading tabs */ |
@@ -150,7 +153,7 @@ int main(int argc, char **argv) { | |||
150 | } | 153 | } |
151 | 154 | ||
152 | strip(temp_buffer); | 155 | strip(temp_buffer); |
153 | if (temp_buffer == NULL || strlen(temp_buffer) == 0) { | 156 | if (strlen(temp_buffer) == 0) { |
154 | die(STATE_CRITICAL, _("DNS CRITICAL - '%s' returned empty server string\n"), NSLOOKUP_COMMAND); | 157 | die(STATE_CRITICAL, _("DNS CRITICAL - '%s' returned empty server string\n"), NSLOOKUP_COMMAND); |
155 | } | 158 | } |
156 | 159 | ||
@@ -163,8 +166,11 @@ int main(int argc, char **argv) { | |||
163 | if (strstr(chld_out.line[i], "Name:")) { | 166 | if (strstr(chld_out.line[i], "Name:")) { |
164 | parse_address = true; | 167 | parse_address = true; |
165 | } else if (parse_address && (strstr(chld_out.line[i], "Address:") || strstr(chld_out.line[i], "Addresses:"))) { | 168 | } else if (parse_address && (strstr(chld_out.line[i], "Address:") || strstr(chld_out.line[i], "Addresses:"))) { |
166 | char *temp_buffer = NULL; | 169 | char *temp_buffer = strchr(chld_out.line[i], ':'); |
167 | temp_buffer = index(chld_out.line[i], ':'); | 170 | if (temp_buffer == NULL) { |
171 | die(STATE_UNKNOWN, _("'%s' returned a weirdly formatted Address line\n"), NSLOOKUP_COMMAND); | ||
172 | } | ||
173 | |||
168 | temp_buffer++; | 174 | temp_buffer++; |
169 | 175 | ||
170 | /* Strip leading spaces */ | 176 | /* Strip leading spaces */ |
@@ -173,7 +179,7 @@ int main(int argc, char **argv) { | |||
173 | } | 179 | } |
174 | 180 | ||
175 | strip(temp_buffer); | 181 | strip(temp_buffer); |
176 | if (temp_buffer == NULL || strlen(temp_buffer) == 0) { | 182 | if (strlen(temp_buffer) == 0) { |
177 | die(STATE_CRITICAL, _("DNS CRITICAL - '%s' returned empty host name string\n"), NSLOOKUP_COMMAND); | 183 | die(STATE_CRITICAL, _("DNS CRITICAL - '%s' returned empty host name string\n"), NSLOOKUP_COMMAND); |
178 | } | 184 | } |
179 | 185 | ||