s4:netcmd/gpo.py: the nTSecurityDescriptor may not be visible for the current user
authorStefan Metzmacher <metze@samba.org>
Sat, 17 Nov 2012 06:13:40 +0000 (07:13 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 30 Nov 2012 16:17:19 +0000 (17:17 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source4/scripting/python/samba/netcmd/gpo.py

index 656b2bd3695a9142fcce7bd65dfc348211ca4322..1c6f25dc39d750457f3f5e72bfce695f48a2677a 100644 (file)
@@ -465,8 +465,12 @@ class cmd_show(Command):
         except Exception:
             raise CommandError("GPO '%s' does not exist" % gpo)
 
-        secdesc_ndr = msg['nTSecurityDescriptor'][0]
-        secdesc = ndr_unpack(security.descriptor, secdesc_ndr)
+        try:
+            secdesc_ndr = msg['nTSecurityDescriptor'][0]
+            secdesc = ndr_unpack(security.descriptor, secdesc_ndr)
+            secdesc_sddl = secdesc.as_sddl()
+        except Exception:
+            secdesc_sddl = "<hidden>"
 
         self.outf.write("GPO          : %s\n" % msg['name'][0])
         self.outf.write("display name : %s\n" % msg['displayName'][0])
@@ -474,7 +478,7 @@ class cmd_show(Command):
         self.outf.write("dn           : %s\n" % msg.dn)
         self.outf.write("version      : %s\n" % attr_default(msg, 'versionNumber', '0'))
         self.outf.write("flags        : %s\n" % gpo_flags_string(int(attr_default(msg, 'flags', 0))))
-        self.outf.write("ACL          : %s\n" % secdesc.as_sddl())
+        self.outf.write("ACL          : %s\n" % secdesc_sddl)
         self.outf.write("\n")