# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import ldb, sys
+import ldb
+import sys
import samba.getopt as options
from samba.auth import system_session
from samba.samdb import SamDB
def process_yes(option, opt, value, parser):
assert value is None
- done = 0
rargs = parser.rargs
if rargs:
arg = rargs[0]
Option("--reindex", dest="reindex", default=False, action="store_true", help="force database re-index"),
Option("--force-modules", dest="force_modules", default=False, action="store_true", help="force loading of Samba modules and ignore the @MODULES record (for very old databases)"),
Option("--reset-well-known-acls", dest="reset_well_known_acls", default=False, action="store_true", help="reset ACLs on objects with well known default ACL values to the default"),
+ Option("--quick-membership-checks", dest="quick_membership_checks",
+ help=("Skips missing/orphaned memberOf backlinks checks, "
+ "but speeds up dbcheck dramatically for domains with "
+ "large groups"),
+ default=False, action="store_true"),
Option("-H", "--URL", help="LDB URL for database or target server (defaults to local SAM database)",
type=str, metavar="URL", dest="H"),
+ Option("--selftest-check-expired-tombstones",
+ dest="selftest_check_expired_tombstones", default=False, action="store_true",
+ help=Option.SUPPRESS_HELP), # This is only used by tests
]
def run(self, DN=None, H=None, verbose=False, fix=False, yes=False,
cross_ncs=False, quiet=False,
scope="SUB", credopts=None, sambaopts=None, versionopts=None,
attrs=None, reindex=False, force_modules=False,
- reset_well_known_acls=False, yes_rules=[]):
+ quick_membership_checks=False,
+ reset_well_known_acls=False,
+ selftest_check_expired_tombstones=False,
+ yes_rules=[]):
lp = sambaopts.get_loadparm()
except:
raise CommandError("Failed to connect to DB at %s. If this is a really old sam.ldb (before alpha9), then try again with --force-modules" % H)
-
if H is None or not over_ldap:
samdb_schema = samdb
else:
scope_map = {"SUB": ldb.SCOPE_SUBTREE, "BASE": ldb.SCOPE_BASE, "ONE": ldb.SCOPE_ONELEVEL}
scope = scope.upper()
- if not scope in scope_map:
+ if scope not in scope_map:
raise CommandError("Unknown scope %s" % scope)
search_scope = scope_map[scope]
started_transaction = True
try:
chk = dbcheck(samdb, samdb_schema=samdb_schema, verbose=verbose,
- fix=fix, yes=yes, quiet=quiet, in_transaction=started_transaction,
+ fix=fix, yes=yes, quiet=quiet,
+ in_transaction=started_transaction,
+ quick_membership_checks=quick_membership_checks,
reset_well_known_acls=reset_well_known_acls)
for option in yes_rules: