From: Björn Jacke Date: Tue, 22 Dec 2020 16:28:41 +0000 (+0100) Subject: tests: also test v6 for async dns test by using dig X-Git-Tag: samba-4.14.0rc1~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f30e100b39677f9a71200d324e5f9562909a343e;p=thirdparty%2Fsamba.git tests: also test v6 for async dns test by using dig Signed-off-by: Bjoern Jacke Reviewed-by: Andrew Bartlett --- diff --git a/testprogs/blackbox/test_net_ads_dns_async.sh b/testprogs/blackbox/test_net_ads_dns_async.sh index f0bd0835b4d..b993ab260bb 100755 --- a/testprogs/blackbox/test_net_ads_dns_async.sh +++ b/testprogs/blackbox/test_net_ads_dns_async.sh @@ -24,15 +24,18 @@ net_tool="$samba4bindir/net" echo "Starting ..." test_async_dns() { - # - # Do the gethostbyname request. This just prints the IPv4 addr. - # - cmd_sync='$net_tool ads dns gethostbyname $SERVER $SERVER.$REALM' + cmd_sync='dig @$SERVER +short -t a $SERVER.$REALM' eval echo "$cmd_sync" ipv4_sync=$(eval $cmd_sync) if [ -z "$ipv4_sync" ]; then return 1 fi + cmd_sync='dig @$SERVER +short -t aaaa $SERVER.$REALM' + eval echo "$cmd_sync" + ipv6_sync=$(eval $cmd_sync) + if [ -z "$ipv6_sync" ]; then + return 1 + fi # # Do the async request. This prints out info like: @@ -50,8 +53,9 @@ test_async_dns() { # Drop everything but the IPv4 address. ipv4_async=`echo "$out_async" | grep IPv4addr | sed -e 's/^.*IPv4addr = //'` + ipv6_async=`echo "$out_async" | grep IPv6addr | sed -e 's/^.*IPv6addr = //'` - if [ -z "$ipv4_async" ]; then + if [ -z "$ipv4_async" -o -z "$ipv6_async" ]; then return 1 fi if [ "$ipv4_sync" != "$ipv4_async" ]; then @@ -59,6 +63,11 @@ test_async_dns() { echo "DNS commands output. out1=$ipv4_sync, out2=$out_async" return 1 fi + if [ "$ipv6_sync" != "$ipv6_async" ]; then + echo "DNS lookup mismatch. Sync $ipv6_sync, async $ipv6_async" + echo "DNS commands output. out1=$ipv6_sync, out2=$out_async" + return 1 + fi return 0 }