From c21a1b7ea1ae743bc731ad8764deb6632ce86d7f Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Wed, 28 Dec 2011 22:52:26 +0000 Subject: 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 --- pynslcd/common.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'pynslcd/common.py') 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): -- cgit v1.2.3