mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
samba-tool delegation: Use self.outf, simplify some code.
This commit is contained in:
parent
3978a50243
commit
0e70e26d92
@ -53,7 +53,7 @@ class cmd_delegation_show(Command):
|
||||
# TODO once I understand how, use the domain info to naildown
|
||||
# to the correct domain
|
||||
(cleanedaccount, realm, domain) = _get_user_realm_domain(accountname)
|
||||
print "Searching for: %s" % (cleanedaccount)
|
||||
self.outf.write("Searching for: %s\n" % (cleanedaccount))
|
||||
res = sam.search(expression="sAMAccountName=%s" % ldb.binary_encode(cleanedaccount),
|
||||
scope=ldb.SCOPE_SUBTREE,
|
||||
attrs=["userAccountControl", "msDS-AllowedToDelegateTo"])
|
||||
@ -63,21 +63,15 @@ class cmd_delegation_show(Command):
|
||||
uac = int(res[0].get("userAccountControl")[0])
|
||||
allowed = res[0].get("msDS-AllowedToDelegateTo")
|
||||
|
||||
print "Account-DN: %s" % str(res[0].dn)
|
||||
self.outf.write("Account-DN: %s\n" % str(res[0].dn))
|
||||
self.outf.write("UF_TRUSTED_FOR_DELEGATION: %s\n"
|
||||
% bool(uac & dsdb.UF_TRUSTED_FOR_DELEGATION))
|
||||
self.outf.write("UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: %s\n" %
|
||||
bool(uac & dsdb.UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION))
|
||||
|
||||
if uac & dsdb.UF_TRUSTED_FOR_DELEGATION:
|
||||
print "UF_TRUSTED_FOR_DELEGATION: 1"
|
||||
else:
|
||||
print "UF_TRUSTED_FOR_DELEGATION: 0"
|
||||
|
||||
if uac & dsdb.UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION:
|
||||
print "UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: 1"
|
||||
else:
|
||||
print "UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: 0"
|
||||
|
||||
if allowed != None:
|
||||
if allowed is not None:
|
||||
for a in allowed:
|
||||
print "msDS-AllowedToDelegateTo: %s" % (str(a))
|
||||
self.outf.write("msDS-AllowedToDelegateTo: %s\n" % a)
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user