2011-07-13 10:50:24 +10:00
#!/bin/sh
if [ $# -lt 1 ] ; then
2022-04-22 15:46:04 +02:00
cat <<EOF
2011-07-13 10:50:24 +10:00
Usage: dbcheck.sh PREFIX
EOF
2022-04-22 15:46:04 +02:00
exit 1
2011-07-13 10:50:24 +10:00
fi
PREFIX = " $1 "
shift 1
2016-07-13 13:30:35 +12:00
ARGS = $@
2011-07-13 10:50:24 +10:00
2022-04-22 15:46:04 +02:00
. $( dirname $0 ) /subunit.sh
2011-07-13 10:50:24 +10:00
2022-04-22 15:46:04 +02:00
dbcheck( )
{
2018-10-10 17:14:39 +01:00
$PYTHON $BINDIR /samba-tool dbcheck --cross-ncs $ARGS
2011-07-13 10:50:24 +10:00
}
2016-07-12 09:54:14 +12:00
# This list of attributes can be freely extended
2022-04-22 15:46:04 +02:00
dbcheck_fix_one_way_links( )
{
2021-10-15 13:09:20 +13:00
$PYTHON $BINDIR /samba-tool dbcheck --quiet --fix --yes fix_all_old_dn_string_component_mismatch --attrs= "lastKnownParent defaultObjectCategory fromServer rIDSetReferences" --cross-ncs $ARGS
2016-07-12 09:54:14 +12:00
}
2016-07-14 10:36:38 +12:00
# This list of attributes can be freely extended
2022-04-22 15:46:04 +02:00
dbcheck_fix_stale_links( )
{
2022-02-11 16:30:13 +13:00
$PYTHON $BINDIR /samba-tool dbcheck --quiet --fix --yes remove_plausible_deleted_DN_links --attrs= "member msDS-NC-Replica-Locations msDS-NC-RO-Replica-Locations msDS-RevealOnDemandGroup msDS-NeverRevealGroup msDS-RevealedUsers" --cross-ncs $ARGS
2016-07-14 10:36:38 +12:00
}
2017-07-24 16:20:58 +12:00
# This list of attributes can be freely extended
2022-04-22 15:46:04 +02:00
dbcheck_fix_crosspartition_backlinks( )
{
2017-07-24 16:20:58 +12:00
# we may not know the target yet when we receive a cross-partition link,
# which can result in a missing backlink
2018-10-10 17:14:39 +01:00
$PYTHON $BINDIR /samba-tool dbcheck --quiet --fix --yes fix_all_missing_backlinks --attrs= "serverReference" --cross-ncs $ARGS
2017-07-24 16:20:58 +12:00
}
2013-03-22 17:12:43 +11:00
# This test shows that this does not do anything to a current
# provision (that would be a bug)
2022-04-22 15:46:04 +02:00
dbcheck_reset_well_known_acls( )
{
2018-10-10 17:14:39 +01:00
$PYTHON $BINDIR /samba-tool dbcheck --cross-ncs --reset-well-known-acls $ARGS
2013-03-22 17:12:43 +11:00
}
2022-04-22 15:46:04 +02:00
reindex( )
{
2018-10-10 17:14:39 +01:00
$PYTHON $BINDIR /samba-tool dbcheck --reindex $ARGS
2011-07-13 17:26:59 +10:00
}
2022-04-22 15:46:04 +02:00
fixed_attrs( )
{
2018-10-10 17:14:39 +01:00
$PYTHON $BINDIR /samba-tool dbcheck --attrs= cn $ARGS
2014-02-27 15:17:35 +13:00
}
2022-04-22 15:46:04 +02:00
force_modules( )
{
2018-10-10 17:14:39 +01:00
$PYTHON $BINDIR /samba-tool dbcheck --force-modules $ARGS
2012-08-23 15:18:13 +10:00
}
2016-07-12 09:54:14 +12:00
dbcheck_fix_one_way_links
2016-07-14 10:36:38 +12:00
dbcheck_fix_stale_links
2017-07-24 16:20:58 +12:00
dbcheck_fix_crosspartition_backlinks
2011-07-13 10:50:24 +10:00
testit "dbcheck" dbcheck
2011-07-13 17:26:59 +10:00
testit "reindex" reindex
2014-02-27 15:17:35 +13:00
testit "fixed_attrs" fixed_attrs
2012-08-23 15:18:13 +10:00
testit "force_modules" force_modules
2011-07-13 10:50:24 +10:00
exit $failed