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

Karolin Seeger kseeger at samba.org
Tue Aug 29 04:15:10 UTC 2017


The branch, v4-7-stable has been updated
       via  7d8e33c VERSION: Disable GIT_SNAPSHOTS for the 4.7.0rc5 release.
       via  74baf7d WHATSNEW: Add release notes for Samba 4.7.0rc5.
       via  52d8cc3 s4:torture: The teardown function should just return
       via  5b41f24 s4:torture: Delete printer before we remove the driver
       via  4ed0884 s4:torture: Use a different driver name for add_driver tests
       via  63945e1 [PATCH] WHATSNEW: Added links to Wiki documentation
       via  bec5eb1 vfs_default: Fix passing of errno from async calls
       via  9ca3ad4 ctdb-client: Fix ctdb_attach() to use database flags
       via  b787635 ctdb-client: Optionally return database id from ctdb_ctrl_createdb()
       via  da1aad0 ctdb-client: Fix ctdb_ctrl_createdb() to use database flags
       via  29270b0 ctdb-tests: Add a test to check databases are attached with correct flags
       via  8fb3c3c ctdb-tests: Add functions to start/stop/restart a single local daemon
       via  9774290 ctdb-tests: Add functions to start/stop/restart ctdb on single node
       via  5568b2d s3:utils: Remove pointless if-clause for remote_machine
       via  c308ad1 s3:utils: Make sure we authenticate against our SAM name in smbpasswd
       via  2fcedfb s3:utils: Pass domain to password_change() in smbpasswd
       via  0714ae6 s3:utils: Make strings const passed to password_change() in smbpasswd
       via  a53ed1e s3:libsmb: Move prototye of remote_password_change()
       via  34137a1 s3:libsmb: Pass domain to remote_password_change()
       via  c9eed50 s3:gse_krb5: make use of precalculated krb5 keys in fill_mem_keytab_from_secrets()
       via  069dd3e s3:secrets: allow secrets_fetch_or_upgrade_domain_info() on an AD DC
       via  173ea78 libcli/smb: debug an error if smb1cli_req_writev_submit() is called for SMB2/3
       via  f35dab5 s3: libsmb: Add cli_smb2_chkpath() and use from cli_chkpath().
       via  639ec48 blackbox: Add test for 'net ads changetrustpw'
       via  f3fb65c s3:libads: Fix changing passwords with Kerberos
       via  fa0b6d5 s3:script: Untaint user supplied data in modprinter.pl
       via  cc9f583 s4:http/gensec: add missing tevent_req_done() to gensec_http_ntlm_update_done()
       via  50ad7f1 s3:libsmb: let do_connect() debug the negotiation result similar to "session request ok"
       via  d5d9632 s3:libsmb: don't call cli_NetServerEnum() on SMB2/3 connections in SMBC_opendir_ctx()
       via  84052d0 s3:smbclient: don't try any workgroup listing with "client min protocol = SMB2"
       via  50a8102 s3:smbclient: improve the error messages for smbclient -L
       via  dcdeb33 s3:libsmb: let get_ipc_connect() use CLI_FULL_CONNECTION_FORCE_SMB1
       via  3ba3f92 s3:libsmb: Print the kinit failed message with DBGLVL_NOTICE
       via  09df2eb s3:utils: Do not report an invalid range for AD DC role
       via  cf604fb s4/lib/tls: Use SHA256 to sign the TLS certificates
       via  21b585f heimdal: Fix printing a short int into a string
       via  168bea2 s3:utils: Fix buffer size for snprintf and format string
       via  3b9c9f0 s3:torture: Fix spoolss test to build with -O3
       via  9850c58 s4:samdb: Fix building Samba with -O3
       via  54ab11d s4: com: Replace erroneous inclusion of internal talloc.h header with external.
       via  dbc050b lib: auth: Store the netlogon_creds_cli_global_db pointer on the NULL context.
       via  eb2d10d s3: clients: Use netlogon_creds_cli_close_global_db() in all normal exit paths.
       via  301044e lib: auth: Add a shutdown function for netlogon_creds_cli_global_db.
       via  df7ccb9 s3: rpcclient: Use rpcclient_msg_ctx as the long-lived talloc context for rpcclient_netlogon_creds.
       via  fc3c124 s3: rpcclient: Use event context as the talloc parent of the rpcclient_msg_ctx.
       via  4880438 s3: rpcclient: Split out initialization and free of event context.
       via  65a90719 s3: rpc_client: Allocate struct db_context * off the local frame, as all other variables in this function.
       via  a4a0478 lib: cli: fname is a local variable already freed in the function scope, doesn't need to be on talloc_autofree_context()
       via  68f8c33 s4: schema: Allocate global_schema off the NULL context, not the talloc_autofree_context().
       via  07ee9d4 lib: ldb: Python. Take care of freeing the passed in module description if ldb_register_module() fails.
       via  d09bb56 lib: ldb: Use NULL to allocate modules not talloc_autofree_context().
       via  f5f63d6 s4: COM: Remove talloc_autofree_context() from (unused) COM code.
       via  490464a lib: rpc: The registered interfaces are a lists of singletons that are never removed.
       via  26cf4ec s4: modules. Fix missing TALLOC_CTX in module init function.
       via  a727c56 smb.conf: Explain that "ntlm auth" is a per-passdb setting
       via  67612bb selftest: Add test for password change when NTLM is disabled
       via  5e1e86e WHATSNEW: Fix some typos.
       via  e131010 VERSION: Bump version up to 4.7.0rc5...
      from  842bac1 VERSION: Disable GIT_SNAPSHOT for the 4.7.0rc4 release.

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


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

