REVIEW:UF_LOCKOUT s4-samr: Reset badPwdCount and lockoutTime when ACB_AUTOLOCK is...
authorAndrew Bartlett <abartlet@samba.org>
Tue, 26 Nov 2013 03:30:42 +0000 (16:30 +1300)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Mar 2014 13:04:13 +0000 (14:04 +0100)
Change-Id: I891e6f38edc1f74a717a0e71b434486e029d1e14
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
REVIEW: "lockoutTime" NULL vs. 0
REVIEW: ACB_AUTOLOCK|ACB_PW_EXPIRED vs. UF_LOCKOUT|UF_PASSWORD_EXPIRED

source4/rpc_server/samr/dcesrv_samr.c

index 6877b903b222b447b82ddade7cb93c3fc0937317..e1906bdaf56f89900376350c214e52027178e7ba 100644 (file)
        }                                                               \
         set_el = ldb_msg_find_element(msg, attr);                      \
        set_el->flags = LDB_FLAG_MOD_REPLACE;                           \
+       if (!(r->in.info->field & ACB_AUTOLOCK)) {                      \
+               int set_aflags_ret;                                     \
+               set_aflags_ret = samdb_msg_add_int(sam_ctx, mem_ctx, msg, "badPwdCount", 0); \
+               if (set_aflags_ret != LDB_SUCCESS) {                    \
+                       return NT_STATUS_NO_MEMORY;                     \
+               }                                                       \
+               set_el = ldb_msg_find_element(msg, "badPwdCount");      \
+               set_el->flags = LDB_FLAG_MOD_REPLACE;                   \
+               set_aflags_ret = samdb_msg_add_int(sam_ctx, mem_ctx, msg, "lockoutTime", 0); \
+               if (set_aflags_ret != LDB_SUCCESS) {                    \
+                       return NT_STATUS_NO_MEMORY;                     \
+               }                                                       \
+               set_el = ldb_msg_find_element(msg, "lockoutTime");      \
+               set_el->flags = LDB_FLAG_MOD_REPLACE;                   \
+       }                                                               \
 } while (0)
 
 #define SET_LHOURS(msg, field, attr) do {                              \