lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1447 - nss-pam-ldapd/nslcd

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

nss-pam-ldapd commit: r1447 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sat Apr 30 21:54:10 2011
New Revision: 1447
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1447

Log:
improve password change failed error message

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

Modified: nss-pam-ldapd/nslcd/pam.c
==============================================================================
--- nss-pam-ldapd/nslcd/pam.c   Sat Apr 30 16:37:43 2011        (r1446)
+++ nss-pam-ldapd/nslcd/pam.c   Sat Apr 30 21:54:10 2011        (r1447)
@@ -661,20 +661,22 @@
   }
   /* perform password modification */
   rc=try_pwmod(binddn,myldap_get_dn(entry),oldpassword,newpassword);
-  /* write response */
-  WRITE_INT32(fp,NSLCD_RESULT_BEGIN);
-  WRITE_STRING(fp,username);
-  WRITE_STRING(fp,myldap_get_dn(entry));
-  if (rc==LDAP_SUCCESS)
+  if (rc!=LDAP_SUCCESS)
   {
-    WRITE_INT32(fp,NSLCD_PAM_SUCCESS);
+    mysnprintf(authzmsg,sizeof(authzmsg)-1,"password change failed: 
%s",ldap_err2string(rc));
+    WRITE_INT32(fp,NSLCD_RESULT_BEGIN);
+    WRITE_STRING(fp,username);
     WRITE_STRING(fp,"");
-  }
-  else
-  {
     WRITE_INT32(fp,NSLCD_PAM_PERM_DENIED);
-    WRITE_STRING(fp,ldap_err2string(rc));
+    WRITE_STRING(fp,authzmsg);
+    WRITE_INT32(fp,NSLCD_RESULT_END);
   }
+  /* write response */
+  WRITE_INT32(fp,NSLCD_RESULT_BEGIN);
+  WRITE_STRING(fp,username);
+  WRITE_STRING(fp,myldap_get_dn(entry));
+  WRITE_INT32(fp,NSLCD_PAM_SUCCESS);
+  WRITE_STRING(fp,"");
   WRITE_INT32(fp,NSLCD_RESULT_END);
   return 0;
 }
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits