The branch, v4-12-stable has been updated
       via  911e11ad4e3 VERSION: Disable GIT_SNAPSHOT for the 4.12.8 release.
       via  1a216673b61 WHATSNEW: Add release notes for Samba 4.12.8.
       via  3af0ca2ee90 winbind: Fix a memleak
       via  ba63dd8867f VERSION: Bump version up to 4.12.8...
       via  155e6c0b855 Merge tag 'samba-4.12.7' into v4-12-test
       via  02ee82f6e4d waf: Only use gnutls_aead_cipher_encryptv2() for GnuTLS 
> 3.6.14
       via  60ddb7b2007 s3:smbd: Fix %U substitutions if it contains a domain 
name
       via  20d3cf455c6 s3:tests: Add test for 'valid users = DOMAIN\%U'
       via  2207bc89005 lib/replace: move lib/replace/closefrom.c from 
ROKEN_HOSTCC_SOURCE to REPLACE_HOSTCC_SOURCE
       via  ea7c6bc9769 tldap: Receiving "msgid == 0" means the connection is 
dead
       via  ffb843f1f6b test: Test winbind idmap_ad ticket expiry behaviour
       via  02a5b62be8d idmap_ad: Pass tldap debug messages on to DEBUG()
       via  96a67ce2b2f tldap: Add PRINTF_ATTRIBUTE declaration to tldap_debug()
       via  5db438e2263 tldap: Make sure all requests are cancelled on rundown
       via  f83e351bafb tldap: Centralize connection rundown on error
       via  8888586f7b2 tldap: Maintain the ldap read request in tldap_context
       via  49afb56d4ad tldap: Always remove ourselves from ld->pending at 
cleanup time
       via  334152a291b tldap: Fix tldap_msg_received()
       via  2eef42e6908 tldap: Only free() ld->pending if "req" is part of it
       via  a8dfc1ad59f ldap_server: Terminate LDAP connections on krb ticket 
expiry
       via  6026130628e ldap_server: Add the krb5 expiry to conn->limits
       via  a15c4c5903c torture: Test ldap session expiry
       via  0f5759f7561 build: Wrap a long line
       via  4955925e912 ctdb-recoverd: Rename update_local_flags() -> 
update_flags()
       via  087f8868209 ctdb-recoverd: Change update_local_flags() to use 
already retrieved nodemaps
       via  99441077417 ctdb-recoverd: Get remote nodemaps earlier
       via  4820778cfbe ctdb-recoverd: Do not fetch the nodemap from the 
recovery master
       via  4c5fde56c30 ctdb-recoverd: Change get_remote_nodemaps() to use 
connected nodes
       via  4aae8adc718 ctdb-recoverd: Fix node_pnn check and assignment of 
nodemap into array
       via  ad9780853ed ctdb-recoverd: Add fail callback to assign banning 
credits
       via  db34c22ab12 ctdb-recoverd: Add an intermediate state struct for 
nodemap fetching
       via  d360401282d ctdb-recoverd: Move memory allocation into 
get_remote_nodemaps()
       via  bedd92b813c ctdb-recoverd: Change signature of get_remote_nodemaps()
       via  3b35541c13d ctdb-recoverd: Fix a local memory leak
       via  828807f52d3 ctdb-recoverd: Basic cleanups for get_remote_nodemaps()
       via  5f0f32ab639 ctdb-recoverd: Simplify calculation of new flags
       via  442d6b0b66e ctdb-recoverd: Correctly find nodemap entry for pnn
       via  b3a3eeb4ba8 ctdb-recoverd: Do not retrieve nodemap from recovery 
master
       via  fc489e5deaf ctdb-recoverd: Flatten update_flags_on_all_nodes()
       via  32dfcdb1bc4 ctdb-recoverd: Move ctdb_ctrl_modflags() to 
ctdb_recoverd.c
       via  ba505c32e96 ctdb-recoverd: Improve a call to 
update_flags_on_all_nodes()
       via  90db66414a0 ctdb-recoverd: Use update_flags_on_all_nodes()
       via  f96017bddcc ctdb-recoverd: Introduce some local variables to 
