The branch, v4-9-stable has been updated
       via  2250bc58aea VERSION: Disable GIT_SNAPSHOT for the 4.9.14 release.
       via  72a2a1b5630 WHATSNEW: Add release notes for Samba 4.9.14.
       via  a5ffe3982cc spnego: fix server handling of no optimistic exchange
       via  e7603aa87f0 selftest: add tests for no optimistic spnego exchange
       via  16b10d1a433 spnego: add client option to omit sending an optimistic 
token
       via  6024163e177 ctdb-vacuum: Process all records not deleted on a 
remote node
       via  c788ff56bae fault.c: improve fault_report message text pointing to 
our wiki
       via  9a5bdc6c9e6 ctdb-tools: Stop deleted nodes from influencing ctdb 
nodestatus exit code
       via  c50486c09a2 s3/4: libsmbclient test. Test using 
smbc_telldir/smbc_lseekdir with smbc_readdir/smbc_readdirplus/smbc_getdents.
       via  5cd57eb58b7 s3: libsmbclient: Fix smbc_lseekdir() to work with 
smbc_readdirplus().
       via  588c84d4882 s3: libsmbclient: Ensure SMBC_getdents_ctx() also 
updates the readdirplus pointers.
       via  b44cc7f07e3 s3: libsmbclient: Ensure SMBC_readdirplus_ctx() also 
updates the readdir pointers.
       via  04cb3d3ee13 s3: libsmbclient: Ensure SMBC_readdir_ctx() also 
updates the readdirplus pointers.
       via  36439305afc libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID
       via  9b60134b8bb libcli/smb: add new COMPRESSION and NETNAME negotiate 
context ids
       via  00a810d8fdd s3:ldap: Fix join with don't exists machine account
       via  b9f1be5cf45 ctdb: fix compilation on systems with glibc robust 
mutexes
       via  5a308ef8e07 vfs_glusterfs: Use pthreadpool for scheduling aio 
operations
       via  745052cb6b9 ctdb-recoverd: Fix typo in previous fix
       via  89b08e4fbcf ctdb-tests: Clear deleted record via recovery instead 
of vacuuming
       via  4cbd3cd970a ctdb-tests: Strengthen volatile DB traverse test
       via  3801c9582b7 ctdb-recoverd: Only check for LMASTER nodes in the VNN 
map
       via  68cc58437fa ctdb-tests: Don't retrieve the VNN map from target node 
for notlmaster
       via  31066fde8c5 ctdb-tests: Handle special cases first and return
       via  c3f2c55320d ctdb-tests: Inline handling of recovered and notlmaster 
statuses
       via  cf39c0fc3b0 ctdb-tests: Drop unused node statuses frozen/unfrozen
       via  fd8a55bb3f4 ctdb-tests: Reformat node_has_status()
       via  b40bef3c5ee VERSION: Bump version up to 4.9.14.
       via  7cb10fc9976 Merge tag 'samba-4.9.13' into v4-9-test
       via  fcf29cda0e7 ctdb-daemon: Make node inactive in the NODE_STOP control
       via  fa705bc7dee ctdb-daemon: Drop unused function 
ctdb_local_node_got_banned()
       via  c2ee9bbeeea ctdb-daemon: Switch banning code to use 
ctdb_node_become_inactive()
       via  13780a3ee01 ctdb-daemon: Factor out new function 
ctdb_node_become_inactive()
       via  f4442942fbb ctdb-tcp: Mark node as disconnected if incoming 
connection goes away
       via  1e45ab3c23d ctdb-tcp: Only mark a node connected if both directions 
are up
       via  9155ad23d43 ctdb-tcp: Create outbound queue when the connection 
becomes writable
       via  f2ce6c745cf ctdb-tcp: Use TALLOC_FREE()
       via  b21bc19bae5 ctdb-tcp: Move incoming fd and queue into struct 
ctdb_tcp_node
       via  17f1a95203a ctdb-tcp: Rename fd -> out_fd
       via  a8dd1a0577e ctdb-daemon: Add function ctdb_ip_to_node()
       via  a309b862e8f ctdb-daemon: Replace function ctdb_ip_to_nodeid() with 
ctdb_ip_to_pnn()
       via  b74fde880de undoguididx: blackbox test
       via  4da5d9c9761 undoguididx: Add "or later" to warning about using 
tools from Samba 4.8
       via  00950aa7cf7 sambaundoguididx: fix for -s
       via  f3f259e7369 sambaundoguididx: Add flags=ldb.FLG_DONT_CREATE_DB and 
