379f28c
Treat 'nsAccountLock: true' the same as 'loginDisabled: true'.  Updated from
379f28c
original version filed as RT#5891.
379f28c
75b0804
diff -up krb5-1.8/src/aclocal.m4.dirsrv-accountlock krb5-1.8/src/aclocal.m4
75b0804
--- krb5-1.8/src/aclocal.m4.dirsrv-accountlock	2010-03-05 11:03:09.000000000 -0500
75b0804
+++ krb5-1.8/src/aclocal.m4	2010-03-05 11:03:10.000000000 -0500
0efe966
@@ -1656,6 +1656,15 @@ if test $with_ldap = yes; then
0efe966
   AC_MSG_NOTICE(enabling OpenLDAP database backend module support)
0efe966
   OPENLDAP_PLUGIN=yes
0efe966
 fi
0efe966
+AC_ARG_WITH([dirsrv-account-locking],
0efe966
+[  --with-dirsrv-account-locking       compile 389/Red Hat/Fedora/Netscape Directory Server database backend module],
379f28c
+[case "$withval" in
379f28c
+    yes | no) ;;
0efe966
+    *)  AC_MSG_ERROR(Invalid option value --with-dirsrv-account-locking="$withval") ;;
0efe966
+esac], with_dirsrv_account_locking=no)
0efe966
+if test $with_dirsrv_account_locking = yes; then
0efe966
+    AC_DEFINE(HAVE_DIRSRV_ACCOUNT_LOCKING,1,[Define if LDAP KDB interface should heed 389 DS's nsAccountLock attribute.])
0efe966
+fi
0efe966
 ])dnl
0efe966
 dnl
0efe966
 dnl If libkeyutils exists (on Linux) include it and use keyring ccache
75b0804
diff -up krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c.dirsrv-accountlock krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
75b0804
--- krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c.dirsrv-accountlock	2009-11-24 18:52:25.000000000 -0500
75b0804
+++ krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c	2010-03-05 11:03:10.000000000 -0500
75b0804
@@ -2101,6 +2101,22 @@ populate_krb5_db_entry(krb5_context cont
0efe966
         goto cleanup;
0efe966
     if ((st=krb5_dbe_update_tl_data(context, entry, &userinfo_tl_data)) != 0)
0efe966
         goto cleanup;
0efe966
+#ifdef HAVE_DIRSRV_ACCOUNT_LOCKING
379f28c
+    {
75b0804
+        krb5_timestamp              expiretime=0;
75b0804
+        char                        *is_login_disabled=NULL;
379f28c
+
75b0804
+        /* LOGIN DISABLED */
0efe966
+        if ((st=krb5_ldap_get_string(ld, ent, "nsAccountLock", &is_login_disabled,
75b0804
+                    &attr_present)) != 0)
75b0804
+            goto cleanup;
75b0804
+        if (attr_present == TRUE) {
75b0804
+            if (strcasecmp(is_login_disabled, "TRUE")== 0)
75b0804
+                entry->attributes |= KRB5_KDB_DISALLOW_ALL_TIX;
75b0804
+            free (is_login_disabled);
75b0804
+        }
379f28c
+    }
379f28c
+#endif
379f28c
 
379f28c
     if ((st=krb5_read_tkt_policy (context, ldap_context, entry, tktpolname)) !=0)
75b0804
         goto cleanup;
75b0804
diff -up krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c.dirsrv-accountlock krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
75b0804
--- krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c.dirsrv-accountlock	2009-11-24 18:52:25.000000000 -0500
75b0804
+++ krb5-1.8/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c	2010-03-05 11:03:10.000000000 -0500
75b0804
@@ -59,6 +59,9 @@ char     *principal_attributes[] = { "kr
0efe966
                                      "krbLastFailedAuth",
0efe966
                                      "krbLoginFailedCount",
0efe966
                                      "krbLastSuccessfulAuth",
0efe966
+#ifdef HAVE_DIRSRV_ACCOUNT_LOCKING
0efe966
+                                     "nsAccountLock",
379f28c
+#endif
75b0804
                                      "krbLastPwdChange",
4260532
                                      "krbLastAdminUnlock",
75b0804
                                      "krbExtraData",