s4/dsdb: Use dsdb_schema_info object to create default schemaInfo values
authorKamen Mazdrashki <kamenim@samba.org>
Thu, 8 Apr 2010 02:31:35 +0000 (05:31 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Fri, 9 Apr 2010 09:21:32 +0000 (12:21 +0300)
source4/dsdb/schema/schema_init.c
source4/dsdb/schema/schema_set.c

index 2f9abea303654f5ea942da14ab27eb3b96491806..1f2b1b8e1728c50aef8a0b2c70ba02613918a1ba 100644 (file)
@@ -734,9 +734,22 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
        }
        info_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "schemaInfo");
        if (!info_val) {
-               info_val_default = strhex_to_data_blob(mem_ctx, "FF0000000000000000000000000000000000000000");
-               if (!info_val_default.data) {
-                       dsdb_oom(error_string, mem_ctx);
+               struct dsdb_schema_info *schema_info;
+
+               status = dsdb_schema_info_create(ldb, mem_ctx, &schema_info);
+               if (!W_ERROR_IS_OK(status)) {
+                       *error_string = talloc_asprintf(mem_ctx,
+                                                       "schema_fsmo_init: dsdb_schema_info_create() failed - %s",
+                                                       win_errstr(status));
+                       DEBUG(0,(__location__ ": %s\n", *error_string));
+                       return LDB_ERR_OPERATIONS_ERROR;
+               }
+               status = dsdb_blob_from_schema_info(schema_info, mem_ctx, &info_val_default);
+               if (!W_ERROR_IS_OK(status)) {
+                       *error_string = talloc_asprintf(mem_ctx,
+                                                       "schema_fsmo_init: dsdb_blob_from_schema_info() failed - %s",
+                                                       win_errstr(status));
+                       DEBUG(0,(__location__ ": %s\n", *error_string));
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                info_val = &info_val_default;
index 1c7d39aa53be39a06546583c7003cfbc96662a41..9dcf2b8d426ed9c46c9f797c3fccbf65f6f42908 100644 (file)
@@ -582,6 +582,7 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const
        const struct ldb_val *prefix_val;
        const struct ldb_val *info_val;
        struct ldb_val info_val_default;
+       struct dsdb_schema_info *schema_info;
 
 
        mem_ctx = talloc_new(ldb);
@@ -622,15 +623,16 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const
 
        info_val = ldb_msg_find_ldb_val(msg, "schemaInfo");
        if (!info_val) {
-               info_val_default = strhex_to_data_blob(mem_ctx, "FF0000000000000000000000000000000000000000");
-               if (!info_val_default.data) {
-                       goto nomem;
-               }
+               status = dsdb_schema_info_create(ldb, mem_ctx, &schema_info);
+               W_ERROR_NOT_OK_GOTO(status, failed);
+               status = dsdb_blob_from_schema_info(schema_info, mem_ctx, &info_val_default);
+               W_ERROR_NOT_OK_GOTO(status, failed);
                info_val = &info_val_default;
        }
 
        status = dsdb_load_oid_mappings_ldb(schema, prefix_val, info_val);
        if (!W_ERROR_IS_OK(status)) {
+               DEBUG(0,("ERROR: dsdb_load_oid_mappings_ldb() failed with %s\n", win_errstr(status)));
                goto failed;
        }