nss-pam-ldapd branch master updated. 0.8.12-151-gaae36cf
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd branch master updated. 0.8.12-151-gaae36cf
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd branch master updated. 0.8.12-151-gaae36cf
- Date: Sat, 30 Mar 2013 23:08:04 +0100 (CET)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".
The branch, master has been updated
via aae36cfcfb6ec00776f6da1e0d1fd5f90a72f2dd (commit)
from 355c2af23f9c2d222bc45bf12ab029700b4d2f49 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=aae36cfcfb6ec00776f6da1e0d1fd5f90a72f2dd
commit aae36cfcfb6ec00776f6da1e0d1fd5f90a72f2dd
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sat Mar 30 22:14:31 2013 +0100
Rename authentication function and return connection
diff --git a/pynslcd/pam.py b/pynslcd/pam.py
index 111fc59..74ae27a 100644
--- a/pynslcd/pam.py
+++ b/pynslcd/pam.py
@@ -32,7 +32,7 @@ import passwd
import search
-def try_bind(binddn, password):
+def authenticate(binddn, password):
# open a new connection
conn = search.Connection()
# bind using the specified credentials
@@ -46,23 +46,23 @@ def try_bind(binddn, password):
'None' if ctrl.error is None else
PasswordPolicyError(ctrl.error).prettyPrint(),
ctrl.error, ctrl.timeBeforeExpiration,
ctrl.graceAuthNsRemaining)
if ctrl.error == 0: # passwordExpired
- return constants.NSLCD_PAM_AUTHTOK_EXPIRED,
PasswordPolicyError(ctrl.error).prettyPrint()
+ return conn, constants.NSLCD_PAM_AUTHTOK_EXPIRED,
PasswordPolicyError(ctrl.error).prettyPrint()
elif ctrl.error == 1: # accountLocked
- return constants.NSLCD_PAM_ACCT_EXPIRED,
PasswordPolicyError(ctrl.error).prettyPrint()
+ return conn, constants.NSLCD_PAM_ACCT_EXPIRED,
PasswordPolicyError(ctrl.error).prettyPrint()
elif ctrl.error == 2: # changeAfterReset
- return constants.NSLCD_PAM_NEW_AUTHTOK_REQD, 'Password change
is needed after reset'
+ return conn, constants.NSLCD_PAM_NEW_AUTHTOK_REQD, 'Password
change is needed after reset'
elif ctrl.error:
- return constants.NSLCD_PAM_PERM_DENIED,
PasswordPolicyError(ctrl.error).prettyPrint()
+ return conn, constants.NSLCD_PAM_PERM_DENIED,
PasswordPolicyError(ctrl.error).prettyPrint()
elif ctrl.timeBeforeExpiration is not None:
- return constants.NSLCD_PAM_NEW_AUTHTOK_REQD, 'Password will
expire in %d seconds' % ctrl.timeBeforeExpiration
+ return conn, constants.NSLCD_PAM_NEW_AUTHTOK_REQD, 'Password
will expire in %d seconds' % ctrl.timeBeforeExpiration
elif ctrl.graceAuthNsRemaining is not None:
- return constants.NSLCD_PAM_NEW_AUTHTOK_REQD, 'Password
expired, %d grace logins left' % ctrl.graceAuthNsRemaining
+ return conn, constants.NSLCD_PAM_NEW_AUTHTOK_REQD, 'Password
expired, %d grace logins left' % ctrl.graceAuthNsRemaining
# perform search for own object (just to do any kind of search)
results = search.LDAPSearch(conn, base=binddn, scope=ldap.SCOPE_BASE,
filter='(objectClass=*)', attributes=['dn', ])
for entry in results:
if entry[0] == binddn:
- return constants.NSLCD_PAM_SUCCESS, ''
+ return conn, constants.NSLCD_PAM_SUCCESS, ''
# if our DN wasn't found raise an error to signal bind failure
raise ldap.NO_SUCH_OBJECT()
@@ -139,7 +139,7 @@ class PAMAuthenticationRequest(PAMRequest):
password = parameters['password']
# try authentication
try:
- authz, msg = try_bind(binddn, password)
+ conn, authz, msg = authenticate(binddn, password)
except ldap.INVALID_CREDENTIALS, e:
try:
msg = e[0]['desc']
-----------------------------------------------------------------------
Summary of changes:
pynslcd/pam.py | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
hooks/post-receive
--
nss-pam-ldapd
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/
- nss-pam-ldapd branch master updated. 0.8.12-151-gaae36cf,
Commits of the nss-pam-ldapd project