Summary of changes:
 VERSION                                         |   2 +-
 WHATSNEW.txt                                    |  85 ++++++++---
 ctdb/client/ctdb_client.c                       |  58 ++++----
 ctdb/include/ctdb_client.h                      |   4 +-
 ctdb/server/ctdb_recoverd.c                     |  13 +-
 ctdb/tests/complex/34_nfs_tickle_restart.sh     |   2 +-
 ctdb/tests/scripts/integration.bash             |  25 +++-
 ctdb/tests/simple/21_ctdb_attach.sh             | 127 +++++++++++++++++
 ctdb/tests/simple/scripts/local_daemons.bash    |  35 +++--
 docs-xml/smbdotconf/security/ntlmauth.xml       |  18 ++-
 lib/ldb/common/ldb_modules.c                    |  12 +-
 lib/ldb/pyldb.c                                 |   5 +-
 libcli/auth/netlogon_creds_cli.c                |  11 +-
 libcli/auth/netlogon_creds_cli.h                |   1 +
 libcli/smb/smbXcli_base.c                       |   3 +
 librpc/ndr/ndr_table.c                          |  12 +-
 pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm         |   6 +-
 python/samba/tests/ntlmauth.py                  |  46 ++++--
 selftest/knownfail                              |   2 +
 source3/client/client.c                         |  16 ++-
 source3/include/includes.h                      |   1 +
 source3/include/proto.h                         |   6 -
 source3/lib/netapi/netapi.c                     |   2 +
 source3/libads/krb5_setpw.c                     |   2 +-
 source3/librpc/crypto/gse_krb5.c                | 180 +++++++++++-------------
 source3/libsmb/cli_smb2_fnum.c                  |  41 ++++++
 source3/libsmb/cli_smb2_fnum.h                  |   2 +
 source3/libsmb/cliconnect.c                     |   4 +-
 source3/libsmb/clidfs.c                         |   9 +-
 source3/libsmb/clifile.c                        |   8 +-
 source3/libsmb/libsmb_dir.c                     |  13 ++
 source3/libsmb/passchange.c                     |   5 +-
 source3/libsmb/proto.h                          |  10 ++
 source3/modules/vfs_default.c                   |  15 +-
 source3/passdb/machine_account_secrets.c        |  15 +-
 source3/rpc_client/cli_netlogon.c               |   2 +-
 source3/rpcclient/rpcclient.c                   |  19 ++-
 source3/script/tests/printing/modprinter.pl     |  15 +-
 source3/smbd/server_exit.c                      |   2 +
 source3/utils/smbpasswd.c                       |  57 +++++---
 source3/utils/status_profile.c                  |   4 +-
 source3/utils/testparm.c                        |  16 ++-
 source3/winbindd/winbindd.c                     |   3 +
 source4/dsdb/samdb/ldb_modules/vlv_pagination.c |   2 +-
 source4/dsdb/schema/schema_set.c                |   4 +-
 source4/heimdal/lib/krb5/krbhst.c               |   4 +-
 source4/lib/com/classes/simple.c                |   4 +-
 source4/lib/com/com.h                           |   3 +-
 source4/lib/com/dcom/tables.c                   |  10 +-
 source4/lib/com/tables.c                        |   6 +-
 source4/lib/http/gensec/ntlm.c                  |   2 +-
 source4/lib/tls/tlscert.c                       |   9 +-
 source4/lib/wmi/wbemdata.c                      |   4 +-
 source4/rpc_server/remote/dcesrv_remote.c       |   4 +-
 source4/torture/rpc/spoolss.c                   |  74 ++++++----
 testprogs/blackbox/test_net_ads.sh              |   4 +
 56 files changed, 736 insertions(+), 308 deletions(-)
 create mode 100755 ctdb/tests/simple/21_ctdb_attach.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 46085e2..72ddcea 100644
--- a/VERSION
+++ b/VERSION
@@ -87,7 +87,7 @@ SAMBA_VERSION_PRE_RELEASE=
 # e.g. SAMBA_VERSION_RC_RELEASE=1                      #
 #  ->  "3.0.0rc1"                                      #
 ########################################################
-SAMBA_VERSION_RC_RELEASE=4
+SAMBA_VERSION_RC_RELEASE=5
 
 ########################################################
 # To mark SVN snapshots this should be set to 'yes'    #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index a40feb3..c58c297 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,7 +1,7 @@
 Release Announcements
 =====================
 
-This is the fourth release candidate of Samba 4.7.  This is *not*
+This is the fifth release candidate of Samba 4.7.  This is *not*
 intended for production environments and is designed for testing
 purposes only.  Please report any defects via the Samba bug reporting
 system at https://bugzilla.samba.org/.
@@ -12,13 +12,13 @@ Samba 4.7 will be the next version of the Samba suite.
 UPGRADING
 =========
 
-smbclient changes
------------------
+'smbclient' changes
+------------------
 
-smbclient no longer prints a 'Domain=[...] OS=[Windows 6.1] Server=[...]'
-banner when connecting to the first server. With SMB2 and Kerberos
-there's no way to print this information reliable. Now we avoid it at all
-consistently. In interactive session the following banner is now presented
+'smbclient' no longer prints a 'Domain=[...] OS=[Windows 6.1] Server=[...]'
+banner when connecting to the first server. With SMB2 and Kerberos,
+there's no way to print this information reliably. Now we avoid it at all
+consistently. In interactive sessions the following banner is now presented
 to the user: 'Try "help" do get a list of possible commands.'.
 
 The default for "client max protocol" has changed to "SMB3_11",
@@ -26,22 +26,23 @@ which means that smbclient (and related commands) will work against
 servers without SMB1 support.
 
 It's possible to use the '-m/--max-protocol' option to overwrite
-the "client max protocol" option temporary.
+the "client max protocol" option temporarily.
 
 Note that the '-e/--encrypt' option also works with most SMB3 servers
 (e.g. Windows >= 2012 and Samba >= 4.0.0), so the SMB1 unix extensions
 are not required for encryption.
 
-The change to SMB3_11 as default also  means smbclient no longer
+The change to SMB3_11 as default also means smbclient no longer
 negotiates SMB1 unix extensions by default, when talking to a Samba server with
-"unix extensions = yes".  As a result some commands are not available, e.g.
-posix_encrypt, posix_open, posix_mkdir, posix_rmdir, posix_unlink, posix_whoami,
-getfacl and symlink. Using "-mNT1" reenabled them, if the server supports SMB1.
+"unix extensions = yes".  As a result, some commands are not available, e.g.
+'posix_encrypt', 'posix_open', 'posix_mkdir', 'posix_rmdir', 'posix_unlink',
+'posix_whoami', 'getfacl' and 'symlink'. Using "-mNT1" reenables them, if the
+server supports SMB1.
 
 Note the default ("CORE") for "client min protocol" hasn't changed,
 so it's still possible to connect to SMB1-only servers by default.
 
-smbclient learned a new command "deltree" that is able to do
+'smbclient' learned a new command "deltree" that is able to do
 a recursive deletion of a directory tree.
 
 
@@ -102,19 +103,22 @@ KDB (Kerberos Database) driver to access the Samba AD database.  When
 provisioning an AD DC using 'samba-tool' it will take care of creating a correct
 kdc.conf file for the MIT KDC.
 
+For further details, see:
+https://wiki.samba.org/index.php/Running_a_Samba_AD_DC_with_MIT_Kerberos_KDC
+
 Dynamic RPC port range
 ----------------------
 
 The dynamic port range for RPC services has been changed from the old default
-value 1024-1300 to 49152-65535. This port range is not only used by a
-Samba AD DC but also applies to all other server roles including NT4-style
+value "1024-1300" to "49152-65535". This port range is not only used by a
+Samba AD DC, but also applies to all other server roles including NT4-style
 domain controllers. The new value has been defined by Microsoft in Windows
 Server 2008 and newer versions. To make it easier for Administrators to control
 those port ranges we use the same default and make it configurable with the
