lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1702 - nss-pam-ldapd/pam

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1702 - nss-pam-ldapd/pam



Author: arthur
Date: Fri Jun 15 23:04:44 2012
New Revision: 1702
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1702&view=revision

Log:
fix problem with returning wrong error code when changing password with wrong 
old password

Modified:
   nss-pam-ldapd/pam/pam.c

Modified: nss-pam-ldapd/pam/pam.c
==============================================================================
--- nss-pam-ldapd/pam/pam.c     Fri May 25 11:04:24 2012        (r1701)
+++ nss-pam-ldapd/pam/pam.c     Fri Jun 15 23:04:44 2012        (r1702)
@@ -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 @@
     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);
   }
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/