kseeger/samba-autobuild-v4-14-test/.git
2 years agos3: smbd: Fix smbd crash on dangling symlink with posix connection calling several... v4-14-test
Jeremy Allison [Tue, 15 Jun 2021 22:42:33 +0000 (15:42 -0700)]
s3: smbd: Fix smbd crash on dangling symlink with posix connection calling several non-posix info levels.

Tidy up fsp == NULL checks. Remove knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14742

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed Jun 16 11:58:00 UTC 2021 on sn-devel-184

(cherry picked from commit 263c95aee38c9198ad9a30c4d960d72f46b7c27a)

2 years agos3/rpc_server: track the number of policy handles with a talloc destructor
Ralph Boehme [Mon, 9 Aug 2021 13:12:31 +0000 (15:12 +0200)]
s3/rpc_server: track the number of policy handles with a talloc destructor

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14783
RN: smbd "deadtime" parameter doesn't work anymore

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Aug 10 18:41:43 UTC 2021 on sn-devel-184

(cherry picked from commit 45a33b25c4e6b1db5d2dfa6297ccb390220a7c80)

Autobuild-User(v4-14-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-14-test): Thu Aug 26 16:03:40 UTC 2021 on sn-devel-184

2 years agoselftest: add a test for the "deadtime" parameter
Ralph Boehme [Mon, 9 Aug 2021 10:31:07 +0000 (12:31 +0200)]
selftest: add a test for the "deadtime" parameter

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14783

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 39db53a1391769fc6476fa55b02add08f1b8cd75)

2 years agos3: smbd: Ensure all returns from OpenDir() correctly set errno.
Jeremy Allison [Thu, 19 Aug 2021 22:43:52 +0000 (15:43 -0700)]
s3: smbd: Ensure all returns from OpenDir() correctly set errno.

Complex code paths inside open_internal_dirfsp() can return an
NTSTATUS, but trample on the matching errno. We need to make
sure if open_internal_dirfsp() fails, errno matches the NTSTATUS
return.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14805

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Fri Aug 20 09:56:49 UTC 2021 on sn-devel-184

(cherry picked from commit 72b4fe93f15e414ca3e7d7f0e77a5f0aae90556a)

2 years agoVERSION: Bump version up to 4.14.8...
Jule Anger [Tue, 24 Aug 2021 06:27:54 +0000 (08:27 +0200)]
VERSION: Bump version up to 4.14.8...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
2 years agoVERSION: Disable GIT_SNAPSHOT for the 4.14.7 release.
Jule Anger [Tue, 24 Aug 2021 06:26:37 +0000 (08:26 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.14.7 release.

Signed-off-by: Jule Anger <janger@samba.org>
2 years agoWHATSNEW: Add release notes for samba 4.14.7
Jule Anger [Tue, 24 Aug 2021 06:25:16 +0000 (08:25 +0200)]
WHATSNEW: Add release notes for samba 4.14.7

Signed-off-by: Jule Anger <janger@samba.org>
2 years agovfs_shadow_copy2: ensure we call convert_sbuf() in shadow_copy2_*stat() on already...
Ralph Boehme [Sat, 3 Jul 2021 13:46:11 +0000 (15:46 +0200)]
vfs_shadow_copy2: ensure we call convert_sbuf() in shadow_copy2_*stat() on already converted paths with absolute path

shadow_copy2_strip_snapshot() will happily return without modifying the passed
timestamp=0 if the path is already converted and refers to an object in a
snapshot, eg (first debug line from extra debugging patch [1]):

[10 2021/07/02 08:19:28.811424 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:1303 shadow_copy2_fstat]
  shadow_copy2_fstat: fsp [test.txt {@GMT-2000.01.02-03.04.05}]
[10 2021/07/02 08:19:28.811449 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:607 _shadow_copy2_strip_snapshot_internal]
  _shadow_copy2_strip_snapshot_internal: [from shadow_copy2_fstat()] Path 'test.txt {@GMT-2000.01.02-03.04.05}'
[10 2021/07/02 08:19:28.811474 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:619 _shadow_copy2_strip_snapshot_internal]
  _shadow_copy2_strip_snapshot_internal: abs path '/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt'
[10 2021/07/02 08:19:28.811496 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:1924 shadow_copy2_snapshot_to_gmt]
  shadow_copy2_snapshot_to_gmt: match @GMT-%Y.%m.%d-%H.%M.%S: @GMT-2000.01.02-03.04.05
[10 2021/07/02 08:19:28.811536 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:566 check_for_converted_path]
  check_for_converted_path: path |/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt| is already converted. connect path = |/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05|

As check_for_converted_path() detects an "already converted path",
_shadow_copy2_strip_snapshot_internal() just returns without modifying the value
of the timestamp.

By using shadow_copy2_strip_snapshot_converted() instead of
shadow_copy2_strip_snapshot() we can check if the path is in fact referring to a
VSS object by checking the "converted" bool.

An alternative way would have been directly checking fsp->fsp_name->twrp != 0,
but that would be a new semantic in the module, I'll leave this excersize for
the future when we clean up the usage of shadow_copy2_strip_snapshot() in the
whole module.

This change also switches to using the absolute paths in both place where
convert_sbuf() is called.

[1]
@@ -1309,8 +1348,16 @@ static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp,
                saved_errno = errno;
        }

+       DBG_DEBUG("fsp [%s]\n", fsp_str_dbg(fsp));

RN: vfs_shadow_copy2 fixinodes not correctly updating inode numbers
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit c7d6745858f2efdd24ed6fd353ec5ece898033fa)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Tue Aug 17 10:07:42 UTC 2021 on sn-devel-184

2 years agovfs_streams_xattr: ensure fstat calls NEXT fstat
Ralph Boehme [Wed, 28 Jul 2021 15:16:27 +0000 (17:16 +0200)]
vfs_streams_xattr: ensure fstat calls NEXT fstat

This ensures fstat behaves the same as stat by calling the NEXT VFS stat
function. This is required for matching path and handle based inode
numbers.

This bug is currently only exposed in a special case: a VSS snapshot of a
stream.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoselftest: add a test for shadow:fixinodes
Ralph Boehme [Tue, 6 Jul 2021 05:24:00 +0000 (07:24 +0200)]
selftest: add a test for shadow:fixinodes

This will fail with

  Failed to open file \@GMT-2015.10.31-19.40.30\subdir\hardlink. NT_STATUS_ACCESS_DENIED

The open is failing in openat_pathref_fsp():

  [2021/07/06 04:58:17.677104, 10, pid=95070, effective(1000, 1000), real(1000, 0)] ../../source3/smbd/files.c:541(openat_pathref_fsp)
    openat_pathref_fsp: file [subdir/hardlink {@GMT-2015.10.31-19.40.30}] - dev/ino mismatch. Old (dev=64770, ino=3826943444). New (dev=64770, ino=1746568660).
  [2021/07/06 04:58:17.677114, 10, pid=95070, effective(1000, 1000), real(1000, 0)] ../../source3/smbd/files.c:568(openat_pathref_fsp)
    openat_pathref_fsp: Opening pathref for [subdir/hardlink {@GMT-2015.10.31-19.40.30}] failed: NT_STATUS_ACCESS_DENIED

