diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2012-01-06 14:59:50 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2012-01-06 14:59:50 +0100 |
commit | e5f552c0fb274c1a02fce51267c563a06c55d334 (patch) | |
tree | 6ac770ff8eace971fd81d1eec7d02c953292afbc /pynslcd/pam.py | |
parent | fea96fdbbc3e01a60fcb0d7e5ec7907987f72345 (diff) |
user the logging framework, handle exceptions properly and some cleanups
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1588 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'pynslcd/pam.py')
-rw-r--r-- | pynslcd/pam.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pynslcd/pam.py b/pynslcd/pam.py index 8bbbe48..8e4f76f 100644 --- a/pynslcd/pam.py +++ b/pynslcd/pam.py @@ -1,7 +1,7 @@ # pam.py - functions authentication, authorisation and session handling # -# Copyright (C) 2010, 2011 Arthur de Jong +# Copyright (C) 2010, 2011, 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,17 +19,18 @@ # 02110-1301 USA import logging + import ldap -import constants -import common import cfg +import common +import constants import passwd def try_bind(userdn, password): # open a new connection - conn = ldap.initialize(cfg.ldap_uri) + conn = ldap.initialize(cfg.uri) # bind using the specified credentials conn.simple_bind_s(userdn, password) # perform search for own object (just to do any kind of search) @@ -60,7 +61,7 @@ class PAMRequest(common.Request): # get the username from the uid attribute values = myldap_get_values(entry, passwd.attmap['uid']) if not values or not values[0]: - logging.warn('%s: is missing a %s attribute', dn, passwd.attmap['uid']) + logging.warning('%s: is missing a %s attribute', dn, passwd.attmap['uid']) value = values[0] # check the username if value and not common.isvalidname(value): |