[SCM] Samba Shared Repository - branch v4-12-stable updated

Karolin Seeger kseeger at samba.org
Tue Apr 7 06:48:53 UTC 2020


The branch, v4-12-stable has been updated
       via  dcaa10c6e37 VERSION: Disable GIT_SNAPSHOT for the 4.12.1 release.
       via  21095de9d96 WHATSNEW: Add release notes for Samba 4.12.1.
       via  b82cec52708 s3/utils: Fix double free error with smbtree
       via  784e4266787 nsswitch: fix use-after-free causing segfault in _pam_delete_cred
       via  2dabb4c5cdd ctdb-recoverd: Avoid dereferencing NULL rec->nodemap
       via  b1b41b88a5e ctdb-daemon: Don't allow attach from recovery if recovery is not active
       via  60dc3c3282d ctdb-daemon: Remove more unused old client database functions
       via  2049792ff78 ctdb-recovery: Remove old code for creating missing databases
       via  c8354a9cb79 ctdb-recovery: Create database on nodes where it is missing
       via  63db9658e1e ctdb-recovery: Fetch database name from all nodes where it is attached
       via  71310819676 ctdb-recovery: Pass db structure for each database recovery
       via  58f83582821 ctdb-recovery: GET_DBMAP from all nodes
       via  808c7aabcbd ctdb-recovery: Replace use of ctdb_dbid_map with local db_list
       via  1e57e5c4e62 ctdb-daemon: Respect CTDB_CTRL_FLAG_ATTACH_RECOVERY when attaching databases
       via  05c2d86d075 ctdb-recovery: Use CTDB_CTRL_FLAG_ATTACH_RECOVERY to attach during recovery
       via  7c1f9bde013 ctdb-protocol: Add control flag CTDB_CTRL_FLAG_ATTACH_RECOVERY
       via  aefd9b2e68d ctdb-daemon: Remove unused old client database functions
       via  c9fa4fb0575 ctdb-daemon: Fix database attach deferral logic
       via  b7f7f7b63e6 ctdb-recovery: Refactor banning a node into separate computation
       via  f468f654078 ctdb-recovery: Don't trust nodemap obtained from local node
       via  ad5c6f3a520 ctdb-recovery: Consolidate node state
       via  be8d05f5978 ctdb-recovery: Fetched vnnmap is never used, so don't fetch it
       via  ee06963cbb4 selftest: test samba-tool group commands with groupnames with brackets and spaces
       via  f2dae546f22 samba-tool group edit: use binary encoded group name
       via  fc8961c1562 samba-tool group delete: use binary encoded group name
       via  ecd119fc6cf samba-tool group move: use binary encoded group name
       via  2dbe9c13d68 samba-tool group listmembers: use binary encoded group names
       via  88edeec6fc1 samba-tool group listmembers: find group members by groups SID
       via  439aeba45e9 samba-tool group listmembers: handle group-does-not-exist error
       via  20d4785856a samba-tool group listmembers: hide python backtracke on command error
       via  a17de0ee683 WHATSNEW: Fix date.
       via  25642c7e960 ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()
       via  e9b727b4f2b ctdb-tcp: Factor out function ctdb_tcp_start_outgoing()
       via  3b5af720a4c ctdb-tcp: add ctdb_tcp_stop_incoming()
       via  26e29f72182 ctdb-tcp: rename ctdb_tcp_stop_connection() to ctdb_tcp_stop_outgoing()
       via  167ef355b34 ctdb-tcp: Remove redundant restart in ctdb_tcp_tnode_cb()
       via  2e619f51b05 ctdb-tcp: always call node_dead() upcall in ctdb_tcp_tnode_cb()
       via  5a51d36317d ctdb-tcp: move free of inbound queue to TCP restart
       via  6f6357c359c ctdb-daemon: more logical whitespace, debug modernisation
       via  0706d539417 ctdb-daemon: ensure restart() callback is called in half-connected state
       via  f50790c1be7 nmblib: avoid undefined behaviour in handle_name_ptrs()
       via  8b86109e5de vfs_recycle: prevent flooding the log if we're called on non-existant paths
       via  1d226313e03 librpc: fix IDL for svcctl_ChangeServiceConfigW
       via  ea4603fd5e5 s4-torture: add ndr svcctl testsuite
       via  ea15a4bd189 s4-torture: add rpc test for ChangeServiceConfigW
       via  b0f590055c1 VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode
       via  34f3476d560 VFS: default: use correct type for pathlen in vfswrap_getxattrat_do_sync()
       via  cfaca1c0b7a VFS: default: avoid a crash in vfswrap_getxattrat_do_sync()
       via  69e66865203 VFS: default: remove unused arg from vfswrap_is_offline()
       via  8f4e8be8554 VFS: default: let vfswrap_is_offline() take conn, not handle
       via  e98dcaa16d0 smbd: ignore set NTACL requests which contain S-1-5-88 NFS ACEs
       via  b8ef341f6b5 vfs_fruit: tmsize prevent overflow Force the type during arithmetic in order to prevent overflow when summing the Time Machine folder size. Increase the precision to off_t (used for file sizes), leave the overflow error traps but with more precise wording.
       via  fdc2f7d218a VERSION: Bump version up to 4.12.1...
      from  21679048604 VERSION: Disable GIT_SNAPSHOT for the 4.12.0 release...

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


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

