diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2013-07-29 23:56:07 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2013-07-29 23:57:18 +0200 |
commit | ec5391838ca71ee31afe0ad4377664dd88e5266b (patch) | |
tree | 5d58cff7c008bb6dfefa013d733d56ddb73b8c28 | |
parent | d659e8347171fff61e1f3dfe094244f310ef4557 (diff) |
Use cleaner import and get rid of uid2dn function in pynslcd
-rw-r--r-- | pynslcd/group.py | 10 | ||||
-rw-r--r-- | pynslcd/passwd.py | 7 |
2 files changed, 5 insertions, 12 deletions
diff --git a/pynslcd/group.py b/pynslcd/group.py index ee1d268..2868d96 100644 --- a/pynslcd/group.py +++ b/pynslcd/group.py @@ -24,7 +24,7 @@ import logging from ldap.filter import escape_filter_chars import ldap -from passwd import dn2uid, uid2dn +import passwd import cache import cfg import common @@ -63,12 +63,12 @@ class Search(search.LDAPSearch): # we still need a custom mk_filter because this is an | query if attmap['member'] and 'memberUid' in self.parameters: memberuid = self.parameters['memberUid'] - dn = uid2dn(self.conn, memberuid) - if dn: + entry = passwd.uid2entry(self.conn, memberuid) + if entry: return '(&%s(|(%s=%s)(%s=%s)))' % ( self.filter, attmap['memberUid'], escape_filter_chars(memberuid), - attmap['member'], escape_filter_chars(dn) + attmap['member'], escape_filter_chars(entry[0]) ) return super(Search, self).mk_filter() @@ -109,7 +109,7 @@ class GroupRequest(common.Request): if memberdn in seen: continue seen.add(memberdn) - member = dn2uid(self.conn, memberdn) + member = passwd.dn2uid(self.conn, memberdn) if member and common.isvalidname(member): members.add(member) elif cfg.nss_nested_groups: diff --git a/pynslcd/passwd.py b/pynslcd/passwd.py index 418be7f..7fb5619 100644 --- a/pynslcd/passwd.py +++ b/pynslcd/passwd.py @@ -120,13 +120,6 @@ def uid2entry(conn, uid): return dn, attributes -def uid2dn(conn, uid): - """Look up the user by uid and return the DN or None if the user was - not found.""" - x = uid2entry(conn, uid) - if x is not None: - return x[0] - # FIXME: use cache of dn2uid and try to use DN to get uid attribute |