The reason is subtle:

shadow_copy2 calculates inode numbers of snapshot files based on the path of the
file. The result of that when doing a path based stat() from filename_convert()
was

  [2021/07/06 04:58:17.676159, 10, pid=95070, effective(1000, 1000), real(1000, 0)] ../../source3/smbd/filename.c:1945(filename_convert_internal)
    filename_convert_internal: XXX smb_fname [subdir/hardlink {@GMT-2015.10.31-19.40.30}] (dev=64770, ino=3826943444).

which is the "Old" inode shown above.

Later in the open code called from openat_pathref_fsp() -> fd_openat() ->
non_widelink_open() since 4.14 we call SMB_VFS_FSTAT() where fsp->fsp_name will
be set to the new relative *basename* of the file:

  [2021/07/06 04:58:17.676917, 10, pid=95070, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_default.c:1302(vfswrap_fstat)
    vfswrap_fstat: XXX fsp [hardlink {@GMT-2015.10.31-19.40.30}] (dev=64770, ino=3826943444)

So for stat() the hash function in called with the full path relative to the share
root:

  subdir/hardlink

while for fstat() the hash function will used

  hardlink

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4a7e483c516cf2b9767919a764f05c43f4620cd7)

2 years agoselftest: simplify snapshot directory creation in test_shadow_copy_torture.sh
Ralph Boehme [Tue, 6 Jul 2021 05:22:40 +0000 (07:22 +0200)]
selftest: simplify snapshot directory creation in test_shadow_copy_torture.sh

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 3aabc9825ca108641c2becf322fa0bd90ea18424)

2 years agoselftest: enable "shadow:fixinodes" in "shadow_write" share
Ralph Boehme [Tue, 6 Jul 2021 05:20:15 +0000 (07:20 +0200)]
selftest: enable "shadow:fixinodes" in "shadow_write" share

The existing tests don't care and this will be used in a subsequent commit to
demonstrate that this option is currently broken.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0a0b438b8ab534eeb552a58ad72a714988e84d89)

2 years agoselftest: pass smbclient arg to samba3.blackbox.shadow_copy_torture test
Ralph Boehme [Tue, 6 Jul 2021 05:19:36 +0000 (07:19 +0200)]
selftest: pass smbclient arg to samba3.blackbox.shadow_copy_torture test

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 745ded9afe12fda6d45638097a32b01122748649)

2 years agosmbd: update smb_fname statinfo from fsp
Ralph Boehme [Wed, 7 Jul 2021 10:40:05 +0000 (12:40 +0200)]
smbd: update smb_fname statinfo from fsp

fd_openat() has done an FSTAT on the handle so update the smb_fname stat info
with "truth".  from the handle.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b32e56d6eb29bfb5f368602edbc10d4b8bc9b4f0)

2 years agosmbd: canonicalize SMB_VFS_FSTAT() stat buffer
Ralph Boehme [Tue, 6 Jul 2021 07:04:26 +0000 (09:04 +0200)]
smbd: canonicalize SMB_VFS_FSTAT() stat buffer

This helps code inside any module implementing fstat() looking at
fsp->fsp_name->st instead of the passed in stat buf.

I only ran afoul of this in a DEBUG message I added while debugging some inode
related problem.

No change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 18a30d939e6f7d49300f235385953412f9e971b9)

2 years agosmbd: return correct timestamps for quota fake file
Ralph Boehme [Mon, 7 Jun 2021 17:02:56 +0000 (19:02 +0200)]
smbd: return correct timestamps for quota fake file

Prior to 572d4e3a56eef00e29f93482daa21647af7310d0 it was sufficient to
initialize struct timespec to zero to return NTTIME 0 (ie not set) over
SMB.

This fixes the same problem from bug 14714 where the timestamps in an SMB2 CLOSE
response.

Windows of course does return *some* timestamps, but as it's neither documented
nor was I able to figure out where they would be coming from, as well as the
Windows client apparently doesn't care, I didn't bother with implementing some
sophisticated heuristic to return some timestamps.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun  9 20:38:02 UTC 2021 on sn-devel-184

(cherry picked from commit 52a421111218d94d2e5cb131648bcdf5411d910b)

2 years agosmbd: handle fake file handles in fdos_mode()
Ralph Boehme [Fri, 4 Jun 2021 13:54:20 +0000 (15:54 +0200)]
smbd: handle fake file handles in fdos_mode()

This ensures SMB requests on the quote fake file "$Extend/$Quota" don't hit the
VFS, where specifically in vfs_gpfs we log an error message if we fail to read
the DOS attributes for a file with

  vfs_gpfs_get_dos_attributes: Getting winattrs failed for $Extend/$Quota

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e093eaed1046638193d973c39fa9df74e41148d3)

2 years agosmbd: add dosmode_from_fake_filehandle()
Ralph Boehme [Fri, 4 Jun 2021 14:31:20 +0000 (16:31 +0200)]
smbd: add dosmode_from_fake_filehandle()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 51b0fd0c566ff6bf112ab9752d9b105a6bb786a8)

2 years agosmbtorture: verify attributes on fake quota file handle
Ralph Boehme [Mon, 7 Jun 2021 17:03:05 +0000 (19:03 +0200)]
smbtorture: verify attributes on fake quota file handle

The expected DOS attributes are taken from a Windows 2016 server. The expected
timestamps are what Samba has returned before commit 572d4e3a56eef00e29f9348:
NTTIME(0), ie no value.

The upcoming fix will restore this behaviour. Windows of course does
return *some* timestamps, but as it's neither documented nor was I able to
figure out where they would be coming from, as well as the Windows client apparently
doesn't care, I didn't bother with implementing some sophisticated heuristic to
return some timestamps.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 1e338d51602a7dca6108e5e8704f5cdde4740713)

2 years agos3: smbd: For FSCTL calls that go async, add the outstanding tevent_reqs to the aio...
Jeremy Allison [Wed, 11 Aug 2021 20:58:13 +0000 (13:58 -0700)]
s3: smbd: For FSCTL calls that go async, add the outstanding tevent_reqs to the aio list on the file handle.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769
RN: smbd panic on force-close share during offload write

Back-ported from c013509680742ff45b2f5965a5564015da7d466b.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(v4-14-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-14-test): Tue Aug 17 09:07:18 UTC 2021 on sn-devel-184

2 years agos3:libsmb: close the temporary IPC$ connection in cli_full_connection()
Stefan Metzmacher [Wed, 11 Aug 2021 13:30:12 +0000 (15:30 +0200)]
s3:libsmb: close the temporary IPC$ connection in cli_full_connection()

