diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2012-06-15 21:04:44 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2012-06-15 21:04:44 +0000 |
commit | 0b4dcc7375dc99cb4ef79f25e6c34818301cfba2 (patch) | |
tree | e907167b062fe3050e71a83419af7133dd391e3e | |
parent | 09ac02ea9ef55d6f488648882023aa7b032b5a22 (diff) |
fix problem with returning wrong error code when changing password with wrong old password (thanks Anton Helwart)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1702 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | pam/pam.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -2,7 +2,7 @@ pam.c - pam module functions Copyright (C) 2009 Howard Chu - Copyright (C) 2009, 2010, 2011 Arthur de Jong + Copyright (C) 2009, 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 @@ -615,8 +615,12 @@ int pam_sm_chauthtok(pam_handle_t *pamh,int flags,int argc,const char **argv) else if (cfg.debug) pam_syslog(pamh,LOG_DEBUG,"authentication succeeded"); /* store password (needed if oldpassword was retreived from context) */ - if (rc==PAM_SUCCESS) - return pam_set_item(pamh,PAM_OLDAUTHTOK,oldpassword); + if (ctx->authok==PAM_SUCCESS) + { + rc=pam_set_item(pamh,PAM_OLDAUTHTOK,oldpassword); + if (rc!=PAM_SUCCESS) + return remap_pam_rc(rc,&cfg); + } /* remap error code */ return remap_pam_rc(ctx->authok,&cfg); } |