|
19 | 19 | import requests |
20 | 20 | from samba.gp.gpclass import gp_pol_ext, gp_applier, GPOSTATE |
21 | 21 | from samba import Ldb |
| 22 | +from samba.dcerpc import misc |
| 23 | +from samba.ndr import ndr_unpack |
| 24 | + |
22 | 25 | from ldb import SCOPE_SUBTREE, SCOPE_BASE |
23 | 26 | from samba.auth import system_session |
24 | 27 | from samba.gp.gpclass import get_dc_hostname |
@@ -52,14 +55,6 @@ def load_der_pkcs7_certificates(x): return [] |
52 | 55 | '/etc/pki/ca-trust/source/anchors', # RHEL/Fedora |
53 | 56 | '/usr/local/share/ca-certificates'] # Debian/Ubuntu |
54 | 57 |
|
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 | | - |
63 | 58 |
|
64 | 59 | def group_and_sort_end_point_information(end_point_information): |
65 | 60 | """Group and Sort End Point Information. |
@@ -480,7 +475,7 @@ def __read_cep_data(self, guid, ldb, end_point_information, |
480 | 475 | # instance. If the values do not match, continue with the next |
481 | 476 | # group. |
482 | 477 | objectGUID = '{%s}' % \ |
483 | | - octet_string_to_objectGUID(res2[0]['objectGUID'][0]).upper() |
| 478 | + str(ndr_unpack(misc.GUID, res2[0]['objectGUID'][0])).upper() |
484 | 479 | if objectGUID != e['PolicyID']: |
485 | 480 | continue |
486 | 481 |
|
|
0 commit comments