Skip to content

Commit a4a01f6

Browse files
GabrielNagygithub-actions[bot]
authored andcommitted
Auto update vendored Samba code
1 parent 1299f27 commit a4a01f6

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

.github/samba/python/samba/gp/gp_cert_auto_enroll_ext.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import requests
2020
from samba.gp.gpclass import gp_pol_ext, gp_applier, GPOSTATE
2121
from samba import Ldb
22+
from samba.dcerpc import misc
23+
from samba.ndr import ndr_unpack
24+
2225
from ldb import SCOPE_SUBTREE, SCOPE_BASE
2326
from samba.auth import system_session
2427
from samba.gp.gpclass import get_dc_hostname
@@ -52,14 +55,6 @@ def load_der_pkcs7_certificates(x): return []
5255
'/etc/pki/ca-trust/source/anchors', # RHEL/Fedora
5356
'/usr/local/share/ca-certificates'] # Debian/Ubuntu
5457

55-
def octet_string_to_objectGUID(data):
56-
"""Convert an octet string to an objectGUID."""
57-
return '%s-%s-%s-%s-%s' % ('%02x' % struct.unpack('<L', data[0:4])[0],
58-
'%02x' % struct.unpack('<H', data[4:6])[0],
59-
'%02x' % struct.unpack('<H', data[6:8])[0],
60-
'%02x' % struct.unpack('>H', data[8:10])[0],
61-
'%02x%02x' % struct.unpack('>HL', data[10:]))
62-
6358

6459
def group_and_sort_end_point_information(end_point_information):
6560
"""Group and Sort End Point Information.
@@ -480,7 +475,7 @@ def __read_cep_data(self, guid, ldb, end_point_information,
480475
# instance. If the values do not match, continue with the next
481476
# group.
482477
objectGUID = '{%s}' % \
483-
octet_string_to_objectGUID(res2[0]['objectGUID'][0]).upper()
478+
str(ndr_unpack(misc.GUID, res2[0]['objectGUID'][0])).upper()
484479
if objectGUID != e['PolicyID']:
485480
continue
486481

0 commit comments

Comments
 (0)