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)
committerStefan Metzmacher <metze@samba.org>
Fri, 19 Feb 2016 23:10:07 +0000 (00:10 +0100)
Windows does the same...

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

index 14dc2684be2ebc3c242731c897822959d5fa03db..0f7aebc3ec22e938c3d7e0783d00a751adada74e 100644 (file)
@@ -1874,6 +1874,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:
@@ -1904,7 +1905,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;
 }