Summary of changes:
 VERSION                                |    2 +-
 WHATSNEW.txt                           |   77 +-
 ctdb/include/ctdb_client.h             |   34 -
 ctdb/include/ctdb_private.h            |    2 +
 ctdb/protocol/protocol.h               |    1 +
 ctdb/server/ctdb_client.c              |  242 ------
 ctdb/server/ctdb_ltdb_server.c         |   13 +-
 ctdb/server/ctdb_recoverd.c            |  169 +---
 ctdb/server/ctdb_recovery_helper.c     | 1478 ++++++++++++++++++++++++--------
 ctdb/server/ctdb_server.c              |   13 +-
 ctdb/tcp/ctdb_tcp.h                    |    3 +-
 ctdb/tcp/tcp_connect.c                 |   67 +-
 ctdb/tcp/tcp_init.c                    |    4 +-
 ctdb/tcp/tcp_io.c                      |    1 -
 examples/winexe/winexe.c               |    2 +
 librpc/idl/svcctl.idl                  |   25 +-
 nsswitch/pam_winbind.c                 |    2 +-
 python/samba/netcmd/group.py           |   41 +-
 python/samba/tests/samba_tool/group.py |    5 +-
 selftest/knownfail                     |    3 +
 source3/libsmb/nmblib.c                |    3 +
 source3/modules/nfs4_acls.c            |    4 +
 source3/modules/vfs_default.c          |   49 +-
 source3/modules/vfs_fruit.c            |   12 +-
 source3/modules/vfs_recycle.c          |    4 +-
 source3/utils/smbtree.c                |    1 -
 source4/torture/ndr/ndr.c              |    1 +
 source4/torture/ndr/svcctl.c           |   88 ++
 source4/torture/rpc/svcctl.c           |   81 +-
 source4/torture/wscript_build          |    1 +
 30 files changed, 1534 insertions(+), 894 deletions(-)
 create mode 100644 source4/torture/ndr/svcctl.c


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 5fcdb65ffb9..d27f694dec5 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=12
-SAMBA_VERSION_RELEASE=0
+SAMBA_VERSION_RELEASE=1
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 82525ebff0a..621fb63bac8 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,6 +1,81 @@
+                   ==============================
+                   Release Notes for Samba 4.12.1
+                           April 07, 2020
+		   ==============================
+
+
+This is the latest stable release of the Samba 4.12 release series.
+
+
+Changes since 4.12.0
+--------------------
+
+o  Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
+   * BUG 14295: nmblib: Avoid undefined behaviour in handle_name_ptrs().
+
+o  Björn Baumbach <bb at sernet.de>
+   * BUG 14296: samba-tool group: Handle group names with special chars
+     correctly.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 14293: Add missing check for DMAPI offline status in async DOS
+     attributes.
+   * BUG 14295: Starting ctdb node that was powered off hard before results in
+     recovery loop.
+   * BUG 14307: smbd: Ignore set NTACL requests which contain S-1-5-88 NFS ACEs.
+   * BUG 14316: vfs_recycle: Prevent flooding the log if we're called on
+     non-existant paths.
+
+o  Günther Deschner <gd at samba.org>
+   * BUG 14313: librpc: Fix IDL for svcctl_ChangeServiceConfigW.
+   * BUG 14327: nsswitch: Fix use-after-free causing segfault in 
+     _pam_delete_cred.
+
+o  Art M. Gallagher <repos at artmg.net>
+   * BUG 13622: fruit:time machine max size is broken on arm.
+
+o  Amitay Isaacs <amitay at gmail.com>
+   * BUG 14294: CTDB recovery corner cases can cause record resurrection and
+     node banning.
+
+o  Noel Power <noel.power at suse.com>
+   * BUG 14332: s3/utils: Fix double free error with smbtree. 
+
+o  Martin Schwenke <martin at meltin.net>
+   * BUG 14294: CTDB recovery corner cases can cause record resurrection and
+     node banning.
+   * BUG 14295: Starting ctdb node that was powered off hard before results in
+     recovery loop.
+   * BUG 14324: CTDB recovery daemon can crash due to dereference of NULL
+     pointer.
+
+
+#######################################
+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.0
-                           March 03, 2019
+                           March 03, 2020
 		   ==============================
 
 
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index ef4950ab533..198a8a38dbb 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -165,10 +165,6 @@ int ctdb_ctrl_getrecmaster(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
 int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout,
 			   uint32_t destnode, uint32_t recmaster);
 
