summaryrefslogtreecommitdiff
path: root/source4/setup/tests/blackbox_supported_features.sh
blob: e8c6a151c62007a7b25777fd57a7abce5c404522 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh

if [ $# -lt 1 ]; then
cat <<EOF
Usage: blackbox_supported_features.sh PREFIX
EOF
exit 1;
fi

PREFIX="$1"
shift 1

DBPATH=$PREFIX/supported-features

mkdir -p $DBPATH

. `dirname $0`/../../../testprogs/blackbox/subunit.sh

ldbmodify="ldbmodify"
if [ -x "$BINDIR/ldbmodify" ]; then
    ldbmodify="$BINDIR/ldbmodify"
fi

ldbdel="ldbdel"
if [ -x "$BINDIR/ldbdel" ]; then
    ldbdel="$BINDIR/ldbdel"
fi

ldbsearch="ldbsearch"
if [ -x "$BINDIR/ldbsearch" ]; then
    ldbsearch="$BINDIR/ldbsearch"
fi

testit "provision" $PYTHON $BINDIR/samba-tool domain provision \
       --domain=FOO --realm=foo.example.com \
       --targetdir=$DBPATH --use-ntvfs

testit "add-compatible-feature" $ldbmodify \
       -H tdb://$DBPATH/private/sam.ldb <<EOF
dn: @SAMBA_DSDB
changetype: modify
add: compatibleFeatures
compatibleFeatures: non-existent-feature
-

EOF

# The non-existent feature is not compatible with this version, so it
# should not be listed in compatibleFeatures even though we tried to
# put it there.

ldb_search_fail() {
    $ldbsearch -H tdb://$DBPATH/private/sam.ldb \
               -s base -b "$1" "$2" \
        |   grep -q "$3"
}


testit_expect_failure "find-compatible-feature" \
                      ldb_search_fail '@SAMBA_DSDB' 'compatibleFeatures' non-existent-feature


# just make sure the thing we're using is normally findable
testit "find-test-feature" \
       $ldbsearch -H tdb://$DBPATH/private/sam.ldb \
       -b 'CN=LostAndFound,DC=foo,DC=example,DC=com'


testit "add-required-feature" $ldbmodify \
       -H tdb://$DBPATH/private/sam.ldb <<EOF
dn: @SAMBA_DSDB
changetype: modify
add: requiredFeatures
requiredFeatures: futuristic-feature
-

EOF

# The futuristic-feature is not implemented in this version, but it is
# required by this database. A search for anything should fail.

testit_expect_failure "find-required-feature" \
                      $ldbsearch -H tdb://$DBPATH/private/sam.ldb \
                      -b 'CN=LostAndFound,DC=foo,DC=example,DC=com'

rm -rf $DBPATH

exit $failed