We don't need the temporary IPC$ connection used for the
SMB1 UNIX CIFS extensions encryption setup anymore,
so we can also let the server close it.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14793

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 11 23:03:11 UTC 2021 on sn-devel-184

(cherry picked from commit 289b7a1595ab13a200cfb327604e4b9296fa81e0)

Autobuild-User(v4-14-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-14-test): Fri Aug 13 07:52:10 UTC 2021 on sn-devel-184

2 years agos3:libsmb: start encryption as soon as possible after the session setup
Stefan Metzmacher [Wed, 11 Aug 2021 12:33:24 +0000 (14:33 +0200)]
s3:libsmb: start encryption as soon as possible after the session setup

For the SMB1 UNIX CIFS extensions we create a temporary IPC$ tcon,
if there's no tcon yet.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14793

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 21302649c46441ea325c66457294225ddb1d6235)

2 years agowscript: fix installing pre-commit with 'git worktree'
Stefan Metzmacher [Wed, 11 Aug 2021 11:26:41 +0000 (13:26 +0200)]
wscript: fix installing pre-commit with 'git worktree'

.git is not always a directory, with 'git worktree' it's a file.

'git rev-parse --git-path hooks' is the generic way to find the
patch for the githooks.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug 12 08:56:13 UTC 2021 on sn-devel-184

(cherry picked from commit 8858cf72af1cc15784749e58f184559a839dd4ef)

Autobuild-User(v4-14-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-14-test): Thu Aug 12 11:49:18 UTC 2021 on sn-devel-184

2 years agoscript/bisect-test.py: add support git worktree
Stefan Metzmacher [Wed, 11 Aug 2021 11:26:41 +0000 (13:26 +0200)]
script/bisect-test.py: add support git worktree

.git is not always a directory, with 'git worktree' it's a file.

Note we could also use 'git rev-parse --show-toplevel', but that's
a patch for another day.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit c7f85146cb50795afcbb1c607e87d163d241c79a)

2 years agowafsamba: add support git worktree to vcs_dir_contents()
Stefan Metzmacher [Wed, 11 Aug 2021 11:26:41 +0000 (13:26 +0200)]
wafsamba: add support git worktree to vcs_dir_contents()

.git is not always a directory, with 'git worktree' it's a file.

Note we could also use 'git rev-parse --show-toplevel', but that's
a patch for another day.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 2e2d2eaa10499537c9af07dd866ac8e613c3da02)

2 years agolibcli/smb: allow unexpected padding in SMB2 READ responses
Stefan Metzmacher [Tue, 29 Jun 2021 13:42:56 +0000 (15:42 +0200)]
libcli/smb: allow unexpected padding in SMB2 READ responses

Make use of smb2cli_parse_dyn_buffer() in smb2cli_read_done()
as it was exactly introduced for a similar problem see:

    commit 4c6c71e1378401d66bf2ed230544a75f7b04376f
    Author:     Stefan Metzmacher <metze@samba.org>
    AuthorDate: Thu Jan 14 17:32:15 2021 +0100
    Commit:     Volker Lendecke <vl@samba.org>
    CommitDate: Fri Jan 15 08:36:34 2021 +0000

        libcli/smb: allow unexpected padding in SMB2 IOCTL responses

        A NetApp Ontap 7.3.7 SMB server add 8 padding bytes to an
        offset that's already 8 byte aligned.

        RN: Work around special SMB2 IOCTL response behavior of NetApp Ontap 7.3.7
        BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

        Pair-Programmed-With: Volker Lendecke <vl@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
        Autobuild-User(master): Volker Lendecke <vl@samba.org>
        Autobuild-Date(master): Fri Jan 15 08:36:34 UTC 2021 on sn-devel-184

RN: Work around special SMB2 READ response behavior of NetApp Ontap 7.3.7
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 15 23:53:55 UTC 2021 on sn-devel-184

(cherry picked from commit 155348cda65b441a6c4db1ed84dbf1682d02973c)

Autobuild-User(v4-14-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-14-test): Thu Aug 12 09:39:40 UTC 2021 on sn-devel-184

2 years agolibcli/smb: make smb2cli_ioctl_parse_buffer() available as smb2cli_parse_dyn_buffer()
Stefan Metzmacher [Tue, 29 Jun 2021 13:24:13 +0000 (15:24 +0200)]
libcli/smb: make smb2cli_ioctl_parse_buffer() available as smb2cli_parse_dyn_buffer()

It will be used in smb2cli_read.c soon...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 1faf15b3d0f41fa8a94b76d1616a4460ce0c6fa4)

2 years agos3:smbd: implement FSCTL_SMBTORTURE_GLOBAL_READ_RESPONSE_BODY_PADDING8
Stefan Metzmacher [Mon, 5 Jul 2021 15:49:00 +0000 (17:49 +0200)]
s3:smbd: implement FSCTL_SMBTORTURE_GLOBAL_READ_RESPONSE_BODY_PADDING8

This turns the 'smb2.read.bug14607' test from 'skip' into 'xfailure',
as the 2nd smb2cli_read() function will now return
NT_STATUS_INVALID_NETWORK_RESPONSE.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ef57fba5dbf359b204ba952451e1e33ed68f1c91)

2 years agos3:smbd: introduce a body_size variable in smbd_smb2_request_read_done
Stefan Metzmacher [Mon, 5 Jul 2021 15:49:00 +0000 (17:49 +0200)]
s3:smbd: introduce a body_size variable in smbd_smb2_request_read_done

This will simplify the following changes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5ecac656fde4e81aa6e51e7b3134ea3fb75f564a)

2 years agos4:torture/smb2: add smb2.read.bug14607 test
Stefan Metzmacher [Tue, 6 Jul 2021 14:24:59 +0000 (16:24 +0200)]
s4:torture/smb2: add smb2.read.bug14607 test

This test will use a FSCTL_SMBTORTURE_GLOBAL_READ_RESPONSE_BODY_PADDING8
in order to change the server behavior of READ responses regarding
the data offset.

It will demonstrate the problem in smb2cli_read*() triggered
by NetApp Ontap servers.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b3c9823d907b91632679e6f0ffce1b7192e4b9b6)

2 years agodosmode: retry reading dos attributes as root for unreadable files
Björn Jacke [Thu, 4 Mar 2021 18:37:37 +0000 (19:37 +0100)]
dosmode: retry reading dos attributes as root for unreadable files

if there are files that the user can't access, he is still allowed to read the
dos attributes information, so we need to try reading them as root also.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14654

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4288319770bc1bde28b1e9ac4bb287e29853378d)

Autobuild-User(v4-14-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-14-test): Wed Aug 11 10:55:24 UTC 2021 on sn-devel-184

