]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests: also test v6 for async dns test by using dig
authorBjörn Jacke <bj@sernet.de>
Tue, 22 Dec 2020 16:28:41 +0000 (17:28 +0100)
committerBjoern Jacke <bjacke@samba.org>
Wed, 23 Dec 2020 12:45:35 +0000 (12:45 +0000)
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
testprogs/blackbox/test_net_ads_dns_async.sh

index f0bd0835b4d3f560b41b83cabebe0af05eb3af55..b993ab260bb170889fd8ae24d1b24f18b896b0e9 100755 (executable)
@@ -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
 }