port to Python3
       via  c61d824e3ca s4/scripting: MORE py3 compatible print functions
       via  47a971f5841 s4/scripting/*: py3 compatible print
       via  8818401b301 ldb: release ldb 1.4.8
       via  e22c1fbd56f ldb: ldbdump key and pack format version comments
       via  388cb30bd7d ldb: baseinfo pack format check on init
       via  3cb3b34def3 ldb: Fix segfault parsing new pack formats
       via  3e9e7afc259 ldb: test for parse errors
       via  abc63d6eab0 VERSION: Bump version up to 4.9.13...
      from  1acf30ac5c1 VERSION: Disable GIT_SNAPSHOT for the 4.9.13 release.

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


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

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       |  86 +++-
 auth/gensec/spnego.c                               |  24 +
 ctdb/include/ctdb_private.h                        |   8 +-
 ctdb/server/ctdb_banning.c                         |  26 +-
 ctdb/server/ctdb_daemon.c                          |  11 +-
 ctdb/server/ctdb_recover.c                         |  45 ++
 ctdb/server/ctdb_recoverd.c                        |  14 +-
 ctdb/server/ctdb_server.c                          |  28 +-
 ctdb/server/ctdb_vacuum.c                          |   2 +-
 ctdb/tcp/ctdb_tcp.h                                |  16 +-
 ctdb/tcp/tcp_connect.c                             | 212 +++++---
 ctdb/tcp/tcp_init.c                                |  21 +-
 ctdb/tcp/tcp_io.c                                  |  17 +-
 ctdb/tests/scripts/integration.bash                |  80 +--
 ctdb/tests/simple/69_recovery_resurrect_deleted.sh |  16 +-
 ctdb/tests/simple/79_volatile_db_traverse.sh       |  67 ++-
 ctdb/tools/ctdb.c                                  |   8 +-
 ctdb/wscript                                       |   2 +-
 lib/ldb/ABI/{ldb-1.3.0.sigs => ldb-1.4.8.sigs}     |   1 +
 ...yldb-util-1.1.10.sigs => pyldb-util-1.4.8.sigs} |   0
 ...-util-1.1.10.sigs => pyldb-util.py3-1.4.8.sigs} |   0
 lib/ldb/common/ldb_pack.c                          |  23 +-
 lib/ldb/include/ldb_module.h                       |   9 +
 lib/ldb/ldb_tdb/ldb_cache.c                        |  45 +-
 lib/ldb/ldb_tdb/ldb_tdb.c                          |  10 +-
 lib/ldb/ldb_tdb/ldb_tdb.h                          |   1 +
 lib/ldb/tests/ldb_kv_ops_test.c                    |  23 +
 lib/ldb/tools/ldbdump.c                            |  24 +
 lib/ldb/wscript                                    |   2 +-
 lib/util/fault.c                                   |   6 +-
 libcli/smb/smb2_constants.h                        |   2 +
 libcli/smb/smbXcli_base.c                          |  17 +
 python/samba/tests/blackbox/undoguididx.py         | 108 ++++
 source3/libads/ldap.c                              |   5 +-
 source3/libsmb/libsmb_dir.c                        | 102 +++-
 source3/modules/vfs_glusterfs.c                    | 545 ++++++++++-----------
 source4/scripting/bin/autoidl                      |  19 +-
 source4/scripting/bin/enablerecyclebin             |   2 +-
 source4/scripting/bin/findprovisionusnranges       |  14 +-
 source4/scripting/bin/fullschema                   |  11 +-
 source4/scripting/bin/get-descriptors              |  11 +-
 source4/scripting/bin/minschema                    |  49 +-
 source4/scripting/bin/mymachinepw                  |   7 +-
 source4/scripting/bin/rebuildextendeddn            |  12 +-
 source4/scripting/bin/sambaundoguididx             |  30 +-
 source4/scripting/bin/smbstatus                    |  29 +-
 source4/scripting/devel/addlotscontacts            |   6 +-
 source4/scripting/devel/config_base                |   2 +-
 source4/scripting/devel/crackname                  |  12 +-
 source4/scripting/devel/enumprivs                  |   2 +-
 source4/scripting/devel/getncchanges               |  10 +-
 source4/selftest/tests.py                          |   6 +
 source4/torture/libsmbclient/libsmbclient.c        | 340 +++++++++++++
 54 files changed, 1533 insertions(+), 637 deletions(-)
 copy lib/ldb/ABI/{ldb-1.3.0.sigs => ldb-1.4.8.sigs} (99%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.4.8.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util.py3-1.4.8.sigs} (100%)
 create mode 100644 python/samba/tests/blackbox/undoguididx.py


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index d2721c27c8e..8f1bacd9ced 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=9
-SAMBA_VERSION_RELEASE=13
+SAMBA_VERSION_RELEASE=14
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index fe8086b436a..cf34f50129f 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,85 @@
+                   ==============================
+                   Release Notes for Samba 4.9.14
+                          October 22, 2019
+                   ==============================
+
+
+This is the last bugfix release of the Samba 4.9 release series. There will be
+security releases only beyond this point.
+
+
+Changes since 4.9.13:
+---------------------
+
+o  Jeremy Allison <[email protected]>
+   * BUG 14094: smbc_readdirplus() is incompatible with smbc_telldir() and
+     smbc_lseekdir().
+
+o  Douglas Bagnall <[email protected]>
+   * BUG 13978: s4/scripting: MORE py3 compatible print functions.
+
+o  Andrew Bartlett <[email protected]>
+   * ldb: release ldb 1.4.8
+   * BUG 13959: ldb_tdb fails to check error return when parsing pack formats.
+   * BUG 13978: undoguididx: Add "or later" to warning about using tools from
+     Samba 4.8.
+
+o  Ralph Boehme <[email protected]>
+   * BUG 14038: ctdb: Fix compilation on systems with glibc robust mutexes.
+
+o  Isaac Boukris <[email protected]>
+   * BUG 14106: Fix spnego fallback from kerberos to ntlmssp in smbd server.
+
+o  Poornima G <[email protected]>
+   * BUG 14098: vfs_glusterfs: Use pthreadpool for scheduling aio operations.
+
+o  Aaron Haslett <[email protected]>
+   * BUG 13977: ldb: baseinfo pack format check on init.
+   * BUG 13978: sambaundoguidindex is untested and py2-only.
+
+o  Amitay Isaacs <[email protected]>
+   * BUG 14147: ctdb-vacuum: Process all records not deleted on a remote node.
+
+o  Björn Jacke <[email protected]>
+   * BUG 14139: Fault.c: Improve fault_report message text pointing to our 
wiki.
+
+o  Stefan Metzmacher <[email protected]>
+   * BUG 14055: libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID.
+
+o  Martin Schwenke <[email protected]>
+   * BUG 14084: ctdb-tcp: Mark node as disconnected if incoming connection goes
+     away.
+   * BUG 14087: 'ctdb stop' command completes before databases are frozen.
+   * BUG 14129: Exit code of ctdb nodestatus should not be influenced by 
deleted
+     nodes.
+
+o  Evgeny Sinelnikov <[email protected]>
+   * BUG 14007: s3:ldap: Fix join with don't exists machine account.
+
+
+#######################################
+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.9.13
                          September 03, 2019
@@ -53,8 +135,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    ==============================
                    Release Notes for Samba 4.9.12
diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
index 0b3fbdce7ac..5f78267281d 100644
--- a/auth/gensec/spnego.c
+++ b/auth/gensec/spnego.c
@@ -136,6 +136,7 @@ struct spnego_state {
        bool done_mic_check;
 
        bool simulate_w2k;
+       bool no_optimistic;
 
        /*
         * The following is used to implement
@@ -187,6 +188,10 @@ static NTSTATUS gensec_spnego_client_start(struct 
gensec_security *gensec_securi
 
        spnego_state->simulate_w2k = 
gensec_setting_bool(gensec_security->settings,
                                                "spnego", "simulate_w2k", 
false);
+       spnego_state->no_optimistic = 
gensec_setting_bool(gensec_security->settings,
+                                                         "spnego",
+                                                         
"client_no_optimistic",
+                                                         false);
 
        gensec_security->private_data = spnego_state;
        return NT_STATUS_OK;
@@ -1295,6 +1300,10 @@ static NTSTATUS gensec_spnego_server_negTokenInit_step(
                        spnego_state->mic_requested = true;
                }
 
+               if (sub_in.length == 0) {
+                       spnego_state->no_optimistic = true;
+               }
+
                /*
                 * Note that 'cur_sec' is temporary memory, but
                 * cur_sec->oid points to a const string in the
@@ -1923,6 +1932,21 @@ static void gensec_spnego_update_pre(struct tevent_req 
*req)
                 * blob and NT_STATUS_OK.
                 */
                state->sub.status = NT_STATUS_OK;
