Bug 36278 - admember.py timesync fails when using wrong locale
admember.py timesync fails when using wrong locale
Product: UCS
Classification: Unclassified
Component: AD Connector
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.0
Assigned To: Dirk Wiesenthal
Arvid Requate
: interim-3
Depends on:
Blocks: 36110 39069
  Show dependency treegraph
Reported: 2014-10-22 22:54 CEST by Dirk Wiesenthal
Modified: 2015-08-03 15:12 CEST (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2014-10-22 22:54:54 CEST
A time string returned by the AD is parsed in def timesync(). This parsing fails sometimes although the string is correct.

TIME_FORMAT = "%a %b %d %H:%M:%S %Z %Y"
datetime.strptime('Wed Oct 22 17:52:26 CEST 2014', TIME_FORMAT)

This works when you use a German UCS and just use python.

But if you do the following prior to the strptime:
  locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())

it fails.

Seen in system-setup, where setting the locale is done (mainly for apt messages).

I am not sure whether the time string returned from AD is strictly defined (w.r.t. the locale). If so, one should probably set the locale to 'C' before the check (and reset afterwards). If not, one should test against 'C' and getdefaultlocale() - as this locale is probably used on the AD, too.
Comment 1 Dirk Wiesenthal univentionstaff 2014-10-23 13:00:02 CEST
There is a
  env["LC_ALL"] = "C"

used in the rdate subprocess.

Set LC_TIME to (None, None) in
  univention-lib 4.0.3-6.283.201410231113
Comment 2 Arvid Requate univentionstaff 2014-11-04 13:16:41 CET
Ok, works. Looks like Debian rdate doesn't do setlocale.
Comment 3 Stefan Gohmann univentionstaff 2014-11-26 06:54:39 CET
UCS 4.0-0 has been released:

If this error occurs again, please use "Clone This Bug".