-int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout,
-		       uint32_t destnode, TALLOC_CTX *mem_ctx,
-		       struct ctdb_dbid_map_old **dbmap);
-
 int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb, struct timeval timeout,
 			 uint32_t destnode, TALLOC_CTX *mem_ctx,
 			 struct ctdb_node_map_old **nodemap);
@@ -176,39 +172,9 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb, struct timeval timeout,
 int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb, struct timeval timeout,
 			   uint32_t destnode, uint32_t *runstate);
 
-int ctdb_ctrl_getdbpath(struct ctdb_context *ctdb, struct timeval timeout,
-			uint32_t destnode, uint32_t dbid,
-			TALLOC_CTX *mem_ctx, const char **path);
-int ctdb_ctrl_getdbname(struct ctdb_context *ctdb, struct timeval timeout,
-			uint32_t destnode, uint32_t dbid,
-			TALLOC_CTX *mem_ctx, const char **name);
-
-int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout,
-		       uint32_t destnode, TALLOC_CTX *mem_ctx,
-		       const char *name, uint8_t db_flags, uint32_t *db_id);
-
 int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode,
 			     int32_t *level);
 
-/*
-  attach to a ctdb database
-*/
-int ctdb_ctrl_db_open_flags(struct ctdb_context *ctdb, uint32_t db_id,
-			    int *tdb_flags);
-
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
-				    struct timeval timeout,
-				    const char *name,
-				    uint8_t db_flags);
-
-/* a ctdb call function */
-typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
-
-/*
-  setup a ctdb call function
-*/
-int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id);
-
 int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout,
 		     uint32_t destnode);
 
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 6aba3c1d48e..fcffc23e2d6 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -36,6 +36,8 @@ struct ctdb_tcp_array {
 /*
   an installed ctdb remote call
 */
+typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
+
 struct ctdb_registered_call {
 	struct ctdb_registered_call *next, *prev;
 	uint32_t id;
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index 43175ae3a95..04a651018be 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -944,6 +944,7 @@ struct ctdb_req_control {
 #define CTDB_CTRL_FLAG_OPCODE_SPECIFIC   0xFFFF0000
 /* Ugly overloading of this field... */
 #define CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE 0x00010000
+#define CTDB_CTRL_FLAG_ATTACH_RECOVERY      0x00020000
 	uint32_t flags;
 	struct ctdb_req_control_data rdata;
 };
diff --git a/ctdb/server/ctdb_client.c b/ctdb/server/ctdb_client.c
index 0da847c401b..453e7b28477 100644
--- a/ctdb/server/ctdb_client.c
+++ b/ctdb/server/ctdb_client.c
@@ -1029,30 +1029,6 @@ int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, ui
 }
 
 
-/*
-  get a list of databases off a remote node
- */
-int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode,
-		       TALLOC_CTX *mem_ctx, struct ctdb_dbid_map_old **dbmap)
-{
-	int ret;
-	TDB_DATA outdata;
-	int32_t res;
-
-	ret = ctdb_control(ctdb, destnode, 0,
-			   CTDB_CONTROL_GET_DBMAP, 0, tdb_null,
-			   mem_ctx, &outdata, &res, &timeout, NULL);
-	if (ret != 0 || res != 0) {
-		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed ret:%d res:%d\n", ret, res));
-		return -1;
-	}
-
-	*dbmap = (struct ctdb_dbid_map_old *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
-	talloc_free(outdata.dptr);
-
-	return 0;
-}
-
 /*
   get a list of nodes (vnn and flags ) from a remote node
  */
@@ -1107,108 +1083,6 @@ int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb,
 	return 0;
 }
 
