s4:dsdb/schema: add a function to generate the "extendedClassInfo" values
authorStefan Metzmacher <metze@samba.org>
Fri, 14 Nov 2008 07:51:59 +0000 (08:51 +0100)
committerStefan Metzmacher <metze@samba.org>
Sun, 16 Nov 2008 15:37:28 +0000 (16:37 +0100)
metze

source4/dsdb/schema/schema_description.c
source4/utils/ad2oLschema.c

index 754ce43615ce33921f0c72dcf82961e043e1d2ed..9443c04bb0d598186571870151ec18acaf8ca8fb 100644 (file)
@@ -216,7 +216,8 @@ char *schema_class_description(TALLOC_CTX *mem_ctx,
                               const char *subClassOf,
                               int objectClassCategory,
                               char **must,
-                              char **may)
+                              char **may,
+                              const char *schemaHexGUID)
 {
        char *schema_entry = talloc_asprintf(mem_ctx, 
                                             "(%s%s%s", seperator, oid, seperator);
@@ -299,7 +300,14 @@ char *schema_class_description(TALLOC_CTX *mem_ctx,
                                                      ")%s", seperator);
                IF_NULL_FAIL_RET(schema_entry);
        }
-       
+
+       if (schemaHexGUID) {
+               schema_entry = talloc_asprintf_append(schema_entry,
+                                                     "CLASS-GUID '%s'%s",
+                                                     schemaHexGUID, seperator);
+               IF_NULL_FAIL_RET(schema_entry);
+       }
+
        schema_entry = talloc_asprintf_append(schema_entry, 
                                              ")");
        return schema_entry;
@@ -325,7 +333,8 @@ char *schema_class_to_description(TALLOC_CTX *mem_ctx, const struct dsdb_class *
                                           dsdb_attribute_list(tmp_ctx, 
                                                               class, DSDB_SCHEMA_ALL_MUST),
                                           dsdb_attribute_list(tmp_ctx, 
-                                                              class, DSDB_SCHEMA_ALL_MAY));
+                                                              class, DSDB_SCHEMA_ALL_MAY),
+                                          NULL);
        talloc_free(tmp_ctx);
        return schema_description;
 }
@@ -369,7 +378,38 @@ char *schema_class_to_dITContentRule(TALLOC_CTX *mem_ctx, const struct dsdb_clas
                                                  * ditContentRules
                                                  * per MS-ADTS
                                                  * 3.1.1.3.1.1.1 */
-                                          -1, must_attr_list, may_attr_list);
+                                          -1, must_attr_list, may_attr_list,
+                                          NULL);
+       talloc_free(tmp_ctx);
+       return schema_description;
+}
+
+char *schema_class_to_extendedInfo(TALLOC_CTX *mem_ctx, const struct dsdb_class *sclass)
+{
+       char *schema_description = NULL;
+       DATA_BLOB guid_blob;
+       char *guid_hex;
+       TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+       if (!tmp_ctx) {
+               return NULL;
+       }
+
+       schema_description
+               = schema_class_description(mem_ctx,
+                                          TARGET_AD_SCHEMA_SUBENTRY,
+                                          " ",
+                                          sclass->governsID_oid,
+                                          sclass->lDAPDisplayName,
+                                          NULL,
+                                          NULL, /* Must not specify a
+                                                 * SUP (subclass) in
+                                                 * ditContentRules
+                                                 * per MS-ADTS
+                                                 * 3.1.1.3.1.1.1 */
+                                          -1, NULL, NULL,
+                                          GUID_hexstring(tmp_ctx, &sclass->schemaIDGUID));
        talloc_free(tmp_ctx);
        return schema_description;
 }
+
+
index c1e74cb3a220f04dccf98a4ecaf2d947c1f0fefd..e926dd1ccc50e476b88452fcc6f1b30db9b6f92a 100644 (file)
@@ -369,7 +369,8 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum dsdb_sch
                                                        subClassOf,
                                                        objectClassCategory,
                                                        must,
-                                                       may);
+                                                       may,
+                                                       NULL);
                if (schema_entry == NULL) {
                        ret.failures++;
                        return ret;