Bug 56537 - Adjust S4-Connector to sambadns.py API change
Adjust S4-Connector to sambadns.py API change
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: S4 Connector
UCS 5.2
Other Linux
: P5 normal (vote)
: UCS 5.0-5-errata
Assigned To: Florian Best
Felix Botner
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-05 19:19 CEST by Florian Best
Modified: 2023-10-11 16:36 CEST (History)
0 users

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
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 Florian Best univentionstaff 2023-09-05 19:19:11 CEST
In UCS 5.2 or UCS 5.2 we see somewhere during the test execution the following traceback:

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/univention/s4connector/__init__.py", line 809, in __sync_file_from_ucs
        if not self.sync_from_ucs(key, mapped_object, pre_mapped_ucs_dn, old_dn, old, new):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/univention/s4connector/s4/__init__.py", line 2029, in sync_from_ucs
        self.property[property_type].con_sync_function(self, property_type, object)
      File "/usr/lib/python3/dist-packages/univention/s4connector/s4/dns.py", line 1568, in ucs2con
        s4_txt_record_create(s4connector, object)
      File "/usr/lib/python3/dist-packages/univention/s4connector/s4/dns.py", line 1249, in s4_txt_record_create
        __pack_txtRecord(object, dnsRecords)
      File "/usr/lib/python3/dist-packages/univention/s4connector/s4/dns.py", line 577, in __pack_txtRecord
        ndr_txt_record = ndr_pack(TXTRecord(token_list))
                                  ^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/samba/provision/sambadns.py", line 179, in __init__
        stringlist.str = slist
        ^^^^^^^^^^^^^^
    TypeError: librpc/gen_ndr/py_dnsp.c:2270: Expected type 'list' for 'value' of type 'tuple'

Patch:
diff --git services/univention-s4-connector/modules/univention/s4connector/s4/dns.py services/univention-s4-connector/modules/univention/s4connector/s4/dns.py
index d830e5e0f8..773fe4206a 100644
--- services/univention-s4-connector/modules/univention/s4connector/s4/dns.py
+++ services/univention-s4-connector/modules/univention/s4connector/s4/dns.py
@@ -574,7 +574,7 @@ def __pack_txtRecord(object, dnsRecords):
         if txtRecord:
             ud.debug(ud.LDAP, ud.INFO, '__pack_txtRecord: %s' % txtRecord)
             token_list = TXT.from_text(rdataclass.IN, rdatatype.TXT, Tokenizer(txtRecord)).strings
-            ndr_txt_record = ndr_pack(TXTRecord(token_list))
+            ndr_txt_record = ndr_pack(TXTRecord(list(token_list)))
             dnsRecords.append(ndr_txt_record)
             ud.debug(ud.LDAP, ud.INFO, '__pack_txtRecord: %s' % ndr_txt_record)
Comment 1 Florian Best univentionstaff 2023-09-05 19:20:17 CEST
Another one:

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/univention/s4connector/__init__.py", line 1486, in sync_to_ucs
        post_ucs_modify_function(self, property_type, object)
      File "/usr/lib/python3/dist-packages/univention/s4connector/s4/ntsecurity_descriptor.py", line 137, in ntsd_to_ucs
        s4connector._remember_entryCSN_commited_by_connector(entryUUID, entryCSN)
      File "/usr/lib/python3/dist-packages/univention/s4connector/__init__.py", line 621, in _remember_entryCSN_commited_by_connector
        entryCSN_set = set(value.split(','))
                           ^^^^^^^^^^^^^^^^
    TypeError: a bytes-like object is required, not 'str'

diff --git services/univention-s4-connector/modules/univention/s4connector/__init__.py services/univention-s4-connector/modules/univention/s4connector/__init__.py
index 85e2941341..1236edf63b 100644
--- services/univention-s4-connector/modules/univention/s4connector/__init__.py
+++ services/univention-s4-connector/modules/univention/s4connector/__init__.py
@@ -617,6 +617,8 @@ class ucs(object):
     def _remember_entryCSN_commited_by_connector(self, entryUUID, entryCSN):
         """Remember the entryCSN of a change committed by the AD-Connector itself"""
         value = self._get_config_option('UCS entryCSN', entryUUID)
+        if isinstance(value, bytes):
+            value = value.decode('ASCII')
         if value:
             entryCSN_set = set(value.split(','))
             entryCSN_set.add(entryCSN)
Comment 3 Florian Best univentionstaff 2023-10-05 13:48:06 CEST
(In reply to Florian Best from comment #1)
→ This is Bug #56603 and has been fixed differently.
Comment 4 Florian Best univentionstaff 2023-10-05 13:54:07 CEST
univention-s4-connector.yaml
0cacd8bd7de1 | fix(s4c): adjust to upstream type check for TXTRecords in python3-samba

univention-s4-connector (14.0.15-5)
0cacd8bd7de1 | fix(s4c): adjust to upstream type check for TXTRecords in python3-samba
Comment 5 Felix Botner univentionstaff 2023-10-09 09:35:33 CEST
OK - yaml
OK - s4con tests
Comment 6 Iván.Delgado univentionstaff 2023-10-11 16:36:30 CEST
<https://errata.software-univention.de/#/?erratum=5.0x838>