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

Karolin Seeger kseeger at samba.org
Wed Mar 6 08:31:43 UTC 2019


The branch, v4-10-stable has been updated
       via  e399a0209f4 VERSION: Disable GIT_SNAPSHOT for the 4.10.0rc4 release.
       via  74aa2abf861 WHATSNEW: Add release notes for Samba 4.10.0rc4.
       via  a65f7b71a25 WHATSNEW: Add some detail on the changes to paged results
       via  3fe0c3031e6 fix samba-tool gpo backup syntax in WHATSNEW.txt
       via  19b2885de7c vfs_ceph: remove ceph_fallocate/ceph_ftruncate fallback
       via  3332a895ed1 vfs_ceph: fix strict_allocate_ftruncate()
       via  0a784f28b46 vfs_ceph: add missing fallocate hook
       via  0c034112280 s3: smbd: filenames - ensure we replace the missing '/' if we error in an intermediate POSIX path.
       via  b58c6f1f8b0 s3: torture: Add additional POSIX mkdir tests.
       via  179db55a3bb smbd: unix_convert: Ensure we don't call get_real_filename on POSIX paths.
       via  230c557e2f7 smbd: SMB1-POSIX: Add missing info-level SMB_POSIX_PATH_OPEN for UCF_UNIX_NAME_LOOKUP flag.
       via  f765b515814 s3: smbtorture3: Add POSIX-MKDIR test for posix_mkdir case sensitive bug.
       via  ce4c9c40fab winbindd: set idmap cache entries as the last step in async wb_xids2sids
       via  3b9ef9090a9 winbindd: track whether a result from xid2sid was coming from the cache
       via  3577293313c winbindd: switch send-next/done order
       via  e9ffadb2b21 winbindd: update xid in wb_xids2sids_state->xids with what we got
       via  406a1cdff42 winbindd: convert id to a pointer in wb_xids2sids_dom_done()
       via  f877231507e winbindd: make xids a const argument to wb_xids2sids_send()
       via  07820a3144f winbindd: make a copy of xid's in wb_xids2sids_send()
       via  e0720c16c43 ctdb-cluster-mutex: Separate out command and file handling
       via  c39430b0ae6 ctdb-tests: Add a test for configuring the recovery lock as a command
       via  75fcaea7251 ctdb-tests: Add -R option for local daemons to use recovery lock command
       via  6ac45076549 ctdb-tests: Force test failure if local daemon setup fails
       via  d7fe81405aa ctdb-recoverd: Time out attempt to take recovery lock after 120s
       via  bf774b81051 ctdb-recoverd: Ban node on unknown error when taking recovery lock
       via  5a060f07469 ctdb-recoverd: Make recoverd context available in recovery lock handle
       via  04baa822c40 ctdb-recoverd: Clean up logging on failure to take recovery lock
       via  6ee34859e86 ctdb-recoverd: Free cluster mutex handler on failure to take lock
       via  a4a8351c1f3 ctdb-tests: Add test for ctdb_io.c
       via  8d28f78bfd7 ctdb: buffer write beyond limits
       via  b69bb1f7619 ctdb-config: Change example recovery lock setting to one that fails
       via  caf15a440a2 messages_dgm: Properly handle receiver re-initialization
       via  d3a84988073 torture3: Extend read3 for the "messaging target re-inits" failure
       via  5b7e33f0556 messages_dgm: Use saved errno value
       via  da238723afe man pages: document prefork process model
       via  a2f740691a7 notifyd: Fix SIGBUS on sparc
       via  97fcdfb58a7 CVE-2019-3824 ldb: version 1.5.4
       via  21a44989274 CVE-2019-3824 ldb: Add tests for ldb_wildcard_match
       via  aecd14f8bdc CVE-2019-3824 ldb: wildcard_match end of data check
       via  41fd2cde0c7 CVE-2019-3824 ldb: wildcard_match check tree operation
       via  9a0ace32390 CVE-2019-3824 ldb: ldb_parse_tree use talloc_zero
       via  4cd0abe3c70 CVE-2019-3824 ldb: Improve code style and layout in wildcard processing
       via  e9afae48efa CVE-2019-3824 ldb: Extra comments to clarify no pointer wrap in wildcard processing
       via  aa13a46221a CVE-2019-3824 ldb: Out of bound read in ldb_wildcard_compare
       via  bfa9353ce1d ldb: The test api.py should not rely on order of entries in dict
       via  942822e7165 lib:ldb: Use correct C99 initializer for 'struct tm'
       via  d16b81cf586 lib:ldb: Use C99 initializer for tdb_logging_context
       via  7d0902c2a2b lib:ldb: Use C99 initializer for PyGetSetDef in pyldb
       via  0da2d830806 tevent: version 0.9.39
       via  f868654638a py_tevent: add_timer takes float argument
       via  6b125f6ce2d lib:tevent: Use correct C99 initializer for tevent_req
       via  7bc0d67e2f5 talloc: version 2.1.16
       via  dd2ec6de72d tdb: version 1.3.18
       via  0130b999d2a lib:tdb: Use C99 initializer for tdb_logging_context
       via  a5284f9ce32 lib:tdb: Use C99 initializer for tdb_header
       via  b6bb285d9a9 lib:tdb: Use C99 initializer for PyGetSetDef in pytdb
       via  50be2c58274 tdb: Fix compatibility of wscript with older python
       via  ba5a93c860a Search for location of waf script
       via  fb1d5988e30 buildtools/wafsamba: Avoid decode when using python2
       via  9dde00c3e0a VERSION: Bump version up to 4.10.0rc4...
      from  3d91947b53e VERSION: Disable GIT_SNAPSHOT for the 4.10.0rc3 release.

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


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

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       |  70 ++++++-
 buildtools/wafsamba/samba_abi.py                   |   2 +-
 buildtools/wafsamba/samba_conftests.py             |   6 +-
 buildtools/wafsamba/samba_cross.py                 |   3 +-
 buildtools/wafsamba/samba_dist.py                  |   4 +-
 buildtools/wafsamba/samba_perl.py                  |   4 +-
 buildtools/wafsamba/samba_utils.py                 |  32 ++++
 buildtools/wafsamba/samba_version.py               |   2 +-
 ctdb/common/ctdb_io.c                              |  13 +-
 ctdb/config/ctdb.conf                              |  13 +-
 ctdb/server/ctdb_cluster_mutex.c                   | 113 +++++++-----
 ctdb/server/ctdb_recoverd.c                        |  36 +++-
 .../cunit/{pkt_read_001.sh => ctdb_io_test_001.sh} |   3 +-
 ctdb/tests/local_daemons.sh                        |  12 +-
 ..._eventscripts.sh => 01_ctdb_reclock_command.sh} |   6 +-
 ctdb/tests/simple/scripts/local_daemons.bash       |   6 +
 ctdb/tests/src/ctdb_io_test.c                      | 196 ++++++++++++++++++++
 ctdb/wscript                                       |   6 +
 docs-xml/manpages/samba.8.xml                      |  35 +++-
 docs-xml/smbdotconf/base/preforkchildren.xml       |   4 +-
 lib/ldb/ABI/{ldb-1.5.1.sigs => ldb-1.5.4.sigs}     |   0
 ...yldb-util-1.1.10.sigs => pyldb-util-1.5.4.sigs} |   0
 ...-util-1.1.10.sigs => pyldb-util.py3-1.5.4.sigs} |   0
 lib/ldb/Makefile                                   |   3 +-
 lib/ldb/common/ldb_match.c                         |  41 ++++-
 lib/ldb/common/ldb_msg.c                           |   6 +-
 lib/ldb/common/ldb_parse.c                         |   2 +-
 lib/ldb/pyldb.c                                    |  62 +++++--
 lib/ldb/tests/ldb_match_test.c                     | 191 +++++++++++++++++++
 lib/ldb/tests/ldb_match_test.valgrind              |  16 ++
 lib/ldb/tests/python/api.py                        |  14 +-
 lib/ldb/tools/ldbdump.c                            |   4 +-
 lib/ldb/wscript                                    |  10 +-
 ...-util-2.1.10.sigs => pytalloc-util-2.1.16.sigs} |   0
 ...3-2.1.10.sigs => pytalloc-util.py3-2.1.16.sigs} |   0
 .../ABI/{talloc-2.1.10.sigs => talloc-2.1.16.sigs} |   0
 lib/talloc/Makefile                                |   3 +-
 lib/talloc/wscript                                 |   2 +-
 lib/tdb/ABI/{tdb-1.3.17.sigs => tdb-1.3.18.sigs}   |   0
 lib/tdb/Makefile                                   |   3 +-
 lib/tdb/common/open.c                              |   4 +-
 lib/tdb/pytdb.c                                    |  52 ++++--
 lib/tdb/tools/tdbdump.c                            |   4 +-
 lib/tdb/wscript                                    |   4 +-
 .../ABI/{tevent-0.9.37.sigs => tevent-0.9.39.sigs} |   0
 lib/tevent/Makefile                                |   3 +-
 lib/tevent/pytevent.c                              |   8 +-
 lib/tevent/tevent_req.c                            |  10 +-
 lib/tevent/wscript                                 |   2 +-
 selftest/skip                                      |   1 +
 source3/lib/messages_dgm.c                         |  18 +-
 source3/modules/vfs_ceph.c                         | 112 +++---------
 source3/selftest/tests.py                          |   2 +-
 source3/smbd/filename.c                            |  43 +++++
 source3/smbd/notifyd/notifyd.c                     |  11 +-
 source3/smbd/trans2.c                              |   1 +
 source3/torture/test_messaging_read.c              |  44 +++--
 source3/torture/torture.c                          | 202 +++++++++++++++++++++
 source3/winbindd/wb_xids2sids.c                    |  74 +++++---
 source3/winbindd/winbindd_proto.h                  |   2 +-
 61 files changed, 1243 insertions(+), 279 deletions(-)
 copy ctdb/tests/cunit/{pkt_read_001.sh => ctdb_io_test_001.sh} (51%)
 copy ctdb/tests/simple/{28_zero_eventscripts.sh => 01_ctdb_reclock_command.sh} (67%)
 create mode 100644 ctdb/tests/src/ctdb_io_test.c
 copy lib/ldb/ABI/{ldb-1.5.1.sigs => ldb-1.5.4.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.5.4.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util.py3-1.5.4.sigs} (100%)
 create mode 100644 lib/ldb/tests/ldb_match_test.c
 create mode 100644 lib/ldb/tests/ldb_match_test.valgrind
 copy lib/talloc/ABI/{pytalloc-util-2.1.10.sigs => pytalloc-util-2.1.16.sigs} (100%)
 copy lib/talloc/ABI/{pytalloc-util.py3-2.1.10.sigs => pytalloc-util.py3-2.1.16.sigs} (100%)
 copy lib/talloc/ABI/{talloc-2.1.10.sigs => talloc-2.1.16.sigs} (100%)
 copy lib/tdb/ABI/{tdb-1.3.17.sigs => tdb-1.3.18.sigs} (100%)
 copy lib/tevent/ABI/{tevent-0.9.37.sigs => tevent-0.9.39.sigs} (100%)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 92fe2780494..a07b000b709 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=3
