2017-01-12 16:51:45 +13:00
#!/bin/sh
if [ $# -lt 1 ] ; then
2022-02-23 12:03:50 +01:00
cat <<EOF
2017-01-12 16:51:45 +13:00
Usage: blackbox_supported_features.sh PREFIX
EOF
2022-02-23 12:03:50 +01:00
exit 1
2017-01-12 16:51:45 +13:00
fi
PREFIX = " $1 "
shift 1
DBPATH = $PREFIX /supported-features
2017-02-10 12:30:59 +13:00
mkdir -p $DBPATH
2022-02-23 12:03:50 +01:00
. $( dirname $0 ) /../../../testprogs/blackbox/subunit.sh
2017-01-12 16:51:45 +13:00
ldbmodify = "ldbmodify"
if [ -x " $BINDIR /ldbmodify " ] ; then
2022-02-23 12:03:50 +01:00
ldbmodify = " $BINDIR /ldbmodify "
2017-01-12 16:51:45 +13:00
fi
ldbdel = "ldbdel"
if [ -x " $BINDIR /ldbdel " ] ; then
2022-02-23 12:03:50 +01:00
ldbdel = " $BINDIR /ldbdel "
2017-01-12 16:51:45 +13:00
fi
ldbsearch = "ldbsearch"
if [ -x " $BINDIR /ldbsearch " ] ; then
2022-02-23 12:03:50 +01:00
ldbsearch = " $BINDIR /ldbsearch "
2017-01-12 16:51:45 +13:00
fi
testit "provision" $PYTHON $BINDIR /samba-tool domain provision \
2022-02-23 12:03:50 +01:00
--domain= FOO --realm= foo.example.com \
--targetdir= $DBPATH --use-ntvfs
2017-01-12 16:51:45 +13:00
testit "add-compatible-feature" $ldbmodify \
2022-02-23 12:03:50 +01:00
-H tdb://$DBPATH /private/sam.ldb <<EOF
2017-01-12 16:51:45 +13:00
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.
2022-02-23 12:03:50 +01:00
ldb_search_fail( )
{
$ldbsearch -H tdb://$DBPATH /private/sam.ldb \
-s base -b " $1 " " $2 " |
grep -q " $3 "
2017-01-12 16:51:45 +13:00
}
testit_expect_failure "find-compatible-feature" \
2022-02-23 12:03:50 +01:00
ldb_search_fail '@SAMBA_DSDB' 'compatibleFeatures' non-existent-feature
2017-01-12 16:51:45 +13:00
# just make sure the thing we're using is normally findable
testit "find-test-feature" \
2022-02-23 12:03:50 +01:00
$ldbsearch -H tdb://$DBPATH /private/sam.ldb \
-b 'CN=LostAndFound,DC=foo,DC=example,DC=com'
2017-01-12 16:51:45 +13:00
testit "add-required-feature" $ldbmodify \
2022-02-23 12:03:50 +01:00
-H tdb://$DBPATH /private/sam.ldb <<EOF
2017-01-12 16:51:45 +13:00
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" \
2022-02-23 12:03:50 +01:00
$ldbsearch -H tdb://$DBPATH /private/sam.ldb \
-b 'CN=LostAndFound,DC=foo,DC=example,DC=com'
2017-01-12 16:51:45 +13:00
rm -rf $DBPATH
exit $failed