2011-07-13 10:50:24 +10:00
#!/bin/sh
if [ $# -lt 1 ] ; then
cat <<EOF
Usage: dbcheck.sh PREFIX
EOF
exit 1;
fi
PREFIX = " $1 "
shift 1
2016-07-13 13:30:35 +12:00
ARGS = $@
2011-07-13 10:50:24 +10:00
. ` dirname $0 ` /subunit.sh
dbcheck( ) {
2016-07-13 13:30:35 +12:00
$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
dbcheck_fix_one_way_links( ) {
2016-07-13 13:30:35 +12:00
$BINDIR /samba-tool dbcheck --quiet --fix --yes fix_all_string_dn_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
dbcheck_fix_stale_links( ) {
2016-07-21 15:34:13 +12:00
$BINDIR /samba-tool dbcheck --quiet --fix --yes remove_plausible_deleted_DN_links --attrs= "member msDS-NC-Replica-Locations msDS-NC-RO-Replica-Locations" --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
dbcheck_fix_crosspartition_backlinks( ) {
# we may not know the target yet when we receive a cross-partition link,
# which can result in a missing backlink
$BINDIR /samba-tool dbcheck --quiet --fix --yes fix_all_missing_backlinks --attrs= "serverReference" --cross-ncs $ARGS
}
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)
dbcheck_reset_well_known_acls( ) {
2016-07-13 13:30:35 +12:00
$BINDIR /samba-tool dbcheck --cross-ncs --reset-well-known-acls $ARGS
2013-03-22 17:12:43 +11:00
}
2011-07-13 17:26:59 +10:00
reindex( ) {
2016-07-13 13:30:35 +12:00
$BINDIR /samba-tool dbcheck --reindex $ARGS
2011-07-13 17:26:59 +10:00
}
2014-02-27 15:17:35 +13:00
fixed_attrs( ) {
2016-07-13 13:30:35 +12:00
$BINDIR /samba-tool dbcheck --attrs= cn $ARGS
2014-02-27 15:17:35 +13:00
}
2012-08-23 15:18:13 +10:00
force_modules( ) {
2016-07-13 13:30:35 +12:00
$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