s4:dsdb/password_hash: use full NTTIME resolution for pwdLastSet
authorStefan Metzmacher <metze@samba.org>
Fri, 12 Feb 2016 12:56:26 +0000 (13:56 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 27 Jun 2016 03:00:17 +0000 (05:00 +0200)
Windows does the same...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9654

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/password_hash.c

index 05b08547437bbd5af398f9024cd45b67111eccb7..492448bf8c1b1adf1da7d35ee3a8031a352d3cf4 100644 (file)
@@ -1687,6 +1687,7 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
 static int setup_last_set_field(struct setup_password_fields_io *io)
 {
        const struct ldb_message *msg = NULL;
+       struct timeval tv = { .tv_sec = 0 };
 
        switch (io->ac->req->operation) {
        case LDB_ADD:
@@ -1717,7 +1718,8 @@ static int setup_last_set_field(struct setup_password_fields_io *io)
        }
 
        /* set it as now */
-       unix_to_nt_time(&io->g.last_set, time(NULL));
+       GetTimeOfDay(&tv);
+       io->g.last_set = timeval_to_nttime(&tv);
 
        return LDB_SUCCESS;
 }