s4:dsdb add systemPossibleInferiors to schema code
authorAndrew Bartlett <abartlet@samba.org>
Thu, 24 Sep 2009 22:12:49 +0000 (15:12 -0700)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sat, 3 Oct 2009 10:37:55 +0000 (12:37 +0200)
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
source4/dsdb/schema/schema_inferiors.c

index 4e7e503931978e4227b84afb27433b2370992f43..ddd9b375f6d686e8f0cea9813d4c439421478355 100644 (file)
@@ -119,6 +119,7 @@ struct dsdb_class {
        const char **mustContain;
        const char **mayContain;
        const char **possibleInferiors;
+       const char **systemPossibleInferiors;
 
        const char *defaultSecurityDescriptor;
 
index b02d557c5884708de50da52db7c64c1c0e714092..264e4712988449361e7b59007e56c8dfa84c7d20 100644 (file)
@@ -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 */