diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2011-12-27 21:05:06 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2011-12-27 21:05:06 +0000 |
commit | 67afca76987fe769f4e7345f5e8396f67bf3fcbb (patch) | |
tree | fdcdbc57604247e8dac3577a3f7dc670adad696d | |
parent | 8190bfb90b272cb98fed05dfdb6d2398c2c20a80 (diff) |
make logging more consistent and remove test bases from shadow and passwd maps
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1574 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | pynslcd/common.py | 10 | ||||
-rw-r--r-- | pynslcd/group.py | 2 | ||||
-rw-r--r-- | pynslcd/netgroup.py | 2 | ||||
-rw-r--r-- | pynslcd/passwd.py | 3 | ||||
-rw-r--r-- | pynslcd/shadow.py | 1 |
5 files changed, 10 insertions, 8 deletions
diff --git a/pynslcd/common.py b/pynslcd/common.py index a44f708..ad79a5c 100644 --- a/pynslcd/common.py +++ b/pynslcd/common.py @@ -85,6 +85,8 @@ class Search(object): case_insensitive = [] limit_attributes = [] +# FIXME: figure out which of these arguments are actually needed + def __init__(self, conn, base=None, scope=None, filter=None, attributes=None, parameters=None): # load information from module that defines the class @@ -143,19 +145,21 @@ class Search(object): # check that these attributes have at least one value for attr in self.required: if not attributes.get(attr, None): - print '%s: attribute %s not found' % (dn, self.attmap[attr]) + print '%s: %s: missing' % (dn, self.attmap[attr]) return # check that requested attribute is present (case sensitive) for attr in self.case_sensitive: value = self.parameters.get(attr, None) if value and str(value) not in attributes[attr]: - print '%s: attribute %s does not contain %r value' % (dn, self.attmap[attr], value) + # TODO: log at debug level, this can happen in normal cases + print '%s: %s: does not contain %r value' % (dn, self.attmap[attr], value) return # not found, skip entry # check that requested attribute is present (case insensitive) for attr in self.case_insensitive: value = self.parameters.get(attr, None) if value and str(value).lower() not in (x.lower() for x in attributes[attr]): - print '%s: attribute %s does not contain %r value' % (dn, self.attmap[attr], value) + # TODO: log at debug level, this can happen in normal cases + print '%s: %s: does not contain %r value' % (dn, self.attmap[attr], value) return # not found, skip entry # limit attribute values to requested value for attr in self.limit_attributes: diff --git a/pynslcd/group.py b/pynslcd/group.py index e32232b..6153e2f 100644 --- a/pynslcd/group.py +++ b/pynslcd/group.py @@ -91,7 +91,7 @@ class GroupRequest(common.Request): # actually return the results for name in names: if not common.isvalidname(name): - print 'Warning: group entry %s contains invalid group name: "%s"' % (dn, name) + print '%s: %s: denied by validnames option' % (dn, self.attmap['cn']) else: for gid in gids: self.fp.write_int32(constants.NSLCD_RESULT_BEGIN) diff --git a/pynslcd/netgroup.py b/pynslcd/netgroup.py index b24d296..7deba01 100644 --- a/pynslcd/netgroup.py +++ b/pynslcd/netgroup.py @@ -47,7 +47,7 @@ class NetgroupRequest(common.Request): for triple in attributes['nisNetgroupTriple']: m = _netgroup_triple_re.match(triple) if not m: - print 'Warning: entry %s contains invalid %s value: %r' % (dn, attmap['nisNetgroupTriple'], triple) + print '%s: %s: invalid value: %r' % (dn, attmap['nisNetgroupTriple'], triple) else: self.fp.write_int32(constants.NSLCD_RESULT_BEGIN) self.fp.write_int32(constants.NSLCD_NETGROUP_TYPE_TRIPLE) diff --git a/pynslcd/passwd.py b/pynslcd/passwd.py index c2b3eea..17ffe34 100644 --- a/pynslcd/passwd.py +++ b/pynslcd/passwd.py @@ -34,7 +34,6 @@ attmap = common.Attributes(uid='uid', loginShell='loginShell', objectClass='objectClass') filter = '(objectClass=posixAccount)' -bases = ('ou=people,dc=test,dc=tld', ) class Search(common.Search): @@ -62,7 +61,7 @@ class PasswdRequest(common.Request): # write results for name in names: if not common.isvalidname(name): - print 'Warning: passwd entry %s contains invalid user name: "%s"' % (dn, name) + print '%s: %s: denied by validnames option' % (dn, self.attmap['uid']) else: for uid in uids: self.fp.write_int32(constants.NSLCD_RESULT_BEGIN) diff --git a/pynslcd/shadow.py b/pynslcd/shadow.py index d79340b..9b74190 100644 --- a/pynslcd/shadow.py +++ b/pynslcd/shadow.py @@ -34,7 +34,6 @@ attmap = common.Attributes(uid='uid', shadowExpire='"${shadowExpire:--1}"', shadowFlag='"${shadowFlag:-0}"') filter = '(objectClass=shadowAccount)' -bases = ('ou=people,dc=test,dc=tld', ) class Search(common.Search): |