2 years agovfs: Fix the FreeBSD build
Volker Lendecke [Mon, 25 Jan 2021 08:55:40 +0000 (09:55 +0100)]
vfs: Fix the FreeBSD build

fd_handle is private now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jan 25 12:16:11 UTC 2021 on sn-devel-184

(cherry picked from commit da3b00f5511d83bdc347eaff9c031390fea41802)

2 years agovfs_default: use fsp_get_io_fd() for copy_file_range()
Ralph Boehme [Thu, 1 Jul 2021 13:19:56 +0000 (15:19 +0200)]
vfs_default: use fsp_get_io_fd() for copy_file_range()

Unintentionally used fsp_get_pathref_fd() in the initial patchset.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul  1 17:45:49 UTC 2021 on sn-devel-184

(cherry picked from commit 0e3ddc27ed6d603a21cb2b187f3295506d560604)

2 years agovfs_default: use copy_file_range()
Ralph Boehme [Thu, 24 Jun 2021 14:21:42 +0000 (16:21 +0200)]
vfs_default: use copy_file_range()

Original file on an XFS filesystem:

  $ ls -l /mnt/test/1048578-file
  -rw-rw-r--. 1 slow slow 1048578 Jun 25 11:40 /mnt/test/1048578-file

  $ xfs_bmap /mnt/test/1048578-file
  /mnt/test/1048578-file:
          0: [0..2055]: 192..2247

Copy created with cp --reflink=never:

  $ xfs_bmap /mnt/test/1048578-file-reflink-never
  /mnt/test/1048578-file-reflink-never:
          0: [0..2055]: 2248..4303

Copy created with cp --reflink=always

  $ xfs_bmap /mnt/test/1048578-file-reflink-always
  /mnt/test/1048578-file-reflink-always:
          0: [0..2055]: 192..2247

Copy done from a Windows client:

  $ xfs_bmap /mnt/test/1048578-file\ -\ Copy
  /mnt/test/1048578-file - Copy:
          0: [0..2055]: 192..2247

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033
RN: smbd should support copy_file_range() for FSCTL_SRV_COPYCHUNK

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 30 17:40:23 UTC 2021 on sn-devel-184

(cherry picked from commit accaa2f1f67a7f064a4ce03a120d7b2f8e847ccf)

2 years agosmbd: use sys_io_ranges_overlap() in fsctl_dup_extents_check_overlap()
Ralph Boehme [Mon, 28 Jun 2021 13:50:32 +0000 (15:50 +0200)]
smbd: use sys_io_ranges_overlap() in fsctl_dup_extents_check_overlap()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e72be5213335ab1ea0f9f396ab071669231c151b)

2 years agolib: add sys_io_ranges_overlap()
Ralph Boehme [Sat, 26 Jun 2021 10:21:19 +0000 (12:21 +0200)]
lib: add sys_io_ranges_overlap()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4f1a02909b8694dcc30fd5c7c6772fcfa1092ed9)

2 years agovfs_default: properly track written bytes for copy-chunk
Ralph Boehme [Fri, 25 Jun 2021 13:47:38 +0000 (15:47 +0200)]
vfs_default: properly track written bytes for copy-chunk

No change in behavour, this just makes the logic slightly more
understandable. In theory it would also allow the logic to be adjusted for
allowing short reads which is not quite clear from MS-SMB2 if we should allow
it. The file could be truncated while we're reading it.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e2d524d4baee193b0d03df3e7edda48b3cb4bddf)

2 years agoreplace: copy_file_range()
Ralph Boehme [Thu, 24 Jun 2021 12:13:50 +0000 (14:13 +0200)]
replace: copy_file_range()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4dcc04228df233be15efe9c31bcbaba822b140c4)

2 years agos3: lib: sysacls: Fix argument numbers for sys_acl_set_fd() for untested OS builds.
David Gajewski [Tue, 3 Aug 2021 00:06:39 +0000 (17:06 -0700)]
s3: lib: sysacls: Fix argument numbers for sys_acl_set_fd() for untested OS builds.

In the stable release 4.14.6 the prototype for solarisacl_sys_acl_set_fd()
in s3/modules/vfs_solarisacl.h is listed with 3 arguments, while the code
in s3/modules/vfs_solarisacl.c has 4. This leads to a compile error. The
latter reflects the upcoming release, with code in solarisacl_sys_acl_set_fd()
checking for the type.

The commit was "vfs: add acl type arg to SMB_VFS_SYS_ACL_SET_FD()"
that made the partial change.

A patch mimicking what was done with posixacl_sys_acl_set_fd()
is applied here.

solarisacl_sys_acl_set_fd() is only called from sys_acl_set_fd() in
s3/lib/sysacls.c which in turn is only called by vfswrap_sys_acl_set_fd()
in s3/modules/vfs_default.c when type == SMB_ACL_TYPE_ACCESS.

This patch mimics the call to posixacl_sys_acl_set_fd() by setting
the type argument to SMB_ACL_TYPE_ACCESS for all the affected OS's
that are not tested in ci (tru64 and aix).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14774

Signed-off-by: David Gajewski <dgajews@math.utoledo.edu>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(similar to commit 2867950721993c62a636d754e50d483fda39e19c)

Autobuild-User(v4-14-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-14-test): Tue Aug 10 12:41:30 UTC 2021 on sn-devel-184

2 years agoconfigure: Do not put arguments into double quotes
Andreas Schneider [Mon, 2 Aug 2021 15:43:01 +0000 (17:43 +0200)]
configure: Do not put arguments into double quotes

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14777

This could create an issue that arguments don't get split by python and then the
following could happen:

    ./configure --libdir=/usr/lib64 --enable-clangdb

    LIBDIR='/usr/lib64 --enable-clangdb'

This ends then up in parameters.all.xml:

    <!ENTITY pathconfig.LIBDIR   '/usr/lib64 --enable-clangdb'>

The python parser then errors out:

    xml.etree.ElementTree.ParseError: not well-formed (invalid token)

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Aug  3 18:36:37 UTC 2021 on sn-devel-184

(cherry picked from commit e2962b4262fc4a7197a3fcbd010fcfaca781baea)

