X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=userdir_ldap.py;h=0ba37f4aa8354c09736c4e05f52b375e1fdbd29a;hb=1220c314db3886b9dc78326e8a0ee1528c3f4001;hp=a0482993b1d956664a7604928fd0de37001272e4;hpb=685de8c801ade6d02e7c5033bf474036ffa57dbb;p=mirror%2Fuserdir-ldap.git diff --git a/userdir_ldap.py b/userdir_ldap.py index a048299..0ba37f4 100644 --- a/userdir_ldap.py +++ b/userdir_ldap.py @@ -411,7 +411,7 @@ def GetUID(l,Name,UnknownMap = {}): return (None,None); -def Group2GID(name): +def Group2GID(l, name): """ Returns the numerical id of a common group on error returns -1 @@ -419,4 +419,10 @@ def Group2GID(name): for g in DebianGroups.keys(): if name == g: return DebianGroups[g] + + filter = "(gid=%s)" % name + res = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,filter,["gidNumber"]); + if res: + return GetAttr(res[0], "gidNumber") + return -1