[SCM] Samba Shared Repository - branch v4-6-stable updated
Karolin Seeger
kseeger at samba.org
Wed Oct 25 11:11:00 UTC 2017
The branch, v4-6-stable has been updated
via b77f419 VERSION: Disable GIT_SNAPSHOTS for the 4.6.9 release.
via b101fa1 WHATSNEW: Add release notes for Samba 4.6.9.
via f8da4ab vfs_catia: Fix a potential memleak
via bd4d3fb vfs_catia: Fix a memory leak
via ff9c618 krb5_wrap: ADDRTYPE_INET6 is available in all supported MIT versions
via 60f0e49 krb5_wrap: KRB5_ADDRESS_INET6 is not a define in Heimdal
via c7726ee s4/torture: vfs_fruit: test xattr unpacking
via d61101b s4/torture: vfs_fruit: replace AppleDouble data blob with xattr data
via cbddb21 vfs_fruit: on-access conversion of AppleDouble xattr data
via 5fb403f vfs_fruit: static string fruit_catia_maps
via 8e95870 vfs_fruit: pass path to ad_convert
via f42c878 vfs_fruit: unpack AppleDouble xattr header if present
via 8d03598 vfs_fruit: allocate ad_data buffer up to AD_XATTR_MAX_HDR_SIZE bytes
via 1e4051b vfs_fruit: add AppleDouble xattr structure definitions
via e414f60 vfs_fruit: fix ftruncating resource fork
via b866626 vfs_catia: factor out mapping functions
via afecdce ctdb-common: Ignore event scripts with multiple '.'s
via 595f108 s3: VFS: Protect errno if sys_getwd() fails across free() call.
via 42b064a s3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.
via 9209c35 net: groupmap cleanup should not delete BUILTIN mappings
via c9fa0e9 ctdb-common: Do not queue a packet if queue does not have valid fd
via 65af3ee ctdb-tests: Send broadcast to connected nodes, not configured nodes
via 9de6540 ctdb-daemon: Send broadcast to connected nodes, not configured nodes
via eb47cdd lib: gpo: Put enforced GPOs at the end of the list.
via 07c6394 lib: gpo: Fixes issue with GPOPTIONS_BLOCK_INHERITANCE.
via 322add1 lib: gpo: Changes order to match GPO application order.
via 3cd186f s3/smbd: use correct access in get_file_handle_for_metadata
via 096a3f8 s3/smbd: fix access checks in set_ea_dos_attribute()
via 88dfaf1 s3/smbd: README.Coding fixes in set_ea_dos_attribute
via 18122f0 s3: spoolss: Fix GUID string format on GetPrinter info
via a68f0bc s3/mdssvc: missing assignment in sl_pack_float
via f5b02e3 s4/torture: add a test for rename change notification with inotify enabled
via b5b77ba selftest: run smb2.notify-inotify testsuite against fileserver
via d052058 selftest: enable kernel change notifications in the fileserver environment
via 1dd367a messaging: Remove messaging_handler_send
via 389f2b7 notifyd: Remove notifyd_handler_done
via bb6011f notifyd: Use messaging_register for MSG_SMB_NOTIFY_DB
via ab6743d notifyd: Use messaging_register for MSG_SMB_NOTIFY_GET_DB
via e4dd339 notifyd: Use messaging_register for MSG_SMB_NOTIFY_TRIGGER
via 340cde8 notifyd: Use messaging_register for MSG_SMB_NOTIFY_REC_CHANGE
via 0f63069 messaging: make messaging_rec_create public
via 5549320 notifyd: Avoid an if-expression
via 7cf36b2 notifyd: Consolidate two #ifdef CLUSTER into one
via ab91b0d notifyd: Only ask for messaging_ctdb_conn when clustering
via cbb4750 selftest: prevent interpretation of escape sequences in test_give_owner.sh
via 8c79020 selftest: add some debugging to test_give_owner.sh
via f4c3b87 vfs_fake_acls: deny give-ownership
via ec87dad vfs_acl_common: fix take ownership vs give ownership
via 52de163 vfs_acl_common: factor out a variable declaration
via da807fe s3/smbd/posix_acls: return correct status in try_chown
via 839830f selftest: tests for change ownership on a file
via 49e080c selftest: fix samba3.blackbox.inherit_owner.default test script test_inherit_owner.sh
via 3044852 selftest: fix acl_xattr test script test_acl_xattr.sh
via bc55590 selftest: fix acl_xattr test: sn-devel unreliable gid
via 7b72c6f selftest: fix acl_xattr test: group, not user
via f9f9687 selftest: fix acl_xattr test: changing owner
via da10d811 vfs/nfs4_acls: move special handling of SMB_ACE4_SYNCHRONIZE to vfs_zfsacl
via 38c3352 s3/vfs: move ACE4_ADD_FILE/ACE4_DELETE_CHILD mapping from NFSv4 framework to vfs_zfsacl
via bda469e vfs_zfsacl: ensure zfs_get_nt_acl_common() has access to stat info
via 7657bb6 vfs_zfsacl: pass smb_fname to zfs_get_nt_acl_common
via 96a8f4c torture/ioctl: test set_compression(format_none)
via bb54467 VERSION: Bump version up to 4.6.9...
via adbe2eb Merge tag 'samba-4.6.8' into v4-6-test
via c66a4d9 smbd/ioctl: match WS2016 ReFS set compression behaviour
via a86c837 ctdb-client: Initialize ctdb_ltdb_header completely for empty record
via bb709c1 ctdb-daemon: Free up record data if a call request is deferred
via 4b86f6c s3: vfs: catia: compression get/set must act only on base file, and must cope with fsp==NULL.
via 21ca207 s3: VFS: streams_xattr: Compression is only set/get on base filenames.
via 9f768e2 vfs_streams_xattr: Fix segfault when running with log level 10
via 5ad9d78 charset: fix str[n]casecmp_m() by comparing lower case values
via a774df0 charset/tests: also tests the system str[n]casecmp()
via 26bff68 charset/tests: add more str[n]casecmp_m() tests to demonstrate the bug
via 03d8780 charset/tests: assert the exact values of str[n]casecmp_m()
via c258b78 ctdb-daemon: GET_DB_SEQNUM should read database conditionally
via 9b93e44 ctdb-daemon: Add a function to check if db access is allowed
via 0ce69f5 ctdb-tests: Fix ctdb test binary name in path testing
via bae034a ctdb-tests: Wait up to 30 seconds for process to be registered in ctdbd
via 7b4d686 ctdb-tests: Fix ctdb process-exist tests
via 037483d ctdb-tests: Add a dummy ctdb client for testing
via 919e8b8 ctdb-tests: Fix the implementation of process-exists in fake daemon
via e9896f6 ctdb-daemon: Fix implementation of process_exists control
via dc47600 messaging: Avoid a socket leak after fork
via 2e17f87 pthreadpool: Test fork with an active thread
via 7b1c746 pthreadpool: Fix fork behaviour
via a379231 tests/fake_snap: sanitize paths
via 76da233 vfs_default: Fix passing of errno from async calls
via 8506375 s3:utils: Remove pointless if-clause for remote_machine
via eabb9ca s3:utils: Make sure we authenticate against our SAM name in smbpasswd
via ae27c7d s3:utils: Pass domain to password_change() in smbpasswd
via 0434034 s3:utils: Make strings const passed to password_change() in smbpasswd
via 2523f77 s3:libsmb: Move prototye of remote_password_change()
via 90b5cbb s3:libsmb: Pass domain to remote_password_change()
via 0485080 s3:gse_krb5: make use of precalculated krb5 keys in fill_mem_keytab_from_secrets()
via b6449bc s3:secrets: allow secrets_fetch_or_upgrade_domain_info() on an AD DC
via c13ab92 blackbox: Add test for 'net ads changetrustpw'
via 85175f8 s3:libads: Fix changing passwords with Kerberos
via 27f76f4 s3:libsmb: Print the kinit failed message with DBGLVL_NOTICE
via 2e4ac5e s3:utils: Do not report an invalid range for AD DC role
via ba9c6fb vfs_fruit: factor out common code from ad_get() and ad_fget()
via 4afdcbf vfs_fruit: return fake pipe fd in fruit_open_meta_netatalk()
via 4d7835f vfs_fruit: don't open basefile in ad_open() and simplify API
via f608905 vfs_fruit: use path based setxattr call in ad_fset()
via 534ee86 s4/torture: additional tests for kernel-oplocks
via c3177ac s4/torture: reproducer for kernel oplocks issue with streams
via ef7ce21 vfs_streams_xattr: return a fake fd in streams_xattr_open()
via d811440 vfs_streams_xattr: implement all missing handle based VFS functions
via 7754581 vfs_streams_xattr: always pass NULL as fsp arg to get_ea_value()
via 29e8d5c vfs_streams_xattr: remove fsp argument from get_xattr_size()
via eddec63 vfs_streams_xattr: remove all uses of fd, use name based functions
via 35924ef vfs_streams_xattr: invalidate stat info if xattr was not found
via a82411ac s3: torture: Add a test for cli_setpathinfo_basic() to smbtorture3.
via 0a2ea71 s3: libsmb: Implement cli_smb2_setatr() by calling cli_smb2_setpathinfo().
via 426c863 s3: libsmb: Add cli_smb2_setpathinfo(), to be called by cli_setpathinfo_basic().
via 5386d7f s3: libsmbclient: Fix cli_setpathinfo_basic() to treat mode == -1 as no change.
via aafdd59 vfs_gpfs: handle EACCES when fetching DOS attributes from xattr
via d909d99 s3/smbd: handle EACCES when fetching DOS attributes from xattr
via e934f02 s3/smbd: handling of failed DOS attributes reading
via 20ec061 s3: libsmb: Reverse sense of 'clear all attributes', ignore attribute change in SMB2 to match SMB1.
from be2ffca VERSION: Disable GIT_SNAPSHOTS for the 4.6.8 release.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-6-stable
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
VERSION | 2 +-
WHATSNEW.txt | 103 +++-
ctdb/client/client_db.c | 6 +-
ctdb/common/ctdb_io.c | 5 +
ctdb/config/events.d/README | 4 +-
ctdb/include/ctdb_private.h | 1 +
ctdb/server/ctdb_daemon.c | 17 +-
ctdb/server/ctdb_eventd.c | 6 +
ctdb/server/ctdb_freeze.c | 18 +
ctdb/server/ctdb_ltdb_server.c | 5 +-
ctdb/server/ctdb_persistent.c | 5 +
ctdb/tests/scripts/test_wrap | 2 +-
ctdb/tests/simple/07_ctdb_process_exists.sh | 34 +-
ctdb/tests/src/cluster_wait.c | 2 +-
ctdb/tests/src/dummy_client.c | 148 +++++
ctdb/tests/src/fake_ctdbd.c | 81 ++-
ctdb/tests/tool/ctdb.process-exists.001.sh | 12 +-
ctdb/wscript | 3 +-
lib/krb5_wrap/krb5_samba.c | 4 +-
lib/util/charset/tests/charset.c | 75 ++-
lib/util/charset/util_str.c | 32 +-
libgpo/gpo_ldap.c | 221 ++++---
selftest/target/Samba3.pm | 2 +
source3/include/messages.h | 13 +-
source3/include/proto.h | 6 -
source3/lib/messages.c | 83 +--
source3/lib/messages_dgm.c | 3 +-
source3/lib/pthreadpool/pthreadpool.c | 67 ++-
source3/lib/pthreadpool/tests.c | 114 ++++
source3/lib/system.c | 11 +-
source3/libads/krb5_setpw.c | 2 +-
source3/librpc/crypto/gse_krb5.c | 180 +++---
source3/libsmb/cli_smb2_fnum.c | 96 +++-
source3/libsmb/cli_smb2_fnum.h | 5 +
source3/libsmb/cliconnect.c | 2 +-
source3/libsmb/clirap.c | 27 +-
source3/libsmb/passchange.c | 5 +-
source3/libsmb/proto.h | 10 +
source3/modules/nfs4_acls.c | 11 -
source3/modules/string_replace.c | 178 ++++++
.../passwd_proto.h => modules/string_replace.h} | 26 +-
source3/modules/vfs_acl_common.c | 18 +-
source3/modules/vfs_catia.c | 214 ++-----
source3/modules/vfs_default.c | 15 +-
source3/modules/vfs_fake_acls.c | 18 +
source3/modules/vfs_fruit.c | 639 ++++++++++++++-------
source3/modules/vfs_gpfs.c | 69 ++-
source3/modules/vfs_streams_xattr.c | 539 ++++++++++++++---
source3/modules/vfs_zfsacl.c | 54 +-
source3/modules/wscript_build | 7 +-
source3/passdb/machine_account_secrets.c | 15 +-
source3/rpc_server/mdssvc/marshalling.c | 2 +
source3/rpc_server/spoolss/srv_spoolss_nt.c | 16 +-
source3/script/tests/fake_snap.pl | 19 +-
source3/script/tests/test_acl_xattr.sh | 13 +-
source3/script/tests/test_give_owner.sh | 141 +++++
source3/script/tests/test_inherit_owner.sh | 17 +-
source3/selftest/tests.py | 11 +-
source3/smbd/dosmode.c | 76 ++-
source3/smbd/notifyd/notifyd.c | 244 ++++----
source3/smbd/posix_acls.c | 2 +-
source3/smbd/server.c | 8 +-
source3/smbd/smb2_ioctl_filesys.c | 26 +-
source3/torture/torture.c | 137 +++++
source3/utils/net_groupmap.c | 4 +-
source3/utils/smbpasswd.c | 57 +-
source3/utils/testparm.c | 16 +-
source4/torture/smb2/ioctl.c | 11 +-
source4/torture/smb2/notify.c | 158 +++++
source4/torture/smb2/oplock.c | 346 +++++++++++
source4/torture/smb2/smb2.c | 1 +
source4/torture/vfs/fruit.c | 171 ++++--
testprogs/blackbox/test_net_ads.sh | 4 +
73 files changed, 3599 insertions(+), 1096 deletions(-)
create mode 100644 ctdb/tests/src/dummy_client.c
create mode 100644 source3/modules/string_replace.c
copy source3/{utils/passwd_proto.h => modules/string_replace.h} (54%)
create mode 100755 source3/script/tests/test_give_owner.sh
Changeset truncated at 500 lines:
diff --git a/VERSION b/VERSION
index f171e86..4fe4545 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
########################################################
SAMBA_VERSION_MAJOR=4
SAMBA_VERSION_MINOR=6
-SAMBA_VERSION_RELEASE=8
+SAMBA_VERSION_RELEASE=9
########################################################
# If a official release has a serious bug #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 5b11c9f..65c1137 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,103 @@
=============================
+ Release Notes for Samba 4.6.9
+ October 25, 2017
+ =============================
+
+
+This is the latest stable release of the Samba 4.6 release series.
+
+
+Changes since 4.6.8:
+--------------------
+
+o Jeremy Allison <jra at samba.org>
+ * BUG 12899: s3: libsmb: Reverse sense of 'clear all attributes', ignore
+ attribute change in SMB2 to match SMB1.
+ * BUG 12913: SMBC_setatr() initially uses an SMB1 call before falling back.
+ * BUG 13003: Fix segfault on MacOS 10.12.3 clients caused by
+ SMB_VFS_GET_COMPRESSION.
+ * BUG 13069: sys_getwd() can leak memory or possibly return the wrong errno
+ on older systems.
+
+o Ralph Boehme <slow at samba.org>
+ * BUG 6133: Cannot delete non-ACL files on Solaris/ZFS/NFSv4 ACL filesystem.
+ * BUG 7909: vfs_zfs_acl: Map SYNCHRONIZE acl permission statically.
+ * BUG 7933: vfs_fake_acls: Honor SEC_STD_WRITE_OWNER bit.
+ * BUG 12791: Kernel oplocks still have issues with named streams.
+ * BUG 12944: vfs_gpfs: Handle EACCES when fetching DOS attributes.
+ * BUG 12991: s3/mdssvc: Missing assignment in sl_pack_float.
+ * BUG 12995: Fix wrong Samba access checks when changing DOS attributes.
+ * BUG 13065: net: Groupmap cleanup should not delete BUILTIN mappings.
+ * BUG 13076: Enabling vfs_fruit results in loss of Finder tags and other
+ xattrs.
+
+o Samuel Cabrero <scabrero at suse.de>
+ * BUG 12993: s3: spoolss: Fix GUID string format on GetPrinter info.
+
+o David Disseldorp <ddiss at samba.org>
+ * BUG 12144: smbd/ioctl: Match WS2016 ReFS set compression behaviour.
+
+o Amitay Isaacs <amitay at gmail.com>
+ * BUG 13012: ctdb-daemon: Fix implementation of process_exists control.
+ * BUG 13021: ctdb: GET_DB_SEQNUM control can cause ctdb to deadlock when
+ databases are frozen.
+ * BUG 13029: ctdb-daemon: Free up record data if a call request is deferred.
+ * BUG 13036: ctdb-client: Initialize ctdb_ltdb_header completely for empty
+ record.
+ * BUG 13056: CTDB starts consuming memory if there are dead nodes in the
+ cluster.
+ * BUG 13070: ctdb-common: Ignore event scripts with multiple '.'s.
+
+o Lutz Justen <ljusten at google.com>
+ * BUG 13046: libgpo: Sort the GPOs in the correct order.
+
+o Stefan Metzmacher <metze at samba.org>
+ * BUG 12973: 'smbd' uses a lot of CPU on startup of a connection.
+ * BUG 13018: charset: Fix str[n]casecmp_m() by comparing lower case values.
+ * BUG 13079: Can't change password in Samba from a windows client if Samba
+ runs on IPv6 only interface.
+
+o Volker Lendecke <vl at samba.org>
+ * BUG 12903: Fix file change notification for renames.
+ * BUG 13006: messaging: Avoid a socket leak after fork.
+ * BUG 13090: vfs_catia: Fix a potential memleak.
+
+o Christof Schmitt <cs at samba.org>
+ * BUG 12983: vfs_default: Fix passing of errno from async calls.
+ * BUG 13032: vfs_streams_xattr: Fix segfault when running with log level 10.
+
+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: Print the kinit failed message with DBGLVL_NOTICE.
+ * 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.
+
+
+#######################################
+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.6.8
September 20, 2017
=============================
@@ -75,8 +174,8 @@ database (https://bugzilla.samba.org/).
======================================================================
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
=============================
Release Notes for Samba 4.6.7
diff --git a/ctdb/client/client_db.c b/ctdb/client/client_db.c
index 888cfbc3..902e841 100644
--- a/ctdb/client/client_db.c
+++ b/ctdb/client/client_db.c
@@ -705,9 +705,9 @@ int ctdb_ltdb_fetch(struct ctdb_db_context *db, TDB_DATA key,
return EIO;
}
- header->rsn = 0;
- header->dmaster = CTDB_UNKNOWN_PNN;
- header->flags = 0;
+ *header = (struct ctdb_ltdb_header) {
+ .dmaster = CTDB_UNKNOWN_PNN,
+ };
if (data != NULL) {
*data = tdb_null;
diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c
index 152d535..3e732e8 100644
--- a/ctdb/common/ctdb_io.c
+++ b/ctdb/common/ctdb_io.c
@@ -300,6 +300,11 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
struct ctdb_queue_pkt *pkt;
uint32_t length2, full_length;
+ /* If the queue does not have valid fd, no point queueing a packet */
+ if (queue->fd == -1) {
+ return 0;
+ }
+
if (queue->alignment) {
/* enforce the length and alignment rules from the tcp packet allocator */
length2 = (length+(queue->alignment-1)) & ~(queue->alignment-1);
diff --git a/ctdb/config/events.d/README b/ctdb/config/events.d/README
index 11da702..69f5904 100644
--- a/ctdb/config/events.d/README
+++ b/ctdb/config/events.d/README
@@ -11,7 +11,9 @@ alphanumeric sort order.
As a special case, any eventscript that ends with a '~' character will be
ignored since this is a common postfix that some editors will append to
-older versions of a file.
+older versions of a file. Similarly, any eventscript with multiple '.'s
+will be ignored as package managers can create copies with additional
+suffix starting with '.' (e.g. .rpmnew, .dpkg-dist).
Only executable event scripts are run by CTDB. Any event script that
does not have execute permission is ignored.
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index d81ed56..491dd78 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -626,6 +626,7 @@ int32_t ctdb_control_wipe_database(struct ctdb_context *ctdb, TDB_DATA indata);
bool ctdb_db_frozen(struct ctdb_db_context *ctdb_db);
bool ctdb_db_all_frozen(struct ctdb_context *ctdb);
+bool ctdb_db_allow_access(struct ctdb_db_context *ctdb_db);
/* from server/ctdb_keepalive.c */
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index d0d86a0..4d6987a 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -675,6 +675,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret));
}
CTDB_DECREMENT_STAT(ctdb, pending_calls);
+ talloc_free(data.dptr);
return;
}
}
@@ -1800,12 +1801,16 @@ int32_t ctdb_control_process_exists(struct ctdb_context *ctdb, pid_t pid)
{
struct ctdb_client *client;
- if (ctdb->nodes[ctdb->pnn]->flags & (NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
- client = ctdb_find_client_by_pid(ctdb, pid);
- if (client != NULL) {
- DEBUG(DEBUG_NOTICE,(__location__ " Killing client with pid:%d on banned/stopped node\n", (int)pid));
- talloc_free(client);
- }
+ client = ctdb_find_client_by_pid(ctdb, pid);
+ if (client == NULL) {
+ return -1;
+ }
+
+ if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_INACTIVE) {
+ DEBUG(DEBUG_NOTICE,
+ ("Killing client with pid:%d on banned/stopped node\n",
+ (int)pid));
+ talloc_free(client);
return -1;
}
diff --git a/ctdb/server/ctdb_eventd.c b/ctdb/server/ctdb_eventd.c
index 232711c..c9a9bf6 100644
--- a/ctdb/server/ctdb_eventd.c
+++ b/ctdb/server/ctdb_eventd.c
@@ -425,6 +425,12 @@ static int script_filter(const struct dirent *de)
return 0;
}
+ /* Ignore filenames with multiple '.'s */
+ ptr = index(&de->d_name[3], '.');
+ if (ptr != NULL) {
+ return 0;
+ }
+
return 1;
}
diff --git a/ctdb/server/ctdb_freeze.c b/ctdb/server/ctdb_freeze.c
index 2666013..e2b12c7 100644
--- a/ctdb/server/ctdb_freeze.c
+++ b/ctdb/server/ctdb_freeze.c
@@ -874,3 +874,21 @@ bool ctdb_db_all_frozen(struct ctdb_context *ctdb)
}
return true;
}
+
+bool ctdb_db_allow_access(struct ctdb_db_context *ctdb_db)
+{
+ if (ctdb_db->freeze_mode == CTDB_FREEZE_NONE) {
+ /* If database is not frozen, then allow access. */
+ return true;
+ } else if (ctdb_db->freeze_transaction_started) {
+ /* If database is frozen, allow access only if the
+ * transaction is started. This is required during
+ * recovery.
+ *
+ * If a node is inactive, then transaction is not started.
+ */
+ return true;
+ }
+
+ return false;
+}
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index 8ff9634..22a1ee8 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -1208,7 +1208,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
lockdown_memory(ctdb->valgrinding);
/* tell all the other nodes about this database */
- ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, tdb_flags,
+ ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, tdb_flags,
persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:
CTDB_CONTROL_DB_ATTACH,
0, CTDB_CTRL_FLAG_NOREPLY,
@@ -1263,7 +1263,8 @@ int32_t ctdb_control_db_detach(struct ctdb_context *ctdb, TDB_DATA indata,
client = reqid_find(ctdb->idr, client_id, struct ctdb_client);
if (client != NULL) {
/* forward the control to all the nodes */
- ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0,
+ ctdb_daemon_send_control(ctdb,
+ CTDB_BROADCAST_CONNECTED, 0,
CTDB_CONTROL_DB_DETACH, 0,
CTDB_CTRL_FLAG_NOREPLY,
indata, NULL, NULL);
diff --git a/ctdb/server/ctdb_persistent.c b/ctdb/server/ctdb_persistent.c
index 1811ae8..fc28655 100644
--- a/ctdb/server/ctdb_persistent.c
+++ b/ctdb/server/ctdb_persistent.c
@@ -344,6 +344,11 @@ static int32_t ctdb_get_db_seqnum(struct ctdb_context *ctdb,
goto done;
}
+ if (! ctdb_db_allow_access(ctdb_db)) {
+ ret = -1;
+ goto done;
+ }
+
key.dptr = (uint8_t *)discard_const(keyname);
key.dsize = strlen(keyname) + 1;
diff --git a/ctdb/tests/scripts/test_wrap b/ctdb/tests/scripts/test_wrap
index 176310e..3db3180 100755
--- a/ctdb/tests/scripts/test_wrap
+++ b/ctdb/tests/scripts/test_wrap
@@ -10,7 +10,7 @@ TEST_SCRIPTS_DIR=$(dirname $0)
# We need the test binaries (i.e. tests/bin/) to be in $PATH. If they
# aren't already in $PATH then we know that tests/bin/ sits alongside
# tests/scripts/.
-f="ctdb_bench"
+f="fetch_ring"
if [ ! $(which $f >/dev/null 2>&1) ] ; then
d=$(dirname "$TEST_SCRIPTS_DIR")/bin
[ -x "$d/$f" ] && PATH="$d:$PATH"
diff --git a/ctdb/tests/simple/07_ctdb_process_exists.sh b/ctdb/tests/simple/07_ctdb_process_exists.sh
index b7492a8..f24e93a 100755
--- a/ctdb/tests/simple/07_ctdb_process_exists.sh
+++ b/ctdb/tests/simple/07_ctdb_process_exists.sh
@@ -15,11 +15,10 @@ Prerequisites:
Steps:
1. Verify that the status on all of the ctdb nodes is 'OK'.
-2. On one of the cluster nodes, get the PID of an existing process
- (using ps wax).
+2. On one of the cluster nodes, get the PID of a ctdb client.
3. Run 'ctdb process-exists <pid>' on the node and verify that the
correct output is shown.
-4. Run 'ctdb process-exists <pid>' with a pid of a non-existent
+4. Run 'ctdb process-exists <pid>' with a pid of ctdb daemon
process and verify that the correct output is shown.
Expected results:
@@ -38,15 +37,25 @@ cluster_is_healthy
test_node=1
-# Create a background process on $test_node that will last for 60 seconds.
+# Execute a ctdb client on $test_node that will last for 60 seconds.
# It should still be there when we check.
-try_command_on_node $test_node 'sleep 60 >/dev/null 2>&1 & echo $!'
-pid="$out"
+try_command_on_node -v $test_node \
+ "$CTDB_TEST_WRAPPER exec dummy_client >/dev/null 2>&1 & echo \$!"
+client_pid="$out"
-echo "Checking for PID $pid on node $test_node"
-# set -e is good, but avoid it here
+cleanup ()
+{
+ if [ -n "$client_pid" ] ; then
+ onnode $test_node kill -9 "$client_pid"
+ fi
+}
+
+ctdb_test_exit_hook_add cleanup
+
+echo "Waiting until PID $client_pid is registered on node $test_node"
status=0
-try_command_on_node $test_node "$CTDB process-exists ${pid}" || status=$?
+wait_until 30 try_command_on_node $test_node \
+ "$CTDB process-exists ${client_pid}" || status=$?
echo "$out"
if [ $status -eq 0 ] ; then
@@ -56,10 +65,9 @@ else
testfailures=1
fi
-# Now just echo the PID of the shell from the onnode process on node
-# 2. This PID will disappear and PIDs shouldn't roll around fast
-# enough to trick the test... but there is a chance that will happen!
-try_command_on_node $test_node 'echo $$'
+# Now just echo the PID of the ctdb daemon on test node.
+# This is not a ctdb client and process-exists should return error.
+try_command_on_node $test_node "ctdb getpid"
pid="$out"
echo "Checking for PID $pid on node $test_node"
diff --git a/ctdb/tests/src/cluster_wait.c b/ctdb/tests/src/cluster_wait.c
index 1405738..ecd2efd 100644
--- a/ctdb/tests/src/cluster_wait.c
+++ b/ctdb/tests/src/cluster_wait.c
@@ -264,7 +264,7 @@ static void cluster_wait_join_unregistered(struct tevent_req *subreq)
msg.data.data = tdb_null;
subreq = ctdb_client_message_send(state, state->ev, state->client,
- CTDB_BROADCAST_ALL, &msg);
+ CTDB_BROADCAST_CONNECTED, &msg);
if (tevent_req_nomem(subreq, req)) {
return;
}
diff --git a/ctdb/tests/src/dummy_client.c b/ctdb/tests/src/dummy_client.c
new file mode 100644
index 0000000..6af41f3
--- /dev/null
+++ b/ctdb/tests/src/dummy_client.c
@@ -0,0 +1,148 @@
+/*
+ Dummy CTDB client for testing
+
+ Copyright (C) Amitay Isaacs 2017
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "system/network.h"
+
+#include <popt.h>
+#include <talloc.h>
+#include <tevent.h>
+
+#include "common/logging.h"
+
+#include "client/client.h"
+
+static struct {
+ const char *sockpath;
+ const char *debuglevel;
+ int timelimit;
+ const char *srvidstr;
+} options;
+
+static struct poptOption cmdline_options[] = {
+ POPT_AUTOHELP
+ { "socket", 's', POPT_ARG_STRING, &options.sockpath, 0,
+ "Unix domain socket path", "filename" },
+ { "debug", 'd', POPT_ARG_STRING, &options.debuglevel, 0,
+ "debug level", "ERR|WARNING|NOTICE|INFO|DEBUG" } ,
+ { "timelimit", 't', POPT_ARG_INT, &options.timelimit, 0,
+ "time limit", "seconds" },
+ { "srvid", 'S', POPT_ARG_STRING, &options.srvidstr, 0,
+ "srvid to register", "srvid" },
+ POPT_TABLEEND
+};
+
+static void dummy_handler(uint64_t srvid, TDB_DATA data, void *private_data)
+{
+ bool *done = (bool *)private_data;
+
+ *done = true;
+}
+
+int main(int argc, const char *argv[])
+{
+ TALLOC_CTX *mem_ctx;
+ struct tevent_context *ev;
+ struct ctdb_client_context *client;
+ const char *ctdb_socket;
+ poptContext pc;
+ int opt, ret;
+ int log_level;
+ bool status, done;
+
+ /* Set default options */
+ options.sockpath = CTDB_SOCKET;
+ options.debuglevel = "ERR";
+ options.timelimit = 60;
+ options.srvidstr = NULL;
+
+ ctdb_socket = getenv("CTDB_SOCKET");
+ if (ctdb_socket != NULL) {
+ options.sockpath = ctdb_socket;
+ }
+
+ pc = poptGetContext(argv[0], argc, argv, cmdline_options,
+ POPT_CONTEXT_KEEP_FIRST);
+ while ((opt = poptGetNextOpt(pc)) != -1) {
+ fprintf(stderr, "Invalid option %s\n", poptBadOption(pc, 0));
+ exit(1);
+ }
+
+ if (options.sockpath == NULL) {
+ fprintf(stderr, "Please specify socket path\n");
+ poptPrintHelp(pc, stdout, 0);
+ exit(1);
+ }
+
+ mem_ctx = talloc_new(NULL);
+ if (mem_ctx == NULL) {
+ fprintf(stderr, "Memory allocation error\n");
--
Samba Shared Repository
More information about the samba-cvs
mailing list