improve readability
       via  e22268a7d7d ctdb-recoverd: Change update_flags_on_all_nodes() to 
take rec argument
       via  878c3b49f62 ctdb-recoverd: Drop unused nodemap argument from 
update_flags_on_all_nodes()
       via  debb98b55a2 docs: Add missing winexe manpage
       via  492213aff41 util: Add cmocka unit test for 
directory_create_or_exists
       via  0797eef2901 util: Allow symlinks in directory_create_or_exist
      from  356c036ef15 VERSION: Disable GIT_SNAPSHOT for 4.12.7 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                    |   2 +-
 WHATSNEW.txt                               |  68 +++++++-
 ctdb/include/ctdb_client.h                 |   5 -
 ctdb/server/ctdb_client.c                  |  65 -------
 ctdb/server/ctdb_recoverd.c                | 264 ++++++++++++++++++++---------
 docs-xml/manpages/winexe.1.xml             | 184 ++++++++++++++++++++
 docs-xml/wscript_build                     |   5 +
 lib/replace/wscript                        |   3 +
 lib/util/tests/test_util.c                 | 234 +++++++++++++++++++++++++
 lib/util/util.c                            |  18 +-
 lib/util/wscript_build                     |   6 +
 nsswitch/tests/test_ticket_expiry.sh       |  74 ++++++++
 selftest/target/Samba3.pm                  |   5 +
 selftest/target/Samba4.pm                  |   6 +-
 selftest/tests.py                          |   2 +
 source3/lib/tldap.c                        | 146 ++++++++++------
 source3/script/tests/test_substitutions.sh |   5 +
 source3/selftest/tests.py                  |   5 +
 source3/smbd/share_access.c                |  18 +-
 source3/winbindd/idmap_ad.c                |  36 ++++
 source3/winbindd/winbindd_ads.c            |   1 +
 source4/heimdal_build/wscript_build        |   7 +-
 source4/ldap_server/ldap_backend.c         |  37 ++++
 source4/ldap_server/ldap_bind.c            |  15 ++
 source4/ldap_server/ldap_server.c          |  66 ++++++++
 source4/ldap_server/ldap_server.h          |   2 +
 source4/selftest/tests.py                  |   7 +-
 source4/torture/ldap/common.c              |   2 +
 source4/torture/ldap/session_expiry.c      | 121 +++++++++++++
 source4/torture/wscript_build              |  13 +-
 wscript_configure_system_gnutls            |   5 +-
 31 files changed, 1210 insertions(+), 217 deletions(-)
 create mode 100644 docs-xml/manpages/winexe.1.xml
 create mode 100644 lib/util/tests/test_util.c
 create mode 100755 nsswitch/tests/test_ticket_expiry.sh
 create mode 100644 source4/torture/ldap/session_expiry.c


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index d54bada6061..37c52ceac5b 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=12
-SAMBA_VERSION_RELEASE=7
+SAMBA_VERSION_RELEASE=8
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 4eac328a7c1..8764f257ba9 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,65 @@
+                   ==============================
+                   Release Notes for Samba 4.12.8
+                          October 07, 2020
+                   ==============================
+
+
+This is the latest stable release of the Samba 4.12 release series.
+
+
+Changes since 4.12.7
+--------------------
+
+o  Günther Deschner <[email protected]>
+   * BUG 14318: docs: Add missing winexe manpage.
+
+o  Volker Lendecke <[email protected]>
+   * BUG 14465: idmap_ad does not deal properly with a RFC4511 section 4.4.1
+     response.
+
+o  Laurent Menase <[email protected]>
+   * BUG 14388: winbind: Fix a memleak.
+
+o  Stefan Metzmacher <[email protected]>
+   * BUG 14465: idmap_ad does not deal properly with a RFC4511 section 4.4.1
+     response.
+   * BUG 14482: Compilation of heimdal tree fails if libbsd is not installed.
+
+o  Christof Schmitt <[email protected]>
+   * BUG 14166: util: Allow symlinks in directory_create_or_exist.
+
+o  Andreas Schneider <[email protected]>
+   * BUG 14399: waf: Only use gnutls_aead_cipher_encryptv2() for GnuTLS >
+     3.6.14.
+   * BUG 14467: s3:smbd: Fix %U substitutions if it contains a domain name.
+
+o  Martin Schwenke <[email protected]>
+   * BUG 14466: ctdb disable/enable can fail due to race condition.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.1 and newer product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
                    ==============================
                    Release Notes for Samba 4.12.7
                          September 18, 2020
