Logon hours (LDAP)
idra at samba.org
Mon Oct 10 14:55:19 GMT 2005
On Thu, 2005-10-06 at 20:18 +0200, Roland Gruber wrote:
> Hi Samba developers,
> I am a bit usure if my current implementation of the sambaLogonHours in
> LDAP Account Manager is correct.
> A long time ago I asked on this list about the format of the LDAP
> attribute. Richard Renard gave me an explanation and told me that the
> times are stored in UTC. Therefore I have to adjust the time for other
> time zones.
> Now one of our users tells me that the time zone is not interpreted by
> Samba. This means that although the times are in UTC Samba takes them as
> local time.
> Unfortunately I have no Windows PC to test this case. This is why I ask
> you. Do I have to care about time zones or is there no difference?
> I attached the relevant email for you.
as the code shows (and the comment before the function that holds that
code), the time expressed are considered in local time.
So if you set 15:00-20:00 it will be so in each time zone.
It does not really UTC.
> -------- Original-Nachricht --------
> Betreff: RE: [Lam-public] Logon hours patch
> Datum: Wed, 5 Oct 2005 07:38:04 -0700
> Von: Joe Julian <joe at julianfamily.org>
> An: <lam-public-admin at lists.sourceforge.net>
> > > You might consider removing the time zone shifting entirely as it's
> > > not necessarily needed. The hours you set in the hours tool, though
> > > stored in UTC are applied in localtime.
> > You mean that the logon hours are always defined in the same time zone
> > (UTC) and then applied in this zone? For Windows 5 o'clock
> > UTC is the same as 5 o'clock Pacific Time? I would not be
> > suprised by this behaviour but Richard Renard told me that I
> > have to manage the offset.
> I just went to the code. It doesn't look right to me, but when I define the
> hours where my samba server's local time zone is Pacific Time, yes, 5 UTC
> applies to 5 pacific. My workstations are all in the Pacific time zone too,
> so I haven't seen how it applies if the workstation's in a different zone.
> The relevant part of the samba code is in auth_sam.c:
> utctime = localtime(&smb_last_time.tv_sec);
> /* find the corresponding byte and bit */
> bitpos = (utctime->tm_wday * 24 + utctime->tm_hour) % 168;
> bitmask = 1 << (bitpos % 8);
> I'm not sure why they use localtime() instead of gmtime(), I assume they do
> that to match the behavior of windows.
Simo Sorce - idra at samba.org
Samba Team - http://www.samba.org
Italian Site - http://samba.xsec.it
More information about the samba-technical