diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-10-13 00:19:51 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-10-13 03:33:21 +0200 |
commit | 0e70e26d927441260332941d8eeb506cf6f06e62 (patch) | |
tree | 2b15805a13aab005a02ef8fd57b87449e0294818 | |
parent | 3978a502438e9a5f9c004401c06ca83a4824327e (diff) | |
download | samba-0e70e26d927441260332941d8eeb506cf6f06e62.tar.gz samba-0e70e26d927441260332941d8eeb506cf6f06e62.tar.bz2 samba-0e70e26d927441260332941d8eeb506cf6f06e62.zip |
samba-tool delegation: Use self.outf, simplify some code.
-rw-r--r-- | source4/scripting/python/samba/netcmd/delegation.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/source4/scripting/python/samba/netcmd/delegation.py b/source4/scripting/python/samba/netcmd/delegation.py index c29c798be4..24f4f51937 100644 --- a/source4/scripting/python/samba/netcmd/delegation.py +++ b/source4/scripting/python/samba/netcmd/delegation.py @@ -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) |