vlendec/samba-autobuild/.git
4 years agolib/socket: autodetect RSS using ETHTOOL_GRXRINGS
Stefan Metzmacher [Thu, 7 May 2020 09:06:03 +0000 (11:06 +0200)]
lib/socket: autodetect RSS using ETHTOOL_GRXRINGS

This is also used as part of 'ethtool -n rdma14' and
'ethtool -x rdma14'.

;#> ethtool -n rdma14
8 RX rings available
rxclass: Cannot get RX class rule count: Operation not supported
RX classification rule retrieval failed

;#> ethtool -x rdma14
RX flow hash indirection table for rdma14 with 8 RX ring(s):
    0:      0     1     2     3     4     5     6     7
    8:      0     1     2     3     4     5     6     7
RSS hash key:
Operation not supported
RSS hash function:
    toeplitz: on
    xor: off
    crc32: off

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolib/socket: let query_iface_speed_from_name() initialize memory passed to syscalls
Stefan Metzmacher [Thu, 7 May 2020 09:06:03 +0000 (11:06 +0200)]
lib/socket: let query_iface_speed_from_name() initialize memory passed to syscalls

I'm not sure if struct initializers would take care of padding,
so I use ZERO_STRUCT().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolib:util: Fix smbclient -l basename dir
Amit Kumar [Wed, 22 Apr 2020 11:53:42 +0000 (06:53 -0500)]
lib:util: Fix smbclient -l basename dir

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

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Amit Kumar <amitkuma@redhat.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu May  7 10:38:29 UTC 2020 on sn-devel-184

4 years agoAdd a test for smbclient -l basename
Amit Kumar [Wed, 22 Apr 2020 11:53:33 +0000 (06:53 -0500)]
Add a test for smbclient -l basename

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

Signed-off-by: Amit Kumar <amitkuma@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agolib util asn1: modernize debug calls
Gary Lockyer [Tue, 5 May 2020 21:11:55 +0000 (09:11 +1200)]
lib util asn1: modernize debug calls

