]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3919. [bug] dig: continue to next line if a address lookup fails
authorMark Andrews <marka@isc.org>
Fri, 22 Aug 2014 05:32:47 +0000 (15:32 +1000)
committerMark Andrews <marka@isc.org>
Fri, 22 Aug 2014 05:35:59 +0000 (15:35 +1000)
                        in batch mode. [RT #36755]

(cherry picked from commit adb503242bc427972afb9bf012e8e2af30852b5a)

CHANGES
bin/dig/dig.c

diff --git a/CHANGES b/CHANGES
index 356e6864babbde68bcdbff3ba26db04d0c52f446..dd1fc43fe31dda53ecad7c62c5634e5aa29c44fb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3919.  [bug]           dig: continue to next line if a address lookup fails
+                       in batch mode. [RT #36755]
+                       
 3918.  [doc]           Update check-spf documentation. [RT #36910]
 
 3917.  [bug]           dig, nslookup and host now continue on names that are
index d7f0b46adccf081c2894abb04757a4ad3f8e5e43..a127337c70e05bbe290a027104893ff3aefbb4d2 100644 (file)
@@ -1456,7 +1456,8 @@ preparse_args(int argc, char **argv) {
 
 static void
 parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
-          int argc, char **argv) {
+          int argc, char **argv)
+{
        isc_result_t result;
        isc_textregion_t tr;
        isc_boolean_t firstarg = ISC_TRUE;
@@ -1547,8 +1548,25 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
                debug("main parsing %s", rv[0]);
                if (strncmp(rv[0], "%", 1) == 0)
                        break;
-               if (strncmp(rv[0], "@", 1) == 0) {
-                       addresscount = getaddresses(lookup, &rv[0][1], NULL);
+               if (rv[0][0] == '@') {
+                       
+                       if (is_batchfile && !config_only) {
+                               addresscount = getaddresses(lookup, &rv[0][1],
+                                                            &result);
+                               if (result != ISC_R_SUCCESS) {
+                                       fprintf(stderr, "couldn't get address "
+                                               "for '%s': %s: skipping "
+                                               "lookup\n", &rv[0][1],
+                                               isc_result_totext(result));
+                                       if (ISC_LINK_LINKED(lookup, link))
+                                               ISC_LIST_DEQUEUE(lookup_list,
+                                                                lookup, link);
+                                       destroy_lookup(lookup);
+                                       return;
+                               }
+                       } else 
+                               addresscount = getaddresses(lookup, &rv[0][1],
+                                                           NULL);
                } else if (rv[0][0] == '+') {
                        plus_option(&rv[0][1], is_batchfile,
                                    lookup);