def get_rodc_partial_attribute_set(self): '''get a list of attributes for RODC replication''' partial_attribute_set = drsuapi.DsPartialAttributeSet() # we expect one block for the object self.check_blocks(partial_attribute_set, 1) attids = [1, 2, 3] partial_attribute_set.version = 1 partial_attribute_set.attids = attids partial_attribute_set.num_attids = len(attids) # we expect one block for the object, a structure, and a # reference to the array self.check_blocks(partial_attribute_set, 2) return partial_attribute_set
def drs_get_rodc_partial_attribute_set(samdb, samdb1, exceptions=[]): '''get a list of attributes for RODC replication''' partial_attribute_set = drsuapi.DsPartialAttributeSet() partial_attribute_set.version = 1 attids = [] # the exact list of attids we send is quite critical. Note that # we do ask for the secret attributes, but set SPECIAL_SECRET_PROCESSING # to zero them out schema_dn = samdb.get_schema_basedn() res = samdb.search(base=schema_dn, scope=ldb.SCOPE_SUBTREE, expression="objectClass=attributeSchema", attrs=["lDAPDisplayName", "systemFlags", "searchFlags"]) for r in res: ldap_display_name = r["lDAPDisplayName"][0] if "systemFlags" in r: system_flags = r["systemFlags"][0] if (int(system_flags) & (samba.dsdb.DS_FLAG_ATTR_NOT_REPLICATED | samba.dsdb.DS_FLAG_ATTR_IS_CONSTRUCTED)): continue if "searchFlags" in r: search_flags = r["searchFlags"][0] if (int(search_flags) & samba.dsdb.SEARCH_FLAG_RODC_ATTRIBUTE): continue try: attid = samdb1.get_attid_from_lDAPDisplayName(ldap_display_name) if not attid in exceptions: attids.append(int(attid)) except: pass # the attids do need to be sorted, or windows doesn't return # all the attributes we need attids.sort() partial_attribute_set.attids = attids partial_attribute_set.num_attids = len(attids) return partial_attribute_set
def get_partial_attribute_set(self, attids=[drsuapi.DRSUAPI_ATTID_objectClass]): partial_attribute_set = drsuapi.DsPartialAttributeSet() partial_attribute_set.attids = attids partial_attribute_set.num_attids = len(attids) return partial_attribute_set