Logon hours (LDAP)

Roland Gruber post at rolandgruber.de
Thu Oct 6 18:18:54 GMT 2005


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.

Thanks in advance for your help.


Greetings,
Roland



-------- 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.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20051006/928289f5/signature.bin


More information about the samba-technical mailing list