Bug 56145 - resync_object_from_s4.py --filter causes: TypeError: Filter must be string, not bytes
resync_object_from_s4.py --filter causes: TypeError: Filter must be string, n...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: S4 Connector
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-4
Assigned To: Arvid Requate
Julia Bremer
https://git.knut.univention.de/univen...
: python3-migration
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-06-13 17:21 CEST by Arvid Requate
Modified: 2023-06-21 09:24 CEST (History)
2 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?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.034
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2023053121000216
Bug group (optional): bitesize
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate univentionstaff 2023-06-13 17:21:45 CEST
Have patch, need bug.
Comment 1 Arvid Requate univentionstaff 2023-06-13 19:19:42 CEST
In a support case this command was run:

/usr/share/univention-s4-connector/resync_object_from_s4.py --filter CN=krbtgt

And it resulted in a reject with this traceback:
====================================================
11.06.2023 00:00:08.243 LDAP        (PROCESS): sync AD > UCS: Resync rejected dn: 'CN=krbtgt,CN=Users,DC=domain,DC=net'
11.06.2023 00:00:08.243 LDAP        (ERROR  ): unexpected Error during s4.resync_rejected
11.06.2023 00:00:08.244 LDAP        (ERROR  ): Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/s4connector/s4/__init__.py", line 1760, in resync_rejected
    elements = self.__search_ad_changeUSN(change_usn, show_deleted=True)
  File "/usr/lib/python3/dist-packages/univention/s4connector/s4/__init__.py", line 965, in __search_ad_changeUSN
    usn_filter = format_escaped('(|(uSNChanged={0!e})(uSNCreated={0!e}))', changeUSN)
  File "/usr/lib/python3/dist-packages/univention/s4connector/s4/__init__.py", line 489, in format_escaped
    return LDAPEscapeFormatter().format(format_string, *args, **kwargs)
  File "/usr/lib/python3.7/string.py", line 186, in format
    return self.vformat(format_string, args, kwargs)
  File "/usr/lib/python3.7/string.py", line 190, in vformat
    result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
  File "/usr/lib/python3.7/string.py", line 234, in _vformat
    obj = self.convert_field(obj, conversion)
  File "/usr/lib/python3/dist-packages/univention/s4connector/s4/__init__.py", line 474, in convert_field
    raise TypeError('Filter must be string, not bytes: %r' % (value,))
TypeError: Filter must be string, not bytes: b'4120'
====================================================

b0370e8d46 | Fix bytes decoding for resync_object_from_s4.py --filter

I guess we should have a backport and then maybe also a resulting changelog entry.
Comment 2 Julia Bremer univentionstaff 2023-06-15 14:48:42 CEST
Ok no new tracebacks are generated by using /usr/share/univention-s4-connector/resync_object_from_s4.py --filter
Please note that already created rejects are not automatically cleaned up.
Package update OK.
No changelog needed.
Verified
Comment 3 Philipp Hahn univentionstaff 2023-06-21 09:24:42 CEST
UCS 5.0-4 has been released:
 https://docs.software-univention.de/release-notes/5.0-4/en/

If this error occurs again, please use the 'Clone This Bug' option.