2 years agoVERSION: Bump version up to 4.14.7...
Karolin Seeger [Tue, 13 Jul 2021 10:26:05 +0000 (12:26 +0200)]
VERSION: Bump version up to 4.14.7...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agoVERSION: Disable GIT_SNAPSHOT for the 4.14.6 release.
Karolin Seeger [Tue, 13 Jul 2021 10:25:23 +0000 (12:25 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.14.6 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agoWHATSNEW: Add release notes for Samba 4.14.6.
Karolin Seeger [Tue, 13 Jul 2021 10:24:33 +0000 (12:24 +0200)]
WHATSNEW: Add release notes for Samba 4.14.6.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agosmbXsrv_{open,session,tcon}: protect smbXsrv_{open,session,tcon}_global_traverse_fn...
Stefan Metzmacher [Mon, 5 Jul 2021 15:17:30 +0000 (17:17 +0200)]
smbXsrv_{open,session,tcon}: protect smbXsrv_{open,session,tcon}_global_traverse_fn against invalid records

I saw systems with locking.tdb records being part of:
  ctdb catdb smbXsrv_tcon_global.tdb

It's yet unknown how that happened, but we should not panic in srvsvc_*
calls because the info0 pointer was NULL.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14752

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul  6 11:08:43 UTC 2021 on sn-devel-184

(cherry picked from commit 00bab5b3c821f272153a25ded9743460887a7907)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Mon Jul 12 13:52:06 UTC 2021 on sn-devel-184

2 years agogensec_krb5: restore ipv6 support for kpasswd
Stefan Metzmacher [Fri, 2 Jul 2021 07:37:25 +0000 (09:37 +0200)]
gensec_krb5: restore ipv6 support for kpasswd

We need to offer as much space we have in order to
get the address out of tsocket_address_bsd_sockaddr().

This fixes a regression in commit
43c808f2ff907497dfff0988ff90a48fdcfc16ef.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14750

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 0388a8f33bdde49f1cc805a0291859203c1a52b4)

2 years agonetcmd: Use next_free_rid() function to calculate a SID for restoring a backup
Joseph Sutton [Thu, 27 May 2021 03:35:35 +0000 (15:35 +1200)]
netcmd: Use next_free_rid() function to calculate a SID for restoring a backup

This means we won't get errors if the DC doesn't have a rIDNextRID
attribute, but we will still error if there is no RID Set or if all its
pools are exhausted.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14669

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 59d293b60608172ae61551c642d13d3b215924e4)

2 years agopython/tests/dsdb: Add tests for RID allocation functions
Joseph Sutton [Mon, 24 May 2021 04:46:28 +0000 (16:46 +1200)]
python/tests/dsdb: Add tests for RID allocation functions

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14669

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 7c7cad81844950c3efe9a540a47b9d4e1ce1b2a1)

2 years agodsdb: Add next_free_rid() function to allocate a RID without modifying the database
Joseph Sutton [Mon, 24 May 2021 00:59:59 +0000 (12:59 +1200)]
dsdb: Add next_free_rid() function to allocate a RID without modifying the database

If used to generate SIDs for objects, care should be taken, as the
possibility for having duplicate objectSIDs can arise.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14669

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit cc98e03e7a0f2bf7a1ace2950fe6500f53640c1b)

2 years agonetcmd: Add tests for performing an offline backup immediately after joining a domain
Joseph Sutton [Mon, 24 May 2021 02:58:40 +0000 (14:58 +1200)]
netcmd: Add tests for performing an offline backup immediately after joining a domain

This currently fails due to the DC not having a rIDNextRID attribute,
which is required for the restore process.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14669

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit b7e6a1c5da7283c49586dc29f85ab19e0e57b0f6)

2 years agonetcmd: Ignore rIDUsedPool attribute in offline domain backup test
Joseph Sutton [Wed, 26 May 2021 01:40:30 +0000 (13:40 +1200)]
netcmd: Ignore rIDUsedPool attribute in offline domain backup test

The RID Set of the newly created DC account has all its values
initialised to zero. If the rIDUsedPool attribute was previously
non-zero, then the restore process will cause its value to change.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14669

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 658e5a6cc20b57f48477affd370fe25458178b92)

2 years agonetcmd: Fix error-checking condition
Joseph Sutton [Mon, 24 May 2021 04:40:55 +0000 (16:40 +1200)]
netcmd: Fix error-checking condition

This condition probably meant to check the argument of the most recently
thrown exception, rather than the previous one again.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14669

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit e8c242bed19432d96e78dc345ab5f06422c5b104)

2 years agonetcmd: Avoid database corruption by opting not to create database files during an...
Joseph Sutton [Tue, 16 Mar 2021 09:20:21 +0000 (22:20 +1300)]
netcmd: Avoid database corruption by opting not to create database files during an offline domain backup

If backup dirs contain hardlinks, the backup process could previously
attempt to open an LMDB database already opened during the backup,
causing it to be recreated as a new TDB database. This commit ensures
that new database files are not created during this operation, and that
the main SamDB database is not modified.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14027

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit 4cf773591d49166b8c7ef8d637d7edfe755d48aa)

2 years agonetcmd: Determine which files are to be copied for an offline domain backup
Joseph Sutton [Tue, 16 Mar 2021 03:22:40 +0000 (16:22 +1300)]
netcmd: Determine which files are to be copied for an offline domain backup

The old behaviour attempted to check for and remove files with duplicate
names, but did not do so due to a bug, and would have left undetermined
which files were given priority when duplicate filenames were present.
Now when hardlinks are present, only one instance of each file is
chosen, with files in the private directory having priority. If one
backup dir is nested inside another, the files contained in the nested
directory are only added once. Additionally, the BIND DNS database is
omitted from the backup.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14027

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit 3723148e7aa7e6d4a48a1a38112f121f52b6ee6f)

2 years agonetcmd: Add test for an offline backup of nested directories
Joseph Sutton [Wed, 17 Mar 2021 21:52:52 +0000 (10:52 +1300)]
netcmd: Add test for an offline backup of nested directories

This test verifies that when performing an offline backup of a domain
where one of the directories to be backed up is nested inside another,
the contained files are only included once in the backup.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14027

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit f994783f4279884ec4d2ee3e7db80fb7af267d1c)

2 years agonetcmd: Add test for an offline backup of a directory containing hardlinks
Joseph Sutton [Tue, 16 Mar 2021 03:13:05 +0000 (16:13 +1300)]
netcmd: Add test for an offline backup of a directory containing hardlinks

This test verifies that when performing an offline backup of a domain
where the directories to be backed up contain hardlinks, only one
instance of each file is backed up, and that files in the private
directory take precedence.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14027

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit 0e5738887524b467bfebcf657bcb00ed71827784)

2 years agomdssvc: avoid direct filesystem access, use the VFS
Ralph Boehme [Mon, 10 May 2021 10:34:32 +0000 (12:34 +0200)]
mdssvc: avoid direct filesystem access, use the VFS

This ensures mdssvc uses the same FileIDs as the fileserver as well as Spotlight
can be used working on a virtual filesystem like GlusterFS.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740
RN: Spotlight RPC service doesn't work with vfs_glusterfs

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jun 16 05:59:13 UTC 2021 on sn-devel-184

(backported from commit 620b99144359f45aa69c13731db8d793cfbba197)
[slow@samba.org: smbd_check_access_rights_fsp() doesn't take dirfsp arg]

2 years agomdssvc: chdir() to the conn of the RPC request
Ralph Boehme [Tue, 15 Jun 2021 12:14:52 +0000 (14:14 +0200)]
mdssvc: chdir() to the conn of the RPC request

In preperation of calling VFS functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740

Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6de3a88494b5932d0fd10f5c8c8ec57916aeefc5)

