Fixed upstream by Douglas Bagnall(Samba.org) using ndr_unpack. With comment: 2 fields were bigger than their string format:
return '%s-%s-%s-%s-%s' % ('%02x' % struct.unpack('<L', data[0:4])[0], ^^ ^^^ '%02x' % struct.unpack('<H', data[4:6])[0], '%02x' % struct.unpack('<H', data[6:8])[0], '%02x' % struct.unpack('>H', data[8:10])[0], '%02x%02x' % struct.unpack('>HL', data[10:])) ^^^^^^^ ^^^ ** Changed in: adsys (Ubuntu) Status: New => Fix Committed -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to adsys in Ubuntu. https://bugs.launchpad.net/bugs/2100868 Title: adsys has problem unpacking GUIDs with initial 0 Status in adsys package in Ubuntu: Fix Committed Bug description: The command "adsysctl" fails due to python's struct.unpack dont handle zero padding for GUIDs. In AD domain registry this key: Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy Has data like this: {AAAAAAAA-BBBB-4EA4-8761-0CCCCCCCCCCC} (A version 4 GUID Variant 8, with last part starting with value "0C") Running "adsysctl update -a" fails on above key/data with: gensec_update_done: spnego[0x17c799f0]: NT_STATUS_OK tevent_req[0x17cc10f0/auth/gensec/spnego.c:1631]: state[2] error[0 (0x0)] state[struct gensec_spnego_update_state (0x17cc12d0)] timer[(nil)] finish[auth/gensec/spnego.c:2116] Traceback (most recent call last): File "<string>", line 142, in <module> File "<string>", line 89, in main File "<string>", line 20, in enroll File "/usr/share/adsys/python/vendor_samba/gp/gp_cert_auto_enroll_ext.py", line 517, in __enroll ca_names.extend(self.__read_cep_data(guid, ldb, TypeError: 'NoneType' object is not iterable In "gp_cert_auto_enroll_ext.py" "0CCCCCCCCCCC" is unpacked as "CCCCCCCCCCC" - as python won't pad begining/end of structs: "Padding is only automatically added between successive structure members. **No padding is added at the beginning or the end of the encoded struct.**" From: https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment One solution is to zfill(length) to ensure prepended zeros: "Return a copy of the string left filled with ASCII '0' digits to make a string of length width" From: https://docs.python.org/3/library/stdtypes.html#str.zfill Diff: diff -Naur /usr/share/adsys/python/vendor_samba/gp/gp_cert_auto_enroll_ext.py /tmp/gp_cert_auto_enroll_ext.py --- /usr/share/adsys/python/vendor_samba/gp/gp_cert_auto_enroll_ext.py 2024-03-21 11:27:01.000000000 +0100 +++ /tmp/gp_cert_auto_enroll_ext.py 2025-03-03 22:49:14.673889413 +0100 @@ -54,11 +54,11 @@ def octet_string_to_objectGUID(data): """Convert an octet string to an objectGUID.""" - return '%s-%s-%s-%s-%s' % ('%02x' % struct.unpack('<L', data[0:4])[0], - '%02x' % struct.unpack('<H', data[4:6])[0], - '%02x' % struct.unpack('<H', data[6:8])[0], - '%02x' % struct.unpack('>H', data[8:10])[0], - '%02x%02x' % struct.unpack('>HL', data[10:])) + return '%s-%s-%s-%s-%s' % (('%02x' % struct.unpack('<L', data[0:4])[0]).zfill(8), + ('%02x' % struct.unpack('<H', data[4:6])[0]).zfill(4), + ('%02x' % struct.unpack('<H', data[6:8])[0]).zfill(4), + ('%02x' % struct.unpack('>H', data[8:10])[0]).zfill(4), + ('%02x%02x' % struct.unpack('>HL', data[10:])).zfill(12)) def group_and_sort_end_point_information(end_point_information): To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/adsys/+bug/2100868/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : desktop-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp