summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2eca952)
raw | patch | inline | side by side (parent: 2eca952)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 12 Mar 2003 00:45:01 +0000 (00:45 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 12 Mar 2003 00:45:01 +0000 (00:45 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@401 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_dns.c | patch | blob | history |
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index fd798a6042b91b24238eb0a321341496e94c8425..2503293ba05bbdf9b885a2bba57ba9e5c7b0b3ad 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
result = error_scan (input_buffer);
if (result != STATE_OK) {
output = strscpy (output, 1 + index (input_buffer, ':'));
+ strip (output);
break;
}
if (error_scan (input_buffer) != STATE_OK) {
result = max_state (result, error_scan (input_buffer));
output = strscpy (output, 1 + index (input_buffer, ':'));
+ strip (output);
}
}
else
multi_address = TRUE;
- printf ("DNS ok - %-7.3f seconds response time, address%s %s|time=%-7.3f\n",
+ printf ("DNS ok - %-5.3f seconds response time, address%s %s|time=%-5.3f\n",
elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, elapsed_time);
}
else if (result == STATE_WARNING)
timeout_interval = atoi (optarg);
break;
case 'H': /* hostname */
- if (is_host (optarg) == FALSE) {
- printf ("Invalid host name/address\n\n");
- print_usage ();
- exit (STATE_UNKNOWN);
- }
if (strlen (optarg) >= ADDRESS_LENGTH)
terminate (STATE_UNKNOWN, "Input buffer overflow\n");
strcpy (query_address, optarg);
break;
case 's': /* server name */
+ /* TODO: this is_host check is probably unnecessary. Better to confirm nslookup
+ response matches */
if (is_host (optarg) == FALSE) {
printf ("Invalid server name/address\n\n");
print_usage ();
strcpy (dns_server, optarg);
break;
case 'r': /* reverse server name */
+ /* TODO: Is this is_host necessary? */
if (is_host (optarg) == FALSE) {
printf ("Invalid host name/address\n\n");
print_usage ();
strcpy (ptr_server, optarg);
break;
case 'a': /* expected address */
- if (is_addr (optarg) == FALSE) {
- printf ("Invalid expected address\n\n");
- print_usage ();
- exit (STATE_UNKNOWN);
- }
if (strlen (optarg) >= ADDRESS_LENGTH)
terminate (STATE_UNKNOWN, "Input buffer overflow\n");
strcpy (expected_address, optarg);
c = optind;
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)
terminate (STATE_UNKNOWN, "Input buffer overflow\n");
strcpy (query_address, argv[c++]);
}
if (strlen(dns_server)==0 && c<argc) {
+ /* TODO: See -s option */
if (is_host(argv[c]) == FALSE) {
printf ("Invalid name/address: %s\n\n", argv[c]);
return ERROR;