-/*
-  find the real path to a ltdb
- */
-int ctdb_ctrl_getdbpath(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx,
-		   const char **path)
-{
-	int ret;
-	int32_t res;
-	TDB_DATA data;
-
-	data.dptr = (uint8_t *)&dbid;
-	data.dsize = sizeof(dbid);
-
-	ret = ctdb_control(ctdb, destnode, 0,
-			   CTDB_CONTROL_GETDBPATH, 0, data,
-			   mem_ctx, &data, &res, &timeout, NULL);
-	if (ret != 0 || res != 0) {
-		return -1;
-	}
-
-	(*path) = talloc_strndup(mem_ctx, (const char *)data.dptr, data.dsize);
-	if ((*path) == NULL) {
-		return -1;
-	}
-
-	talloc_free(data.dptr);
-
-	return 0;
-}
-
-/*
-  find the name of a db
- */
-int ctdb_ctrl_getdbname(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t dbid, TALLOC_CTX *mem_ctx,
-		   const char **name)
-{
-	int ret;
-	int32_t res;
-	TDB_DATA data;
-
-	data.dptr = (uint8_t *)&dbid;
-	data.dsize = sizeof(dbid);
-
-	ret = ctdb_control(ctdb, destnode, 0,
-			   CTDB_CONTROL_GET_DBNAME, 0, data,
-			   mem_ctx, &data, &res, &timeout, NULL);
-	if (ret != 0 || res != 0) {
-		return -1;
-	}
-
-	(*name) = talloc_strndup(mem_ctx, (const char *)data.dptr, data.dsize);
-	if ((*name) == NULL) {
-		return -1;
-	}
-
-	talloc_free(data.dptr);
-
-	return 0;
-}
-
-/*
-  create a database
- */
-int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout,
-		       uint32_t destnode, TALLOC_CTX *mem_ctx,
-		       const char *name, uint8_t db_flags, uint32_t *db_id)
-{
-	int ret;
-	int32_t res;
-	TDB_DATA data;
-	uint32_t opcode;
-
-	data.dptr = discard_const(name);
-	data.dsize = strlen(name)+1;
-
-	if (db_flags & CTDB_DB_FLAGS_PERSISTENT) {
-		opcode = CTDB_CONTROL_DB_ATTACH_PERSISTENT;
-	} else if (db_flags & CTDB_DB_FLAGS_REPLICATED) {
-		opcode = CTDB_CONTROL_DB_ATTACH_REPLICATED;
-	} else {
-		opcode = CTDB_CONTROL_DB_ATTACH;
-	}
-
-	ret = ctdb_control(ctdb, destnode, 0, opcode, 0, data,
-			   mem_ctx, &data, &res, &timeout, NULL);
-
-	if (ret != 0 || res != 0) {
-		return -1;
-	}
-
-	if (data.dsize != sizeof(uint32_t)) {
-		TALLOC_FREE(data.dptr);
-		return -1;
-	}
-	if (db_id != NULL) {
-		*db_id = *(uint32_t *)data.dptr;
-	}
-	talloc_free(data.dptr);
-
-	return 0;
-}
-
 /*
   get debug level on a node
  */
@@ -1233,122 +1107,6 @@ int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32
 	return 0;
 }
 
