[SCM] Samba Shared Repository - branch v4-14-stable updated
Jule Anger
janger at samba.org
Tue Aug 24 13:12:14 UTC 2021
The branch, v4-14-stable has been updated
via 625e30ad0b9 VERSION: Disable GIT_SNAPSHOT for the 4.14.7 release.
via e91ef286644 WHATSNEW: Add release notes for samba 4.14.7
via 3228383d8ae vfs_shadow_copy2: ensure we call convert_sbuf() in shadow_copy2_*stat() on already converted paths with absolute path
via 8222ff1110c vfs_streams_xattr: ensure fstat calls NEXT fstat
via 262d09c511a selftest: add a test for shadow:fixinodes
via 9d6d585ca00 selftest: simplify snapshot directory creation in test_shadow_copy_torture.sh
via 5ae4300a36b selftest: enable "shadow:fixinodes" in "shadow_write" share
via a2ac4ee3d71 selftest: pass smbclient arg to samba3.blackbox.shadow_copy_torture test
via 93383852f0d smbd: update smb_fname statinfo from fsp
via e12c92d0175 smbd: canonicalize SMB_VFS_FSTAT() stat buffer
via 46995a8b146 smbd: return correct timestamps for quota fake file
via b53968656ee smbd: handle fake file handles in fdos_mode()
via 7e1d4a4b138 smbd: add dosmode_from_fake_filehandle()
via 8abd1abca64 smbtorture: verify attributes on fake quota file handle
via 618fd6c2594 s3: smbd: For FSCTL calls that go async, add the outstanding tevent_reqs to the aio list on the file handle.
via 3d912fe86cf s3:libsmb: close the temporary IPC$ connection in cli_full_connection()
via f25d1315686 s3:libsmb: start encryption as soon as possible after the session setup
via a8b40f15f90 wscript: fix installing pre-commit with 'git worktree'
via e393635ab82 script/bisect-test.py: add support git worktree
via 87b8e7f39be wafsamba: add support git worktree to vcs_dir_contents()
via 25f3cb8c973 libcli/smb: allow unexpected padding in SMB2 READ responses
via a095a2d960a libcli/smb: make smb2cli_ioctl_parse_buffer() available as smb2cli_parse_dyn_buffer()
via cee1b839a1f s3:smbd: implement FSCTL_SMBTORTURE_GLOBAL_READ_RESPONSE_BODY_PADDING8
via 0d89ce25acd s3:smbd: introduce a body_size variable in smbd_smb2_request_read_done
via d84d0c1095c s4:torture/smb2: add smb2.read.bug14607 test
via 9c470eb6cd7 dosmode: retry reading dos attributes as root for unreadable files
via 99bca25289e vfs: Fix the FreeBSD build
via 0fca66858de vfs_default: use fsp_get_io_fd() for copy_file_range()
via f9bcec6298d vfs_default: use copy_file_range()
via c44d2e8dbdc smbd: use sys_io_ranges_overlap() in fsctl_dup_extents_check_overlap()
via a25b75b2ca2 lib: add sys_io_ranges_overlap()
via 0772ff448fc vfs_default: properly track written bytes for copy-chunk
via d5d6bbaa939 replace: copy_file_range()
via 340aff1c8f4 s3: lib: sysacls: Fix argument numbers for sys_acl_set_fd() for untested OS builds.
via de50dc5c3db configure: Do not put arguments into double quotes
via 4801b6c298b VERSION: Bump version up to 4.14.7...
from 507cdfb744e VERSION: Disable GIT_SNAPSHOT for the 4.14.6 release.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-14-stable
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
VERSION | 2 +-
WHATSNEW.txt | 63 +++++++-
buildtools/wafsamba/samba_dist.py | 2 +-
configure | 2 +-
lib/replace/replace.c | 25 ++++
lib/replace/replace.h | 10 ++
lib/replace/wscript | 12 +-
lib/util/sys_rw.c | 25 ++++
lib/util/sys_rw.h | 2 +
lib/util/tests/test_sys_rw.c | 110 ++++++++++++++
lib/util/wscript_build | 6 +
libcli/smb/smb2cli_ioctl.c | 123 ++--------------
libcli/smb/smb2cli_read.c | 22 ++-
libcli/smb/smbXcli_base.c | 91 ++++++++++++
libcli/smb/smbXcli_base.h | 9 ++
libcli/smb/smb_constants.h | 2 +
script/bisect-test.py | 2 +-
selftest/knownfail | 1 +
selftest/target/Samba3.pm | 1 +
selftest/tests.py | 2 +
source3/include/fake_file.h | 1 +
source3/lib/sysacls.c | 6 +-
source3/libsmb/cliconnect.c | 39 ++++-
source3/libsmb/clidfs.c | 56 +++++--
source3/modules/vfs_default.c | 138 ++++++++++++++++-
source3/modules/vfs_shadow_copy2.c | 180 +++++++++++++++++------
source3/modules/vfs_solarisacl.h | 1 +
source3/modules/vfs_streams_xattr.c | 27 +---
source3/modules/vfs_tru64acl.h | 1 +
source3/modules/vfs_zfsacl.c | 14 +-
source3/script/tests/test_shadow_copy_torture.sh | 32 +++-
source3/selftest/tests.py | 2 +-
source3/smbd/dosmode.c | 18 +++
source3/smbd/fake_file.c | 15 ++
source3/smbd/filename.c | 5 +
source3/smbd/files.c | 7 +
source3/smbd/globals.h | 4 +
source3/smbd/open.c | 4 +-
source3/smbd/smb2_ioctl.c | 25 ++++
source3/smbd/smb2_ioctl_filesys.c | 38 +----
source3/smbd/smb2_read.c | 14 +-
source4/torture/smb2/create.c | 63 ++++++++
source4/torture/smb2/read.c | 136 +++++++++++++++++
wscript | 20 ++-
44 files changed, 1104 insertions(+), 254 deletions(-)
create mode 100644 lib/util/tests/test_sys_rw.c
Changeset truncated at 500 lines:
diff --git a/VERSION b/VERSION
index b5b81dc3eef..82268e491d0 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
########################################################
SAMBA_VERSION_MAJOR=4
SAMBA_VERSION_MINOR=14
-SAMBA_VERSION_RELEASE=6
+SAMBA_VERSION_RELEASE=7
########################################################
# If a official release has a serious bug #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 452eee13b54..ed154ee97c6 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,61 @@
+ ==============================
+ Release Notes for Samba 4.14.7
+ August 24, 2021
+ ==============================
+
+
+This is the latest stable release of the Samba 4.14 release series.
+
+
+Changes since 4.14.6
+--------------------
+
+o Jeremy Allison <jra at samba.org>
+ * BUG 14769: smbd panic on force-close share during offload write.
+
+o Ralph Boehme <slow at samba.org>
+ * BUG 12033: smbd should support copy_file_range() for FSCTL_SRV_COPYCHUNK.
+ * BUG 14731: Fix returned attributes on fake quota file handle and avoid
+ hitting the VFS.
+ * BUG 14756: vfs_shadow_copy2 fix inodes not correctly updating inode
+ numbers.
+
+o David Gajewski <dgajews at math.utoledo.edu>
+ * BUG 14774: Fix build on Solaris.
+
+o Björn Jacke <bj at sernet.de>
+ * BUG 14654: Make dos attributes available for unreadable files.
+
+o Stefan Metzmacher <metze at samba.org>
+ * BUG 14607: Work around special SMB2 READ response behavior of NetApp Ontap
+ 7.3.7.
+ * BUG 14793: Start the SMB encryption as soon as possible.
+
+
+#######################################
+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.14.6
July 13, 2021
@@ -55,10 +113,7 @@ database (https://bugzilla.samba.org/).
======================================================================
-Release notes for older releases follow:
-----------------------------------------
-
-
+----------------------------------------------------------------------
==============================
Release Notes for Samba 4.14.5
June 01, 2021
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index c211a94d3db..0218cad6271 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -109,7 +109,7 @@ def vcs_dir_contents(path):
"""
repo = path
while repo != "/":
- if os.path.isdir(os.path.join(repo, ".git")):
+ if os.path.exists(os.path.join(repo, ".git")):
ls_files_cmd = [ 'git', 'ls-files', '--full-name',
os.path.relpath(path, repo) ]
cwd = None
diff --git a/configure b/configure
index a6ca50feb47..2b0ffb0dae1 100755
--- a/configure
+++ b/configure
@@ -13,5 +13,5 @@ export JOBS
unset LD_PRELOAD
cd . || exit 1
-$PYTHON $WAF configure "$@" || exit 1
+$PYTHON $WAF configure $@ || exit 1
cd $PREVPATH
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 99b18e82590..0652cb4e6d6 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -1056,3 +1056,28 @@ const char *rep_getprogname(void)
#endif /* HAVE_PROGRAM_INVOCATION_SHORT_NAME */
}
#endif /* HAVE_GETPROGNAME */
+
+#ifndef HAVE_COPY_FILE_RANGE
+# ifdef HAVE_SYSCALL_COPY_FILE_RANGE
+# include <sys/syscall.h>
+# endif
+ssize_t rep_copy_file_range(int fd_in,
+ loff_t *off_in,
+ int fd_out,
+ loff_t *off_out,
+ size_t len,
+ unsigned int flags)
+{
+# ifdef HAVE_SYSCALL_COPY_FILE_RANGE
+ return syscall(__NR_copy_file_range,
+ fd_in,
+ off_in,
+ fd_out,
+ off_out,
+ len,
+ flags);
+# endif /* HAVE_SYSCALL_COPY_FILE_RANGE */
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* HAVE_COPY_FILE_RANGE */
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index e08bf7c2e58..a546185d47a 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -964,6 +964,16 @@ int rep_memset_s(void *dest, size_t destsz, int ch, size_t count);
const char *rep_getprogname(void);
#endif
+#ifndef HAVE_COPY_FILE_RANGE
+#define copy_file_range rep_copy_file_range
+ssize_t rep_copy_file_range(int fd_in,
+ loff_t *off_in,
+ int fd_out,
+ loff_t *off_out,
+ size_t len,
+ unsigned int flags);
+#endif /* HAVE_COPY_FILE_RANGE */
+
#ifndef FALL_THROUGH
# ifdef HAVE_FALLTHROUGH_ATTRIBUTE
# define FALL_THROUGH __attribute__ ((fallthrough))
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 2c856b61a0f..3811084db3c 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -465,6 +465,16 @@ def configure(conf):
conf.CHECK_FUNCS('getpwent_r getpwnam_r getpwuid_r epoll_create')
conf.CHECK_FUNCS('port_create')
conf.CHECK_FUNCS('getprogname')
+ if not conf.CHECK_FUNCS('copy_file_range'):
+ conf.CHECK_CODE('''
+#include <sys/syscall.h>
+#include <unistd.h>
+syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0);
+ ''',
+ 'HAVE_SYSCALL_COPY_FILE_RANGE',
+ msg='Checking whether we have copy_file_range system call')
+ if conf.CONFIG_SET('HAVE_COPY_FILE_RANGE') or conf.CONFIG_SET('HAVE_SYSCALL_COPY_FILE_RANGE'):
+ conf.DEFINE('USE_COPY_FILE_RANGE', 1)
conf.SET_TARGET_TYPE('attr', 'EMPTY')
@@ -846,7 +856,7 @@ REPLACEMENT_FUNCTIONS = {
'strsep', 'strtok_r', 'strtoll', 'strtoull', 'setenv', 'unsetenv',
'utime', 'utimes', 'dup2', 'chown', 'link', 'readlink',
'symlink', 'lchown', 'realpath', 'memmem', 'vdprintf',
- 'dprintf', 'get_current_dir_name',
+ 'dprintf', 'get_current_dir_name', 'copy_file_range',
'strerror_r', 'clock_gettime', 'memset_s'],
'timegm.c': ['timegm'],
# Note: C99_VSNPRINTF is not a function, but a special condition
diff --git a/lib/util/sys_rw.c b/lib/util/sys_rw.c
index d74395fc409..02aaa871a39 100644
--- a/lib/util/sys_rw.c
+++ b/lib/util/sys_rw.c
@@ -48,6 +48,31 @@ bool sys_valid_io_range(off_t offset, size_t length)
return true;
}
+bool sys_io_ranges_overlap(size_t c1, off_t o1,
+ size_t c2, off_t o2)
+{
+ if (c1 == 0 || c2 == 0) {
+ return false;
+ }
+ if (o2 < o1) {
+ /*
+ * o1
+ * |····c1····|
+ * o2
+ * |····c2···| ?
+ */
+ return (o2 + c2 > o1);
+ } else {
+ /*
+ * o1
+ * |····c1···|
+ * o2
+ * |····c2····| ?
+ */
+ return (o1 + c1 > o2);
+ }
+}
+
/*******************************************************************
A read wrapper that will deal with EINTR/EWOULDBLOCK
********************************************************************/
diff --git a/lib/util/sys_rw.h b/lib/util/sys_rw.h
index b224ecb30ac..6693d34de57 100644
--- a/lib/util/sys_rw.h
+++ b/lib/util/sys_rw.h
@@ -28,6 +28,8 @@
struct iovec;
bool sys_valid_io_range(off_t offset, size_t length);
+bool sys_io_ranges_overlap(size_t c1, off_t o1,
+ size_t c2, off_t o2);
ssize_t sys_read(int fd, void *buf, size_t count);
void sys_read_v(int fd, void *buf, size_t count);
ssize_t sys_write(int fd, const void *buf, size_t count);
diff --git a/lib/util/tests/test_sys_rw.c b/lib/util/tests/test_sys_rw.c
new file mode 100644
index 00000000000..551a6a09bda
--- /dev/null
+++ b/lib/util/tests/test_sys_rw.c
@@ -0,0 +1,110 @@
+/*
+ * Unix SMB/CIFS implementation.
+ *
+ * Unit test for sys_rw.c
+ *
+ * Copyright (C) Ralph Böhme 2021
+ *
+ * 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 <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "lib/replace/replace.h"
+#include "system/dir.h"
+
+#include "lib/util/sys_rw.c"
+
+static void test_sys_io_ranges_overlap(void **state)
+{
+ bool overlap;
+
+ /*
+ * sys_io_ranges_overlap() args are:
+ *
+ * src size, src offset, dst size, dst offset
+ */
+
+ /* src and dst size 0 => no overlap */
+ overlap = sys_io_ranges_overlap(0, 0, 0, 0);
+ assert_false(overlap);
+
+ /* dst size 0 => no overlap */
+ overlap = sys_io_ranges_overlap(1, 0, 0, 0);
+ assert_false(overlap);
+
+ /* src size 0 => no overlap */
+ overlap = sys_io_ranges_overlap(0, 0, 1, 0);
+ assert_false(overlap);
+
+ /* same range => overlap */
+ overlap = sys_io_ranges_overlap(1, 0, 1, 0);
+ assert_true(overlap);
+
+ /*
+ * |.|
+ * |.|
+ * src before dst => no overlap
+ */
+ overlap = sys_io_ranges_overlap(1, 0, 1, 1);
+ assert_false(overlap);
+
+ /*
+ * |..|
+ * |..|
+ * src into dst => overlap
+ */
+ overlap = sys_io_ranges_overlap(2, 0, 2, 1);
+ assert_true(overlap);
+
+ /*
+ * |....|
+ * |..|
+ * src encompasses dst => overlap
+ */
+ overlap = sys_io_ranges_overlap(4, 0, 1, 2);
+ assert_true(overlap);
+
+
+ /*
+ * |..|
+ * |..|
+ * dst into src => overlap
+ */
+ overlap = sys_io_ranges_overlap(2, 1, 2, 0);
+ assert_true(overlap);
+
+ /*
+ * |..|
+ * |....|
+ * dst encompasses src => overlap
+ */
+ overlap = sys_io_ranges_overlap(2, 1, 4, 0);
+ assert_true(overlap);
+}
+
+int main(int argc, char **argv)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_sys_io_ranges_overlap),
+ };
+
+ cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
+
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 460661e9a63..839d3c2e2e9 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -356,3 +356,9 @@ else:
deps='cmocka replace talloc samba-util',
local_include=False,
for_selftest=True)
+
+ bld.SAMBA_BINARY('test_sys_rw',
+ source='tests/test_sys_rw.c',
+ deps='cmocka replace samba-util',
+ local_include=False,
+ for_selftest=True)
diff --git a/libcli/smb/smb2cli_ioctl.c b/libcli/smb/smb2cli_ioctl.c
index f9abcc57bab..d638b281678 100644
--- a/libcli/smb/smb2cli_ioctl.c
+++ b/libcli/smb/smb2cli_ioctl.c
@@ -160,97 +160,6 @@ struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
return req;
}
-static NTSTATUS smb2cli_ioctl_parse_buffer(uint32_t dyn_offset,
- const DATA_BLOB dyn_buffer,
- uint32_t min_offset,
- uint32_t buffer_offset,
- uint32_t buffer_length,
- uint32_t max_length,
- uint32_t *next_offset,
- DATA_BLOB *buffer)
-{
- uint32_t offset;
- bool oob;
-
- *buffer = data_blob_null;
- *next_offset = dyn_offset;
-
- if (buffer_offset == 0) {
- /*
- * If the offset is 0, we better ignore
- * the buffer_length field.
- */
- return NT_STATUS_OK;
- }
-
- if (buffer_length == 0) {
- /*
- * If the length is 0, we better ignore
- * the buffer_offset field.
- */
- return NT_STATUS_OK;
- }
-
- if ((buffer_offset % 8) != 0) {
- /*
- * The offset needs to be 8 byte aligned.
- */
- return NT_STATUS_INVALID_NETWORK_RESPONSE;
- }
-
- /*
- * We used to enforce buffer_offset to be
- * an exact match of the expected minimum,
- * but the NetApp Ontap 7.3.7 SMB server
- * gets the padding wrong and aligns the
- * input_buffer_offset by a value of 8.
- *
- * So we just enforce that the offset is
- * not lower than the expected value.
- */
- SMB_ASSERT(min_offset >= dyn_offset);
- if (buffer_offset < min_offset) {
- return NT_STATUS_INVALID_NETWORK_RESPONSE;
- }
-
- /*
- * Make [input|output]_buffer_offset relative to "dyn_buffer"
- */
- offset = buffer_offset - dyn_offset;
- oob = smb_buffer_oob(dyn_buffer.length, offset, buffer_length);
- if (oob) {
- return NT_STATUS_INVALID_NETWORK_RESPONSE;
- }
-
- /*
- * Give the caller a hint what we consumed,
- * the caller may need to add possible padding.
- */
- *next_offset = buffer_offset + buffer_length;
-
- if (max_length == 0) {
- /*
- * If max_input_length is 0 we ignore the
- * input_buffer_length, because Windows 2008 echos the
- * DCERPC request from the requested input_buffer to
- * the response input_buffer.
- *
- * We just use the same logic also for max_output_length...
- */
- buffer_length = 0;
- }
-
- if (buffer_length > max_length) {
- return NT_STATUS_INVALID_NETWORK_RESPONSE;
- }
-
- *buffer = (DATA_BLOB) {
- .data = dyn_buffer.data + offset,
- .length = buffer_length,
- };
- return NT_STATUS_OK;
-}
-
static void smb2cli_ioctl_done(struct tevent_req *subreq)
{
struct tevent_req *req =
@@ -352,14 +261,14 @@ static void smb2cli_ioctl_done(struct tevent_req *subreq)
input_min_offset = dyn_ofs;
input_next_offset = dyn_ofs;
- error = smb2cli_ioctl_parse_buffer(dyn_ofs,
- dyn_buffer,
- input_min_offset,
- input_buffer_offset,
- input_buffer_length,
- state->max_input_length,
- &input_next_offset,
- &state->out_input_buffer);
+ error = smb2cli_parse_dyn_buffer(dyn_ofs,
+ dyn_buffer,
+ input_min_offset,
+ input_buffer_offset,
+ input_buffer_length,
+ state->max_input_length,
+ &input_next_offset,
+ &state->out_input_buffer);
--
Samba Shared Repository
More information about the samba-cvs
mailing list