diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 20 | ||||
-rw-r--r-- | source4/dsdb/schema/schema.h | 7 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_inferiors.c | 21 |
3 files changed, 37 insertions, 11 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index f9411fe95f..26703528a7 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -1352,16 +1352,6 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) replmd_replPropertyMetaDataCtr1_sort(&nmd.ctr.ctr1, &rdn_p->attid); } - /* create the meta data value */ - ndr_err = ndr_push_struct_blob(&nmd_value, msg, - lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), - &nmd, - (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err); - return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status)); - } - /* * check if some replicated attributes left, otherwise skip the ldb_modify() call */ @@ -1385,6 +1375,16 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) nmd.ctr.ctr1.array[i].local_usn = seq_num; } + /* create the meta data value */ + ndr_err = ndr_push_struct_blob(&nmd_value, msg, + lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), + &nmd, + (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err); + return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status)); + } + /* * when we know that we'll modify the record, add the whenChanged, uSNChanged * and replPopertyMetaData attributes diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h index a605e2f707..4e7e503931 100644 --- a/source4/dsdb/schema/schema.h +++ b/source4/dsdb/schema/schema.h @@ -146,6 +146,13 @@ struct dsdb_class { uint32_t *mustContain_ids; uint32_t *mayContain_ids; uint32_t *systemPossSuperiors_ids; + + /* An ordered index showing how this subClass fits into the + * subClass tree. that is, an objectclass that is not + * subClassOf anything is 0 (just in case), and top is 1, and + * subClasses of top are 2, subclasses of those classes are + * 3 */ + uint32_t subClass_order; }; struct dsdb_schema_oid_prefix { diff --git a/source4/dsdb/schema/schema_inferiors.c b/source4/dsdb/schema/schema_inferiors.c index b0ecc08600..493b425b72 100644 --- a/source4/dsdb/schema/schema_inferiors.c +++ b/source4/dsdb/schema/schema_inferiors.c @@ -127,6 +127,20 @@ static char **schema_subclasses_recurse(struct dsdb_schema *schema, struct dsdb_ return list; } +/* Walk down the subClass tree, setting a higher index as we go down + * each level. top is 1, subclasses of top are 2, etc */ +void schema_subclasses_order_recurse(struct dsdb_schema *schema, struct dsdb_class *schema_class, int order) +{ + const char **list = schema_class->subclasses_direct; + int i; + schema_class->subClass_order = order; + for (i=0;list && list[i]; i++) { + struct dsdb_class *schema_class2 = dsdb_class_by_lDAPDisplayName(schema, list[i]); + schema_subclasses_order_recurse(schema, schema_class2, order+1); + } + return; +} + static void schema_create_subclasses(struct dsdb_schema *schema) { struct dsdb_class *schema_class; @@ -148,7 +162,12 @@ static void schema_create_subclasses(struct dsdb_schema *schema) for (schema_class=schema->classes; schema_class; schema_class=schema_class->next) { schema_class->subclasses = str_list_unique(schema_subclasses_recurse(schema, schema_class)); - } + + /* Initilise the subClass order, to ensure we can't have uninitilised sort on the subClass hirarchy */ + schema_class->subClass_order = 0; + } + + schema_subclasses_order_recurse(schema, dsdb_class_by_lDAPDisplayName(schema, "top"), 1); } static void schema_fill_possible_inferiors(struct dsdb_schema *schema, struct dsdb_class *schema_class) |