summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/test-extended.sh
blob: 14b988e3f94f28990484edeb2cbbecaf9e5f4a7c (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
#!/bin/sh

echo "Running extended search tests"

mv $LDB_URL $LDB_URL.1

cat <<EOF | $VALGRIND ldbadd$EXEEXT || exit 1
dn: cn=testrec1,cn=TEST
i1: 1
i2: 0
i3: 1234
i4: 0x7003004

dn: cn=testrec2,cn=TEST
i1: 0x800000

dn: cn=testrec3,cn=TEST
i1: 0x101010101
i1: 7

dn: cn=auser1,cn=TEST
groupType: 2147483648
samAccountType: 805306368

dn: cn=auser2,cn=TEST
groupType: 2147483648
samAccountType: 805306369

dn: cn=auser3,cn=TEST
groupType: 2147483649
samAccountType: 805306370

dn: cn=auser4,cn=TEST
groupType: 2147483649
samAccountType: 805306369
EOF

checkcount() {
    count=$1
    expression="$2"
    n=`$VALGRIND ldbsearch$EXEEXT "$expression" | grep '^dn' | wc -l`
    if [ $n != $count ]; then
	echo "Got $n but expected $count for $expression"
	$VALGRIND ldbsearch$EXEEXT "$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))'