From e5f552c0fb274c1a02fce51267c563a06c55d334 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Fri, 6 Jan 2012 13:59:50 +0000 Subject: 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 --- pynslcd/pam.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pynslcd/pam.py') 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): -- cgit v1.2.3