projects
/
mirror
/
userdir-ldap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
685de8c
)
Query the LDAP server if no locally defined group with that name was found
author
joey
<>
Sat, 11 Aug 2007 13:27:37 +0000
(13:27 +0000)
committer
joey
<>
Sat, 11 Aug 2007 13:27:37 +0000
(13:27 +0000)
ud-useradd
patch
|
blob
|
history
userdir_ldap.py
patch
|
blob
|
history
diff --git
a/ud-useradd
b/ud-useradd
index
075b20b
..
419ae6a
100755
(executable)
--- a/
ud-useradd
+++ b/
ud-useradd
@@
-160,7
+160,7
@@
if Res != "":
# GID
Res = raw_input("Group ID Number [" + gidNumber + "]? ");
if Res != "":
# GID
Res = raw_input("Group ID Number [" + gidNumber + "]? ");
if Res != "":
- gidNumber = Group2GID(Res);
+ gidNumber = Group2GID(
l,
Res);
# UID
if uidNumber == 0:
# UID
if uidNumber == 0:
diff --git
a/userdir_ldap.py
b/userdir_ldap.py
index
a048299
..
0ba37f4
100644
(file)
--- a/
userdir_ldap.py
+++ b/
userdir_ldap.py
@@
-411,7
+411,7
@@
def GetUID(l,Name,UnknownMap = {}):
return (None,None);
return (None,None);
-def Group2GID(name):
+def Group2GID(
l,
name):
"""
Returns the numerical id of a common group
on error returns -1
"""
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]
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
return -1