Bug 46546 - fix s42unix_time()
fix s42unix_time()
Status: CLOSED DUPLICATE of bug 50202
Product: UCS
Classification: Unclassified
Component: S4 Connector
UCS 4.3
Other Linux
: P5 normal (vote)
: UCS 4.4-2-errata
Assigned To: Julia Bremer
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-08 13:52 CET by Felix Botner
Modified: 2020-07-13 11:17 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.051
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2018-03-08 13:52:25 CET
see Bug #46544

 def s42unix_time(l):
        d = 116444736000000000L  # difference between 1601 and 1970
-       return time.strftime("%d.%m.%y", time.gmtime((l - d) / 10000000))
+       return time.strftime("%Y-%m-%d", time.gmtime((l - d) / 10000000))

also for ad-connector
Comment 1 Florian Best univentionstaff 2019-10-28 17:02:46 CET
A little bit more descriptive:

UDM stores the userexpiry internally as e.g. "2019-10-28" (not as 28.10.19 which is only accepted as input).
The function s42unix_time is only used once/twice in the S4-Connector:

services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py:
  2027 »   def disable_user_to_ucs(self, key, object):
…
  2060 »   »   »   if s42unix_time(int(ldap_object_s4['accountExpires'][0])) != ucs_admin_object['userexpiry']:
  2061 »   »   »   »   # ucs account not expired -> change
  2062 »   »   »   »   ucs_admin_object['userexpiry'] = s42unix_time(int(ldap_object_s4['accountExpires'][0]))
  2063 »   »   »   »   modified = 1

In the case the 'accountExpires' attribute changed on the AD-object the code always evaluates to True and makes a modify() call, even if it's not necessary.

It can simply be changed/fixed without side effects.
Comment 2 Florian Best univentionstaff 2019-10-30 10:31:56 CET
Julias fixed this along with:
73695b3806 Bug #50202: Fix userexpiry timezone Loop
Comment 3 Florian Best univentionstaff 2019-10-30 12:57:56 CET
OK

*** This bug has been marked as a duplicate of bug 50202 ***