-/*
- * Get db open flags
- */
-int ctdb_ctrl_db_open_flags(struct ctdb_context *ctdb, uint32_t db_id,
-			    int *tdb_flags)
-{
-	TDB_DATA indata, outdata;
-	int ret;
-	int32_t res;
-
-	indata.dptr = (uint8_t *)&db_id;
-	indata.dsize = sizeof(db_id);
-
-	ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0,
-			   CTDB_CONTROL_DB_OPEN_FLAGS, 0, indata,
-			   ctdb, &outdata, &res, NULL, NULL);
-	if (ret != 0 || res != 0) {
-		D_ERR("ctdb control for db open flags failed\n");
-		return  -1;
-	}
-
-	if (outdata.dsize != sizeof(int32_t)) {
-		D_ERR(__location__ " expected %zi bytes, received %zi bytes\n",
-		      sizeof(int32_t), outdata.dsize);
-		talloc_free(outdata.dptr);
-		return -1;
-	}
-
-	*tdb_flags = *(int32_t *)outdata.dptr;
-	talloc_free(outdata.dptr);
-	return 0;
-}
-
-/*
-  attach to a specific database - client call
-*/
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
-				    struct timeval timeout,
-				    const char *name,
-				    uint8_t db_flags)
-{
-	struct ctdb_db_context *ctdb_db;
-	int ret;
-	int tdb_flags;
-
-	ctdb_db = ctdb_db_handle(ctdb, name);
-	if (ctdb_db) {
-		return ctdb_db;
-	}
-
-	ctdb_db = talloc_zero(ctdb, struct ctdb_db_context);
-	CTDB_NO_MEMORY_NULL(ctdb, ctdb_db);
-
-	ctdb_db->ctdb = ctdb;
-	ctdb_db->db_name = talloc_strdup(ctdb_db, name);
-	CTDB_NO_MEMORY_NULL(ctdb, ctdb_db->db_name);
-
-	/* tell ctdb daemon to attach */
-	ret = ctdb_ctrl_createdb(ctdb, timeout, CTDB_CURRENT_NODE,
-				 ctdb_db, name, db_flags, &ctdb_db->db_id);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR,("Failed to attach to database '%s'\n", name));
-		talloc_free(ctdb_db);
-		return NULL;
-	}
-
-	ret = ctdb_ctrl_getdbpath(ctdb, timeout, CTDB_CURRENT_NODE, ctdb_db->db_id, ctdb_db, &ctdb_db->db_path);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR,("Failed to get dbpath for database '%s'\n", name));
-		talloc_free(ctdb_db);
-		return NULL;
-	}
-
-	ret = ctdb_ctrl_db_open_flags(ctdb, ctdb_db->db_id, &tdb_flags);
-	if (ret != 0) {
-		D_ERR("Failed to get tdb_flags for database '%s'\n", name);
-		talloc_free(ctdb_db);
-		return NULL;
-	}
-
-	ctdb_db->ltdb = tdb_wrap_open(ctdb_db, ctdb_db->db_path, 0, tdb_flags,
-				      O_RDWR, 0);
-	if (ctdb_db->ltdb == NULL) {
-		ctdb_set_error(ctdb, "Failed to open tdb '%s'\n", ctdb_db->db_path);
-		talloc_free(ctdb_db);
-		return NULL;
-	}
-
-	ctdb_db->db_flags = db_flags;
-
-	DLIST_ADD(ctdb->db_list, ctdb_db);
-
-	/* add well known functions */
-	ctdb_set_call(ctdb_db, ctdb_null_func, CTDB_NULL_FUNC);
-	ctdb_set_call(ctdb_db, ctdb_fetch_func, CTDB_FETCH_FUNC);
-	ctdb_set_call(ctdb_db, ctdb_fetch_with_header_func, CTDB_FETCH_WITH_HEADER_FUNC);
-
-	return ctdb_db;
-}
-
-/*
-  setup a call for a database
- */
-int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id)
-{
-	struct ctdb_registered_call *call;
-
-	/* register locally */
-	call = talloc(ctdb_db, struct ctdb_registered_call);
-	call->fn = fn;
-	call->id = id;
-
-	DLIST_ADD(ctdb_db->calls, call);
-	return 0;
-}
-
 /* Freeze all databases */
 int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout,
 		     uint32_t destnode)
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index 970eb54b00b..ce3569fe7b1 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -1135,9 +1135,16 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb,
 			return -1;
 		}
 
-		if (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE &&
-		    client->pid != ctdb->recoverd_pid &&
-		    ctdb->runstate < CTDB_RUNSTATE_RUNNING) {
+		if ((c->flags & CTDB_CTRL_FLAG_ATTACH_RECOVERY) &&
+		    ctdb->recovery_mode != CTDB_RECOVERY_ACTIVE) {
+			DBG_ERR("Attach from recovery refused because "
+				"recovery is not active\n");
+			return -1;
+		}
+
+		if (!(c->flags & CTDB_CTRL_FLAG_ATTACH_RECOVERY) &&
+		    (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE ||
+		     ctdb->runstate < CTDB_RUNSTATE_STARTUP)) {
 			struct ctdb_deferred_attach_context *da_ctx = talloc(client, struct ctdb_deferred_attach_context);
 
 			if (da_ctx == NULL) {
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 6fddb44a014..ee083e92fb1 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -424,140 +424,6 @@ static int set_recovery_mode(struct ctdb_context *ctdb,
 	return 0;
 }
 
-/*
-  ensure all other nodes have attached to any databases that we have
- */
-static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap, 
-					   uint32_t pnn, struct ctdb_dbid_map_old *dbmap, TALLOC_CTX *mem_ctx)
-{
-	unsigned int i, j, db;
-	int ret;
-	struct ctdb_dbid_map_old *remote_dbmap;
-
-	/* verify that all other nodes have all our databases */
-	for (j=0; j<nodemap->num; j++) {
-		/* we don't need to ourself ourselves */
-		if (nodemap->nodes[j].pnn == pnn) {
-			continue;
-		}
-		/* don't check nodes that are unavailable */
-		if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
-			continue;
-		}
-


-- 
Samba Shared Repository



More information about the samba-cvs mailing list