Univention Bugzilla – Bug 46544
OverflowError: mktime argument out of range
Last modified: 2019-02-27 18:04:43 CET
We have seen rejects after migrating a productive server with legacy data containing disabled use accounts: 08.03.2018 12:13:39,961 LDAP (PROCESS): sync to ucs: [ user] [ modify] uid=someuser,cn=disabled,cn=users,dc=domain,dc=local 08.03.2018 12:13:41,77 LDAP (ERROR ): failed in post_con_modify_functions 08.03.2018 12:13:41,78 LDAP (ERROR ): Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1600, in sync_to_ucs f(self, property_type, object) File "/usr/lib/pymodules/python2.7/univention/s4connector/s4/__init__.py", line 107, in disable_user_to_ucs return s4connector.disable_user_to_ucs(key, object) File "/usr/lib/pymodules/python2.7/univention/s4connector/s4/__init__.py", line 2180, in disable_user_to_ucs ucs_admin_object.modify() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 1676, in modify return super(object, self).modify(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 526, in modify dn = self._modify(modify_childs, ignore_license=ignore_license, response=response) File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 1068, in _modify ml = self._ldap_modlist() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 1975, in _ldap_modlist ml = self._modlist_samba_kickoff_time(ml) File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 2221, in _modlist_samba_kickoff_time sambaKickoffTime = "%d" % long(time.mktime(time.strptime(self['userexpiry'], "%Y-%m-%d"))) OverflowError: mktime argument out of range
samba: accountExpires: 116446428000000000
Created attachment 9451 [details] fix_userexpiry_mapping_1970_to_2070.patch The S4-Connector writes 02.01.70 into the UDM property "userexpiry". The date2 syntax turns that into 2070. That's wrong. The mktime traceback is just a symptom due to the 2038 unix date boundary: >>> time.mktime(time.strptime("2070-01-02", "%Y-%m-%d")) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: mktime argument out of range The attached patch may be suitable to fix this.
ldap account before migration objectClass: top objectClass: person objectClass: univentionPWHistory objectClass: posixAccount objectClass: shadowAccount objectClass: univentionMail objectClass: organizationalPerson objectClass: inetOrgPerson objectClass: kolabInetOrgPerson objectClass: ownCloudUser objectClass: oxUserObject objectClass: univentionObject objectClass: univentionXMPPAccount shadowMax: 90 shadowLastChange: 16563 shadowExpire: 1 migration script [('objectClass', [], ['krb5KDCEntry', 'sambaSamAccount', 'krb5Principal']), ('krb5KeyVersionNumber', [], ['1']), ('krb5KDCFlags', [], ['254']), ('krb5MaxLife', [], ['86400']), ('krb5MaxRenew', [], ['604800']), ('krb5ValidEnd', [], ['19700102000000Z']), ('krb5PasswordEnd', [], ['20150806000000Z']), ('sambaSID', [], ['S-1-4-2281']), ('sambaAcctFlags', [], ['[UD ]']), ('sambaPwdLastSet', [], ['1431039600'])]
maybe at this point it is a good idea to fix the s4 connector ad to userexpiry function? 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))
I committed a similar patch. Package rebuilt Package: univention-directory-manager-modules Version: 13.0.21-13A~4.3.0.201803081313 Branch: ucs_4.3-0 Changelog adjusted.
OK, works
UCS 4.3 has been released: https://docs.software-univention.de/release-notes-4.3-0-en.html https://docs.software-univention.de/release-notes-4.3-0-de.html If this error occurs again, please use "Clone This Bug".