diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 3462701a07f6ba9a4caf73b492042cfc69642683..19649f50045bbfdde8c1a8f27239bc4b2dea11b6 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
printf ("%s\n", input_buffer);
if ((temp_buffer = index (input_buffer, ':'))) {
- address = strscpy (address, temp_buffer + 2);
+ temp_buffer++;
+ /* Strip leading spaces */
+ for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++)
+ /* NOOP */;
+ address = strscpy (address, temp_buffer);
strip (address);
result = STATE_OK;
}
}
c = optind;
- if (query_address[0] == 0) {
- if (is_host (argv[c]) == FALSE) {
+ if (strlen(query_address)==0 && c<argc) {
+ if (is_host(argv[c])==FALSE) {
printf ("Invalid name/address: %s\n\n", argv[c]);
return ERROR;
}
- if (strlen (argv[c]) >= ADDRESS_LENGTH)
+ if (strlen(argv[c])>=ADDRESS_LENGTH)
terminate (STATE_UNKNOWN, "Input buffer overflow\n");
strcpy (query_address, argv[c++]);
}
- if (dns_server[0] == 0) {
- if (is_host (argv[c]) == FALSE) {
+ if (strlen(dns_server)==0 && c<argc) {
+ if (is_host(argv[c]) == FALSE) {
printf ("Invalid name/address: %s\n\n", argv[c]);
return ERROR;
}
- if (strlen (argv[c]) >= ADDRESS_LENGTH)
+ if (strlen(argv[c]) >= ADDRESS_LENGTH)
terminate (STATE_UNKNOWN, "Input buffer overflow\n");
strcpy (dns_server, argv[c++]);
}