From: Mark Andrews Date: Wed, 14 Nov 2018 00:30:50 +0000 (+1100) Subject: check that delv -q -m works X-Git-Tag: v9.13.4~30^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77128c867c037b8208da074bd94957e6211e938d;p=thirdparty%2Fbind9.git check that delv -q -m works --- diff --git a/bin/delv/delv.c b/bin/delv/delv.c index e83a35de57b..ba654f4777c 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -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; } } diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index 059e5eae273..f917f5490a3 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -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