0f979abc7eb703902b7df06a8b50c36fd208c990
[samba.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         $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         $BINDIR/samba-tool dbcheck --quiet --fix --yes fix_all_string_dn_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         $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 test shows that this does not do anything to a current
31 # provision (that would be a bug)
32 dbcheck_reset_well_known_acls() {
33         $BINDIR/samba-tool dbcheck --cross-ncs --reset-well-known-acls $ARGS
34 }
35
36 reindex() {
37         $BINDIR/samba-tool dbcheck --reindex $ARGS
38 }
39
40 fixed_attrs() {
41         $BINDIR/samba-tool dbcheck --attrs=cn $ARGS
42 }
43
44 force_modules() {
45         $BINDIR/samba-tool dbcheck --force-modules $ARGS
46 }
47
48 dbcheck_fix_one_way_links
49 dbcheck_fix_stale_links
50 testit "dbcheck" dbcheck
51 testit "reindex" reindex
52 testit "fixed_attrs" fixed_attrs
53 testit "force_modules" force_modules
54
55 exit $failed