svn commit: samba r8980 - in branches/SAMBA_4_0/source/auth: .

abartlet at samba.org abartlet at samba.org
Wed Aug 3 04:41:10 GMT 2005


Author: abartlet
Date: 2005-08-03 04:41:10 +0000 (Wed, 03 Aug 2005)
New Revision: 8980

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8980

Log:
Make Samba4 honour account control flags (we were asking for a
non-existant field).

Also change time(NULL) into an NTTIME for comparison, rather than
experience rounding bugs (size of time_t) when converting an NTTIME
into a time_t.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/auth/auth_sam.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/auth_sam.c
===================================================================
--- branches/SAMBA_4_0/source/auth/auth_sam.c	2005-08-03 04:15:16 UTC (rev 8979)
+++ branches/SAMBA_4_0/source/auth/auth_sam.c	2005-08-03 04:41:10 UTC (rev 8980)
@@ -117,6 +117,7 @@
 				   const char *workstation_list,
 				   const struct auth_usersupplied_info *user_info)
 {
+	NTTIME now;
 	DEBUG(4,("authsam_account_ok: Checking SMB password for user %s\n", user_info->mapped.account_name));
 
 	/* Quit if the account was disabled. */
@@ -132,7 +133,8 @@
 	}
 
 	/* Test account expire time */
-	if ((acct_expiry) != -1 && time(NULL) > nt_time_to_unix(acct_expiry)) {
+	unix_to_nt_time(&now, time(NULL));
+	if (now > acct_expiry) {
 		DEBUG(1,("authsam_account_ok: Account for user '%s' has expired.\n", user_info->mapped.account_name));
 		DEBUG(3,("authsam_account_ok: Account expired at '%s'.\n", 
 			 nt_time_string(mem_ctx, acct_expiry)));
@@ -148,7 +150,7 @@
 		}
 
 		/* check for expired password */
-		if ((must_change_time) != 0 && nt_time_to_unix(must_change_time) < time(NULL)) {
+		if ((must_change_time != 0) && (must_change_time < now)) {
 			DEBUG(1,("sam_account_ok: Account for user '%s' password expired!.\n", 
 				 user_info->mapped.account_name));
 			DEBUG(1,("sam_account_ok: Password expired at '%s' unix time.\n", 
@@ -356,7 +358,7 @@
 	NTSTATUS nt_status;
 	const char *domain_dn = samdb_result_string(msgs_domain[0], "nCName", "");
 
-	acct_flags = samdb_result_acct_flags(msgs[0], "sAMAcctFlags");
+	acct_flags = samdb_result_acct_flags(msgs[0], "userAccountControl");
 	
 	/* Quit if the account was locked out. */
 	if (acct_flags & ACB_AUTOLOCK) {



More information about the samba-cvs mailing list