Bug 55042 - o365_usertokens TypeError Tuple_to_LDAPMod expected a byte string in the list
o365_usertokens TypeError Tuple_to_LDAPMod expected a byte string in the list
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Office 365
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: Johannes Lohmer
Erik Damrose
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-29 06:58 CEST by stefan.schatz
Modified: 2023-07-18 17:31 CEST (History)
5 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.229
Enterprise Customer affected?: Yes
School Customer affected?:
ISV affected?:
Waiting Support: Yes
Flags outvoted (downgraded) after PO Review:
Ticket number: 2023031621000436, 2023031621000847
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 stefan.schatz 2022-07-29 06:58:05 CEST
Possible Python 3 Migration Bug:

root@srv:~# /usr/share/univention-office365/scripts/o365_usertokens --invalidate-tokens --modify
Traceback (most recent call last):
  File "/usr/share/univention-office365/scripts/o365_usertokens", line 150, in <module>
    lo.modify(ldap_user[0], [('univentionOffice365TokenResetDate', ldap_user_old_reset_date, [next_mod_date.strftime("%Y%m%d")])])
  File "/usr/lib/python3/dist-packages/univention/admin/uldap.py", line 803, in modify
    return self.lo.modify(dn, changes, serverctrls=serverctrls, response=response, rename_callback=rename_callback)
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 208, in _decorated
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 754, in modify
    self.modify_ext_s(dn, ml, serverctrls=serverctrls, response=response)
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 208, in _decorated
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 813, in modify_ext_s
    rtype, rdata, rmsgid, resp_ctrls = self.lo.modify_ext_s(dn, ml, serverctrls=serverctrls)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 1253, in modify_ext_s
    return self._apply_method_s(SimpleLDAPObject.modify_ext_s,*args,**kwargs)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 1197, in _apply_method_s
    return func(self,*args,**kwargs)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 601, in modify_ext_s
    msgid = self.modify_ext(dn,modlist,serverctrls,clientctrls)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 598, in modify_ext
    return self._ldap_call(self._l.modify_ext,dn,modlist,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls))
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 313, in _ldap_call
    result = func(*args,**kwargs)
TypeError: ('Tuple_to_LDAPMod(): expected a byte string in the list', '20220927')

Fixed with:
root@srv:~# diff /usr/share/univention-office365/scripts/o365_usertokens /usr/share/univention-office365/scripts/o365_usertokens.fixed
150c150
<                               lo.modify(ldap_user[0], [('univentionOffice365TokenResetDate', ldap_user_old_reset_date, [next_mod_date.strftime("%Y%m%d")])])
---
>                               lo.modify(ldap_user[0], [('univentionOffice365TokenResetDate', ldap_user_old_reset_date, [next_mod_date.strftime("%Y%m%d").encode('utf-8')])])
Comment 1 Erik Damrose univentionstaff 2023-03-20 10:54:43 CET
Workaround: deactivate cronjob for now
ucr set office365/tokens/cron/enable=false
Comment 3 Stefan Gohmann univentionstaff 2023-07-18 15:27:02 CEST
Any updates?
Comment 4 Erik Damrose univentionstaff 2023-07-18 17:31:52 CEST
Fixed in app version office365=5.7 for UCS 5.0

22fead6b univention-office365 2.0.4-14