s4:auth/sam: update the logonCount for interactive logons
authorStefan Metzmacher <metze@samba.org>
Wed, 3 Feb 2016 18:33:51 +0000 (19:33 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 30 Jun 2016 01:30:24 +0000 (03:30 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/sam.c

index 302a4e9b4f17c6173324cec3a19f74b2dd9e8d61..32e48fb3f36a667f71cc072aeb6235ddd35a6a66 100644 (file)
@@ -863,6 +863,22 @@ NTSTATUS authsam_logon_success_accounting(struct ldb_context *sam_ctx,
                        return NT_STATUS_NO_MEMORY;
                }
        }
+
+       if (interactive_or_kerberos) {
+               int logonCount;
+
+               logonCount = ldb_msg_find_attr_as_int(msg, "logonCount", 0);
+
+               logonCount += 1;
+
+               ret = samdb_msg_add_int(sam_ctx, msg_mod, msg_mod,
+                                       "logonCount", logonCount);
+               if (ret != LDB_SUCCESS) {
+                       TALLOC_FREE(mem_ctx);
+                       return NT_STATUS_NO_MEMORY;
+               }
+       }
+
        status = authsam_update_lastlogon_timestamp(sam_ctx, msg_mod, domain_dn,
                                                    lastLogonTimestamp, now);
        if (!NT_STATUS_IS_OK(status)) {