Code

allow check to proceed using servers from resolv.conf
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>
Wed, 5 Feb 2003 05:58:35 +0000 (05:58 +0000)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>
Wed, 5 Feb 2003 05:58:35 +0000 (05:58 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@290 f882894a-f735-0410-b71e-b25c423dba1c

plugins/check_dns.c

index 3462701a07f6ba9a4caf73b492042cfc69642683..c0ea298278049237e8f86fe9a4690851e2d86052 100644 (file)
@@ -352,22 +352,22 @@ process_arguments (int argc, char **argv)
        }
 
        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++]);
        }