1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

55033 Commits

Author SHA1 Message Date
Amitay Isaacs
93408f60cb 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>
2020-05-06 00:06:40 +00:00
Jeremy Allison
8d22b9edff 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
2020-05-05 20:55:41 +00:00
Jeremy Allison
35be625b09 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>
2020-05-05 19:18:44 +00:00
Jeremy Allison
c3377b4c02 s3: torture: Add call to smbtorture smb2.twrp.openroot
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 19:18:43 +00:00
Jeremy Allison
2992891e27 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>
2020-05-05 19:18:43 +00:00
Jeremy Allison
8019b3d0af smbd: Update description of canonicalize_snapshot_path().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 19:18:43 +00:00
Ralph Boehme
773b98c11e 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>
2020-05-05 19:18:43 +00:00
Ralph Boehme
2dd21e650c 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>
2020-05-05 19:18:43 +00:00
Ralph Boehme
3a52e3f0f8 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>
2020-05-05 19:18:43 +00:00
Ralph Boehme
55877f958a 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>
2020-05-05 19:18:43 +00:00
Ralph Boehme
f689f3cb22 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>
2020-05-05 19:18:43 +00:00
Ralph Boehme
6e364c5453 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>
2020-05-05 19:18:43 +00:00
Ralph Boehme
28763125cf 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>
2020-05-05 19:18:43 +00:00
Ralph Boehme
1130c64f49 smbd: realign stat_cache_add() args in unix_convert()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:43 +00:00
Ralph Boehme
6e8ffcff46 smbd: realigning a complex if expression in unix_convert()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:42 +00:00
Ralph Boehme
8632f7eaba 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
1eb0cb078d 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
a2e800d835 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
6cefa15bf1 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
3515ab6c3d 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
9fb491797e 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
40e7750b4d 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
89eb4c0225 smbd: set twrp in target_fname in target_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:42 +00:00
Ralph Boehme
c289f58b8c 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
872b0919e1 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
671319bcb4 smbd: realign target_fname initialisation in process_symlink_open()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:42 +00:00
Ralph Boehme
31b5a369f7 smbd: set twrp in vfs_stat_smb_basename()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:42 +00:00
Ralph Boehme
d912999394 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>
2020-05-05 19:18:42 +00:00
Ralph Boehme
386574f2c9 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
d66de7d568 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
3073586fd8 smbd: set twrp in dptr_ReadDirName()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:41 +00:00
Ralph Boehme
e9a6552da3 smbd: realign smb_fname_base initialisation in dptr_ReadDirName()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:41 +00:00
Ralph Boehme
64a3a31861 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
f109be3cac 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
b6b0c3d1ec 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
26ca22fa14 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
7fca428cfb 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
96921b6f5b smbd: make canonicalize_snapshot_path() public
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:41 +00:00
Ralph Boehme
f9c6706080 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
0c61b2658b 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>
2020-05-05 19:18:41 +00:00
Ralph Boehme
af1af901e7 vfs_glusterfs: realign vfs_gluster_get_real_filename() args
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:41 +00:00
Ralph Boehme
9b78da9e32 smbd: realign smb_vfs_call_get_real_filename() args
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:40 +00:00
Ralph Boehme
82daff3efd 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
09b841aa1c smbd: realign args of get_real_filename() and friends
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:40 +00:00
Ralph Boehme
1e5164afaf 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
8a8fe887f5 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
f8bb2f59e1 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
69458cc22a 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
b74653f2cd 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
ab3152bf22 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
8bf629a0f3 smbd: realign synthetic_smb_fname() args in vfs_GetWd()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:40 +00:00
Ralph Boehme
ed27194363 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
730f6d597e 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>
2020-05-05 19:18:40 +00:00
Ralph Boehme
15f438dd22 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
b102ab4f41 smbd: realign synthetic_smb_fname() args in file_new()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:39 +00:00
Ralph Boehme
b9af0ecb3a 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
917b8a47ec 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
7cca2c1528 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
4381def0b7 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
bdaa6cae82 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
e78acc76e8 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
64f4981b7d 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
b09881207a 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
f7bf27cbf4 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
2a658c5461 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
f2b9f24605 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>
2020-05-05 19:18:39 +00:00
Ralph Boehme
f1ed7687da 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
2f10c390fb 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
f0a4d8c785 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
3892c5b0d5 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
edf2cde070 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
b6452b4a71 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
0692c3e9db 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
3f15b66f87 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
7c10d078eb 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
abc16fafd9 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
fdbb90a8e1 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
c893b9cd90 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
5732a260a3 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>
2020-05-05 19:18:38 +00:00
Ralph Boehme
2d02da5d83 vfs_gpfs: pass smb_fname to gpfsacl_emu_chmod()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05 19:18:38 +00:00
Volker Lendecke
f80c97cb8d 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
2020-05-05 17:12:04 +00:00
Volker Lendecke
ce8b70df7b 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>
2020-05-05 15:35:35 +00:00
Volker Lendecke
4a9fe4efef 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>
2020-05-05 15:35:35 +00:00
Volker Lendecke
ae91d67a24 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>
2020-05-05 15:35:35 +00:00
Volker Lendecke
1be128eeed smbd: Make share_mode_for_one_entry() use just a uint8*
"num_share_modes" is passed separately, so "data.dsize" was not used

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): Tue May  5 13:23:49 UTC 2020 on sn-devel-184
2020-05-05 13:23:49 +00:00
Volker Lendecke
733ae9cd95 smbd: Make share_mode_do_locked() use a const uint8_t *
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:40 +00:00
Volker Lendecke
14cc4a6576 smbd: Make parse_share_modes() use a const ptr
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:40 +00:00
Volker Lendecke
b2dfd4cc53 smbd: Make share_mode_memcache_fetch() use a const ptr
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:40 +00:00
Volker Lendecke
955b3c3de9 smbd: Convert get_share_mode_blob_header() to use a const ptr
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:40 +00:00
Volker Lendecke
7905afcd77 smbd: Make share_mode_entry_find() take a const pointer
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
6d3399906f smbd: Make sure share_mode_entry_do() maintains sorting order
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
7c3cce9888 smbd: Simplify reset_share_mode_entry()
This has more lines, but it's a lot simpler: reset_share_mode_entry is
only called during durable reconnect, which only works with a single
share mode entry. See durable_reconnect_fn(). Thus we don't have to
keep the share mode array sorted, there is just a single entry.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
7cd687fd05 smbd: Simplify share_mode_entry_get()
If we don't use a DATA_BLOB, we can more correctly state in the
prototype that the buffer we parse is constant.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
2e3be1394c libsmb: Add a NULL check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
157554f3d8 libsmb: Align integer types in net_share_enum_rpc()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
3d2abb6772 libsmb: Use talloc_strndup() to cut a backslash
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
2d6448a3df libsmb: Add a NULL check after talloc_strdup()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
1226f43549 lib: Move push_skip_string() to clirap2.c
It's only used there

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
909c82fe03 net: Add g_lock dumpall
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
50a1e995cb net: "net g_lock locks" needs to print binary keys
In 2017 g_lock changed to take TDB_DATA as a key

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:39 +00:00
Volker Lendecke
abae5889d9 rpc_server3: Align integer types
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Volker Lendecke
0ad9273961 lib: Fix a comment
The "deleted bit" went away with 341223a005

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Volker Lendecke
78737c6869 lib: Remove two unused macro definitions
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Volker Lendecke
b3dec1bc1f registry3: Align a few integer types
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Volker Lendecke
e96f6b0f88 locking: Move br_off typedef to where it's used
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Volker Lendecke
489023e481 locking: Move SMB_OFF_T_BITS macro to its only user
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Volker Lendecke
652242f542 vfs_virusfilter: Fix canonicalizing socket path
canonicalize_absolute_path() returns its result, the previous code was
a no-op

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Volker Lendecke
e3e902f570 vfs_widelinks: Fix small typos
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-05 11:48:38 +00:00
Jeremy Allison
29cbfd0ba3 s3: smbd: Add a dirfsp parameter to smbd_calculate_maximum_allowed_access().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon May  4 15:33:09 UTC 2020 on sn-devel-184
2020-05-04 15:33:08 +00:00
Jeremy Allison
976a60304a s3: smbd: Reformat users of smbd_calculate_maximum_allowed_access().
Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:34 +00:00
Jeremy Allison
a20d06675f s3: smbd: Add a dirfsp parameter to smbd_calculate_access_mask().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:34 +00:00
Jeremy Allison
c7144b7acd s3: smbd: Reformat users of smbd_calculate_access_mask().
Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:34 +00:00
Jeremy Allison
66a4e6b5c6 s3: smbd: Add a dirfsp parameter to check_parent_access().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:34 +00:00
Jeremy Allison
3e6e9e4281 s3: smbd: Reformat users of check_parent_access().
Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:34 +00:00
Jeremy Allison
c9c8c83ca2 s3: smbd: Add a dirfsp parameter to user_can_read_file().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:33 +00:00
Jeremy Allison
f24e1abeee s3: smbd: Reformat users of user_can_read_file().
Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:33 +00:00
Jeremy Allison
49ec754fca s3: smbd: Add a dirfsp parameter to smbd_check_access_rights().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:33 +00:00
Jeremy Allison
b4acf74049 s3: smbd: Reformat users of smbd_check_access_rights().
Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:33 +00:00
Jeremy Allison
7c1f1e5243 s3: smbd: Add dirfsp parameter to can_write_to_file().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:33 +00:00
Jeremy Allison
21d16fe212 s3: smbd: Reformat users of can_write_to_file().
Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:33 +00:00
Jeremy Allison
18f67e354f s3: smbd: Add dirfsp parameter to user_can_write_file().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:32 +00:00
Jeremy Allison
6d83b785cf s3: smbd: Reformat caller of user_can_write_file().
Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:32 +00:00
Jeremy Allison
839a2fb7a5 s3: smbd: Add dirfsp parameter to can_delete_file_in_directory().
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:32 +00:00
Jeremy Allison
1a53b81a7b s3: smbd: Reformat definition and callers of can_delete_file_in_directory().
Makes future addition of parameter easier to see.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-04 13:55:32 +00:00
Gary Lockyer
3149ea0a8a CVE-2020-10704: libcli ldap_message: Add search size limits to ldap_decode
Add search request size limits to ldap_decode calls.