2 years agomdssvc: maintain a connection struct in the mds_ctx
Ralph Boehme [Mon, 10 May 2021 10:10:08 +0000 (12:10 +0200)]
mdssvc: maintain a connection struct in the mds_ctx

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8b681cfb5d9b1ece03f7e7b9d3a08ae6c461d679)

2 years agosmbd: add create_conn_struct_cwd()
Ralph Boehme [Fri, 28 May 2021 07:25:22 +0000 (09:25 +0200)]
smbd: add create_conn_struct_cwd()

Compared to create_conn_struct_tos_cwd() this takes a TALLOC_CTX and
tevent_context as additional arguments and the resulting connection_struct is
stable across the lifetime of mem_ctx and ev.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 9a2d6bcfd5797dd4db764921548c8dca6dd0eb21)

2 years agosmbd: pass tevent context to create_conn_struct_as_root()
Ralph Boehme [Tue, 15 Jun 2021 09:17:57 +0000 (11:17 +0200)]
smbd: pass tevent context to create_conn_struct_as_root()

The next commit will add another caller of create_conn_struct_as_root() that is
going to pass a long-lived tevent context.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 16c39b81d6f2c7d75cfe72bbbe2f6a5bde42c7b0)

2 years agomdssvc: pass messaging context to mds_init_ctx()
Ralph Boehme [Mon, 10 May 2021 10:08:17 +0000 (12:08 +0200)]
mdssvc: pass messaging context to mds_init_ctx()

This is needed in a subsequent commit. Note that I prefer to do the event
context unwrapping in the caller and pass both the event and messaging context
explicitly to mds_init_ctx().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 1ef2828e1025e4c89292df1dfa6161c4453b3afe)

2 years agomdssvc: don't fail mds_add_result() if result is not found in CNID set
Ralph Boehme [Mon, 10 May 2021 09:07:27 +0000 (11:07 +0200)]
mdssvc: don't fail mds_add_result() if result is not found in CNID set

Just skip adding the result to the pending results set, don't return an
error. Returning an error triggers an error at the MDSSVC RPC error which is NOT
what we want here.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8847f46f75ac5c1a753a0e7da88c522be25ef681)

2 years agomdssvc: use a helper variable in mds_add_result()
Ralph Boehme [Mon, 10 May 2021 09:04:38 +0000 (11:04 +0200)]
mdssvc: use a helper variable in mds_add_result()

No change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e2486d76b611f07b85b26c54fe14da7b76bd01c2)

2 years agosmbd: add synthetic_pathref()
Ralph Boehme [Thu, 21 Jan 2021 14:04:57 +0000 (15:04 +0100)]
smbd: add synthetic_pathref()

Similar to synthetic_smb_fname(), but also opens a pathref fsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d9f95b8cefe2d1c8020592434481025aa1045e2f)

2 years agos3: smbd: Remove erroneous TALLOC_FREE(smb_fname_parent) in change_file_owner_to_pare...
Jeremy Allison [Wed, 9 Jun 2021 19:22:26 +0000 (12:22 -0700)]
s3: smbd: Remove erroneous TALLOC_FREE(smb_fname_parent) in change_file_owner_to_parent() error path.

Caller is still using this !

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14736

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power<npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Fri Jun 11 10:17:46 UTC 2021 on sn-devel-184

(cherry picked from commit 4f20d310af2bb1f96dea4810a7130492cc4cfc55)

2 years agos3/modules: fchmod: fallback to path based chmod if pathref
Ralph Boehme [Fri, 9 Apr 2021 12:58:34 +0000 (14:58 +0200)]
s3/modules: fchmod: fallback to path based chmod if pathref

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14734

Signed-off-by: Noel Power <noel.power@suse.com>
Signed-off-by: Ralph Boehme <slow@samba.org>
Back-ported from master commit 6ad10836d6e04d8c95773e9122b63f5a5e040487)

2 years agos3: VFS: default: Add proc_fd's fallback for vfswrap_fchown().
Jeremy Allison [Wed, 9 Jun 2021 22:57:38 +0000 (15:57 -0700)]
s3: VFS: default: Add proc_fd's fallback for vfswrap_fchown().

https://bugzilla.samba.org/show_bug.cgi?id=14734

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Jun 10 09:16:22 UTC 2021 on sn-devel-184

(cherry picked from commit f44918e6c83c89936156eb24c982a897c9c45f61)

2 years agos3: lib: Fix talloc heirarcy error in parent_smb_fname().
Jeremy Allison [Tue, 1 Jun 2021 20:27:47 +0000 (13:27 -0700)]
s3: lib: Fix talloc heirarcy error in parent_smb_fname().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14722

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit c500d99e2f5aaec102bf952b7941a2596b3e35a1)

2 years agosmbd: fix pathref unlinking in create_file_unixpath()
Jeremy Allison [Tue, 8 Jun 2021 16:53:18 +0000 (18:53 +0200)]
smbd: fix pathref unlinking in create_file_unixpath()

This is really subtle. If someone passes in an smb_fname where smb_fname
actually is taken from fsp->fsp_name, then the lifetime of these objects is
meant to be the same.

This is commonly the case from an SMB1 path-based call
(eg call_trans2qfilepathinfo()) where we use the pathref fsp
(smb_fname->fsp) as the handle. In this case we must not unlink smb_fname->fsp
from it's owner.

The asserts below:

  SMB_ASSERT(fsp->fsp_name->fsp != NULL);
  SMB_ASSERT(fsp->fsp_name->fsp == fsp);

ensure the required invarients are met.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14732

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Jun  8 20:44:41 UTC 2021 on sn-devel-184

