s4-dsdb: fail the transaction instead of asserting on error
authorAndrew Tridgell <tridge@samba.org>
Fri, 1 Oct 2010 17:24:46 +0000 (10:24 -0700)
committerAndrew Tridgell <tridge@samba.org>
Fri, 1 Oct 2010 17:44:24 +0000 (10:44 -0700)
It is more useful to fail the transaction and give the user an error
message than to assert when we have an error in the repl_meta_data
module

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index ebd005e46ef5cc0c77b5f36853cacd61354a78e1..17dcba5929b97d93e5652ed60458c17cf2d464b2 100644 (file)
@@ -2981,9 +2981,17 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
        md_remote = replmd_replPropertyMetaData1_find_attid(rmd, DRSUAPI_ATTRIBUTE_name);
        if (md_remote) {
                md_local = replmd_replPropertyMetaData1_find_attid(&omd, DRSUAPI_ATTRIBUTE_name);
-               SMB_ASSERT(md_local);
+               if (!md_local) {
+                       DEBUG(0,(__location__ ": No md_local in RPMD\n"));
+                       return replmd_replicated_request_werror(ar, WERR_DS_DRA_INTERNAL_ERROR);
+               }
                if (replmd_replPropertyMetaData1_is_newer(md_local, md_remote)) {
-                       SMB_ASSERT(ldb_dn_compare(msg->dn, ar->search_msg->dn) != 0);
+                       if (ldb_dn_compare(msg->dn, ar->search_msg->dn) != 0) {
+                               DEBUG(0,(__location__ ": DNs don't match in RPMD: %s %s\n",
+                                        ldb_dn_get_linearized(msg->dn),
+                                        ldb_dn_get_linearized(ar->search_msg->dn)));
+                               return replmd_replicated_request_werror(ar, WERR_DS_DRA_INTERNAL_ERROR);
+                       }
                        /* TODO: Find appropriate local name (dn) for the object
                         *       and modify msg->dn appropriately */