Bug 36278

Summary: admember.py timesync fails when using wrong locale
Product: UCS Reporter: Dirk Wiesenthal <wiesenthal>
Component: AD ConnectorAssignee: Dirk Wiesenthal <wiesenthal>
Status: CLOSED FIXED QA Contact: Arvid Requate <requate>
Severity: normal    
Priority: P5 CC: gohmann
Version: UCS 4.0Keywords: interim-3
Target Milestone: UCS 4.0   
Hardware: Other   
OS: Linux   
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: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:
Bug Depends on:    
Bug Blocks: 36110, 39069    

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:
 http://docs.univention.de/release-notes-4.0-0-en.html
 http://docs.univention.de/release-notes-4.0-0-de.html

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