Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pynslcd/common.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-12-28 23:52:26 +0100
committerArthur de Jong <arthur@arthurdejong.org>2011-12-28 23:52:26 +0100
commitc21a1b7ea1ae743bc731ad8764deb6632ce86d7f (patch)
tree310051f6c0959c469f70ae444cbfee44e9af9fd0 /pynslcd/common.py
parent3d99c1858d014e2cadc8fc4ed72c5697e47becb8 (diff)
support for reading the configuration file (not all options are used though)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1581 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'pynslcd/common.py')
-rw-r--r--pynslcd/common.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/pynslcd/common.py b/pynslcd/common.py
index ad79a5c..ed5bb4e 100644
--- a/pynslcd/common.py
+++ b/pynslcd/common.py
@@ -28,9 +28,6 @@ import constants
from attmap import Attributes
-_validname_re = re.compile(r'^[a-z0-9._@$][a-z0-9._@$ \\~-]{0,98}[a-z0-9._@$~-]$', re.IGNORECASE)
-
-
def isvalidname(name):
"""Checks to see if the specified name seems to be a valid user or group
name.
@@ -44,14 +41,14 @@ def isvalidname(name):
The standard defines user names valid if they contain characters from
the set [A-Za-z0-9._-] where the hyphen should not be used as first
character. As an extension this test allows some more characters."""
- return bool(_validname_re.match(name))
+ return bool(cfg.validnames.search(name))
def validate_name(name):
"""Checks to see if the specified name seems to be a valid user or group
name. See isvalidname()."""
- if not _validname_re.match(name):
- raise ValueError('%r: invalid user name' % name)
+ if not cfg.validnames.search(name):
+ raise ValueError('%r: denied by validnames option' % name)
class Search(object):
@@ -109,6 +106,7 @@ class Search(object):
# get search results
filter = self.mk_filter()
for base in self.bases:
+ print 'SEARCHING %s' % base
# do the LDAP search
try:
for entry in self.conn.search_s(base, self.scope, filter, self.attributes):