]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
check that delv -q -m works
authorMark Andrews <marka@isc.org>
Wed, 14 Nov 2018 00:30:50 +0000 (11:30 +1100)
committerMark Andrews <marka@isc.org>
Wed, 14 Nov 2018 00:38:08 +0000 (11:38 +1100)
bin/delv/delv.c
bin/tests/system/digdelv/tests.sh

index e83a35de57bc7ae59a706f84d663ee793e555048..ba654f4777c5f3afb83673e6b39881f50923899b 100644 (file)
@@ -1167,6 +1167,8 @@ plus_option(char *option) {
  * options: "46a:b:c:d:himp:q:t:vx:";
  */
 static const char *single_dash_opts = "46himv";
+static const char *dash_opts = "46abcdhimpqtvx";
+
 static bool
 dash_option(char *option, char *next, bool *open_type_class) {
        char opt, *value;
@@ -1392,6 +1394,20 @@ preparse_args(int argc, char **argv) {
                        }
                        option = &option[1];
                }
+               if (strlen(option) == 0U) {
+                       continue;
+               }
+               /* Look for dash value option. */
+               if (strpbrk(option, dash_opts) != &option[0] ||
+                   strlen(option) > 1U) {
+                       /* Error or value in option. */
+                       continue;
+               }
+               /* Dash value is next argument so we need to skip it. */
+               argc--, argv++;
+               /* Handle missing argument */
+               if (argc == 0)
+                       break;
        }
 }
 
index 059e5eae2731b7c8ecfd920622ef50573b80aea6..f917f5490a3f3748dad1f2ab3d37bf65913bae41 100644 (file)
@@ -503,7 +503,6 @@ if [ -x ${DIG} ] ; then
   grep "Dump of all outstanding memory allocations" dig.out.test$n > /dev/null && ret=1
   if [ $ret != 0 ]; then echo_i "failed"; fi
   status=`expr $status + $ret`
-
 else
   echo_i "$DIG is needed, so skipping these dig tests"
 fi
@@ -703,6 +702,24 @@ if [ -x ${DELV} ] ; then
   grep "a.example." < delv.out.test$n > /dev/null || ret=1
   if [ $ret != 0 ]; then echo_i "failed"; fi
   status=`expr $status + $ret`
+
+  n=`expr $n + 1`
+  echo_i "checking delv H is ignored, and treated like IN ($n)"
+  ret=0
+  $DELV $DELVOPTS @10.53.0.3 -c CH -t a a.example > delv.out.test$n || ret=1
+  grep "a.example." < delv.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo_i "failed"; fi
+  status=`expr $status + $ret`
+
+  n=`expr $n + 1`
+  echo_i "check that delv -q -m works ($n)"
+  ret=0
+  $DELV $DELVOPTS @10.53.0.3 -q -m > delv.out.test$n 2>&1
+  grep '^; -m\..*[0-9]*.*IN.*ANY.*;' delv.out.test$n > /dev/null || ret=1
+  grep "^add " delv.out.test$n > /dev/null && ret=1
+  grep "^del " delv.out.test$n > /dev/null && ret=1
+  if [ $ret != 0 ]; then echo_i "failed"; fi
+  status=`expr $status + $ret`
 else
   echo_i "$DELV is needed, so skipping these delv tests"
 fi