commit a22b54de7a Author: Arvid Requate Date: Wed Dec 8 17:44:28 2021 +0100 Bug #53012: Patch proposal * Looks like accountExpires is not EOD in Samba but rather behaving just like userexpiry in UDM * Consider local server timezone when to define change of day diff --git services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py index b75a73f9a4..a0e2012305 100644 --- services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py +++ services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py @@ -240,12 +240,12 @@ def encode_s4_resultlist(s4_resultlist): def unix2s4_time(l): d = 116444736000000000 # difference between 1601 and 1970 - return int(calendar.timegm(time.strptime(l, "%Y-%m-%d")) - 86400) * 10000000 + d # AD stores end of day in accountExpires + return int(time.mktime(time.strptime(l, "%Y-%m-%d"))) * 10000000 + d # AD stores end of day in accountExpires def s42unix_time(l): d = 116444736000000000 # difference between 1601 and 1970 - return time.strftime("%Y-%m-%d", time.gmtime((l - d) / 10000000 + 86400)) # shadowExpire treats day of expiry as exclusive + return time.strftime("%Y-%m-%d", time.localtime((l - d) / 10000000)) # shadowExpire treats day of expiry as exclusive def samba2s4_time(l):