Lines 30-42
def wait_for_drs_replication(ldap_filter, attrs=None, base=None, scope=ldb.SCOPE
|
Link Here
|
---|
|
30 |
|
30 |
|
31 |
samdb = SamDB("tdb://%s" % lp.private_path("sam.ldb"), session_info=system_session(lp), lp=lp) |
31 |
samdb = SamDB("tdb://%s" % lp.private_path("sam.ldb"), session_info=system_session(lp), lp=lp) |
32 |
controls = ["domain_scope:0"] |
32 |
controls = ["domain_scope:0"] |
|
|
33 |
base = samdb.domain_dn() |
34 |
if not base: |
35 |
if verbose: |
36 |
print 'wait_for_drs_replication(): skip, no samba domain found' |
37 |
return |
33 |
|
38 |
|
34 |
if verbose: |
39 |
if verbose: |
35 |
print "Waiting for DRS replication, filter: '%s'" % (ldap_filter, ), |
40 |
print "Waiting for DRS replication, filter: '%s'" % (ldap_filter, ), |
36 |
t = t0 = time.time() |
41 |
t = t0 = time.time() |
37 |
while t < t0 + timeout: |
42 |
while t < t0 + timeout: |
38 |
try: |
43 |
try: |
39 |
res = samdb.search(base=samdb.domain_dn(), scope=scope, expression=ldap_filter, attrs=attrs, controls=controls) |
44 |
res = samdb.search(base=base, scope=scope, expression=ldap_filter, attrs=attrs, controls=controls) |
40 |
if res: |
45 |
if res: |
41 |
if verbose: |
46 |
if verbose: |
42 |
print "\nDRS replication took %d seconds" % (t - t0, ) |
47 |
print "\nDRS replication took %d seconds" % (t - t0, ) |