Commit 455c083e authored by Joseph Sutton's avatar Joseph Sutton Committed by Andreas Schneider
Browse files

python: Remove redundant assignments



Signed-off-by: Joseph Sutton's avatarJoseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider's avatarAndreas Schneider <asn@samba.org>
parent 139f00c3
......@@ -1181,7 +1181,7 @@ def generate_clangdb(bld):
lst = tg.tasks
for task in lst:
try:
cmd = task.last_cmd
task.last_cmd
except AttributeError:
continue
if isinstance(task, task_classes):
......
......@@ -39,16 +39,16 @@ if __name__ == "__main__":
dns_conn = dnsserver.dnsserver(binding_str, lp, creds)
print("querying a NS record")
res = dns_conn.DnssrvEnumRecords2(0x00070000,
0,
server,
dnszone,
newname,
None,
dnsp.DNS_TYPE_NS,
0x0f,
None,
None)
dns_conn.DnssrvEnumRecords2(0x00070000,
0,
server,
dnszone,
newname,
None,
dnsp.DNS_TYPE_NS,
0x0f,
None,
None)
print("adding a NS glue record")
name = dnsserver.DNS_RPC_NAME()
......@@ -66,22 +66,22 @@ if __name__ == "__main__":
addrecbuf = dnsserver.DNS_RPC_RECORD_BUF()
addrecbuf.rec = addrec
res = dns_conn.DnssrvUpdateRecord2(0x00070000,
0,
server,
dnszone,
newname,
addrecbuf,
None)
dns_conn.DnssrvUpdateRecord2(0x00070000,
0,
server,
dnszone,
newname,
addrecbuf,
None)
print("querying the NS record")
res = dns_conn.DnssrvEnumRecords2(0x00070000,
0,
server,
dnszone,
newname,
None,
dnsp.DNS_TYPE_NS,
0x0f,
None,
None)
dns_conn.DnssrvEnumRecords2(0x00070000,
0,
server,
dnszone,
newname,
None,
dnsp.DNS_TYPE_NS,
0x0f,
None,
None)
......@@ -369,7 +369,6 @@ interface_ips = _glue.interface_ips
fault_setup = _glue.fault_setup
set_debug_level = _glue.set_debug_level
get_debug_level = _glue.get_debug_level
unix2nttime = _glue.unix2nttime
float2nttime = _glue.float2nttime
nttime2float = _glue.nttime2float
nttime2string = _glue.nttime2string
......
......@@ -878,9 +878,9 @@ class cmd_zonecreate(Command):
zone_create_info.fLoadExisting = 1
zone_create_info.dwDpFlags = dnsserver.DNS_DP_DOMAIN_DEFAULT
res = dns_conn.DnssrvOperation2(client_version, 0, server, None,
0, 'ZoneCreate', typeid,
zone_create_info)
dns_conn.DnssrvOperation2(client_version, 0, server, None,
0, 'ZoneCreate', typeid,
zone_create_info)
typeid = dnsserver.DNSSRV_TYPEID_NAME_AND_PARAM
name_and_param = dnsserver.DNS_RPC_NAME_AND_PARAM()
......@@ -888,9 +888,9 @@ class cmd_zonecreate(Command):
name_and_param.dwParam = dnsp.DNS_ZONE_UPDATE_SECURE
try:
res = dns_conn.DnssrvOperation2(client_version, 0, server, zone,
0, 'ResetDwordProperty', typeid,
name_and_param)
dns_conn.DnssrvOperation2(client_version, 0, server, zone,
0, 'ResetDwordProperty', typeid,
name_and_param)
except WERRORError as e:
if e.args[0] == werror.WERR_DNS_ERROR_ZONE_ALREADY_EXISTS:
self.outf.write('Zone already exists.')
......
......@@ -733,7 +733,7 @@ class cmd_setlink(GPOCommand):
# Check if valid GPO DN
try:
msg = get_gpo_info(self.samdb, gpo=gpo)[0]
get_gpo_info(self.samdb, gpo=gpo)[0]
except Exception:
raise CommandError("GPO '%s' does not exist" % gpo)
gpo_dn = str(get_gpo_dn(self.samdb, gpo))
......
......@@ -604,11 +604,8 @@ class LDAPObject(object):
continue
# Attribute values that are list that contain DN based values that may differ
elif x.upper() in self.dn_attributes:
m = p
n = q
if not p and not q:
m = self.attributes[x]
n = other.attributes[x]
m = self.attributes[x]
n = other.attributes[x]
p = [self.fix_dn(j) for j in m]
q = [other.fix_dn(j) for j in n]
if p == q:
......
......@@ -153,8 +153,7 @@ def get_crypt_value(alg, utf8pw, rounds=0):
try:
import hashlib
h = hashlib.sha1()
h = None
hashlib.sha1()
virtual_attributes["virtualSSHA"] = {
}
except ImportError as e:
......@@ -167,8 +166,7 @@ except ImportError as e:
for (alg, attr) in [("5", "virtualCryptSHA256"), ("6", "virtualCryptSHA512")]:
try:
import crypt
v = get_crypt_value(alg, "")
v = None
get_crypt_value(alg, "")
virtual_attributes[attr] = {
}
except ImportError as e:
......@@ -3262,7 +3260,6 @@ class cmd_user_rename(Command):
for s in msg['uPNSuffixes']:
upn_suffixes.append(str(s).lower())
upn_suffix = upn.split('@')[-1].lower()
upn_split = upn.split('@')
if (len(upn_split) < 2):
return False
......
......@@ -267,7 +267,6 @@ def setup_dns_partitions(samdb, domainsid, domaindn, forestdn, configdn,
"SECDESC": b64encode(descriptor).decode('utf8')
})
domainzone_guid = get_domainguid(samdb, domainzone_dn)
domainzone_guid = str(uuid.uuid4())
domainzone_dns = ldb.Dn(samdb, domainzone_dn).canonical_ex_str().strip()
......@@ -289,7 +288,6 @@ def setup_dns_partitions(samdb, domainsid, domaindn, forestdn, configdn,
})
if fill_level != FILL_SUBDOMAIN:
forestzone_guid = get_domainguid(samdb, forestzone_dn)
forestzone_guid = str(uuid.uuid4())
forestzone_dns = ldb.Dn(samdb, forestzone_dn).canonical_ex_str().strip()
......
......@@ -900,7 +900,6 @@ unicodePwd:: %s
user_dn = res[0].dn
userAccountControl = int(res[0]["userAccountControl"][0])
accountExpires = int(res[0]["accountExpires"][0])
if no_expiry_req:
userAccountControl = userAccountControl | 0x10000
accountExpires = 0
......
......@@ -358,8 +358,6 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
for entry in listMissing:
reference = newsecrets_ldb.search(expression="distinguishedName=%s" % entry,
base="", scope=SCOPE_SUBTREE)
current = secrets_ldb.search(expression="distinguishedName=%s" % entry,
base="", scope=SCOPE_SUBTREE)
delta = secrets_ldb.msg_diff(empty, reference[0])
for att in hashAttrNotCopied:
delta.remove(att)
......
......@@ -428,7 +428,7 @@ def call_nsupdate(d, op="add"):
rfile = open(opts.use_file, 'r+')
except IOError:
# Perhaps create it
rfile = open(opts.use_file, 'w+')
open(opts.use_file, 'w+')
# Open it for reading again, in case someone else got to it first
rfile = open(opts.use_file, 'r+')
fcntl.lockf(rfile, fcntl.LOCK_EX)
......@@ -746,7 +746,7 @@ try:
cfile = open(dns_update_cache, 'r+')
except IOError:
# Perhaps create it
cfile = open(dns_update_cache, 'w+')
open(dns_update_cache, 'w+')
# Open it for reading again, in case someone else got to it first
cfile = open(dns_update_cache, 'r+')
fcntl.lockf(cfile, fcntl.LOCK_EX)
......
......@@ -80,7 +80,7 @@ controls = ["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf
(msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=*)", base=base, attrs=["objectClass"], controls=controls)
if (len(ctrls)):
for ctl in ctrls:
cookie = printdirsync(ctl)
printdirsync(ctl)
print("Returned %d entries" % len(msgs))
cookie = savedcookie
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment