self.outf.write("Namespaces[%d]%s:\n" % (
len(fti.entries), tln_string))
- for i in xrange(0, len(fti.entries)):
- e = fti.entries[i]
+ for i, e in enumerate(fti.entries):
flags = e.flags
collision_string = ""
update_spn_vals.extend(stored_spn_vals)
for upn in add_upn:
- idx = None
- for i in xrange(0, len(update_upn_vals)):
- v = update_upn_vals[i]
- if v.lower() != upn.lower():
- continue
- idx = i
- break
- if idx is not None:
- raise CommandError("Entry already present for value[%s] specified for --add-upn-suffix" % upn)
+ for i, v in enumerate(update_upn_vals):
+ if v.lower() == upn.lower():
+ raise CommandError("Entry already present for "
+ "value[%s] specified for "
+ "--add-upn-suffix" % upn)
update_upn_vals.append(upn)
replace_upn = True
for upn in delete_upn:
idx = None
- for i in xrange(0, len(update_upn_vals)):
- v = update_upn_vals[i]
+ for i, v in enumerate(update_upn_vals):
if v.lower() != upn.lower():
continue
idx = i
replace_upn = True
for spn in add_spn:
- idx = None
- for i in xrange(0, len(update_spn_vals)):
- v = update_spn_vals[i]
- if v.lower() != spn.lower():
- continue
- idx = i
- break
- if idx is not None:
- raise CommandError("Entry already present for value[%s] specified for --add-spn-suffix" % spn)
+ for i, v in enumerate(update_spn_vals):
+ if v.lower() == spn.lower():
+ raise CommandError("Entry already present for "
+ "value[%s] specified for "
+ "--add-spn-suffix" % spn)
update_spn_vals.append(spn)
replace_spn = True
for spn in delete_spn:
idx = None
- for i in xrange(0, len(update_spn_vals)):
- v = update_spn_vals[i]
+ for i, v in enumerate(update_spn_vals):
if v.lower() != spn.lower():
continue
idx = i
update_forest_info.entries = entries
if enable_all:
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME:
continue
if update_forest_info.entries[i].flags == 0:
continue
update_forest_info.entries[i].time = 0
update_forest_info.entries[i].flags &= ~lsa.LSA_TLN_DISABLED_MASK
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO:
continue
if update_forest_info.entries[i].flags == 0:
for tln in enable_tln:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME:
continue
if r.forest_trust_data.string.lower() != tln.lower():
for tln in disable_tln:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME:
continue
if r.forest_trust_data.string.lower() != tln.lower():
for tln_ex in add_tln_ex:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX:
continue
if r.forest_trust_data.string.lower() != tln_ex.lower():
tln_dot = ".%s" % tln_ex.lower()
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME:
continue
r_dot = ".%s" % r.forest_trust_data.string.lower()
for tln_ex in delete_tln_ex:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX:
continue
if r.forest_trust_data.string.lower() != tln_ex.lower():
for nb in enable_nb:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO:
continue
if r.forest_trust_data.netbios_domain_name.string.upper() != nb.upper():
for nb in disable_nb:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO:
continue
if r.forest_trust_data.netbios_domain_name.string.upper() != nb.upper():
for sid in enable_sid:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO:
continue
if r.forest_trust_data.domain_sid != sid:
for sid in disable_sid:
idx = None
- for i in xrange(0, len(update_forest_info.entries)):
- r = update_forest_info.entries[i]
+ for i, r in enumerate(update_forest_info.entries):
if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO:
continue
if r.forest_trust_data.domain_sid != sid: