Load the various guids: - schemaIDguid - propset This cache is used to resolve the GUIDs of objects in ACEs.
(self)
| 585 | self._showsearchresult(item, results) |
| 586 | |
| 587 | def load_guids(self): |
| 588 | """ |
| 589 | Load the various guids: |
| 590 | - schemaIDguid |
| 591 | - propset |
| 592 | |
| 593 | This cache is used to resolve the GUIDs of objects in ACEs. |
| 594 | """ |
| 595 | if self.loadedSchemaIDGuids: |
| 596 | return True |
| 597 | |
| 598 | # Property set |
| 599 | self.guids.update( |
| 600 | ( |
| 601 | k, |
| 602 | { |
| 603 | "objectClass": ["propset"], |
| 604 | "name": v, |
| 605 | }, |
| 606 | ) |
| 607 | for k, v in LDAP_PROPERTY_SET.items() |
| 608 | ) |
| 609 | |
| 610 | # Control access |
| 611 | self.guids.update( |
| 612 | ( |
| 613 | k, |
| 614 | { |
| 615 | "objectClass": ["controlset access right"], |
| 616 | "name": v, |
| 617 | }, |
| 618 | ) |
| 619 | for k, v in LDAP_CONTROL_ACCESS_RIGHTS.items() |
| 620 | ) |
| 621 | |
| 622 | self.tprint("Resolving schemaIDguid... ", flush=True) |
| 623 | try: |
| 624 | results = self.client.search( |
| 625 | baseObject=self.rootDSE["schemaNamingContext"][0], |
| 626 | scope=1, |
| 627 | attributes=["lDAPDisplayName", "schemaIDGUID", "objectClass"], |
| 628 | ) |
| 629 | except LDAP_Exception as ex: |
| 630 | self.tprint( |
| 631 | ex.diagnosticMessage or "Error: %s" % ex.resultCode, |
| 632 | tags=["error"], |
| 633 | ) |
| 634 | return False |
| 635 | |
| 636 | self.guids.update( |
| 637 | { |
| 638 | uuid.UUID(bytes_le=v["schemaIDGUID"][0]): { |
| 639 | "objectClass": v["objectClass"], |
| 640 | "name": v["lDAPDisplayName"][0], |
| 641 | } |
| 642 | for v in results.values() |
| 643 | if "schemaIDGUID" in v |
| 644 | } |