(cherry picked from commit 8a427783e5e780d3ffbe4f9710ac4a17c483ca33)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Thu Jun 10 10:31:11 UTC 2021 on sn-devel-184

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from call_trans2findfirst()
Ralph Boehme [Tue, 2 Feb 2021 15:01:19 +0000 (16:01 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from call_trans2findfirst()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Feb  5 07:26:44 UTC 2021 on sn-devel-184

(cherry picked from commit 1b3d70e9ae95892a70bd0f46ae5bf733c1bc9548)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()
Ralph Boehme [Tue, 2 Feb 2021 15:00:32 +0000 (16:00 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5898f5769e0b126cca33ba0002f1e4c3eb80d21a)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()
Ralph Boehme [Tue, 2 Feb 2021 14:58:57 +0000 (15:58 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 544767f72df366baf50be6d841e36dbcbe9f4065)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()
Ralph Boehme [Tue, 2 Feb 2021 14:58:42 +0000 (15:58 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8999c7d69c6312c7e7bef93417ecef93ddbdabf5)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()
Ralph Boehme [Tue, 2 Feb 2021 14:58:30 +0000 (15:58 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f21eb28cb8737d3125e4c0c65545f93dd7ea863f)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from reply_search()
Ralph Boehme [Tue, 2 Feb 2021 14:57:26 +0000 (15:57 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from reply_search()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6c2dad2aaef5eab75f3fe14219e9eca6724d6c99)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from create_file_unixpath()
Ralph Boehme [Tue, 2 Feb 2021 14:57:09 +0000 (15:57 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from create_file_unixpath()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 300d851a89248ac9b220fbac55cd5daaebb7fbca)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from open_streams_for_del...
Ralph Boehme [Tue, 2 Feb 2021 14:56:44 +0000 (15:56 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from open_streams_for_delete()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f121374514ed6957b9c6d022a17cc4e5c8aea9a6)

2 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from get_file_handle_for_...
Ralph Boehme [Tue, 2 Feb 2021 14:54:43 +0000 (15:54 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from get_file_handle_for_metadata()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0d454f34db52d2903c830e1f1acd56a9a1dca04b)

2 years agonet: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from openat_pathref_fsp()
Ralph Boehme [Tue, 2 Feb 2021 14:54:02 +0000 (15:54 +0100)]
net: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from openat_pathref_fsp()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6e7142ba6c79c9c6f3ce299b6c7dd476cc229e6b)

2 years agosmbd: don't return NT_STATUS_STOPPED_ON_SYMLINK in openat_pathref_fsp()
Ralph Boehme [Tue, 2 Feb 2021 10:18:54 +0000 (11:18 +0100)]
smbd: don't return NT_STATUS_STOPPED_ON_SYMLINK in openat_pathref_fsp()

NT_STATUS_STOPPED_ON_SYMLINK is returned when trying to open a symlink, most
callers are not interested in this.

Some callers that would want to know whether openat_pathref_fsp() failed
specifically on a symlink are setup_close_full_information(),
smbd_dirptr_get_entry(), unlink_internals() and filename_convert_internal(), so
we fix those callers to handle the symlink case themselves.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 977f37643b223e164fbbf6c3ba1d37aa546ddb7d)

2 years agosmbd: simplify error codepath in openat_pathref_fsp()
Ralph Boehme [Tue, 2 Feb 2021 12:49:56 +0000 (13:49 +0100)]
smbd: simplify error codepath in openat_pathref_fsp()

No change in behaviour: the cleanup code at the fail label does the same as the
cleanup this patch removes. It has an extra fd_close() that is not existing in
the removed cleanup, but as fsp->fd is -1, that's a noop.

And when previously the

return NT_STATUS_OBJECT_NAME_NOT_FOUND;

returns an an explicit status code, when now doing goto fail status will also be
set to NT_STATUS_OBJECT_NAME_NOT_FOUND.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit cd3d970c84b340630745bc555a86ac2d1306baac)

2 years agosmbd: expect valid stat info in openat_pathref_fsp()
Ralph Boehme [Mon, 1 Feb 2021 09:17:13 +0000 (10:17 +0100)]
smbd: expect valid stat info in openat_pathref_fsp()

We're never creating files here, so instead of waiting for the underlying open()
to return ENOENT, just check that we have valid stat info, expecting all callers
to have called SMB_VFS_[L]STAT() on the smb_fname.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 48bc561d1a8bb5ce99663b58a2e5e9aa344af96a)

2 years agosmbd: stat path before calling openat_pathref_fsp() in smbd_dirptr_get_entry()
Ralph Boehme [Mon, 1 Feb 2021 11:09:39 +0000 (12:09 +0100)]
smbd: stat path before calling openat_pathref_fsp() in smbd_dirptr_get_entry()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 87e97e1b519159b5f4c5ed4ef684783855e79ac3)

2 years agosmbd: move smb_fname creation to earlier point in smbd_dirptr_get_entry()
Ralph Boehme [Mon, 1 Feb 2021 11:04:49 +0000 (12:04 +0100)]
smbd: move smb_fname creation to earlier point in smbd_dirptr_get_entry()

No change in behaviour. Makes way for the next commit adding additional logic.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b3a0d6a128989b593f135c425dd59351d13b6120)

2 years agosmbd: stat path before calling openat_pathref_fsp() in open_pathref_base_fsp()
Ralph Boehme [Mon, 1 Feb 2021 11:04:01 +0000 (12:04 +0100)]
smbd: stat path before calling openat_pathref_fsp() in open_pathref_base_fsp()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit c31fe2f9e7d65409229b7ad73418793ab34d359d)

2 years agosmbd: remove a redundant fstat()in create_file_unixpath()
Ralph Boehme [Mon, 1 Feb 2021 11:03:08 +0000 (12:03 +0100)]
smbd: remove a redundant fstat()in create_file_unixpath()

openat_pathref_fsp() deep inside already calls fstat().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 91edc50dc0aaa82d9ede7a7f8cf0f63312eb8503)

2 years agosmbd: call stat before openat_pathref_fsp() in create_file_unixpath()
Ralph Boehme [Mon, 1 Feb 2021 11:01:22 +0000 (12:01 +0100)]
smbd: call stat before openat_pathref_fsp() in create_file_unixpath()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit aa0ef26d1e9dcef0bcb47974d7cf60db922d7d08)

2 years agosmbd: fix a resource leak in create_file_unixpath()
Ralph Boehme [Mon, 1 Feb 2021 11:01:01 +0000 (12:01 +0100)]
smbd: fix a resource leak in create_file_unixpath()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e636e20f90d4ee221ce6e20cab15a3cecb03850f)

2 years agosmbd: stat path before calling openat_pathref_fsp() in unlink_internals()
Ralph Boehme [Mon, 1 Feb 2021 11:00:35 +0000 (12:00 +0100)]
smbd: stat path before calling openat_pathref_fsp() in unlink_internals()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ab82dbc5ae43cdb661bf49627a84926163bc8998)

2 years agos3/libadouble: stat path before calling openat_pathref_fsp() in ad_unconvert_open_ad()
Ralph Boehme [Mon, 1 Feb 2021 10:59:37 +0000 (11:59 +0100)]
s3/libadouble: stat path before calling openat_pathref_fsp() in ad_unconvert_open_ad()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14730

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4f30c04462fb1536323606dd4216fe5e32458ba5)