+       } else if (spnego_state->state_position == SPNEGO_CLIENT_START &&
+                  spnego_state->no_optimistic) {
+               /*
+                * Skip optimistic token per conf.
+                */
+               state->sub.status = NT_STATUS_MORE_PROCESSING_REQUIRED;
+       } else if (spnego_state->state_position == SPNEGO_SERVER_START &&
+                  state->sub.in.length == 0 && spnego_state->no_optimistic) {
+               /*
+                * If we didn't like the mechanism for which the client sent us
+                * an optimistic token, or if he didn't send any, don't call
+                * the sub mechanism just yet.
+                */
+               state->sub.status = NT_STATUS_MORE_PROCESSING_REQUIRED;
+               spnego_state->no_optimistic = false;
        } else {
                /*
                 * MORE_PROCESSING_REQUIRED =>
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index ea00bb12128..0c66725d36c 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -481,7 +481,6 @@ int ctdb_ibw_init(struct ctdb_context *ctdb);
 
 /* from ctdb_banning.c */
 
-void ctdb_local_node_got_banned(struct ctdb_context *ctdb);
 int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata);
 int32_t ctdb_control_get_ban_state(struct ctdb_context *ctdb, TDB_DATA 
*outdata);
 void ctdb_ban_self(struct ctdb_context *ctdb);
