From 0e028fcb7d141d68de2baadeb2c0fae262f2bedc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 24 Sep 2009 15:12:49 -0700 Subject: s4:dsdb add systemPossibleInferiors to schema code This allows us to figure out what the system can add, which will not be in possibleInferiors due to the systemOnly flag. Andrew Bartlett --- source4/dsdb/schema/schema.h | 1 + source4/dsdb/schema/schema_inferiors.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'source4/dsdb/schema') diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h index 4e7e503931..ddd9b375f6 100644 --- a/source4/dsdb/schema/schema.h +++ b/source4/dsdb/schema/schema.h @@ -119,6 +119,7 @@ struct dsdb_class { const char **mustContain; const char **mayContain; const char **possibleInferiors; + const char **systemPossibleInferiors; const char *defaultSecurityDescriptor; diff --git a/source4/dsdb/schema/schema_inferiors.c b/source4/dsdb/schema/schema_inferiors.c index b02d557c58..264e471298 100644 --- a/source4/dsdb/schema/schema_inferiors.c +++ b/source4/dsdb/schema/schema_inferiors.c @@ -198,6 +198,25 @@ static void schema_fill_possible_inferiors(struct dsdb_schema *schema, struct ds schema_class->possibleInferiors = str_list_unique(schema_class->possibleInferiors); } +static void schema_fill_system_possible_inferiors(struct dsdb_schema *schema, struct dsdb_class *schema_class) +{ + struct dsdb_class *c2; + + for (c2=schema->classes; c2; c2=c2->next) { + char **superiors = schema_posssuperiors(schema, c2); + if (c2->objectClassCategory != 2 + && c2->objectClassCategory != 3 + && str_list_check(superiors, schema_class->lDAPDisplayName)) { + if (schema_class->possibleInferiors == NULL) { + schema_class->systemPossibleInferiors = str_list_make_empty(schema_class); + } + schema_class->systemPossibleInferiors = str_list_add_const(schema_class->systemPossibleInferiors, + c2->lDAPDisplayName); + } + } + schema_class->systemPossibleInferiors = str_list_unique(schema_class->systemPossibleInferiors); +} + /* fill in a string class name from a governs_ID */ @@ -285,6 +304,7 @@ void schema_fill_constructed(struct dsdb_schema *schema) for (schema_class=schema->classes; schema_class; schema_class=schema_class->next) { schema_fill_possible_inferiors(schema, schema_class); + schema_fill_system_possible_inferiors(schema, schema_class); } /* free up our internal cache elements */ -- cgit