2011-07-13 04:50:24 +04:00
#!/bin/sh
if [ $# -lt 1 ] ; then
2022-04-22 16:46:04 +03:00
cat <<EOF
2011-07-13 04:50:24 +04:00
Usage: dbcheck.sh PREFIX
EOF
2022-04-22 16:46:04 +03:00
exit 1
2011-07-13 04:50:24 +04:00
fi
PREFIX = " $1 "
shift 1
2016-07-13 04:30:35 +03:00
ARGS = $@
2011-07-13 04:50:24 +04:00
2022-04-22 16:46:04 +03:00
. $( dirname $0 ) /subunit.sh
2011-07-13 04:50:24 +04:00
2022-04-22 16:46:04 +03:00
dbcheck( )
{
2018-10-10 19:14:39 +03:00
$PYTHON $BINDIR /samba-tool dbcheck --cross-ncs $ARGS
2011-07-13 04:50:24 +04:00
}
2016-07-12 00:54:14 +03:00
# This list of attributes can be freely extended
2022-04-22 16:46:04 +03:00
dbcheck_fix_one_way_links( )
{
2021-10-15 03:09:20 +03: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 00:54:14 +03:00
}
2016-07-14 01:36:38 +03:00
# This list of attributes can be freely extended
2022-04-22 16:46:04 +03:00
dbcheck_fix_stale_links( )
{
2022-02-11 06:30:13 +03: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 01:36:38 +03:00
}
2017-07-24 07:20:58 +03:00
# This list of attributes can be freely extended
2022-04-22 16:46:04 +03:00
dbcheck_fix_crosspartition_backlinks( )
{
2017-07-24 07:20:58 +03: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 19:14:39 +03:00
$PYTHON $BINDIR /samba-tool dbcheck --quiet --fix --yes fix_all_missing_backlinks --attrs= "serverReference" --cross-ncs $ARGS
2017-07-24 07:20:58 +03:00
}
2013-03-22 10:12:43 +04:00
# This test shows that this does not do anything to a current
# provision (that would be a bug)
2022-04-22 16:46:04 +03:00
dbcheck_reset_well_known_acls( )
{
2018-10-10 19:14:39 +03:00
$PYTHON $BINDIR /samba-tool dbcheck --cross-ncs --reset-well-known-acls $ARGS
2013-03-22 10:12:43 +04:00
}
2022-04-22 16:46:04 +03:00
reindex( )
{
2018-10-10 19:14:39 +03:00
$PYTHON $BINDIR /samba-tool dbcheck --reindex $ARGS
2011-07-13 11:26:59 +04:00
}
2022-04-22 16:46:04 +03:00
fixed_attrs( )
{
2018-10-10 19:14:39 +03:00
$PYTHON $BINDIR /samba-tool dbcheck --attrs= cn $ARGS
2014-02-27 06:17:35 +04:00
}
2022-04-22 16:46:04 +03:00
force_modules( )
{
2018-10-10 19:14:39 +03:00
$PYTHON $BINDIR /samba-tool dbcheck --force-modules $ARGS
2012-08-23 09:18:13 +04:00
}
2016-07-12 00:54:14 +03:00
dbcheck_fix_one_way_links
2016-07-14 01:36:38 +03:00
dbcheck_fix_stale_links
2017-07-24 07:20:58 +03:00
dbcheck_fix_crosspartition_backlinks
2011-07-13 04:50:24 +04:00
testit "dbcheck" dbcheck
2011-07-13 11:26:59 +04:00
testit "reindex" reindex
2014-02-27 06:17:35 +04:00
testit "fixed_attrs" fixed_attrs
2012-08-23 09:18:13 +04:00
testit "force_modules" force_modules
2011-07-13 04:50:24 +04:00
exit $failed