s4 - Mapped AD schema to existing FDS schema.
[samba.git] / source4 / dsdb / schema / schema_convert_to_ol.c
index ebcb7ade59e3f73cb23ae253a14fead094c0d3f7..f858dc35e90de94ce258d6963e4e5e61953d384c 100644 (file)
@@ -56,9 +56,11 @@ static char *print_schema_recursive(char *append_to_string, struct dsdb_schema *
                const char **must;
                const char **may;
                char *schema_entry = NULL;
-               const char *objectclass_name_as_list[] = {
-                       objectclass->lDAPDisplayName,
-                       NULL
+               struct ldb_val objectclass_name_as_ldb_val = data_blob_string_const(objectclass->lDAPDisplayName);
+               struct ldb_message_element objectclass_name_as_el = {
+                       .name = "objectClass",
+                       .num_values = 1,
+                       .values = &objectclass_name_as_ldb_val
                };
                int j;
                int attr_idx;
@@ -89,7 +91,15 @@ static char *print_schema_recursive(char *append_to_string, struct dsdb_schema *
                        }
                }
                
-               may = dsdb_full_attribute_list(mem_ctx, schema, objectclass_name_as_list, DSDB_SCHEMA_ALL_MAY);
+               /* We might have been asked to remap this subClassOf, due to a conflict */
+               for (j=0; subClassOf && attr_map && attr_map[j].old_attr; j++) {
+                       if (strcasecmp(subClassOf, attr_map[j].old_attr) == 0) {
+                               subClassOf =  attr_map[j].new_attr;
+                               break;
+                       }
+               }
+               
+               may = dsdb_full_attribute_list(mem_ctx, schema, &objectclass_name_as_el, DSDB_SCHEMA_ALL_MAY);
 
                for (j=0; may && may[j]; j++) {
                        /* We might have been asked to remap this name, due to a conflict */ 
@@ -101,7 +111,7 @@ static char *print_schema_recursive(char *append_to_string, struct dsdb_schema *
                        }                                               
                }
 
-               must = dsdb_full_attribute_list(mem_ctx, schema, objectclass_name_as_list, DSDB_SCHEMA_ALL_MUST);
+               must = dsdb_full_attribute_list(mem_ctx, schema, &objectclass_name_as_el, DSDB_SCHEMA_ALL_MUST);
 
                for (j=0; must && must[j]; j++) {
                        /* We might have been asked to remap this name, due to a conflict */