+SAMBA_VERSION_RC_RELEASE=4
 
 ########################################################
 # To mark SVN snapshots this should be set to 'yes'    #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 2d535610583..875d168e749 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,7 +1,7 @@
 Release Announcements
 =====================
 
-This is the third release candidate of Samba 4.10.  This is *not*
+This is the fourth release candidate of Samba 4.10.  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/.
@@ -19,7 +19,7 @@ NEW FEATURES/CHANGES
 GPO Improvements
 ----------------
 
-A new 'samba-tool gpo export' command has been added that can export a
+A new 'samba-tool gpo backup' command has been added that can export a
 set of Group Policy Objects from a domain in a generalised XML format.
 
 A corresponding 'samba-tool gpo restore' command has been added to
@@ -63,6 +63,24 @@ information about how the users are spread across groups in your domain.
 The 'samba-tool group list --verbose' command has also been updated to include
 the number of users in each group.
 
+Paged results LDAP control
+--------------------------
+
+The behaviour of the paged results control (1.2.840.113556.1.4.319, RFC2696)
+has been changed to more closely match Windows servers, to improve memory
+usage. Paged results may be used internally (or is requested by the user) by
+LDAP libraries or tools that deal with large result sizes, for example, when
+listing all the objects in the database.
+
+Previously, results were returned as a snapshot of the database but now,
+some changes made to the set of results while paging may be reflected in the
+responses. If strict inter-record consistency is required in answers (which is
+not possible on Windows with large result sets), consider avoiding the paged
+results control or alternatively, it might be possible to enforce restrictions
+using the LDAP filter expression.
+
+For further details see https://wiki.samba.org/index.php/Paged_Results
+
 Prefork process restart
 -----------------------
 