@@ -829,6 +828,8 @@ int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb);
 int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb,
                                   uint32_t opcode, TDB_DATA indata);
 
+void ctdb_node_become_inactive(struct ctdb_context *ctdb);
+
 int32_t ctdb_control_stop_node(struct ctdb_context *ctdb);
 int32_t ctdb_control_continue_node(struct ctdb_context *ctdb);
 
@@ -841,7 +842,10 @@ void ctdb_stop_recoverd(struct ctdb_context *ctdb);
 
 int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
 
-int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const ctdb_sock_addr *nodeip);
+struct ctdb_node *ctdb_ip_to_node(struct ctdb_context *ctdb,
+                                 const ctdb_sock_addr *nodeip);
+uint32_t ctdb_ip_to_pnn(struct ctdb_context *ctdb,
+                       const ctdb_sock_addr *nodeip);
 
 void ctdb_load_nodes_file(struct ctdb_context *ctdb);
 
diff --git a/ctdb/server/ctdb_banning.c b/ctdb/server/ctdb_banning.c
index 9cd163645a1..3c711575e8c 100644
--- a/ctdb/server/ctdb_banning.c
+++ b/ctdb/server/ctdb_banning.c
@@ -57,30 +57,6 @@ static void ctdb_ban_node_event(struct tevent_context *ev,
        }
 }
 
