samba-tool group list patch
Matthieu Patou
mat at samba.org
Mon Feb 18 21:39:16 MST 2013
-security_group = dict({"Domain": GTYPE_SECURITY_DOMAIN_LOCAL_GROUP, "Global": GTYPE_SECURITY_GLOBAL_GROUP, "Universal": GTYPE_SECURITY_UNIVERSAL_GROUP})
-distribution_group = dict({"Domain": GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP, "Global": GTYPE_DISTRIBUTION_GLOBAL_GROUP, "Universal": GTYPE_DISTRIBUTION_UNIVERSAL_GROUP})
+security_group = dict({"Builtin": GTYPE_SECURITY_BUILTIN_LOCAL_GROUP,
+ "Domain": GTYPE_SECURITY_DOMAIN_LOCAL_GROUP,
+ "Global": GTYPE_SECURITY_GLOBAL_GROUP,
+ "Universal": GTYPE_SECURITY_UNIVERSAL_GROUP})
+distribution_group = dict({"Domain": GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP,
+ "Global": GTYPE_DISTRIBUTION_GLOBAL_GROUP,
+ "Universal": GTYPE_DISTRIBUTION_UNIVERSAL_GROUP})
Can you align the different strings ?
+ if verbose:
+ self.outf.write("Group
Name Group Type Group Scope\n")
+
self.outf.write("-----------------------------------------------------------------------------\n")
Why the two lines doesn't have the same with ?
+ hgtype = hex(int("%s" % msg["grouptype"]) &
0x00000000FFFFFFFF)
+ if (hgtype == hex(int(security_group.get("Builtin")))):
+ self.outf.write("Security Builtin\n")
+ elif (hgtype == hex(int(security_group.get("Domain")))):
+ self.outf.write("Security Domain\n")
+ elif (hgtype == hex(int(security_group.get("Global")))):
+ self.outf.write("Security Global\n")
+ elif (hgtype == hex(int(security_group.get("Universal")))):
+ self.outf.write("Security Universal\n")
+ elif (hgtype ==
hex(int(distribution_group.get("Global")))):
+ self.outf.write("Distribution Global\n")
+ elif (hgtype ==
hex(int(distribution_group.get("Domain")))):
+ self.outf.write("Distribution Domain\n")
+ elif (hgtype ==
hex(int(distribution_group.get("Universal")))):
+ self.outf.write("Distribution Universal\n")
+ else:
+ self.outf.write("\n")
Can we use a switch ? + precalculated hex
switch(hgtype):
case HEX_SEC_GRP_BUILTIN:
...
case HEX_SEC_GRP_DOMAIN:
...
Just my 2cents.
Matthieu.
On 02/17/2013 05:22 PM, Ricky Nance wrote:
> Here you go, this wasn't intended to get rid of boring output, but give the
> user a bit more info on the type of groups they had without doing a
> ldbsearch (if they don't have RSAT). I had a user in IRC that needed this
> info at the time, so I took a shot at trying to help them out a bit. Anyway
> I hope this works, but if not let me know.
>
> Ricky
>
>
> On Sun, Feb 17, 2013 at 5:45 PM, Andrew Bartlett <abartlet at samba.org> wrote:
>
>> On Sun, 2013-02-17 at 16:07 +0000, Jelmer Vernooij wrote:
>>> Hi Ricky,
>>>
>>> On Thu, 2012-12-13 at 22:35 -0600, Ricky Nance wrote:
>>>> This patch adds the group type and group scope to the "samba-tool group
>>>> list" command.
>>>>
>>>> Jelmer, I still cannot get this to work without converting it from
>> string
>>>> -> int -> hex. This patch does work though, but it may not be as
>> efficient
>>>> as it could be, I just don't see how to fix it.
>>> Sorry for not getting to this earlier. I don't really want to stall this
>>> any further. Perhaps we should just land this as-is and iterate from
>>> there.
>>>
>>> Would somebody else (Andrew?) be able to take over piloting of this
>>> patch?
>> The main thing I would like is to move this to something like a '-v'
>> verbose mode (named appropriately). I don't have a view on the
>> comparison stuff, but it's quite useful if these tools keep a consistent
>> (if booring) output for shell manipulation as an option, and not to
>> change that if it's the default in a release.
>>
>> Andrew Bartlett
>>
>> --
>> Andrew Bartlett http://samba.org/~abartlet/
>> Authentication Developer, Samba Team http://samba.org
>>
>>
>>
>
> --
--
Matthieu Patou
Samba Team
http://samba.org
More information about the samba-technical
mailing list