Merge Samba3 and Samba4 together
[sfrench/samba-autobuild/.git] / source4 / lib / ldb / tests / test-extended.sh
1 #!/bin/sh
2
3 echo "Running extended search tests"
4
5 mv $LDB_URL $LDB_URL.1
6
7 cat <<EOF | bin/ldbadd || exit 1
8 dn: cn=testrec1,cn=TEST
9 i1: 1
10 i2: 0
11 i3: 1234
12 i4: 0x7003004
13
14 dn: cn=testrec2,cn=TEST
15 i1: 0x800000
16
17 dn: cn=testrec3,cn=TEST
18 i1: 0x101010101
19 i1: 7
20
21 dn: cn=auser1,cn=TEST
22 groupType: 2147483648
23 samAccountType: 805306368
24
25 dn: cn=auser2,cn=TEST
26 groupType: 2147483648
27 samAccountType: 805306369
28
29 dn: cn=auser3,cn=TEST
30 groupType: 2147483649
31 samAccountType: 805306370
32
33 dn: cn=auser4,cn=TEST
34 groupType: 2147483649
35 samAccountType: 805306369
36 EOF
37
38 checkcount() {
39     count=$1
40     expression="$2"
41     n=`bin/ldbsearch "$expression" | grep '^dn' | wc -l`
42     if [ $n != $count ]; then
43         echo "Got $n but expected $count for $expression"
44         bin/ldbsearch "$expression"
45         exit 1
46     fi
47     echo "OK: $count $expression"
48 }
49
50 checkcount 1 '(i3=1234)'
51 checkcount 0 '(i3=12345)'
52
53 checkcount 2 '(i1:1.2.840.113556.1.4.803:=1)'
54 checkcount 1 '(i1:1.2.840.113556.1.4.803:=3)'
55 checkcount 1 '(i1:1.2.840.113556.1.4.803:=7)'
56 checkcount 0 '(i1:1.2.840.113556.1.4.803:=15)'
57 checkcount 1 '(i1:1.2.840.113556.1.4.803:=0x800000)'
58 checkcount 1 '(i1:1.2.840.113556.1.4.803:=8388608)'
59
60 checkcount 2 '(i1:1.2.840.113556.1.4.804:=1)'
61 checkcount 2 '(i1:1.2.840.113556.1.4.804:=3)'
62 checkcount 2 '(i1:1.2.840.113556.1.4.804:=7)'
63 checkcount 2 '(i1:1.2.840.113556.1.4.804:=15)'
64 checkcount 1 '(i1:1.2.840.113556.1.4.804:=0x800000)'
65 checkcount 1 '(i1:1.2.840.113556.1.4.804:=8388608)'
66
67 # this is one that w2k gives
68 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))'
69