drs-fsmo: Improve handling of FSMO role takeover.
authorAndrew Bartlett <abartlet@samba.org>
Tue, 20 Nov 2012 03:59:17 +0000 (14:59 +1100)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 Jan 2013 14:10:10 +0000 (15:10 +0100)
This needs to be more async, and give less scary errors.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/dsdb/repl/drepl_fsmo.c
source4/dsdb/samdb/ldb_modules/rootdse.c
source4/rpc_server/drsuapi/getncchanges.c

index 0e83982ab480be2129c556e2eb7dd314c6f3b7b6..37fb684f473a1cf6970017b33d97d19b73d2c8a1 100644 (file)
@@ -108,9 +108,8 @@ NTSTATUS drepl_take_FSMO_role(struct irpc_message *msg,
                return NT_STATUS_OK;
        }
        
-       if (is_us || 
-           (extended_op == DRSUAPI_EXOP_NONE)) {
-               DEBUG(0,("FSMO role check failed for DN %s and owner %s \n",
+       if (is_us) {
+               DEBUG(5,("FSMO role check failed, we already own DN %s with %s\n",
                         ldb_dn_get_linearized(fsmo_role_dn),
                         ldb_dn_get_linearized(role_owner_dn)));
                r->out.result = WERR_OK;
index ba71b5f8ff9fe6e6a297475473f536ee9df470aa..add83d293af7ac4fc452707d9b157e1584b99c40 100644 (file)
@@ -1377,9 +1377,18 @@ static int rootdse_become_master(struct ldb_module *module,
        fsmo->ldb = ldb;
        fsmo->req = req;
 
-       /* we send the call asynchronously, as the ldap client is
+       /*
+        * we send the call asynchronously, as the ldap client is
         * expecting to get an error back if the role transfer fails
+        *
+        * We need more than the default 10 seconds IRPC allows, so
+        * set a longer timeout (default ldb timeout is 300 seconds).
+        * We send an async reply when we are done.
+        *
+        * We are the first module, so don't bother working out how
+        * long we have spent so far.
         */
+       dcerpc_binding_handle_set_timeout(irpc_handle, req->timeout);
 
        treq = dcerpc_drepl_takeFSMORole_send(req, ldb_get_event_context(ldb), irpc_handle, role);
        if (treq == NULL) {
index c3fd000e8a24d1612800b2a1b317aaadc62e345d..575d037110112be80055ce648776f6a5cb8a47fa 100644 (file)
@@ -2022,7 +2022,8 @@ allowed:
 
                werr = drsuapi_UpdateRefs(b_state, mem_ctx, &ureq);
                if (!W_ERROR_IS_OK(werr)) {
-                       DEBUG(0,(__location__ ": Failed UpdateRefs in DsGetNCChanges - %s\n",
+                       DEBUG(0,(__location__ ": Failed UpdateRefs on %s for %s in DsGetNCChanges - %s\n",
+                                drs_ObjectIdentifier_to_string(mem_ctx, ncRoot), ureq.dest_dsa_dns_name,
                                 win_errstr(werr)));
                }
        }