2 years agoVERSION: Bump version up to 4.14.6...
Karolin Seeger [Mon, 31 May 2021 09:18:34 +0000 (11:18 +0200)]
VERSION: Bump version up to 4.14.6...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agoVERSION: Disable GIT_SNAPSHOT for the 4.14.5 release.
Karolin Seeger [Mon, 31 May 2021 09:17:22 +0000 (11:17 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.14.5 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agoWHATSNEW: Add release notes for Samba 4.14.5.
Karolin Seeger [Mon, 31 May 2021 09:07:52 +0000 (11:07 +0200)]
WHATSNEW: Add release notes for Samba 4.14.5.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agos3: smbd: Fix uninitialized memory read in process_symlink_open() when used with...
Jeremy Allison [Thu, 27 May 2021 05:41:53 +0000 (22:41 -0700)]
s3: smbd: Fix uninitialized memory read in process_symlink_open() when used with vfs_shadow_copy2().

Valgrind trace follows.

==3627798== Invalid read of size 1
==3627798==    at 0x483FF46: strlen (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3627798==    by 0x55DE412: strdup (strdup.c:41)
==3627798==    by 0x4F4657E: smb_xstrdup (util.c:660)
==3627798==    by 0x4C62C2E: vfs_ChDir (vfs.c:988)
==3627798==    by 0x4C4A51C: process_symlink_open (open.c:656)
==3627798==    by 0x4C4ADE7: non_widelink_open (open.c:862)
==3627798==    by 0x4C4AFB7: fd_openat (open.c:918)
==3627798==    by 0x4BBE895: openat_pathref_fsp (files.c:506)
==3627798==    by 0x4C48A00: filename_convert_internal (filename.c:2027)
==3627798==    by 0x4C48B77: filename_convert (filename.c:2067)
==3627798==    by 0x4C32408: call_trans2qfilepathinfo (trans2.c:6173)
==3627798==    by 0x4C3C5DA: handle_trans2 (trans2.c:10143)
==3627798==  Address 0xda8bc90 is 96 bytes inside a block of size 217 free'd
==3627798==    at 0x483DA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3627798==    by 0x4FCA3C9: _tc_free_internal (talloc.c:1222)
==3627798==    by 0x4FCA481: _talloc_free_internal (talloc.c:1248)
==3627798==    by 0x4FCB825: _talloc_free (talloc.c:1792)
==3627798==    by 0xDB248DD: store_cwd_data (vfs_shadow_copy2.c:1473)
==3627798==    by 0xDB24BEF: shadow_copy2_chdir (vfs_shadow_copy2.c:1542)
==3627798==    by 0x4C662A4: smb_vfs_call_chdir (vfs.c:2257)
==3627798==    by 0x4C62B48: vfs_ChDir (vfs.c:940)
==3627798==    by 0x4C4A51C: process_symlink_open (open.c:656)
==3627798==    by 0x4C4ADE7: non_widelink_open (open.c:862)
==3627798==    by 0x4C4AFB7: fd_openat (open.c:918)
==3627798==    by 0x4BBE895: openat_pathref_fsp (files.c:506)
==3627798==  Block was alloc'd at
==3627798==    at 0x483C7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3627798==    by 0x4FC9365: __talloc_with_prefix (talloc.c:783)
==3627798==    by 0x4FC94FF: __talloc (talloc.c:825)
==3627798==    by 0x4FCCFDC: __talloc_strlendup (talloc.c:2454)
==3627798==    by 0x4FCD096: talloc_strdup (talloc.c:2470)
==3627798==    by 0xDB24977: store_cwd_data (vfs_shadow_copy2.c:1476)
==3627798==    by 0xDB24BEF: shadow_copy2_chdir (vfs_shadow_copy2.c:1542)
==3627798==    by 0x4C662A4: smb_vfs_call_chdir (vfs.c:2257)
==3627798==    by 0x4C62B48: vfs_ChDir (vfs.c:940)
==3627798==    by 0x4C4A92D: non_widelink_open (open.c:755)
==3627798==    by 0x4C4AFB7: fd_openat (open.c:918)
==3627798==    by 0x4BBE895: openat_pathref_fsp (files.c:506)
==3627798==

Even though SMB_VFS_CONNECTPATH() returns a const char,
vfs_shadow_copy2() can free and reallocate this whilst
in use inside process_symlink_open().

Take a copy to make sure we don't reference free'd memory.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14721

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May 27 17:25:43 UTC 2021 on sn-devel-184

(cherry picked from commit 2f0cfe82907516ecf23cc385d41b8d29ed6b8c96)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Fri May 28 08:55:50 UTC 2021 on sn-devel-184

2 years agodocs: Update list of available commands in rpcclient
Pavel Filipenský [Wed, 19 May 2021 11:12:31 +0000 (13:12 +0200)]
docs: Update list of available commands in rpcclient

The list of available commands in rpcclient.1 manpage is updated to
match the current state, which is visible via help commnad of rpcclient.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14719

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 2d7740f65c69497de665043051228f6315de4f5c)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Wed May 26 12:45:16 UTC 2021 on sn-devel-184

2 years agos3:rpcclient: Document command of witness protocol
Pavel Filipenský [Wed, 19 May 2021 12:51:00 +0000 (14:51 +0200)]
s3:rpcclient: Document command of witness protocol

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14719

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 139cefceca20bd21ad557830f551eb51b343c660)

2 years agodocs-xml: Update smbcacls manpage
Pavel Filipenský [Wed, 19 May 2021 13:10:36 +0000 (15:10 +0200)]
docs-xml: Update smbcacls manpage

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14718

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 9d9ed421b26f733c59f9fac44e2034df704cef6a)

2 years agosmbd: correctly initialize close timestamp fields
Ralph Boehme [Mon, 24 May 2021 10:03:28 +0000 (12:03 +0200)]
smbd: correctly initialize close timestamp fields

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14714

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May 24 16:56:22 UTC 2021 on sn-devel-184

(cherry picked from commit f96cc29711181b5237a5b92c4bfb5e75fe2a73b9)

2 years agotorture: add a test that verifies SMB2 close fields without postqueryattrib
Ralph Boehme [Mon, 24 May 2021 10:21:38 +0000 (12:21 +0200)]
torture: add a test that verifies SMB2 close fields without postqueryattrib

The server must set all fields to 0 if postqueryattrib is not set.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14714

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ac9042ff4dc6c892764abd23a9445116ad40e62a)

2 years agoctdb: Fix a crash in run_proc_signal_handler()
Volker Lendecke [Tue, 18 May 2021 06:32:45 +0000 (08:32 +0200)]
ctdb: Fix a crash in run_proc_signal_handler()

If a script times out the caller can talloc_free() the script_list
output of run_event_recv, which talloc_free's proc->output from
run_proc.c as well. If the script generates further output after the
timeout and then exits after a while, the SIGCHLD handler in the
eventd tries to read into proc->output, which was already free'ed.

Fix this by not doing just a talloc_steal but a talloc_move. This way
proc_read_handler() called from run_proc_signal_handler() does not try
to realloc the stale reference to proc->output but gets a NULL
reference.

I don't really know how to do a knownfail in ctdb, so this commit
actually activates catching the signal by waiting long enough for
22.bar to exit and generate the SIGCHLD.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit adef87a621b17baf746d12f991c60a8a3ffcfcd3)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Tue May 25 09:51:20 UTC 2021 on sn-devel-184