caf89ca402b75594db1eac2676d06769c0fe3518
[kai/samba-autobuild/.git] / testprogs / blackbox / dbcheck.sh
1 #!/bin/sh
2
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: dbcheck.sh PREFIX
6 EOF
7 exit 1;
8 fi
9
10 PREFIX="$1"
11 shift 1
12 ARGS=$@
13
14 . `dirname $0`/subunit.sh
15
16 dbcheck() {
17         $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs $ARGS
18 }
19
20 # This list of attributes can be freely extended
21 dbcheck_fix_one_way_links() {
22         $PYTHON $BINDIR/samba-tool dbcheck --quiet --fix --yes fix_all_old_dn_string_component_mismatch --attrs="lastKnownParent defaultObjectCategory fromServer rIDSetReferences" --cross-ncs $ARGS
23 }
24
25 # This list of attributes can be freely extended
26 dbcheck_fix_stale_links() {
27         $PYTHON $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
28 }
29
30 # This list of attributes can be freely extended
31 dbcheck_fix_crosspartition_backlinks() {
32         # we may not know the target yet when we receive a cross-partition link,
33         # which can result in a missing backlink
34         $PYTHON $BINDIR/samba-tool dbcheck --quiet --fix --yes fix_all_missing_backlinks --attrs="serverReference" --cross-ncs $ARGS
35 }
36
37 # This test shows that this does not do anything to a current
38 # provision (that would be a bug)
39 dbcheck_reset_well_known_acls() {
40         $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --reset-well-known-acls $ARGS
41 }
42
43 reindex() {
44         $PYTHON $BINDIR/samba-tool dbcheck --reindex $ARGS
45 }
46
47 fixed_attrs() {
48         $PYTHON $BINDIR/samba-tool dbcheck --attrs=cn $ARGS
49 }
50
51 force_modules() {
52         $PYTHON $BINDIR/samba-tool dbcheck --force-modules $ARGS
53 }
54
55 dbcheck_fix_one_way_links
56 dbcheck_fix_stale_links
57 dbcheck_fix_crosspartition_backlinks
58 testit "dbcheck" dbcheck
59 testit "reindex" reindex
60 testit "fixed_attrs" fixed_attrs
61 testit "force_modules" force_modules
62
63 exit $failed