-void ctdb_local_node_got_banned(struct ctdb_context *ctdb)
-{
-       struct ctdb_db_context *ctdb_db;
-
-       DEBUG(DEBUG_NOTICE, ("This node has been banned - releasing all public "
-                            "IPs and setting the generation to INVALID.\n"));
-
-       /* Reset the generation id to 1 to make us ignore any
-          REQ/REPLY CALL/DMASTER someone sends to us.
-          We are now banned so we shouldnt service database calls
-          anymore.
-       */
-       ctdb->vnn_map->generation = INVALID_GENERATION;
-       for (ctdb_db = ctdb->db_list; ctdb_db != NULL; ctdb_db = ctdb_db->next) 
{
-               ctdb_db->generation = INVALID_GENERATION;
-       }
-
-       /* Recovery daemon will set the recovery mode ACTIVE and freeze
-        * databases.
-        */
-
-       ctdb_release_all_ips(ctdb);
-}
-
 int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata)
 {
        struct ctdb_ban_state *bantime = (struct ctdb_ban_state *)indata.dptr;
@@ -129,7 +105,7 @@ int32_t ctdb_control_set_ban_state(struct ctdb_context 
*ctdb, TDB_DATA indata)
                         ctdb_ban_node_event, ctdb);
 
        if (!already_banned) {
-               ctdb_local_node_got_banned(ctdb);
+               ctdb_node_become_inactive(ctdb);
        }
        return 0;
 }
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index ca98be6a100..d79634c3b54 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1251,21 +1251,18 @@ static void ctdb_initialise_vnn_map(struct ctdb_context 
*ctdb)
 
 static void ctdb_set_my_pnn(struct ctdb_context *ctdb)
 {
-       int nodeid;
-
        if (ctdb->address == NULL) {
                ctdb_fatal(ctdb,
                           "Can not determine PNN - node address is not set\n");
        }
 
-       nodeid = ctdb_ip_to_nodeid(ctdb, ctdb->address);
-       if (nodeid == -1) {
+       ctdb->pnn = ctdb_ip_to_pnn(ctdb, ctdb->address);
+       if (ctdb->pnn == CTDB_UNKNOWN_PNN) {
                ctdb_fatal(ctdb,
-                          "Can not determine PNN - node address not found in 
node list\n");
+                          "Can not determine PNN - unknown node address\n");
        }
 
-       ctdb->pnn = ctdb->nodes[nodeid]->pnn;
-       DEBUG(DEBUG_NOTICE, ("PNN is %u\n", ctdb->pnn));
+       D_NOTICE("PNN is %u\n", ctdb->pnn);
 }
 
 /*
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index f05052e8466..b9646eb4808 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -1415,12 +1415,57 @@ int32_t ctdb_control_set_recmaster(struct ctdb_context 
*ctdb, uint32_t opcode, T
        return 0;
 }
 
+void ctdb_node_become_inactive(struct ctdb_context *ctdb)
+{
+       struct ctdb_db_context *ctdb_db;
+
+       D_WARNING("Making node INACTIVE\n");
+
+       /*
+        * Do not service database calls - reset generation to invalid
+        * so this node ignores any REQ/REPLY CALL/DMASTER
+        */
+       ctdb->vnn_map->generation = INVALID_GENERATION;
+       for (ctdb_db = ctdb->db_list; ctdb_db != NULL; ctdb_db = ctdb_db->next) 
{
+               ctdb_db->generation = INVALID_GENERATION;
+       }
+
+       /*
+        * Although this bypasses the control, the only thing missing
+        * is the deferred drop of all public IPs, which isn't
+        * necessary because they are dropped below
+        */
+       if (ctdb->recovery_mode != CTDB_RECOVERY_ACTIVE) {
+               D_NOTICE("Recovery mode set to ACTIVE\n");
+               ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
+       }
+
+       /*
+        * Initiate database freeze - this will be scheduled for
+        * immediate execution and will be in progress long before the
+        * calling control returns
+        */
+       ctdb_daemon_send_control(ctdb,
+                                ctdb->pnn,
+                                0,
+                                CTDB_CONTROL_FREEZE,
+                                0,
+                                CTDB_CTRL_FLAG_NOREPLY,
+                                tdb_null,
+                                NULL,
+                                NULL);
+
+       D_NOTICE("Dropping all public IP addresses\n");
+       ctdb_release_all_ips(ctdb);
+}
 
 int32_t ctdb_control_stop_node(struct ctdb_context *ctdb)
 {
        DEBUG(DEBUG_ERR, ("Stopping node\n"));
        ctdb->nodes[ctdb->pnn]->flags |= NODE_FLAGS_STOPPED;
 
+       ctdb_node_become_inactive(ctdb);
+
        return 0;
 }
 
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 88ef3b1c5a0..4e7e79c264b 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -2982,13 +2982,19 @@ static void main_loop(struct ctdb_context *ctdb, struct 
ctdb_recoverd *rec,
                return;
        }
 
-       /* verify that all active nodes in the nodemap also exist in 
-          the vnnmap.
+       /*
+        * Verify that all active lmaster nodes in the nodemap also
+        * exist in the vnnmap
         */
        for (j=0; j<nodemap->num; j++) {
                if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
                        continue;
                }
+               if (! ctdb_node_has_capabilities(rec->caps,
+                                                nodemap->nodes[j].pnn,
+                                                CTDB_CAP_LMASTER)) {
+                       continue;
+               }
                if (nodemap->nodes[j].pnn == pnn) {
                        continue;
                }
@@ -2999,8 +3005,8 @@ static void main_loop(struct ctdb_context *ctdb, struct 
ctdb_recoverd *rec,
                        }
                }
                if (i == vnnmap->size) {
-                       DEBUG(DEBUG_ERR, (__location__ " Node %u is active in 
the nodemap but did not exist in the vnnmap\n", 
-                                 nodemap->nodes[j].pnn));
+                       D_ERR("Active LMASTER node %u is not in the vnnmap\n",
+                             nodemap->nodes[j].pnn);
                        ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
                        do_recovery(rec, mem_ctx, pnn, nodemap, vnnmap);
                        return;
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index c991b85d99b..ddff85b81c5 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -45,24 +45,36 @@ int ctdb_set_transport(struct ctdb_context *ctdb, const 
char *transport)
        return 0;
 }
 
