s4-dsdb: fixed re-join of subdomain
authorAndrew Tridgell <tridge@samba.org>
Sat, 1 Oct 2011 00:57:14 +0000 (10:57 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 4 Oct 2011 04:08:58 +0000 (15:08 +1100)
if we repeat the join of a subdomain then we try to re-create the NC
for the subdomain during a DsAddEntry(). This allows that re-creation
to succeed if the NC already exists

source4/dsdb/common/util.c

index 106e261..cae6bd4 100644 (file)
@@ -4495,9 +4495,10 @@ int dsdb_create_partial_replica_NC(struct ldb_context *ldb,  struct ldb_dn *dn)
        }
 
        ret = dsdb_add(ldb, msg, DSDB_MODIFY_PARTIAL_REPLICA);
-       if (ret != LDB_SUCCESS) {
-               DEBUG(0,("Failed to create new NC for %s - %s\n",
-                        ldb_dn_get_linearized(dn), ldb_errstring(ldb)));
+       if (ret != LDB_SUCCESS && ret != LDB_ERR_ENTRY_ALREADY_EXISTS) {
+               DEBUG(0,("Failed to create new NC for %s - %s (%s)\n",
+                        ldb_dn_get_linearized(dn),
+                        ldb_errstring(ldb), ldb_strerror(ret)));
                talloc_free(tmp_ctx);
                return ret;
        }