-option: 'rpc server dynamic port range'.
+option: "rpc server dynamic port range".
 
-The 'rpc server port' option sets the first available port from the new
-'rpc server dynamic port range' option. The option 'rpc server port' only
+The "rpc server port" option sets the first available port from the new
+"rpc server dynamic port range" option. The option "rpc server port" only
 applies to Samba provisioned as an AD DC.
 
 Authentication and Authorization audit support
@@ -135,11 +139,14 @@ authentication, SMB and RPC authorization is covered, however password
 changes are not at this stage, and this support is not currently
 backed by a testsuite.
 
+For further details, see:
+https://wiki.samba.org/index.php/Setting_up_Audit_Logging
+
 Multi-process LDAP Server
 -------------------------
 
 The LDAP server in the AD DC now honours the process model used for
-the rest of the samba process, rather than being forced into a single
+the rest of the 'samba' process, rather than being forced into a single
 process.  This aids in Samba's ability to scale to larger numbers of AD
 clients and the AD DC's overall resiliency, but will mean that there is a
 fork()ed child for every LDAP client, which may be more resource
@@ -327,6 +334,46 @@ KNOWN ISSUES
 https://wiki.samba.org/index.php/Release_Planning_for_Samba_4.7#Release_blocking_bugs
 
 
+CHANGES SINCE 4.7.0rc4
+======================
+
+o  Andrew Bartlett <abartlet at samba.org>
+   * BUG 12929: smb.conf: Explain that "ntlm auth" is a per-passdb setting.
+   * BUG 12953: s4/lib/tls: Use SHA256 to sign the TLS certificates.
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 12932: Get rid of talloc_autofree_context().
+
+o  Amitay Isaacs <amitay at gmail.com>
+   * BUG 12978: After restarting CTDB, it attaches replicated databases with
+     wrong flags.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * BUG 12863: s3:smbclient: Don't try any workgroup listing with
+     "client min protocol = SMB2".
+   * BUG 12876: s3:libsmb: Don't call cli_NetServerEnum() on SMB2/3 connections
+     in SMBC_opendir_ctx().
+   * BUG 12881: s3:libsmb: Let do_connect() debug the negotiation result
+     similar to "session request ok".
+   * BUG 12919: s4:http/gensec: add missing tevent_req_done() to
+     gensec_http_ntlm_update_done().
+   * BUG 12968: Fix 'smbclient tarmode' with SMB2/3.
+   * BUG 12973: 'smbd': Don't use a lot of CPU on startup of a connection.
+
+o  Christof Schmitt <cs at samba.org>
+   * BUG 12983: vfs_default: Fix passing of errno from async calls.
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 12629: s3:utils: Do not report an invalid range for AD DC role.
+   * BUG 12704: s3:libsmb: Let get_ipc_connect() use
+     CLI_FULL_CONNECTION_FORCE_SMB1.
+   * BUG 12930: Fix build issues with GCC 7.1.
+   * BUG 12950: s3:script: Untaint user supplied data in modprinter.pl.
+   * BUG 12956: s3:libads: Fix changing passwords with Kerberos.
+   * BUG 12975: Fix changing the password with 'smbpasswd' as a local user on
+     a domain member.
+
+
 CHANGES SINCE 4.7.0rc3
 ======================
 
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index 5ec3d00..b36d46e 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -1947,37 +1947,42 @@ int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout,
 /*
   create a database
  */
-int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, 
-		       TALLOC_CTX *mem_ctx, const char *name, bool persistent)
+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;
-	uint64_t tdb_flags = 0;
+	uint32_t opcode;
 
 	data.dptr = discard_const(name);
 	data.dsize = strlen(name)+1;
 
-	/* Make sure that volatile databases use jenkins hash */
-	if (!persistent) {
-		tdb_flags = TDB_INCOMPATIBLE_HASH;
-	}
-
-#ifdef TDB_MUTEX_LOCKING
-	if (!persistent && ctdb->tunable.mutex_enabled == 1) {
-		tdb_flags |= (TDB_MUTEX_LOCKING | TDB_CLEAR_IF_FIRST);
+	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;
 	}
-#endif
 
-	ret = ctdb_control(ctdb, destnode, tdb_flags,
-			   persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH, 
-			   0, data, 
+	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;
 }
 
