s4:auth/sam: use a higher time resolution in authsam_account_ok()
authorStefan Metzmacher <metze@samba.org>
Mon, 31 Mar 2014 11:35:25 +0000 (13:35 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 2 Apr 2014 15:12:46 +0000 (17:12 +0200)
Change-Id: I2961e7311f31e239a6768f56437e5c112a7a9bb0
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/sam.c

index 72c57b92c81b5300d173e60ac0683340c0c6085d..8729ec59bb44ed7a3ba19aa0ad24c1183f649821 100644 (file)
@@ -165,8 +165,9 @@ _PUBLIC_ NTSTATUS authsam_account_ok(TALLOC_CTX *mem_ctx,
        const char *workstation_list;
        NTTIME acct_expiry;
        NTTIME must_change_time;
+       struct timeval tv_now = timeval_current();
+       NTTIME now = timeval_to_nttime(&tv_now);
 
-       NTTIME now;
        DEBUG(4,("authsam_account_ok: Checking SMB password for user %s\n", name_for_logs));
 
        acct_flags = samdb_result_acct_flags(sam_ctx, mem_ctx, msg, domain_dn);
@@ -193,7 +194,6 @@ _PUBLIC_ NTSTATUS authsam_account_ok(TALLOC_CTX *mem_ctx,
        }
 
        /* Test account expire time */
-       unix_to_nt_time(&now, time(NULL));
        if (now > acct_expiry) {
                DEBUG(2,("authsam_account_ok: Account for user '%s' has expired.\n", name_for_logs));
                DEBUG(3,("authsam_account_ok: Account expired at '%s'.\n",