r11886: Fix 3187: logon hours restrictions were off corresponding to our offset from
authorJim McDonough <jmcd@samba.org>
Wed, 23 Nov 2005 22:08:57 +0000 (22:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:33 +0000 (11:05 -0500)
GMT.  Use gmtime() instead of localtime() in the calc, but still use
localtime() in displaying it.

source/auth/auth_sam.c

index c92cecdde59ddb45ed0a6d415165c340975e4b51..558c181f704452731324e98515f00a3fee6b9293 100644 (file)
@@ -88,7 +88,7 @@ static BOOL logon_hours_ok(SAM_ACCOUNT *sampass)
        }
 
        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 @@ static BOOL logon_hours_ok(SAM_ACCOUNT *sampass)
 
        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;
        }