@@ -2118,12 +2123,10 @@ int ctdb_ctrl_db_open_flags(struct ctdb_context *ctdb, uint32_t db_id,
 struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
 				    struct timeval timeout,
 				    const char *name,
-				    bool persistent)
+				    uint8_t db_flags)
 {
 	struct ctdb_db_context *ctdb_db;
-	TDB_DATA data;
 	int ret;
-	int32_t res;
 	int tdb_flags;
 
 	ctdb_db = ctdb_db_handle(ctdb, name);
@@ -2138,22 +2141,15 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
 	ctdb_db->db_name = talloc_strdup(ctdb_db, name);
 	CTDB_NO_MEMORY_NULL(ctdb, ctdb_db->db_name);
 
-	data.dptr = discard_const(name);
-	data.dsize = strlen(name)+1;
-
 	/* tell ctdb daemon to attach */
-	ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0,
-			   persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH,
-			   0, data, ctdb_db, &data, &res, NULL, NULL);
-	if (ret != 0 || res != 0 || data.dsize != sizeof(uint32_t)) {
+	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;
 	}
 
-	ctdb_db->db_id = *(uint32_t *)data.dptr;
-	talloc_free(data.dptr);
-
 	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));
@@ -2176,9 +2172,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
 		return NULL;
 	}
 
-	if (persistent) {
-		ctdb_db->db_flags = CTDB_DB_FLAGS_PERSISTENT;
-	}
+	ctdb_db->db_flags = db_flags;
 
 	DLIST_ADD(ctdb->db_list, ctdb_db);
 
@@ -3925,7 +3919,7 @@ struct ctdb_transaction_handle *ctdb_transaction_start(struct ctdb_db_context *c
 	}
 
 	h->g_lock_db = ctdb_attach(h->ctdb_db->ctdb, timeval_current_ofs(3,0),
-				   "g_lock.tdb", false);
+				   "g_lock.tdb", 0);
 	if (!h->g_lock_db) {
 		DEBUG(DEBUG_ERR, (__location__ " unable to attach to g_lock.tdb\n"));
 		talloc_free(h);
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index d4fd771..9ad9bdb 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -254,7 +254,7 @@ int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout,
 
 int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout,
 		       uint32_t destnode, TALLOC_CTX *mem_ctx,
-		       const char *name, bool persistent);
+		       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);
@@ -276,7 +276,7 @@ int ctdb_ctrl_db_open_flags(struct ctdb_context *ctdb, uint32_t db_id,
 struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
 				    struct timeval timeout,
 				    const char *name,
-				    bool persistent);
+				    uint8_t db_flags);
 
 int ctdb_detach(struct ctdb_context *ctdb, uint32_t db_id);
 
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index b57be06..9488bc2 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -472,7 +472,7 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
 			ret = ctdb_ctrl_createdb(ctdb, CONTROL_TIMEOUT(),
 						 nodemap->nodes[j].pnn,
 						 mem_ctx, name,
-						 dbmap->dbs[db].flags & CTDB_DB_FLAGS_PERSISTENT);
+						 dbmap->dbs[db].flags, NULL);
 			if (ret != 0) {
 				DEBUG(DEBUG_ERR, (__location__ " Unable to create remote db:%s\n", name));
 				return -1;
@@ -534,8 +534,9 @@ static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb
 					  nodemap->nodes[j].pnn));
 				return -1;
 			}
-			ctdb_ctrl_createdb(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, name, 
-					   remote_dbmap->dbs[db].flags & CTDB_DB_FLAGS_PERSISTENT);
+			ctdb_ctrl_createdb(ctdb, CONTROL_TIMEOUT(), pnn,
+					   mem_ctx, name,
+					   remote_dbmap->dbs[db].flags, NULL);
 			if (ret != 0) {
 				DEBUG(DEBUG_ERR, (__location__ " Unable to create local db:%s\n", name));
 				return -1;
@@ -653,7 +654,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
 	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
 	const char *name;
 	struct ctdb_dbid_map_old *dbmap=NULL;
-	bool persistent = false;
+	uint8_t db_flags = 0;
 	struct ctdb_db_context *ctdb_db;
 	struct ctdb_rec_data_old *r;
 
@@ -672,7 +673,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
 
 	for (i=0;i<dbmap->num;i++) {
 		if (dbmap->dbs[i].db_id == recs->db_id) {
-			persistent = dbmap->dbs[i].flags & CTDB_DB_FLAGS_PERSISTENT;
+			db_flags = dbmap->dbs[i].flags;
 			break;
 		}
 	}
@@ -688,7 +689,7 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
 	}
 
 	/* attach to it */
