summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/test-extended.sh
blob: 93ac2db6bd0f8042ed5441c922b6b77b56be0e71 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh

echo "Running extended search tests"

rm -f $LDB_URL

cat <<EOF | bin/ldbadd || exit 1
dn: testrec1
i1: 1
i2: 0
i3: 1234
i4: 0x7003004

dn: testrec2
i1: 0x800000

dn: testrec3
i1: 0x101010101
i1: 7

dn: auser1
groupType: 2147483648
samAccountType: 805306368

dn: auser2
groupType: 2147483648
samAccountType: 805306369

dn: auser3
groupType: 2147483649
samAccountType: 805306370

dn: auser4
groupType: 2147483649
samAccountType: 805306369
EOF

checkcount() {
    count=$1
    expression="$2"
    n=`bin/ldbsearch "$expression" | grep ^dn | wc -l`
    if [ $n != $count ]; then
	echo "Got $n but expected $count for $expression"
	bin/ldbsearch "$expression"
	exit 1
    fi
    echo "OK: $count $expression"
}

checkcount 1 '(i3=1234)'
checkcount 0 '(i3=12345)'

checkcount 2 '(i1:1.2.840.113556.1.4.803:=1)'
checkcount 1 '(i1:1.2.840.113556.1.4.803:=3)'
checkcount 1 '(i1:1.2.840.113556.1.4.803:=7)'
checkcount 0 '(i1:1.2.840.113556.1.4.803:=15)'
checkcount 1 '(i1:1.2.840.113556.1.4.803:=0x800000)'
checkcount 1 '(i1:1.2.840.113556.1.4.803:=8388608)'

checkcount 2 '(i1:1.2.840.113556.1.4.804:=1)'
checkcount 2 '(i1:1.2.840.113556.1.4.804:=3)'
checkcount 2 '(i1:1.2.840.113556.1.4.804:=7)'
checkcount 2 '(i1:1.2.840.113556.1.4.804:=15)'
checkcount 1 '(i1:1.2.840.113556.1.4.804:=0x800000)'
checkcount 1 '(i1:1.2.840.113556.1.4.804:=8388608)'

# this is one that w2k gives
checkcount 3 '(|(|(&(!(groupType:1.2.840.113556.1.4.803:=1))(groupType:1.2.840.113556.1.4.803:=2147483648)(groupType:1.2.840.113556.1.4.804:=10))(samAccountType=805306368))(samAccountType=805306369))'

rm -f $LDB_URL