Author: jmcd Date: 2005-11-23 22:08:57 +0000 (Wed, 23 Nov 2005) New Revision: 11886
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11886 Log: Fix 3187: logon hours restrictions were off corresponding to our offset from GMT. Use gmtime() instead of localtime() in the calc, but still use localtime() in displaying it. Modified: branches/SAMBA_3_0/source/auth/auth_sam.c trunk/source/auth/auth_sam.c Changeset: Modified: branches/SAMBA_3_0/source/auth/auth_sam.c =================================================================== --- branches/SAMBA_3_0/source/auth/auth_sam.c 2005-11-23 18:49:30 UTC (rev 11885) +++ branches/SAMBA_3_0/source/auth/auth_sam.c 2005-11-23 22:08:57 UTC (rev 11886) @@ -88,7 +88,7 @@ } lasttime = (time_t)smb_last_time.tv_sec; - utctime = localtime(&lasttime); + utctime = gmtime(&lasttime); /* find the corresponding byte and bit */ bitpos = (utctime->tm_wday * 24 + utctime->tm_hour) % 168; @@ -96,7 +96,8 @@ if (! (hours[bitpos/8] & bitmask)) { DEBUG(1,("logon_hours_ok: Account for user %s not allowed to logon at this time (%s).\n", - pdb_get_username(sampass), asctime(utctime) )); + pdb_get_username(sampass), + asctime(localtime(&lasttime)) )); return False; } Modified: trunk/source/auth/auth_sam.c =================================================================== --- trunk/source/auth/auth_sam.c 2005-11-23 18:49:30 UTC (rev 11885) +++ trunk/source/auth/auth_sam.c 2005-11-23 22:08:57 UTC (rev 11886) @@ -88,7 +88,7 @@ } lasttime = (time_t)smb_last_time.tv_sec; - utctime = localtime(&lasttime); + utctime = gmtime(&lasttime); /* find the corresponding byte and bit */ bitpos = (utctime->tm_wday * 24 + utctime->tm_hour) % 168; @@ -96,7 +96,8 @@ if (! (hours[bitpos/8] & bitmask)) { DEBUG(1,("logon_hours_ok: Account for user %s not allowed to logon at this time (%s).\n", - pdb_get_username(sampass), asctime(utctime) )); + pdb_get_username(sampass), + asctime(localtime(&lasttime)) )); return False; }