Skip to content

Commit 2380856

Browse files
GabrielNagygithub-actions[bot]
authored andcommitted
Auto update vendored Samba code
1 parent f68a9bc commit 2380856

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
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

.github/samba/python/samba/gp/gpclass.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,10 @@ def __init__(self, gPLink, gPOptions):
673673
self.gp_opts = int(gPOptions)
674674

675675
def gpo_parse_gplink(self, gPLink):
676+
# normally formed link looks like [LDAP://host/path;options]
677+
# empty link looks like [ ]
676678
for p in gPLink.decode().split(']'):
677-
if not p:
679+
if not p or ';' not in p:
678680
continue
679681
log.debug('gpo_parse_gplink: processing link')
680682
p = p.lstrip('[')

0 commit comments

Comments
 (0)