@@ -220,10 +238,56 @@ smb.conf changes
                               "smbd:async dosmode"
   smbd max async dosmode      Name changed, old name was
                               "smbd:max async dosmode"
-  smbd getinfo ask sharemode  New: similar to "smbd search ask  yes
+  smbd getinfo ask sharemode  New: similar to "smbd search ask yes
                               sharemode" but for SMB getinfo
 
 
+CHANGES SINCE 4.10.0rc3
+=======================
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 13803: SMB1 POSIX mkdir does case insensitive name lookup.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 13802: Fix idmap xid2sid cache issue.
+
+o  David Disseldorp <ddiss at samba.org>
+   * BUG 13807: vfs_ceph strict_allocate_ftruncate calls (local FS) ftruncate
+     and fallocate.
+
+o  Volker Lendecke <vl at samba.org>
+   * BUG 13786: messages_dgm: Properly handle receiver re-initialization.
+
+o  Gary Lockyer <gary at catalyst.net.nz>
+   * BUG 13765: man pages: Document prefork process model.
+   * BUG 13773: CVE-2019-3824 ldb: wildcard_match end of data check.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * tdb: Fix compatibility of wscript with older python.
+   * tevent: version 0.9.39
+   * BUG 13773: CVE-2019-3824 ldb: version 1.5.4
+
+o  David Mulder <dmulder at suse.com>
+   * Search for location of waf script.
+
+o  Noel Power <noel.power at suse.com>
+   * BUG 13777: buildtools/wafsamba: Avoid decode when using python2.
+
+o  Jiří Šašek <jiri.sasek at oracle.com>
+   * BUG 13704: notifyd: Fix SIGBUS on sparc.
+
+o  Swen Schillig <swen at linux.ibm.com>
+   * BUG 13791: ctdb: Buffer write beyond limits.
+
+o  Lukas Slebodnik <lslebodn at fedoraproject.org>
+   * BUG 13773: CVE-2019-3824 ldb: Out of bound read in ldb_wildcard_compare.
+
+o  Martin Schwenke <martin at meltin.net>
+   * BUG 13790: ctdb-config: Change example recovery lock setting to one that
+     fails.
+   * BUG 13800: Fix recovery lock bug.
+
+
 CHANGES SINCE 4.10.0rc2
 =======================
 
diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index 80db7f87be5..5e7686da3d6 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -85,7 +85,7 @@ def abi_check_task(self):
     libpath = self.inputs[0].abspath(self.env)
     libname = os.path.basename(libpath)
 
-    sigs = Utils.cmd_output([abi_gen, libpath]).decode('utf8')
+    sigs = samba_utils.get_string(Utils.cmd_output([abi_gen, libpath]))
     parsed_sigs = parse_sigs(sigs, self.ABI_MATCH)
 
     sig_file = self.ABI_FILE
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index c0b9ae49296..7d9b5316902 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -4,7 +4,7 @@
 import os, shutil, re
 from waflib import Build, Configure, Utils, Options, Logs, Errors
 from waflib.Configure import conf
-from samba_utils import TO_LIST, ADD_LD_LIBRARY_PATH
+from samba_utils import TO_LIST, ADD_LD_LIBRARY_PATH, get_string
 
 
 def add_option(self, *k, **kw):
@@ -418,7 +418,7 @@ def CHECK_COMMAND(conf, cmd, msg=None, define=None, on_target=True, boolean=Fals
     if on_target:
         cmd.extend(conf.SAMBA_CROSS_ARGS(msg=msg))
     try:
-        ret = Utils.cmd_output(cmd).decode('utf8')
+        ret = get_string(Utils.cmd_output(cmd))
     except:
         conf.COMPOUND_END(False)
         return False
@@ -508,7 +508,7 @@ def CHECK_STANDARD_LIBPATH(conf):
     # at least gcc and clang support this:
     try:
         cmd = conf.env.CC + ['-print-search-dirs']
-        out = Utils.cmd_output(cmd).decode('utf8').split('\n')
+        out = get_string(Utils.cmd_output(cmd)).split('\n')
     except ValueError:
         # option not supported by compiler - use a standard list of directories
         dirlist = [ '/usr/lib', '/usr/lib64' ]
diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
index f9c4b10e82b..8863c2c53e7 100644
--- a/buildtools/wafsamba/samba_cross.py
+++ b/buildtools/wafsamba/samba_cross.py
@@ -3,6 +3,7 @@
 import os, sys, re, shlex
 from waflib import Utils, Logs, Options, Errors, Context
 from waflib.Configure import conf
+from wafsamba import samba_utils
 
 real_Popen = None
 
@@ -121,7 +122,7 @@ class cross_Popen(Utils.subprocess.Popen):
                                stdout=Utils.subprocess.PIPE,
                                stderr=Utils.subprocess.PIPE)
                 ce_out, ce_err = p.communicate()