Replace DEBUG(0 with DBG_ERR(

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed May  6 22:53:02 UTC 2020 on sn-devel-184

4 years agos4 ldap_server: modernize debug calls
Gary Lockyer [Tue, 5 May 2020 21:10:32 +0000 (09:10 +1200)]
s4 ldap_server: modernize debug calls

Replace DEBUG(0 with DBG_ERR(

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agotest: Make local.event.*.fd1 a bit less flapping
Volker Lendecke [Tue, 5 May 2020 13:07:49 +0000 (15:07 +0200)]
test: Make local.event.*.fd1 a bit less flapping

One millisecond seems not enough on slow machines, make the timeout 10 msec

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May  6 11:58:42 UTC 2020 on sn-devel-184

4 years agovfs_shadow_copy2: implement case canonicalisation in shadow_copy2_get_real_filename()
Ralph Boehme [Tue, 5 May 2020 08:13:00 +0000 (10:13 +0200)]
vfs_shadow_copy2: implement case canonicalisation in shadow_copy2_get_real_filename()

unix_convert() can't do this for us in snapdirseverywhere mode, so we do it
ourselves.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: make get_real_filename_full_scan() public
Ralph Boehme [Thu, 23 Apr 2020 14:09:16 +0000 (16:09 +0200)]
smbd: make get_real_filename_full_scan() public

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoCI: add two tests for shadow_copy2 VFS module
Ralph Boehme [Tue, 21 Apr 2020 11:06:03 +0000 (13:06 +0200)]
CI: add two tests for shadow_copy2 VFS module

Note that the test "fetch a previous version of a regular file via non-canonical
basepath" doesn't fail by "luck" because it runs into the "creating file"
optimisation in unix_convert().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_shadow_copy2: log caller location in shadow_copy2_strip_snapshot()
Ralph Boehme [Tue, 5 May 2020 08:09:01 +0000 (10:09 +0200)]
vfs_shadow_copy2: log caller location in shadow_copy2_strip_snapshot()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoctdb-build: Add messages_dgm build to ctdb
Amitay Isaacs [Fri, 28 Jun 2019 13:10:38 +0000 (23:10 +1000)]
ctdb-build: Add messages_dgm build to ctdb

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed May  6 01:47:16 UTC 2020 on sn-devel-184

4 years agolib/util: Build genrand for util core
Amitay Isaacs [Fri, 28 Jun 2019 13:07:34 +0000 (23:07 +1000)]
lib/util: Build genrand for util core

messages_dgm depends on genrand.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agowscript_build: Remove duplicate recursion in source4/smbd
Amitay Isaacs [Mon, 4 May 2020 06:32:38 +0000 (16:32 +1000)]
wscript_build: Remove duplicate recursion in source4/smbd

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agolib/messaging: Move messages_dgm out of source3
Amitay Isaacs [Fri, 28 Jun 2019 13:05:43 +0000 (23:05 +1000)]
lib/messaging: Move messages_dgm out of source3

... so CTDB can also use it.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agoRevert "smbd: fullpath based on fsp->fsp_name may contain an @GMT token"
Jeremy Allison [Tue, 5 May 2020 17:28:08 +0000 (10:28 -0700)]
Revert "smbd: fullpath based on fsp->fsp_name may contain an @GMT token"

This reverts commit e593c38f5a8602be497a29e145ccdd4f9cc595e7.

As stated in the original commit message, "When canonicalize_snapshot_path()
starts actually stripping off @GMT tokens, we can remove this again."

canonicalize_snapshot_path() now strips off @GMT tokens from
any SMB1 names, so this is now not needed anymore.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue May  5 20:55:42 UTC 2020 on sn-devel-184

4 years agos3: torture: Add samba3.blackbox.NT1.shadow_copy_torture.
Jeremy Allison [Tue, 5 May 2020 00:57:29 +0000 (17:57 -0700)]
s3: torture: Add samba3.blackbox.NT1.shadow_copy_torture.

Runs the SMB1 root @GMT-pathname open test.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos4: torture: Add an SMB1-specific open root of share with @GMT-path test - base.smb1...
Jeremy Allison [Tue, 5 May 2020 00:56:46 +0000 (17:56 -0700)]
s4: torture: Add an SMB1-specific open root of share with @GMT-path test - base.smb1-twrp-openroot

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: torture: Add call to smbtorture smb2.twrp.openroot
Jeremy Allison [Tue, 5 May 2020 00:08:30 +0000 (17:08 -0700)]
s3: torture: Add call to smbtorture smb2.twrp.openroot

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos4: torture: Add smb2.twrp.openroot test.
Jeremy Allison [Tue, 5 May 2020 00:07:40 +0000 (17:07 -0700)]
s4: torture: Add smb2.twrp.openroot test.

Opens the root of a share over SMB2 with a zero-length
filename and a timewarp token.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Move the initialization of the filename and the call to canonicalize_snapsh...
Jeremy Allison [Tue, 5 May 2020 02:29:17 +0000 (19:29 -0700)]
s3: smbd: Move the initialization of the filename and the call to canonicalize_snapshot_path() *before* zero-length string checks.

canonicalize_snapshot_path() may eat the incoming pathname in total
for SMB1, so we need to check after that call.

Fix the zero-length string check to look at state->smb_fname->base_name
instead of state->orig_path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Update description of canonicalize_snapshot_path().
Jeremy Allison [Mon, 4 May 2020 19:53:21 +0000 (12:53 -0700)]
smbd: Update description of canonicalize_snapshot_path().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs_snapper: remove @GMT token stripping from snapper_gmt_strip_snapshot()
Ralph Boehme [Mon, 4 May 2020 08:37:22 +0000 (10:37 +0200)]
vfs_snapper: remove @GMT token stripping from snapper_gmt_strip_snapshot()

Leaving the exercize of removing the now unneeded stripped logic to a future
patchset.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: remove @GMT token stripping from ceph_snap_gmt_strip_snapshot()
Ralph Boehme [Mon, 4 May 2020 08:21:41 +0000 (10:21 +0200)]
vfs_ceph_snapshots: remove @GMT token stripping from ceph_snap_gmt_strip_snapshot()

Leaving the exercize of removing the now unneeded stripped logic to a future
patchset.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: fix return value of ceph_snap_gmt_strip_snapshot()
Ralph Boehme [Mon, 4 May 2020 08:19:35 +0000 (10:19 +0200)]
vfs_ceph_snapshots: fix return value of ceph_snap_gmt_strip_snapshot()

The function returns ints and the callers expect ints. Declaring bool while
returning ints works, as generally compilers implement bools as ints.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove processing of @GMT tokens from the SMB2 server
Ralph Boehme [Sun, 3 May 2020 17:07:08 +0000 (19:07 +0200)]
smbd: remove processing of @GMT tokens from the SMB2 server

Setting this flag was a hokey hack to trigger @GMT token processing in
filename_convert(). Now that all internal processing is based on struct
smb_filename.NTTIME twrp, we can remove this hack.

With this change, paths containing @GMT tokens received over SMB2 are
subsequently processed unchanged, the @GMT token is not stripped and will hit
the filesystem, mostly resulting in NT_STATUS_NOT_FOUND failures which is the
same behaviour as Windows.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass ucf_flags to canonicalize_snapshot_path()
Ralph Boehme [Mon, 4 May 2020 11:51:37 +0000 (13:51 +0200)]
smbd: pass ucf_flags to canonicalize_snapshot_path()

No change in behaviour. ucf_flags are just now checked *inside*
canonicalize_snapshot_path() instead of the caller.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: strip @GMT token in canonicalize_snapshot_path()
Ralph Boehme [Thu, 30 Apr 2020 13:24:44 +0000 (15:24 +0200)]
smbd: strip @GMT token in canonicalize_snapshot_path()

smbd and all previous-versions implementing VFS modules have been patched to
work with struct smb_filename.NTTIME twrp, so we can now safely strip @GMT
tokens from paths.

This also means that "@GMT-something/foo" and "foo" will both come out as "foo",
so we have to take care of the stat-cache now and change it to take and use an
additional twrp arg.

At the same time remove @GMT stripping from shadow_copy2. In theory this could
be made a seperate commit, but due to the absolute path and pstripped logic, it
felt too cumbersome to attempt this.

Leaving the exercize of removing the now unneeded stripped logic to a future
patchset.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass translated_path as const to stat_cache_add()
Ralph Boehme [Tue, 5 May 2020 11:03:29 +0000 (13:03 +0200)]
smbd: pass translated_path as const to stat_cache_add()

Prepares for doing more stuff with the translated_path in a subsequent commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign stat_cache_add() args in unix_convert()
Ralph Boehme [Tue, 5 May 2020 11:00:00 +0000 (13:00 +0200)]
smbd: realign stat_cache_add() args in unix_convert()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realigning a complex if expression in unix_convert()
Ralph Boehme [Tue, 5 May 2020 09:13:47 +0000 (11:13 +0200)]
smbd: realigning a complex if expression in unix_convert()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: use struct smb_filename.twrp instead of @GMT string token
Ralph Boehme [Sat, 2 May 2020 09:45:11 +0000 (11:45 +0200)]
vfs_ceph_snapshots: use struct smb_filename.twrp instead of @GMT string token

@GMT tokens are still validated and stripped, but the previous version timestamp
is taken from the struct smb_filename twrp member.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: pass struct smb_filename to ceph_snap_gmt_strip_snapshot()
Ralph Boehme [Sat, 2 May 2020 09:39:58 +0000 (11:39 +0200)]
vfs_ceph_snapshots: pass struct smb_filename to ceph_snap_gmt_strip_snapshot()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_snapper: use struct smb_filename.twrp instead of @GMT string token
Ralph Boehme [Sat, 2 May 2020 09:45:11 +0000 (11:45 +0200)]
vfs_snapper: use struct smb_filename.twrp instead of @GMT string token

@GMT tokens are still validated and stripped, but the previous version timestamp
is taken from the struct smb_filename twrp member.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_snapper: pass struct smb_filename to snapper_gmt_strip_snapshot()
Ralph Boehme [Sat, 2 May 2020 09:39:58 +0000 (11:39 +0200)]
vfs_snapper: pass struct smb_filename to snapper_gmt_strip_snapshot()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_shadow_copy2: use struct smb_filename.twrp instead of @GMT string token
Ralph Boehme [Sat, 2 May 2020 10:10:38 +0000 (12:10 +0200)]
vfs_shadow_copy2: use struct smb_filename.twrp instead of @GMT string token

Removes the asserts which were only needed to prove patchset correctness.

If smb_fname->twrp is zero, the path won't contain an @GMT token, so we can skip
the stripping logic and directly goto out.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_shadow_copy2: use smb_fname->twrp in shadow_copy2_strip_snapshot_internal()
Ralph Boehme [Fri, 1 May 2020 14:36:09 +0000 (16:36 +0200)]
vfs_shadow_copy2: use smb_fname->twrp in shadow_copy2_strip_snapshot_internal()

Use smb_fname->twrp instead if the @GMT token and assert both the twrp value and
the converted @GMT string token have the same value.

With this commit passing CI (which it did), we can somewhat safely assume that
anything that calls into the VFS stack is correctly passing struct
smb_filename.twrp from unix_convert() to the VFS without loosing the twrp value
in one of the myriad places where we copy the original struct smb_filename value
one way or another.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_shadow_copy2: pass orig_name as struct smb_filename to shadow_copy2_strip_snapshot()
Ralph Boehme [Thu, 30 Apr 2020 15:28:16 +0000 (17:28 +0200)]
vfs_shadow_copy2: pass orig_name as struct smb_filename to shadow_copy2_strip_snapshot()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: set twrp in target_fname in target_fname()
Ralph Boehme [Sat, 2 May 2020 08:30:24 +0000 (10:30 +0200)]
smbd: set twrp in target_fname in target_fname()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: set twrp in smb_fname in fruit_fstat_meta_stream()
Ralph Boehme [Sat, 2 May 2020 08:28:44 +0000 (10:28 +0200)]
vfs_fruit: set twrp in smb_fname in fruit_fstat_meta_stream()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: set twrp in smb_fname in vfswrap_get_dos_attributes_getxattr_done()
Ralph Boehme [Sat, 2 May 2020 08:28:00 +0000 (10:28 +0200)]
vfs_default: set twrp in smb_fname in vfswrap_get_dos_attributes_getxattr_done()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign target_fname initialisation in process_symlink_open()
Ralph Boehme [Sat, 2 May 2020 08:27:04 +0000 (10:27 +0200)]
smbd: realign target_fname initialisation in process_symlink_open()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: set twrp in vfs_stat_smb_basename()
Ralph Boehme [Sat, 2 May 2020 06:10:36 +0000 (08:10 +0200)]
smbd: set twrp in vfs_stat_smb_basename()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: move a DEBUG in unix_convert()
Ralph Boehme [Sat, 2 May 2020 06:09:24 +0000 (08:09 +0200)]
smbd: move a DEBUG in unix_convert()

Ensure a successfull conversion via early exit also logs a message.

While at it, use smb_fname_str_dbg() to print the string which ensure any stream
component or twrp value is also printed.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: initialize twrp in smb_fname in smbd_dirptr_get_entry()
Ralph Boehme [Fri, 1 May 2020 15:08:37 +0000 (17:08 +0200)]
smbd: initialize twrp in smb_fname in smbd_dirptr_get_entry()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign smb_fname member initialisation in smbd_dirptr_get_entry()
Ralph Boehme [Fri, 1 May 2020 15:06:26 +0000 (17:06 +0200)]
smbd: realign smb_fname member initialisation in smbd_dirptr_get_entry()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: set twrp in dptr_ReadDirName()
Ralph Boehme [Fri, 1 May 2020 15:05:48 +0000 (17:05 +0200)]
smbd: set twrp in dptr_ReadDirName()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign smb_fname_base initialisation in dptr_ReadDirName()
Ralph Boehme [Fri, 1 May 2020 14:55:58 +0000 (16:55 +0200)]
smbd: realign smb_fname_base initialisation in dptr_ReadDirName()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: fullpath based on fsp->fsp_name may contain an @GMT token
Ralph Boehme [Fri, 1 May 2020 14:38:04 +0000 (16:38 +0200)]
smbd: fullpath based on fsp->fsp_name may contain an @GMT token

This ensure unix_convert() calls canonicalize_snapshot_path() on the path to
process the @GMT token, so smb_fname->twrp is filled in with the converted time
value of the @GMT token.

When canonicalize_snapshot_path() starts actually stripping off @GMT tokens, we
can remove this again.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: use cp_smb_filename_nostream() in vfswrap_streaminfo()
Ralph Boehme [Fri, 1 May 2020 14:30:57 +0000 (16:30 +0200)]
vfs_default: use cp_smb_filename_nostream() in vfswrap_streaminfo()

Ensure twrp field and whatever else may be added in the future is correctly
copied over to smb_fname_cp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: print twrp in smb_fname_str_dbg()
Ralph Boehme [Fri, 1 May 2020 14:30:28 +0000 (16:30 +0200)]
smbd: print twrp in smb_fname_str_dbg()

This looses precision by going from NTTIME to time_t, but GMT_FORMAT only has
seconds granularity anyway and @GMT token as defined by MS-SMB2 as well.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: vfs: convert link_contents arg of SMB_VFS_SYMLINKAT() to struct smb_filename
Ralph Boehme [Thu, 30 Apr 2020 17:30:50 +0000 (19:30 +0200)]
smbd: vfs: convert link_contents arg of SMB_VFS_SYMLINKAT() to struct smb_filename

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: call canonicalize_snapshot_path() on link target paths from client
Ralph Boehme [Thu, 30 Apr 2020 15:46:31 +0000 (17:46 +0200)]
smbd: call canonicalize_snapshot_path() on link target paths from client

Prepares for having canonicalize_snapshot_path() strip any @GMT token from link
targets. In the future VFS modules won't be doing @GMT token stripping, so we
have to do it here.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: make canonicalize_snapshot_path() public
Ralph Boehme [Sat, 2 May 2020 10:55:33 +0000 (12:55 +0200)]
smbd: make canonicalize_snapshot_path() public

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: convert SMB_VFS_GET_REAL_FILENAME() arg path to be a struct smb_filename
Ralph Boehme [Thu, 30 Apr 2020 14:40:28 +0000 (16:40 +0200)]
smbd: convert SMB_VFS_GET_REAL_FILENAME() arg path to be a struct smb_filename

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/vfs: change VFS interface comment to be a single multi-line comment
Ralph Boehme [Mon, 4 May 2020 08:56:21 +0000 (10:56 +0200)]
s3/vfs: change VFS interface comment to be a single multi-line comment

Looks much better imho. :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_glusterfs: realign vfs_gluster_get_real_filename() args
Ralph Boehme [Thu, 30 Apr 2020 14:28:55 +0000 (16:28 +0200)]
vfs_glusterfs: realign vfs_gluster_get_real_filename() args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign smb_vfs_call_get_real_filename() args
Ralph Boehme [Thu, 30 Apr 2020 14:26:48 +0000 (16:26 +0200)]
smbd: realign smb_vfs_call_get_real_filename() args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass struct smb_filename to get_real_filename()
Ralph Boehme [Thu, 30 Apr 2020 14:22:19 +0000 (16:22 +0200)]
smbd: pass struct smb_filename to get_real_filename()

Prepares for passing struct smb_filename to SMB_VFS_GET_REAL_FILENAME().

This also makes it necessary to move the NULL or empty path checks to
unix_convert_step_stat().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign args of get_real_filename() and friends
Ralph Boehme [Thu, 30 Apr 2020 15:20:49 +0000 (17:20 +0200)]
smbd: realign args of get_real_filename() and friends

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass twrp as NTTIME to filename_convert() and all the way down to canonicalize_...
Ralph Boehme [Thu, 30 Apr 2020 14:04:54 +0000 (16:04 +0200)]
smbd: pass twrp as NTTIME to filename_convert() and all the way down to canonicalize_snapshot_path()

Also pass by value rather then by reference.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: let canonicalize_snapshot_path() fill in struct smb_filename.twrp
Ralph Boehme [Thu, 30 Apr 2020 13:17:11 +0000 (15:17 +0200)]
smbd: let canonicalize_snapshot_path() fill in struct smb_filename.twrp

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: move time_t twrp to @GMT string token conversion to canonicalize_snapshot_path()
Ralph Boehme [Thu, 30 Apr 2020 13:14:36 +0000 (15:14 +0200)]
smbd: move time_t twrp to @GMT string token conversion to canonicalize_snapshot_path()

Prepares for canonicalize_snapshot_path() being the one-stop shop for
previous-versions related stuff in subsequent commits.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: refactor canonicalize_snapshot_path()
Ralph Boehme [Thu, 30 Apr 2020 12:13:44 +0000 (14:13 +0200)]
smbd: refactor canonicalize_snapshot_path()

This prepares for adding additional code after calling rearrange_snapshot_path().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add twrp arg to synthetic_smb_fname()
Ralph Boehme [Thu, 30 Apr 2020 09:48:32 +0000 (11:48 +0200)]
smbd: add twrp arg to synthetic_smb_fname()

Most places take twrp from a local struct smb_filename variable that the
function is working on. Some don't for various reasons:

o synthetic_smb_fname_split() is only called in very few places where we don't
  expect twrp paths

o implementations of SMB_VFS_GETWD(), SMB_VFS_FS_CAPABILITIES() and
  SMB_VFS_REALPATH() return the systems view of cwd and realpath without twrp info

o VFS modules implementing previous-versions support (vfs_ceph_snapshots,
  vfs_shadow_copy2, vfs_snapper) synthesize raw paths that are passed to VFS NEXT
  functions and therefor do not use twrp

o vfs_fruit: macOS doesn't support VSS

o vfs_recycle: in recycle_create_dir() we need a raw OS path to create a directory

o vfs_virusfilter: a few places where we need raw OS paths

o vfs_xattr_tdb: needs a raw OS path for SMB_VFS_NEXT_STAT()

o printing and rpc server: don't support VSS

o vfs_default_durable_reconnect: no Durable Handles on VSS handles, this might
  be enhances in the future. No idea if Windows supports this.

o get_real_filename_full_scan: hm.... FIXME??

o get_original_lcomp: working on a raw path

o msdfs: doesn't support VSS

o vfs_get_ntquota: synthesizes an smb_filename from ".", so doesn't support VSS
  even though VFS modules implement it

o fd_open: conn_rootdir_fname is a raw path

o msg_file_was_renamed: obvious

o open_np_file: pipes don't support VSS

o Python bindings: get's a raw path from the caller

o set_conn_connectpath: raw path

o set_conn_connectpath: raw path

o torture: gets raw paths from the caller

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonet: vfs: realign synthetic_smb_fname() args in net_vfs_get_ntacl()
Ralph Boehme [Sun, 3 May 2020 13:09:15 +0000 (15:09 +0200)]
net: vfs: realign synthetic_smb_fname() args in net_vfs_get_ntacl()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign synthetic_smb_fname() args in vfs_GetWd()
Ralph Boehme [Sun, 3 May 2020 13:08:59 +0000 (15:08 +0200)]
smbd: realign synthetic_smb_fname() args in vfs_GetWd()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign synthetic_smb_fname() args in smbd_dirptr_lanman2_entry()
Ralph Boehme [Sun, 3 May 2020 13:08:36 +0000 (15:08 +0200)]
smbd: realign synthetic_smb_fname() args in smbd_dirptr_lanman2_entry()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign synthetic_smb_fname() args in open_np_file()
Ralph Boehme [Sun, 3 May 2020 13:08:20 +0000 (15:08 +0200)]
smbd: realign synthetic_smb_fname() args in open_np_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign synthetic_smb_fname() args in msg_file_was_renamed()
Ralph Boehme [Sun, 3 May 2020 13:08:03 +0000 (15:08 +0200)]
smbd: realign synthetic_smb_fname() args in msg_file_was_renamed()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign synthetic_smb_fname() args in file_new()
Ralph Boehme [Sun, 3 May 2020 13:07:45 +0000 (15:07 +0200)]
smbd: realign synthetic_smb_fname() args in file_new()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/rpc_server: fss: realign synthetic_smb_fname() args in snap_path_exists()
Ralph Boehme [Sun, 3 May 2020 13:07:05 +0000 (15:07 +0200)]
s3/rpc_server: fss: realign synthetic_smb_fname() args in snap_path_exists()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/printing: realign synthetic_smb_fname() args in print_spool_open()
Ralph Boehme [Sun, 3 May 2020 13:06:51 +0000 (15:06 +0200)]
s3/printing: realign synthetic_smb_fname() args in print_spool_open()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/printing: realign synthetic_smb_fname() args in driver_unlink_internals()
Ralph Boehme [Sun, 3 May 2020 13:06:32 +0000 (15:06 +0200)]
s3/printing: realign synthetic_smb_fname() args in driver_unlink_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_xattr_tdb: realign synthetic_smb_fname() args in xattr_tdb_get_file_id()
Ralph Boehme [Sun, 3 May 2020 13:06:12 +0000 (15:06 +0200)]
vfs_xattr_tdb: realign synthetic_smb_fname() args in xattr_tdb_get_file_id()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_virusfilter: realign synthetic_smb_fname() args in infected_file_action_quarantine()
Ralph Boehme [Sun, 3 May 2020 13:05:46 +0000 (15:05 +0200)]
vfs_virusfilter: realign synthetic_smb_fname() args in infected_file_action_quarantine()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_virusfilter: realign synthetic_smb_fname() args in quarantine_create_dir()
Ralph Boehme [Sun, 3 May 2020 13:05:25 +0000 (15:05 +0200)]
vfs_virusfilter: realign synthetic_smb_fname() args in quarantine_create_dir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_gpfs: realign synthetic_smb_fname() args in gpfsacl_emu_chmod()
Ralph Boehme [Sun, 3 May 2020 13:04:58 +0000 (15:04 +0200)]
vfs_gpfs: realign synthetic_smb_fname() args in gpfsacl_emu_chmod()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_glusterfs: realign synthetic_smb_fname() args in vfs_gluster_realpath()
Ralph Boehme [Sun, 3 May 2020 13:04:36 +0000 (15:04 +0200)]
vfs_glusterfs: realign synthetic_smb_fname() args in vfs_gluster_realpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: realign synthetic_smb_fname() args in fruit_get_bandsize()
Ralph Boehme [Sun, 3 May 2020 13:04:14 +0000 (15:04 +0200)]
vfs_fruit: realign synthetic_smb_fname() args in fruit_get_bandsize()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: realign synthetic_smb_fname() args in delete_invalid_meta_stream()
Ralph Boehme [Sun, 3 May 2020 13:03:42 +0000 (15:03 +0200)]
vfs_fruit: realign synthetic_smb_fname() args in delete_invalid_meta_stream()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: realign synthetic_smb_fname() args in vfswrap_realpath()
Ralph Boehme [Sun, 3 May 2020 13:03:22 +0000 (15:03 +0200)]
vfs_fruit: realign synthetic_smb_fname() args in vfswrap_realpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: realign synthetic_smb_fname() args in vfswrap_realpath()
Ralph Boehme [Sun, 3 May 2020 13:03:01 +0000 (15:03 +0200)]
vfs_fruit: realign synthetic_smb_fname() args in vfswrap_realpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: realign synthetic_smb_fname() args in vfswrap_realpath()
Ralph Boehme [Sun, 3 May 2020 13:02:38 +0000 (15:02 +0200)]
vfs_default: realign synthetic_smb_fname() args in vfswrap_realpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: realign synthetic_smb_fname() args in vfswrap_fs_capabilities()
Ralph Boehme [Sun, 3 May 2020 13:01:54 +0000 (15:01 +0200)]
vfs_default: realign synthetic_smb_fname() args in vfswrap_fs_capabilities()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: realign synthetic_smb_fname() args in ceph_snap_gmt_convert_dir()
Ralph Boehme [Sun, 3 May 2020 06:33:51 +0000 (08:33 +0200)]
vfs_ceph_snapshots: realign synthetic_smb_fname() args in ceph_snap_gmt_convert_dir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: realign synthetic_smb_fname() args in ceph_snap_fill_label()
Ralph Boehme [Sun, 3 May 2020 06:32:53 +0000 (08:32 +0200)]
vfs_ceph_snapshots: realign synthetic_smb_fname() args in ceph_snap_fill_label()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_catia: realign synthetic_smb_fname() args in catia_readdir_attr()
Ralph Boehme [Sun, 3 May 2020 06:28:14 +0000 (08:28 +0200)]
vfs_catia: realign synthetic_smb_fname() args in catia_readdir_attr()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/lib: realign synthetic_smb_fname() args in synthetic_smb_fname_split()
Ralph Boehme [Sun, 3 May 2020 06:26:47 +0000 (08:26 +0200)]
s3/lib: realign synthetic_smb_fname() args in synthetic_smb_fname_split()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign synthetic_smb_fname() args in check_reduced_name_with_privilege()
Ralph Boehme [Thu, 30 Apr 2020 10:05:43 +0000 (12:05 +0200)]
smbd: realign synthetic_smb_fname() args in check_reduced_name_with_privilege()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: realign args calling synthetic_smb_fname() in change_dir_owner_to_parent()
Ralph Boehme [Thu, 30 Apr 2020 10:01:44 +0000 (12:01 +0200)]
smbd: realign args calling synthetic_smb_fname() in change_dir_owner_to_parent()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_vxfs: pass name as struct smb_filename to vxfs_compare()
Ralph Boehme [Thu, 30 Apr 2020 09:51:15 +0000 (11:51 +0200)]
vfs_vxfs: pass name as struct smb_filename to vxfs_compare()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_vxfs: realign vxfs_compare() args to one per line
Ralph Boehme [Thu, 30 Apr 2020 09:48:41 +0000 (11:48 +0200)]
vfs_vxfs: realign vxfs_compare() args to one per line

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_depot: realign synthetic_smb_fname() to one arg per line
Ralph Boehme [Thu, 30 Apr 2020 09:44:15 +0000 (11:44 +0200)]
vfs_streams_depot: realign synthetic_smb_fname() to one arg per line

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_depot: pass dirname to walk_streams()/collect_one_stream() as struct...
Ralph Boehme [Thu, 30 Apr 2020 09:42:50 +0000 (11:42 +0200)]
vfs_streams_depot: pass dirname to walk_streams()/collect_one_stream() as struct smb_filename

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_gpfs: pass smb_fname to gpfsacl_emu_chmod()
Ralph Boehme [Thu, 30 Apr 2020 09:28:57 +0000 (11:28 +0200)]
vfs_gpfs: pass smb_fname to gpfsacl_emu_chmod()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Protect cli_oem_change_password() from rprcnt<2
Volker Lendecke [Sat, 2 May 2020 13:18:07 +0000 (15:18 +0200)]
libsmb: Protect cli_oem_change_password() from rprcnt<2

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14362
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue May  5 17:12:04 UTC 2020 on sn-devel-184

4 years agolibsmb: Protect cli_RNetServerEnum against rprcnt<6
Volker Lendecke [Sat, 2 May 2020 13:10:14 +0000 (15:10 +0200)]
libsmb: Protect cli_RNetServerEnum against rprcnt<6

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14362
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolibsmb: Protect cli_RNetShareEnum() against rprcnt<6
Volker Lendecke [Sat, 2 May 2020 12:59:07 +0000 (14:59 +0200)]
libsmb: Protect cli_RNetShareEnum() against rprcnt<6

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14362
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolibsmb: Fix indentation in cli_RNetShareEnum()
Volker Lendecke [Sat, 2 May 2020 12:54:01 +0000 (14:54 +0200)]
libsmb: Fix indentation in cli_RNetShareEnum()

Also remove a level of indentation with a "goto done;"

Best review with "git show -b", almost no code change

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14362
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>