s4-drepl: During Schema replication, we need to save updated prefixMap if everything...
authorKamen Mazdrashki <kamenim@samba.org>
Sat, 18 Dec 2010 03:30:08 +0000 (05:30 +0200)
committerKamen Mazdrashki <kamenim@samba.org>
Sat, 18 Dec 2010 04:53:48 +0000 (05:53 +0100)
Autobuild-User: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-Date: Sat Dec 18 05:53:48 CET 2010 on sn-devel-104

source4/dsdb/repl/replicated_objects.c

index 5997073a8a2907867fd3878a733a478acc60394f..0def815c5f65029dc23bc9e0a07f671dd4b047c7 100644 (file)
@@ -445,6 +445,7 @@ WERROR dsdb_replicated_objects_commit(struct ldb_context *ldb,
                                      struct dsdb_extended_replicated_objects *objects,
                                      uint64_t *notify_uSN)
 {
+       WERROR werr;
        struct ldb_result *ext_res;
        struct dsdb_schema *cur_schema = NULL;
        int ret;
@@ -503,6 +504,23 @@ WERROR dsdb_replicated_objects_commit(struct ldb_context *ldb,
        }
        talloc_free(ext_res);
 
+       /* Save our updated prefixMap */
+       if (working_schema) {
+               werr = dsdb_write_prefixes_from_schema_to_ldb(working_schema,
+                                                             ldb,
+                                                             working_schema);
+               if (!W_ERROR_IS_OK(werr)) {
+                       /* restore previous schema */
+                       if (cur_schema ) {
+                               dsdb_reference_schema(ldb, cur_schema, false);
+                               dsdb_make_schema_global(ldb, cur_schema);
+                       }
+                       DEBUG(0,("Failed to save updated prefixMap: %s\n",
+                                win_errstr(werr)));
+                       return werr;
+               }
+       }
+
        ret = ldb_transaction_prepare_commit(ldb);
        if (ret != LDB_SUCCESS) {
                /* restore previous schema */