-/*
-  Check whether an ip is a valid node ip
-  Returns the node id for this ip address or -1
-*/
-int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const ctdb_sock_addr *nodeip)
+/* Return the node structure for nodeip, NULL if nodeip is invalid */
+struct ctdb_node *ctdb_ip_to_node(struct ctdb_context *ctdb,
+                                 const ctdb_sock_addr *nodeip)
 {
-       int nodeid;
+       unsigned int nodeid;
 
        for (nodeid=0;nodeid<ctdb->num_nodes;nodeid++) {
                if (ctdb->nodes[nodeid]->flags & NODE_FLAGS_DELETED) {
                        continue;
                }
                if (ctdb_same_ip(&ctdb->nodes[nodeid]->address, nodeip)) {
-                       return nodeid;
+                       return ctdb->nodes[nodeid];
                }
        }
 
-       return -1;
+       return NULL;
+}
+
+/* Return the PNN for nodeip, CTDB_UNKNOWN_PNN if nodeip is invalid */
+uint32_t ctdb_ip_to_pnn(struct ctdb_context *ctdb,
+                       const ctdb_sock_addr *nodeip)
+{
+       struct ctdb_node *node;
+
+       node = ctdb_ip_to_node(ctdb, nodeip);
+       if (node == NULL) {
+               return CTDB_UNKNOWN_PNN;
+       }
+
+       return node->pnn;
 }
 
 /* Load a nodes list file into a nodes array */
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c
index 2194b7f4da7..fa43eaa8e67 100644
--- a/ctdb/server/ctdb_vacuum.c
+++ b/ctdb/server/ctdb_vacuum.c
@@ -814,7 +814,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context 
*ctdb_db,
                 */
                records = (struct ctdb_marshall_buffer *)outdata.dptr;
                rec = (struct ctdb_rec_data_old *)&records->data[0];
-               while (records->count-- > 1) {
+               while (records->count-- > 0) {
                        TDB_DATA reckey, recdata;
                        struct ctdb_ltdb_header *rechdr;
                        struct delete_record_data *dd;
diff --git a/ctdb/tcp/ctdb_tcp.h b/ctdb/tcp/ctdb_tcp.h
index 0a998c94da4..9a615fc6393 100644
--- a/ctdb/tcp/ctdb_tcp.h
+++ b/ctdb/tcp/ctdb_tcp.h
@@ -26,23 +26,19 @@ struct ctdb_tcp {
        int listen_fd;
 };
 
-/*
-  state associated with an incoming connection
-*/
-struct ctdb_incoming {
-       struct ctdb_context *ctdb;
-       int fd;
-       struct ctdb_queue *queue;
-};
-
 /*
   state associated with one tcp node
 */
 struct ctdb_tcp_node {
-       int fd;
+       int out_fd;
        struct ctdb_queue *out_queue;
+
        struct tevent_fd *connect_fde;
        struct tevent_timer *connect_te;
+
+       struct ctdb_context *ctdb;
+       int in_fd;
+       struct ctdb_queue *in_queue;
 };
 
 
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index 385547e0e78..f02340c1789 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -44,15 +44,13 @@ void ctdb_tcp_stop_connection(struct ctdb_node *node)
 {
        struct ctdb_tcp_node *tnode = talloc_get_type(
                node->private_data, struct ctdb_tcp_node);
-       
-       ctdb_queue_set_fd(tnode->out_queue, -1);
-       talloc_free(tnode->connect_te);
-       talloc_free(tnode->connect_fde);
-       tnode->connect_fde = NULL;
-       tnode->connect_te = NULL;
-       if (tnode->fd != -1) {
-               close(tnode->fd);
-               tnode->fd = -1;
+
+       TALLOC_FREE(tnode->out_queue);
+       TALLOC_FREE(tnode->connect_te);
+       TALLOC_FREE(tnode->connect_fde);
+       if (tnode->out_fd != -1) {
+               close(tnode->out_fd);
+               tnode->out_fd = -1;
        }
 }
 
@@ -93,12 +91,13 @@ static void ctdb_node_connect_write(struct tevent_context 
*ev,


-- 
Samba Shared Repository

Reply via email to