summaryrefslogtreecommitdiffstats
path: root/source3/script/tests/test_net_lookup.sh
blob: ee183335550dfb227489fe749bc486dafcdea362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

if [ $# != 6 ]; then
	echo "Usage: $0 SERVER USERNAME PASSWORD NET SAMBA-TOOL DNS-ZONE"
	exit 1
fi

SERVER="$1"
shift 1
USERNAME="$1"
shift 1
PASSWORD="$1"
shift 1
NET="$1"
shift 1
SAMBATOOL="$1"
shift 1
DNSZONE="$1"
shift 1

SITE="mysite"

incdir=$(dirname $0)/../../../testprogs/blackbox
. $incdir/subunit.sh

failed=0

$SAMBATOOL dns add "$SERVER" -U "$USERNAME"%"$PASSWORD" \
	_msdcs."$DNSZONE" _ldap._tcp."$SITE"._sites.dc \
	SRV "mydc.$DNSZONE 389 100 100"
$SAMBATOOL dns add "$SERVER" -U "$USERNAME"%"$PASSWORD" \
	"$DNSZONE" mydc \
	A "1.2.3.4"

# global lookup
testit_grep global 10.53.57.30:389 $NET lookup ldap "$DNSZONE" ||
	failed=$(expr $failed + 1)

# correct site-aware lookup
testit_grep site-aware 1.2.3.4:389 $NET lookup ldap "$DNSZONE" "$SITE" ||
	failed=$(expr $failed + 1)

# lookup with nonexisting site -- global fallback
testit_grep global 10.53.57.30:389 $NET lookup ldap "$DNSZONE" nosite ||
	failed=$(expr $failed + 1)

$SAMBATOOL dns delete "$SERVER" -U "$USERNAME"%"$PASSWORD" \
	"$DNSZONE" mydc \
	A "1.2.3.4"
$SAMBATOOL dns delete "$SERVER" -U "$USERNAME"%"$PASSWORD" \
	_msdcs."$DNSZONE" _ldap._tcp."$SITE"._sites.dc \
	SRV "mydc.$DNSZONE 389 100 100"

testok $0 $failed