@@ -98,8 +160,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    ==============================
                    Release Notes for Samba 4.12.6
@@ -296,7 +358,7 @@ o  Andrew Bartlett <[email protected]>
 
 o  Gary Lockyer <[email protected]>
    * BUG 14364: CVE-2020-10730: NULL de-reference in AD DC LDAP server when ASQ
-     and VLV combined, ldb: Bump version to 2.1.4.  
+     and VLV combined, ldb: Bump version to 2.1.4.
    
 
 #######################################
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index 198a8a38dbb..b89c4e49b2f 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -195,11 +195,6 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
                         TALLOC_CTX *mem_ctx,
                         struct ctdb_iface_list_old **ifaces);
 
-int ctdb_ctrl_modflags(struct ctdb_context *ctdb,
-                      struct timeval timeout,
-                      uint32_t destnode,
-                      uint32_t set, uint32_t clear);
-
 int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
                               struct timeval timeout, uint32_t destnode,
                               struct ctdb_tunable_list *tunables);
diff --git a/ctdb/server/ctdb_client.c b/ctdb/server/ctdb_client.c
index 453e7b28477..5d1a30d03da 100644
--- a/ctdb/server/ctdb_client.c
+++ b/ctdb/server/ctdb_client.c
@@ -1243,71 +1243,6 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
        return 0;
 }
 