The ldap server uses the smb.conf variable
"ldap max search request size" which defaults to 250Kb.
For cldap the limit is hard coded as 4096.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-05-04 02:59:32 +00:00
Gary Lockyer
d7e5213818 CVE-2020-10704: smb.conf: Add max ldap request sizes
Add two new smb.conf parameters to control the maximum permitted ldap
request size.

Adds:
   ldap max anonymous request size       default 250Kb
   ldap max authenticated request size   default 16Mb

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-05-04 02:59:32 +00:00
Gary Lockyer
f467727db5 CVE-2020-10704: lib util asn1: Add ASN.1 max tree depth
Add maximum parse tree depth to the call to asn1_init, which will be
used to limit the depth of the ASN.1 parse tree.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-05-04 02:59:31 +00:00
Ralph Boehme
62621bd686 smbd: use is_lease_stat_open() in delay_for_oplock()
This allows READ_CONTROL_ACCESS in the access mask as stat open if a file has
only leases.

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

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 Apr 30 21:10:43 UTC 2020 on sn-devel-184
2020-04-30 21:10:43 +00:00
Ralph Boehme
9b0a31af12 smbd: add is_lease_stat_open()
This adds a leases specific stat opens access mask check function.

See also:

https://lists.samba.org/archive/cifs-protocol/2020-March/003409.html

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-30 19:32:45 +00:00
Ralph Boehme
00001286e1 smbd: rename is_stat_open() to is_oplock_stat_open()
Testing stat opens with with leases reveals that that the access mask

  SYNCHRONIZE_ACCESS | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES

is specific to oplocks.

See also:

https://lists.samba.org/archive/cifs-protocol/2020-March/003409.html

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-30 19:32:45 +00:00
Jeremy Allison
d3be759aee s3: smbd: Add dirfsp parameter to check_access().
Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Apr 30 09:11:56 UTC 2020 on sn-devel-184
2020-04-30 09:11:55 +00:00
Jeremy Allison
cc5b49b80a s3: smbd: Reformat callers of check_access().
Makes it easier to see when we add the dirfsp
parameter.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
3a7fb967e5 s3: smbd: Make check_access() a simple wrapper around smbd_check_access_rights().
Now we call check_access_fsp() separately in the callers we don't need the fsp
parameter anymore.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
3fa18f9866 s3: smbd: Reformat spacing for parameters of check_access().
Makes it easier to see the removal of the parameter next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
dc0ea4a195 s3: smbd: Move the fsp check up one level from check_access().
This allows us to call check_access_fsp() directly when
we have an fsp, and to add in the dirfsp for relative
name access to check_access() in the next commit, making
it clear what it's for (and not confusing it with the
file fsp).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
d7f4bb57f2 s3: smbd: Cleanup - move the function get_nt_acl_no_snum() to it's user module.
Make static. It was only called from one place.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
152fb23fac s3: smbd: Add a dirfsp parameter to directory_has_default_acl().
Not yet used, but will make it easier to move to SMB_VFS_GET_NT_ACL_AT()
later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
98c8785c58 s3: smbd: Reformat uses of directory_has_default_acl().
Makes it easier to add a dirfsp parameter.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
2243ba78d9 s3: smbd: Change is_visible_file() to take a directory handle not a name.
No change in functionality as the name is
easily retrieved from the directory handle
(it's always the name we opened the directory with)
and this will allow us to use the directory handle
fsp later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:41 +00:00
Jeremy Allison
668ef24701 s3: smbd: Reformat calls to is_visible_file() to one arg per line.
Will make it easier to see parameter change in a later commit.

No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:40 +00:00
Jeremy Allison
3373500f7e s3: VFS: snapper. Remove snapper_gmt_fget_nt_acl().
This fallback was only used for directories. Now we always
have a valid fd for directories it is no longer needed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:40 +00:00
Jeremy Allison
26e48cb18b s3: VFS: ceph_snapshots. Remove duplicate definition of get_nt_acl_fn.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:40 +00:00
Jeremy Allison
2ef629fed7 s3: VFS: ceph_snapshots. Remove ceph_snap_gmt_fget_nt_acl().
This fallback was only used for directories. Now we always
have a valid fd for directories it is no longer needed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:40 +00:00
Jeremy Allison
031d665728 s3: VFS: shadow_copy2. SMB_VFS_FGET_NT_ACL() makes no sense in this module.
Once we have an open fsp we know we've gone through the pathname
translation.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:40 +00:00
Jeremy Allison
7288e9a445 s3: smbd: In posix_fget_nt_acl() remove the fall-back to path based operations.
Previously we'd do this for directory opens, but directory opens
now always have an open fd. stat opens don't have permissions
to read a security descriptor anyway.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-30 07:33:40 +00:00
Alexander Bokovoy
3be17c891b s3 rpc server: set on-wire handle type explicitly
Since wire_handle.handle_type is uint32_t, we can simply assign uint8_t
handle type to it without using SIVAL() macros. Further unify with s4
RPC server code flow.

Fixes CID 1462616
>>> CID 1462616:    (CONSTANT_EXPRESSION_RESULT)
>>> "(uint32_t)handle_type >> 16" is 0 regardless of the values of its operands. This occurs as a value.
284             SIVAL(&rpc_hnd->wire_handle.handle_type, 0 , handle_type);

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Thu Apr 30 07:09:55 UTC 2020 on sn-devel-184
2020-04-30 07:09:55 +00:00
Ralph Boehme
954d877a2e smbd: remove unneeded parent_dir variable from mkdir_internal()
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 Apr 29 18:16:02 UTC 2020 on sn-devel-184
2020-04-29 18:16:02 +00:00
Ralph Boehme
328716b91b smbd: convert inherit_from_dir arg of change_dir_owner_to_parent() to struct smb_filename
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
3eb42c24ff smbd: convert inherit_from_dir arg of change_file_owner_to_parent() to struct smb_filename
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
bf504ac3c6 smbd: convert inherit_access_posix_acl() arg parent_dir to struct smb_filename
This also fixes a bug introduced by cea8e57eac
where inherit_access_posix_acl() used the smb_fname->base_name instead of
inherit_from_dir in synthetic_smb_fname() to get an struct smb_filename of the
parent directory.

Nobody complained so far, fix it silently.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
0ff2dda37d smbd: convert parent_dir arg of open_file() to struct smb_filename
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
4cc86556a8 smbd: pass dirname as struct smb_filename to is_visible_file()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
84743b727f smbd: realign is_visible_file() args one per line
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
37a9736810 smbd: copy twrp in cp_smb_filename()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
9f64f30140 smbd: add previous version timestamp to struct smb_filename
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
45a560bce3 smbd: pass struct smb_filename smb_fname_parent to unix_mode()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:41 +00:00
Ralph Boehme
214dea7def smbd: pass struct smb_filename parent_dir to file_set_dosmode()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
224b140583 smbd: align file_set_dosmode() args one per line
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
d9ae1c78b9 smbd: pass struct smb_filename to directory_has_default_acl()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
aa0ec8a209 smbd: use parent_smb_fname() in check_reduced_name()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
8fdfbc8d5c smbd: use parent_smb_fname() in check_reduced_name_with_privilege()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
adf75b8cef smbd: use parent_smb_fname() in smb_unix_mknod()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
75b85a4d84 smbd: use parent_smb_fname() in parent_dirname_compatible_open()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
3830ba0d5b smbd: use parent_smb_fname() in inherit_new_acl()
Note: has to rename the variable parent_smb_fname otherwise it conflicts with
the function name.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
90a198bcd0 smbd: use parent_smb_fname() in mkdir_internal()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
16f866a1a0 smbd: use parent_smb_fname() in open_file_ntcreate()
Prepares for converting a bunch of functions to struct smb_filename later.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
4c497c7731 smbd: use parent_smb_fname() in non_widelink_open()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:40 +00:00
Ralph Boehme
61bf5410f0 smbd: use parent_smb_fname() in check_parent_access()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
58a995931d smbd: use parent_smb_fname() in copy_internals()
Prepares for converting file_set_dosmode() to struct smb_filename.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
c0a9c8698c smbd: use parent_smb_fname() in unix_convert()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
3cc0dcad35 smbd: use synthetic_smb_fname() in check_parent_exists()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
4d1ba69aba smbd: use parent_smb_fname() in can_delete_file_in_directory()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
aa125a7d36 vfs_linux_xfs_sgid: use parent_smb_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
259857038b vfs_gpfs: use parent_smb_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
036ed35b3b vfs_default: use parent_smb_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
8bd6908bae vfs_ceph: use parent_smb_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
7f68944acd vfs_aio_pthread: use parent_smb_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
eafd4160b0 vfs_acl_common: use parent_smb_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Ralph Boehme
5fe180e751 s3/lib: add parent_smb_fname()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-29 16:39:39 +00:00
Alexander Bokovoy
c7a4578d06 s3: pass DCE RPC handle type to create_policy_hnd
Various RPC services expect policy handles of a specific type.

s3 RPC server did not allow to create policy handles with a specific
type while actually requiring that policy handle type itself in some
places.

Make sure we are able to specify the policy on-wire handle type when
creating the policy handle. The changes follow s4 DCE RPC server
implementation.

The original logic to always set on-wire handle type to 0 can be tracked
down to commit fdeea341ed when we didn't
really know about differences in on-wire handle types.

All but LSA trusted domain RPC calls do not check the on-wire handle
type in s3 RPC server.

Fixes trusted domain operations when Samba RPC client attempts to call
s3 RPC server to perform lsa_lsaRSetForestTrustInformation in FreeIPA.
This fix is a pre-requisite for FreeIPA-FreeIPA forest trust.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 28 22:55:29 UTC 2020 on sn-devel-184
2020-04-28 22:55:29 +00:00
David Mulder
dedb4f24af s4:torture: Convert samba3.raw.mkdir test to smb2
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 888abcaf8ffbec45fc47520bd3f544e3aa6f58f2)

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 28 19:46:32 UTC 2020 on sn-devel-184
2020-04-28 19:46:32 +00:00
David Mulder
34311553d7 s4:torture: Convert samba4.base.tcon test to smb2
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit eb167bc43dbe196ef5b3bfd24160c72c74113dea)
2020-04-28 18:09:39 +00:00
David Mulder
c690428ebe Convert samba4.base.mangle test to smb2
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 9437b44668c9f7742d6d4fe0891ac4d9fda7c804)
2020-04-28 18:09:39 +00:00
Ralph Boehme
2f55b662a3 smbd: add missing done check from unix_convert_step_stat() refactoring
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-28 18:09:39 +00:00
Volker Lendecke
6233929f72 lib: Remove unused elements from ctdbd_connection
Nobody set them, only the destructor referenced them

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): Tue Apr 28 10:46:22 UTC 2020 on sn-devel-184
2020-04-28 10:46:22 +00:00
Volker Lendecke
c949d15ad5 lib: Nobody sets ctdbd_connection->fde anymore, remove it
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:40 +00:00
Volker Lendecke
ca063446cf lib: Remove unused ctdbd_setup_fde() and callees
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:40 +00:00
Volker Lendecke
296114cf47 lib: Use ctdbd_req_send/recv in ctdb_parse_send/recv
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:40 +00:00
Volker Lendecke
7a7d56c562 torture3: Test ctdb_req_send/recv
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:40 +00:00
Volker Lendecke
e1418589b0 lib: Add ctdbd_req_send/recv
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:40 +00:00
Volker Lendecke
177de8ec3f lib: Add ctdbd_prep_hdr_next_reqid()
Preparation for generic ctdb_req_send/recv: No need to expose
ctdbd_next_reqid(), do basic preparations of a ctdb_req_header

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:40 +00:00
Volker Lendecke
c70b8f069b lib: Add ctdbd_init_async_connection()
Prepare for ctdb_req_send/recv doing tevent_req based async ctdb
requests

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:39 +00:00
Volker Lendecke
af75d0afd0 selftest: Run local-dbwrap-ctdb1 test
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:39 +00:00
Volker Lendecke
262a7aa7a6 torture3: Rename LOCAL-DBWRAP-CTDB->LOCAL-DBWRAP-CTDB1
There will be more

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:39 +00:00
Volker Lendecke
6829e73627 torture3: Fix the local-dbwrap-ctdb test
We need to O_CREAT the database when connecting

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:39 +00:00
Volker Lendecke
684d3d06ce torture3: test readdir timestamp
Create -o files per -N client connections, set a specific timestamp, then write
a bit. This leads to the locking.tdb dmasters to be spread across all nodes.
Then list from one node. This makes sure that the async share mode fetch works
right.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:39 +00:00
Volker Lendecke
b57bb1fe22 libsmb: Add cli_setfileinfo_ext()
Analogue to cli_setpathinfo_ext()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:39 +00:00
Volker Lendecke
9b63cbd789 libsmb: Factor out prep_basic_information_buf()
Will be used in cli_setfileinfo_ext next

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-28 09:08:39 +00:00
Jeremy Allison
e7dfe87ac6 smbd: unix_convert_step(). Fix use of state->end as a boolean, always compare with NULL.
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): Fri Apr 24 23:21:16 UTC 2020 on sn-devel-184
2020-04-24 23:21:16 +00:00
Ralph Boehme
90713cbd63 smbd: add some logging to unix_convert()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-24 21:46:27 +00:00