-                ans = (p.returncode, ce_out.decode('utf8'))
+                ans = (p.returncode, samba_utils.get_string(ce_out))
                 add_answer(ca_file, msg, ans)
             else:
                 args = newargs
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index c3144e9adf7..6af7bb4eaff 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -4,7 +4,7 @@
 import os, sys, tarfile
 from waflib import Utils, Scripting, Logs, Options
 from waflib.Configure import conf
-from samba_utils import os_path_relpath
+from samba_utils import os_path_relpath, get_string
 from waflib import Context
 
 dist_dirs = None
@@ -119,7 +119,7 @@ def vcs_dir_contents(path):
         repo = os.path.dirname(repo)
     if repo == "/":
         raise Exception("unsupported or no vcs for %s" % path)
-    return Utils.cmd_output(ls_files_cmd, cwd=cwd, env=env).decode('utf8').split('\n')
+    return get_string(Utils.cmd_output(ls_files_cmd, cwd=cwd, env=env)).split('\n')
 
 
 def dist(appname='', version=''):
diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py
index 3d4fe29027f..e019acb0fa1 100644
--- a/buildtools/wafsamba/samba_perl.py
+++ b/buildtools/wafsamba/samba_perl.py
@@ -1,6 +1,6 @@
 from waflib import Utils
 from waflib.Configure import conf
-
+from samba_utils import get_string
 done = {}
 
 @conf
@@ -17,7 +17,7 @@ def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)):
     def read_perl_config_var(cmd):
         output = Utils.cmd_output([conf.env.get_flat('PERL'), '-MConfig', '-e', cmd])
         if not isinstance(output, str):
-            output = output.decode('utf8')
+            output = get_string(output)
         return Utils.to_list(output)
 
     def check_perl_config_var(var):
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 2a7f62f03bd..bc36d1f194d 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -15,6 +15,38 @@ from waflib.Build import CACHE_SUFFIX
 LIB_PATH="shared"
 
 
+PY3 = sys.version_info[0] == 3
+
+if PY3:
+
+    # helper function to get a string from a variable that maybe 'str' or
+    # 'bytes' if 'bytes' then it is decoded using 'utf8'. If 'str' is passed
+    # it is returned unchanged
+    # Using this function is PY2/PY3 code should ensure in most cases
+    # the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
+    # decodes the variable (see PY2 implementation of this function below)
+    def get_string(bytesorstring):
+        tmp = bytesorstring
+        if isinstance(bytesorstring, bytes):
+            tmp = bytesorstring.decode('utf8')
+        elif not isinstance(bytesorstring, str):
+            raise ValueError('Expected byte of string for %s:%s' % (type(bytesorstring), bytesorstring))
+        return tmp
+
+else:
+
+    # Helper function to return string.
+    # if 'str' or 'unicode' passed in they are returned unchanged
+    # otherwise an exception is generated
+    # Using this function is PY2/PY3 code should ensure in most cases
+    # the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
+    # decodes the variable (see PY3 implementation of this function above)
+    def get_string(bytesorstring):
+        tmp = bytesorstring
+        if not(isinstance(bytesorstring, str) or isinstance(bytesorstring, unicode)):
+            raise ValueError('Expected str or unicode for %s:%s' % (type(bytesorstring), bytesorstring))
+        return tmp
+
 # sigh, python octal constants are a mess
 MODE_644 = int('644', 8)
 MODE_744 = int('744', 8)
diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py
index 670001e753a..f0e7b4d0caf 100644
--- a/buildtools/wafsamba/samba_version.py
+++ b/buildtools/wafsamba/samba_version.py
@@ -14,7 +14,7 @@ def git_version_summary(path, env=None):
     environ = dict(os.environ)
     environ["GIT_DIR"] = '%s/.git' % path
     environ["GIT_WORK_TREE"] = path
-    git = Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ).decode('utf8')
+    git = samba_utils.get_string(Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ))
 
     lines = git.splitlines()
     if not lines or len(lines) < 4:
diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c
index d86540762ea..c16eb7f67b7 100644
--- a/ctdb/common/ctdb_io.c
+++ b/ctdb/common/ctdb_io.c
@@ -164,6 +164,7 @@ static void queue_io_read(struct ctdb_queue *queue)
 {
 	int num_ready = 0;
 	uint32_t pkt_size = 0;
+	uint32_t start_offset;
 	ssize_t nread;
 	uint8_t *data;
 
@@ -226,7 +227,17 @@ buffer_shift:
 	}
 
 data_read:
-	num_ready = MIN(num_ready, queue->buffer.size - queue->buffer.length);
+	start_offset = queue->buffer.length + queue->buffer.offset;
+	if (start_offset < queue->buffer.length) {
+		DBG_ERR("Buffer overflow\n");
+		goto failed;
+	}
+	if (start_offset > queue->buffer.size) {
+		DBG_ERR("Buffer overflow\n");
+		goto failed;
+	}
+
+	num_ready = MIN(num_ready, queue->buffer.size - start_offset);
 
 	if (num_ready > 0) {
 		nread = sys_read(queue->fd,
diff --git a/ctdb/config/ctdb.conf b/ctdb/config/ctdb.conf
index a9e6f693405..5440600a435 100644
--- a/ctdb/config/ctdb.conf
+++ b/ctdb/config/ctdb.conf
@@ -11,7 +11,12 @@
 	# log level = NOTICE
 
 [cluster]
-	# Shared recovery lock file to avoid split brain.  No default.
-	# Do NOT run CTDB without a recovery lock file unless you know exactly
-	# what you are doing.
-	# recovery lock = /shared/recovery.lock
+	# Shared recovery lock file to avoid split brain.  Daemon
+	# default is no recovery lock.  Do NOT run CTDB without a
+	# recovery lock file unless you know exactly what you are
+	# doing.
+	#
+	# Please see the RECOVERY LOCK section in ctdb(7) for more
+	# details.
+	#
+	# recovery lock = !/bin/false RECOVERY LOCK NOT CONFIGURED
diff --git a/ctdb/server/ctdb_cluster_mutex.c b/ctdb/server/ctdb_cluster_mutex.c
index 330d5fd1d90..2e3cb8112ad 100644
--- a/ctdb/server/ctdb_cluster_mutex.c
+++ b/ctdb/server/ctdb_cluster_mutex.c
@@ -118,72 +118,101 @@ static void cluster_mutex_handler(struct tevent_context *ev,
 
 static char cluster_mutex_helper[PATH_MAX+1] = "";
 
-static bool cluster_mutex_helper_args(TALLOC_CTX *mem_ctx,
-				      const char *argstring, char ***argv)
+static bool cluster_mutex_helper_args_file(TALLOC_CTX *mem_ctx,
+					   const char *argstring,
+					   char ***argv)
 {
-	int nargs, i, ret, n;
-	bool is_command = false;
+	bool ok;
 	char **args = NULL;
-	char *strv = NULL;
-	char *t = NULL;
 
-	if (argstring != NULL && argstring[0] == '!') {
-		/* This is actually a full command */
-		is_command = true;
-		t = discard_const(&argstring[1]);
-	} else {
-		is_command = false;
-		t = discard_const(argstring);
+	ok = ctdb_set_helper("cluster mutex helper",
+			     cluster_mutex_helper,
+			     sizeof(cluster_mutex_helper),
+			     "CTDB_CLUSTER_MUTEX_HELPER",
+			     CTDB_HELPER_BINDIR,
+			     "ctdb_mutex_fcntl_helper");
+	if (! ok) {
+		DBG_ERR("ctdb exiting with error: "
+			"Unable to set cluster mutex helper\n");
+		exit(1);
 	}
 
-	ret = strv_split(mem_ctx, &strv, t, " \t");
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR,
-		      ("Unable to parse mutex helper string \"%s\" (%s)\n",
-		       argstring, strerror(ret)));
+
+	/* Array includes default helper, file and NULL */
+	args = talloc_array(mem_ctx, char *, 3);
+	if (args == NULL) {
+		DBG_ERR("Memory allocation error\n");
 		return false;
 	}
-	n = strv_count(strv);
 
-	args = talloc_array(mem_ctx, char *, n + (is_command ? 1 : 2));
+	args[0] = cluster_mutex_helper;
 
-	if (args == NULL) {
-		DEBUG(DEBUG_ERR,(__location__ " out of memory\n"));
+	args[1] = talloc_strdup(args, argstring);
+	if (args[1] == NULL) {
+		DBG_ERR("Memory allocation error\n");
 		return false;
 	}
 
-	nargs = 0;
-
-	if (! is_command) {
-		if (!ctdb_set_helper("cluster mutex helper",
-				     cluster_mutex_helper,
-				     sizeof(cluster_mutex_helper),
-				     "CTDB_CLUSTER_MUTEX_HELPER",
-				     CTDB_HELPER_BINDIR,
-				     "ctdb_mutex_fcntl_helper")) {
-			DEBUG(DEBUG_ERR,("ctdb exiting with error: %s\n",
-					 __location__
-					 " Unable to set cluster mutex helper\n"));
-			exit(1);
-		}
+	args[2] = NULL;
+
+	*argv = args;
+	return true;
+}
 
-		args[nargs++] = cluster_mutex_helper;
+static bool cluster_mutex_helper_args_cmd(TALLOC_CTX *mem_ctx,
+					  const char *argstring,
+					  char ***argv)
+{
+	int i, ret, n;
+	char **args = NULL;
+	char *strv = NULL;
+	char *t = NULL;
+
+	ret = strv_split(mem_ctx, &strv, argstring, " \t");
+	if (ret != 0) {
+		D_ERR("Unable to parse mutex helper command \"%s\" (%s)\n",
+		      argstring,
+		      strerror(ret));
+		return false;
 	}
+	n = strv_count(strv);
+
+	/* Extra slot for NULL */
+	args = talloc_array(mem_ctx, char *, n + 1);
+	if (args == NULL) {
+		DBG_ERR("Memory allocation error\n");
+		return false;
+	}
+
+	talloc_steal(args, strv);
 
 	t = NULL;
-	for (i = 0; i < n; i++) {
-		/* Don't copy, just keep cmd_args around */
+	for (i = 0 ; i < n; i++) {
 		t = strv_next(strv, t);
-		args[nargs++] = t;
+		args[i] = t;
 	}
 
-	/* Make sure last argument is NULL */
-	args[nargs] = NULL;
+	args[n] = NULL;
 
 	*argv = args;
 	return true;
 }
 
+static bool cluster_mutex_helper_args(TALLOC_CTX *mem_ctx,
+				      const char *argstring,
+				      char ***argv)
+{
+	bool ok;
+
+	if (argstring != NULL && argstring[0] == '!') {
+		ok = cluster_mutex_helper_args_cmd(mem_ctx, &argstring[1], argv);
+	} else {
+		ok = cluster_mutex_helper_args_file(mem_ctx, argstring, argv);
+	}
+
+	return ok;
+}
+
 struct ctdb_cluster_mutex_handle *
 ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
 		   struct ctdb_context *ctdb,
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 578127a4514..9b3559b2a92 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -888,6 +888,7 @@ struct ctdb_recovery_lock_handle {
 	bool locked;
 	double latency;
 	struct ctdb_cluster_mutex_handle *h;
+	struct ctdb_recoverd *rec;
 };
 
 static void take_reclock_handler(char status,
@@ -897,22 +898,45 @@ static void take_reclock_handler(char status,
 	struct ctdb_recovery_lock_handle *s =
 		(struct ctdb_recovery_lock_handle *) private_data;
 
+	s->locked = (status == '0') ;
+


-- 
Samba Shared Repository



More information about the samba-cvs mailing list