-/*
-  set/clear the permanent disabled bit on a remote node
- */
-int ctdb_ctrl_modflags(struct ctdb_context *ctdb, struct timeval timeout, 
uint32_t destnode,
-                      uint32_t set, uint32_t clear)
-{
-       int ret;
-       TDB_DATA data;
-       struct ctdb_node_map_old *nodemap=NULL;
-       struct ctdb_node_flag_change c;
-       TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
-       uint32_t recmaster;
-       uint32_t *nodes;
-
-
-       /* find the recovery master */
-       ret = ctdb_ctrl_getrecmaster(ctdb, tmp_ctx, timeout, CTDB_CURRENT_NODE, 
&recmaster);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from 
local node\n"));
-               talloc_free(tmp_ctx);
-               return ret;
-       }
-
-
-       /* read the node flags from the recmaster */
-       ret = ctdb_ctrl_getnodemap(ctdb, timeout, recmaster, tmp_ctx, &nodemap);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from 
node %u\n", destnode));
-               talloc_free(tmp_ctx);
-               return -1;
-       }
-       if (destnode >= nodemap->num) {
-               DEBUG(DEBUG_ERR,(__location__ " Nodemap from recmaster does not 
contain node %d\n", destnode));
-               talloc_free(tmp_ctx);
-               return -1;
-       }
-
-       c.pnn       = destnode;
-       c.old_flags = nodemap->nodes[destnode].flags;
-       c.new_flags = c.old_flags;
-       c.new_flags |= set;
-       c.new_flags &= ~clear;
-
-       data.dsize = sizeof(c);
-       data.dptr = (unsigned char *)&c;
-
-       /* send the flags update to all connected nodes */
-       nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
-
-       if (ctdb_client_async_control(ctdb, CTDB_CONTROL_MODIFY_FLAGS,
-                                       nodes, 0,
-                                       timeout, false, data,
-                                       NULL, NULL,
-                                       NULL) != 0) {
-               DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on 
remote nodes\n"));
-
-               talloc_free(tmp_ctx);
-               return -1;
-       }
-
-       talloc_free(tmp_ctx);
-       return 0;
-}
-
-
 /*
   get all tunables
  */
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 3f5d43c1e87..f825427e7a3 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -425,18 +425,62 @@ static int set_recovery_mode(struct ctdb_context *ctdb,
 }
 
 /*
-  update flags on all active nodes
+ * Update flags on all connected nodes
  */
-static int update_flags_on_all_nodes(struct ctdb_context *ctdb, struct 
ctdb_node_map_old *nodemap, uint32_t pnn, uint32_t flags)
+static int update_flags_on_all_nodes(struct ctdb_recoverd *rec,
+                                    uint32_t pnn,
+                                    uint32_t flags)
 {
+       struct ctdb_context *ctdb = rec->ctdb;
+       struct timeval timeout = CONTROL_TIMEOUT();
+       TDB_DATA data;
+       struct ctdb_node_map_old *nodemap=NULL;
+       struct ctdb_node_flag_change c;
+       TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+       uint32_t *nodes;
+       uint32_t i;
        int ret;
 
-       ret = ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), pnn, flags, ~flags);
-               if (ret != 0) {
-               DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on 
remote nodes\n"));
+       nodemap = rec->nodemap;
+
+       for (i = 0; i < nodemap->num; i++) {
+               if (pnn == nodemap->nodes[i].pnn) {
+                       break;
+               }
+       }
+       if (i >= nodemap->num) {
+               DBG_ERR("Nodemap does not contain node %d\n", pnn);
+               talloc_free(tmp_ctx);
                return -1;
        }
 
+       c.pnn       = pnn;
+       c.old_flags = nodemap->nodes[i].flags;
+       c.new_flags = flags;
+
+       data.dsize = sizeof(c);
+       data.dptr = (unsigned char *)&c;
+
+       /* send the flags update to all connected nodes */
+       nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
+
+       ret = ctdb_client_async_control(ctdb,
+                                       CTDB_CONTROL_MODIFY_FLAGS,
+                                       nodes,
+                                       0,
+                                       timeout,
+                                       false,
+                                       data,
+                                       NULL,
+                                       NULL,
+                                       NULL);
+       if (ret != 0) {
+               DBG_ERR("Unable to update flags on remote nodes\n");
+               talloc_free(tmp_ctx);
+               return -1;
+       }
+
+       talloc_free(tmp_ctx);
        return 0;
 }
 
@@ -493,60 +537,57 @@ static void ctdb_wait_election(struct ctdb_recoverd *rec)
 }
 
 /*
-  Update our local flags from all remote connected nodes. 
-  This is only run when we are or we belive we are the recovery master
+ * Update local flags from all remote connected nodes and push out
+ * flags changes to all nodes.  This is only run by the recovery
+ * master.
  */