-	ctdb_db = ctdb_attach(ctdb, CONTROL_TIMEOUT(), name, persistent);
+	ctdb_db = ctdb_attach(ctdb, CONTROL_TIMEOUT(), name, db_flags);
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
 		goto done;
diff --git a/ctdb/tests/complex/34_nfs_tickle_restart.sh b/ctdb/tests/complex/34_nfs_tickle_restart.sh
index 365a017..6350db6 100755
--- a/ctdb/tests/complex/34_nfs_tickle_restart.sh
+++ b/ctdb/tests/complex/34_nfs_tickle_restart.sh
@@ -71,7 +71,7 @@ rn=$(awk -F'|' -v test_node=$test_node \
     '$2 != test_node { print $2 ; exit }' <<<"$listnodes_output")
 
 echo "Restarting CTDB on node ${rn}"
-try_command_on_node $rn $CTDB_TEST_WRAPPER restart_ctdb_1
+restart_ctdb_1 $rn
 
 # In some theoretical world this is racy.  In practice, the node will
 # take quite a while to become healthy, so this will beat any
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index b2a3451..4f1227f 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -524,19 +524,21 @@ wait_until_node_has_some_ips ()
 
 #######################################
 
-restart_ctdb_1 ()
+_service_ctdb ()
 {
+    cmd="$1"
+
     if [ -e /etc/redhat-release ] ; then
-	service ctdb restart
+	service ctdb "$cmd"
     else
-	/etc/init.d/ctdb restart
+	/etc/init.d/ctdb "$cmd"
     fi
 }
 
 # Restart CTDB on all nodes.  Override for local daemons.
 _restart_ctdb_all ()
 {
-    onnode -p all $CTDB_TEST_WRAPPER restart_ctdb_1
+    onnode -p all $CTDB_TEST_WRAPPER _service_ctdb restart
 }
 
 # Nothing needed for a cluster.  Override for local daemons.
@@ -545,6 +547,21 @@ setup_ctdb ()
     :
 }
 
+start_ctdb_1 ()
+{
+    onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb start
+}
+
+stop_ctdb_1 ()
+{
+    onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb stop
+}
+
+restart_ctdb_1 ()
+{
+    onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb restart
+}
+
 restart_ctdb ()
 {
     echo -n "Restarting CTDB"
diff --git a/ctdb/tests/simple/21_ctdb_attach.sh b/ctdb/tests/simple/21_ctdb_attach.sh
new file mode 100755
index 0000000..11b6008
--- /dev/null
+++ b/ctdb/tests/simple/21_ctdb_attach.sh
@@ -0,0 +1,127 @@
+#!/bin/bash
+
+test_info()
+{
+    cat <<EOF
+Verify the operation of 'ctdb attach' command.
+
+Prerequisites:
+
+* An active CTDB cluster with at least 2 active nodes.
+
+Steps:
+
+1. Verify that the status on all of the ctdb nodes is 'OK'.
+2. Shut down one of the nodes
+3. Attach test databases
+4. Start shutdown node
+5. Verify that the databases are attached.
+6. Restart one of the nodes
+7. Verify that the databses are attached.
+
+
+Expected results:
+
+* Command 'ctdb attach' command successfully attaches databases.
+EOF
+}
+
+. "${TEST_SCRIPTS_DIR}/integration.bash"
+
+ctdb_test_init "$@"
+
+set -e
+
+cluster_is_healthy
+
+# Reset configuration
+ctdb_restart_when_done
+
+######################################################################
+
+try_command_on_node 0 "$CTDB listnodes -X"
+listnodes_output="$out"
+numnodes=$(wc -l <<<"$listnodes_output")
+lastnode=$(( numnodes - 1 ))
+
+######################################################################
+
+# Confirm that the database is attached
+check_db ()
+{
+    pnn="$1"
+    db="$2"
+    flag="$3"
+    try_command_on_node $pnn "$CTDB getdbmap | grep $db"
+    if [ -z "$out" ] ; then
+	echo "BAD: database $db is not attached on node $node"
+	echo "$out"
+	exit 1
+    else
+	local flags=$(awk '{print $4}' <<<"$out") || true
+	if [ "$flags" = "$flag" ]; then
+	    echo "GOOD: database $db is attached on node $node with flag $flag"
+	else
+	    echo "BAD: database $db is attached on node $node with wrong flag"
+	    echo "$out"


-- 
Samba Shared Repository



More information about the samba-cvs mailing list