diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-12 00:45:01 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-12 00:45:01 +0000 |
commit | 6f621a1118b854070fc34896230b09be66279cb1 (patch) | |
tree | 056609ad2665164ca54c41f83ddd2e7123d179d6 /plugins/check_dns.c | |
parent | 2eca952f2666244c4dd2c60735e6721134d0de14 (diff) | |
download | monitoring-plugins-6f621a1118b854070fc34896230b09be66279cb1.tar.gz |
Removed is_host checks to speed up code. Fixed timings so no spaces
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@401 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_dns.c')
-rw-r--r-- | plugins/check_dns.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index fd798a60..2503293b 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -154,6 +154,7 @@ main (int argc, char **argv) result = error_scan (input_buffer); if (result != STATE_OK) { output = strscpy (output, 1 + index (input_buffer, ':')); + strip (output); break; } @@ -164,6 +165,7 @@ main (int argc, char **argv) if (error_scan (input_buffer) != STATE_OK) { result = max_state (result, error_scan (input_buffer)); output = strscpy (output, 1 + index (input_buffer, ':')); + strip (output); } } @@ -191,7 +193,7 @@ main (int argc, char **argv) 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) @@ -315,16 +317,13 @@ process_arguments (int argc, char **argv) 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 (); @@ -335,6 +334,7 @@ process_arguments (int argc, char **argv) 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 (); @@ -345,11 +345,6 @@ process_arguments (int argc, char **argv) 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); @@ -360,16 +355,13 @@ process_arguments (int argc, char **argv) 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; |