-static int update_local_flags(struct ctdb_recoverd *rec, struct 
ctdb_node_map_old *nodemap)
+static int update_flags(struct ctdb_recoverd *rec,
+                       struct ctdb_node_map_old *nodemap,
+                       struct ctdb_node_map_old **remote_nodemaps)
 {
        unsigned int j;
        struct ctdb_context *ctdb = rec->ctdb;
        TALLOC_CTX *mem_ctx = talloc_new(ctdb);
 
-       /* get the nodemap for all active remote nodes and verify
-          they are the same as for this node
-        */
+       /* Check flags from remote nodes */
        for (j=0; j<nodemap->num; j++) {
                struct ctdb_node_map_old *remote_nodemap=NULL;
+               uint32_t local_flags = nodemap->nodes[j].flags;
+               uint32_t remote_flags;
                int ret;
 
-               if (nodemap->nodes[j].flags & NODE_FLAGS_DISCONNECTED) {
+               if (local_flags & NODE_FLAGS_DISCONNECTED) {
                        continue;
                }
                if (nodemap->nodes[j].pnn == ctdb->pnn) {
                        continue;
                }
 
-               ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), 
nodemap->nodes[j].pnn, 
-                                          mem_ctx, &remote_nodemap);
-               if (ret != 0) {
-                       DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap 
from remote node %u\n", 
-                                 nodemap->nodes[j].pnn));
-                       ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
-                       talloc_free(mem_ctx);
-                       return -1;
-               }
-               if (nodemap->nodes[j].flags != remote_nodemap->nodes[j].flags) {
-                       /* We should tell our daemon about this so it
-                          updates its flags or else we will log the same 
-                          message again in the next iteration of recovery.
-                          Since we are the recovery master we can just as
-                          well update the flags on all nodes.
-                       */
-                       ret = ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), 
nodemap->nodes[j].pnn, remote_nodemap->nodes[j].flags, 
~remote_nodemap->nodes[j].flags);
+               remote_nodemap = remote_nodemaps[j];
+               remote_flags = remote_nodemap->nodes[j].flags;
+
+               if (local_flags != remote_flags) {
+                       ret = update_flags_on_all_nodes(rec,
+                                                       nodemap->nodes[j].pnn,
+                                                       remote_flags);
                        if (ret != 0) {
-                               DEBUG(DEBUG_ERR, (__location__ " Unable to 
update nodeflags on remote nodes\n"));
+                               DBG_ERR(
+                                   "Unable to update flags on remote nodes\n");
+                               talloc_free(mem_ctx);
                                return -1;
                        }
 
-                       /* Update our local copy of the flags in the recovery
-                          daemon.
-                       */
-                       DEBUG(DEBUG_NOTICE,("Remote node %u had flags 0x%x, 
local had 0x%x - updating local\n",
-                                nodemap->nodes[j].pnn, 
remote_nodemap->nodes[j].flags,
-                                nodemap->nodes[j].flags));
-                       nodemap->nodes[j].flags = 
remote_nodemap->nodes[j].flags;
+                       /*
+                        * Update the local copy of the flags in the
+                        * recovery daemon.
+                        */
+                       D_NOTICE("Remote node %u had flags 0x%x, "
+                                "local had 0x%x - updating local\n",
+                                nodemap->nodes[j].pnn,
+                                remote_flags,
+                                local_flags);
+                       nodemap->nodes[j].flags = remote_flags;
                }
-               talloc_free(remote_nodemap);
        }
        talloc_free(mem_ctx);
        return 0;
@@ -1125,7 +1166,9 @@ static int do_recovery(struct ctdb_recoverd *rec,
                        continue;
                }
 
-               ret = update_flags_on_all_nodes(ctdb, nodemap, i, 
nodemap->nodes[i].flags);
+               ret = update_flags_on_all_nodes(rec,
+                                               nodemap->nodes[i].pnn,
+                                               nodemap->nodes[i].flags);
                if (ret != 0) {
                        if (nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE) {
                                DEBUG(DEBUG_WARNING, (__location__ "Unable to 
update flags on inactive node %d\n", i));
@@ -2172,37 +2215,94 @@ done:
 }
 
 
-static void async_getnodemap_callback(struct ctdb_context *ctdb, uint32_t 
node_pnn, int32_t res, TDB_DATA outdata, void *callback_data)
+struct remote_nodemaps_state {
+       struct ctdb_node_map_old **remote_nodemaps;
+       struct ctdb_recoverd *rec;
+};
+
+static void async_getnodemap_callback(struct ctdb_context *ctdb,
+                                     uint32_t node_pnn,
+                                     int32_t res,
+                                     TDB_DATA outdata,
+                                     void *callback_data)
 {
-       struct ctdb_node_map_old **remote_nodemaps = callback_data;
+       struct remote_nodemaps_state *state =
+               (struct remote_nodemaps_state *)callback_data;
+       struct ctdb_node_map_old **remote_nodemaps = state->remote_nodemaps;
+       struct ctdb_node_map_old *nodemap = state->rec->nodemap;
+       size_t i;
 
-       if (node_pnn >= ctdb->num_nodes) {
-               DEBUG(DEBUG_ERR,(__location__ " pnn from invalid node\n"));
+       for (i = 0; i < nodemap->num; i++) {
+               if (nodemap->nodes[i].pnn == node_pnn) {
+                       break;
+               }
+       }
+
+       if (i >= nodemap->num) {
+               DBG_ERR("Invalid PNN %"PRIu32"\n", node_pnn);
                return;
        }
 
-       remote_nodemaps[node_pnn] = (struct ctdb_node_map_old 
*)talloc_steal(remote_nodemaps, outdata.dptr);
+       remote_nodemaps[i] = (struct ctdb_node_map_old *)talloc_steal(
+                                       remote_nodemaps, outdata.dptr);
+
+}
+
+static void async_getnodemap_error(struct ctdb_context *ctdb,
+                                  uint32_t node_pnn,
+                                  int32_t res,
+                                  TDB_DATA outdata,
+                                  void *callback_data)
+{
+       struct remote_nodemaps_state *state =
+               (struct remote_nodemaps_state *)callback_data;
+       struct ctdb_recoverd *rec = state->rec;
 
+       DBG_ERR("Failed to retrieve nodemap from node %u\n", node_pnn);
+       ctdb_set_culprit(rec, node_pnn);
 }
 
-static int get_remote_nodemaps(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
-       struct ctdb_node_map_old *nodemap,
-       struct ctdb_node_map_old **remote_nodemaps)
+static int get_remote_nodemaps(struct ctdb_recoverd *rec,
+                              TALLOC_CTX *mem_ctx,
+                              struct ctdb_node_map_old ***remote_nodemaps)
 {
+       struct ctdb_context *ctdb = rec->ctdb;
+       struct ctdb_node_map_old **t;
        uint32_t *nodes;
+       struct remote_nodemaps_state state;
+       int ret;
 
-       nodes = list_of_active_nodes(ctdb, nodemap, mem_ctx, true);
-       if (ctdb_client_async_control(ctdb, CTDB_CONTROL_GET_NODEMAP,
-                                       nodes, 0,
-                                       CONTROL_TIMEOUT(), false, tdb_null,
+       t = talloc_zero_array(mem_ctx,
+                             struct ctdb_node_map_old *,
+                             rec->nodemap->num);
+       if (t == NULL) {
+               DBG_ERR("Memory allocation error\n");
+               return -1;
+       }
+
+       nodes = list_of_connected_nodes(ctdb, rec->nodemap, mem_ctx, false);
+
+       state.remote_nodemaps = t;
+       state.rec = rec;
+
+       ret = ctdb_client_async_control(ctdb,
+                                       CTDB_CONTROL_GET_NODEMAP,
+                                       nodes,
+                                       0,
+                                       CONTROL_TIMEOUT(),
+                                       false,
+                                       tdb_null,
                                        async_getnodemap_callback,
-                                       NULL,
-                                       remote_nodemaps) != 0) {
-               DEBUG(DEBUG_ERR, (__location__ " Unable to pull all remote 
nodemaps\n"));
+                                       async_getnodemap_error,
+                                       &state);
+       talloc_free(nodes);
 
-               return -1;
+       if (ret != 0) {
+               talloc_free(t);
+               return ret;
        }
 
+       *remote_nodemaps = t;
        return 0;
 }
 
@@ -2447,10 +2547,17 @@ static void main_loop(struct ctdb_context *ctdb, struct 
ctdb_recoverd *rec,
        }
 
 
-       /* ensure our local copies of flags are right */
-       ret = update_local_flags(rec, nodemap);
+       /* Get the nodemaps for all connected remote nodes */
+       ret = get_remote_nodemaps(rec, mem_ctx, &remote_nodemaps);
        if (ret != 0) {
-               DEBUG(DEBUG_ERR,("Unable to update local flags\n"));
+               DBG_ERR("Failed to read remote nodemaps\n");
+               return;
+       }
+
+       /* Ensure our local and remote flags are correct */
+       ret = update_flags(rec, nodemap, remote_nodemaps);
+       if (ret != 0) {
+               D_ERR("Unable to update flags\n");
                return;
        }


-- 
Samba Shared Repository

Reply via email to