]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agos3: smbd: smbd_calculate_maximum_allowed_access_fsp(), add parent dirfsp parameter...
Jeremy Allison [Tue, 8 Jun 2021 18:40:11 +0000 (11:40 -0700)] 
s3: smbd: smbd_calculate_maximum_allowed_access_fsp(), add parent dirfsp parameter and pass to can_delete_file_in_directory().

Pass the same fsp->conn->cwd_fsp parameter to can_delete_file_in_directory()
dirfsp for now.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove smbd_check_access_rights(). No longer used.
Jeremy Allison [Tue, 8 Jun 2021 18:37:57 +0000 (11:37 -0700)] 
s3: smbd: Remove smbd_check_access_rights(). No longer used.

There are now no more callers of SMB_VFS_GET_NT_ACL_AT().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: can_delete_file_in_directory(), smbd_check_access_rights() -> smbd_check_ac...
Jeremy Allison [Tue, 8 Jun 2021 18:18:34 +0000 (11:18 -0700)] 
s3: smbd: can_delete_file_in_directory(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().

Last user of smbd_check_access_rights().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: can_delete_file_in_directory(), we no longer need to do the SMB_VFS_STAT...
Jeremy Allison [Tue, 8 Jun 2021 18:15:59 +0000 (11:15 -0700)] 
s3: smbd: can_delete_file_in_directory(), we no longer need to do the SMB_VFS_STAT() call.

All code paths must have a valid stat here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In can_delete_file_in_directory(), get a real parent pathref.
Jeremy Allison [Tue, 8 Jun 2021 18:14:29 +0000 (11:14 -0700)] 
s3: smbd: In can_delete_file_in_directory(), get a real parent pathref.

Not yet used but we will use this to get the parent ACL via handle.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In can_delete_file_in_directory(), remove the assertion that dirfsp ==...
Jeremy Allison [Tue, 8 Jun 2021 18:08:06 +0000 (11:08 -0700)] 
s3: smbd: In can_delete_file_in_directory(), remove the assertion that dirfsp == conn->cwd_fsp.

Allow a real parent directory fsp to be passed in. We're not doing this
yet but this will allow more efficient calling from the open code
where we have the parent directory fsp available.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In can_delete_file_in_directory(), move a fast-path exit to before any...
Jeremy Allison [Tue, 8 Jun 2021 18:03:24 +0000 (11:03 -0700)] 
s3: smbd: In can_delete_file_in_directory(), move a fast-path exit to before any pathname manipulation.

If we're root we always return true on a writable share.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove smbd_calculate_maximum_allowed_access(). No longer used.
Jeremy Allison [Tue, 8 Jun 2021 00:28:58 +0000 (17:28 -0700)] 
s3: smbd: Remove smbd_calculate_maximum_allowed_access(). No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove smbd_calculate_access_mask(). No longer used.
Jeremy Allison [Tue, 8 Jun 2021 00:27:29 +0000 (17:27 -0700)] 
s3: smbd: Remove smbd_calculate_access_mask(). No longer used.

Comment out smbd_calculate_maximum_allowed_access() as it is
a static function and we just removed the only caller.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_fake_file(), smbd_calculate_access_mask() -> smbd_calculate_access_mas...
Jeremy Allison [Tue, 8 Jun 2021 00:22:57 +0000 (17:22 -0700)] 
s3: smbd: open_fake_file(), smbd_calculate_access_mask() -> smbd_calculate_access_mask_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_fake_file(). Move the smbd_calculate_access_mask() check until after...
Jeremy Allison [Tue, 8 Jun 2021 00:21:04 +0000 (17:21 -0700)] 
s3: smbd: open_fake_file(). Move the smbd_calculate_access_mask() check until after we've initialized the file handle.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_directory(), smbd_calculate_access_mask() -> smbd_calculate_access_mas...
Jeremy Allison [Tue, 8 Jun 2021 00:19:25 +0000 (17:19 -0700)] 
s3: smbd: open_directory(), smbd_calculate_access_mask() -> smbd_calculate_access_mask_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_file_ntcreate(), smbd_calculate_access_mask() -> smbd_calculate_access...
Jeremy Allison [Tue, 8 Jun 2021 00:17:40 +0000 (17:17 -0700)] 
s3: smbd: open_file_ntcreate(), smbd_calculate_access_mask() -> smbd_calculate_access_mask_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: fruit: fruit_freaddir_attr(), smbd_calculate_access_mask() -> smbd_calculate...
Jeremy Allison [Tue, 8 Jun 2021 00:13:50 +0000 (17:13 -0700)] 
s3: VFS: fruit: fruit_freaddir_attr(), smbd_calculate_access_mask() -> smbd_calculate_access_mask_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: smbd_smb2_create_after_exec(), smbd_calculate_access_mask() -> smbd_calcula...
Jeremy Allison [Tue, 8 Jun 2021 00:12:29 +0000 (17:12 -0700)] 
s3: smbd: smbd_smb2_create_after_exec(), smbd_calculate_access_mask() -> smbd_calculate_access_mask_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change check_base_file_access() to take an fsp as the first argument.
Jeremy Allison [Tue, 8 Jun 2021 00:07:17 +0000 (17:07 -0700)] 
s3: smbd: Change check_base_file_access() to take an fsp as the first argument.

Internally, change check_base_file_access(), smbd_calculate_access_mask() -> smbd_calculate_access_mask_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add smbd_calculate_access_mask_fsp().
Jeremy Allison [Tue, 8 Jun 2021 00:02:06 +0000 (17:02 -0700)] 
s3: smbd: Add smbd_calculate_access_mask_fsp().

Not yet used but this now uses smbd_calculate_maximum_allowed_access_fsp(),
so uncomment it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add new smbd_calculate_access_mask_fsp() function.
Jeremy Allison [Mon, 7 Jun 2021 23:37:25 +0000 (16:37 -0700)] 
s3: smbd: Add new smbd_calculate_access_mask_fsp() function.

Commented out as not yet used.

Signed-off-by: Noel Power <noel.power@suse.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_directory(). Cleanup debug message to refer to correct function.
Jeremy Allison [Mon, 7 Jun 2021 23:27:22 +0000 (16:27 -0700)] 
s3: smbd: open_directory(). Cleanup debug message to refer to correct function.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_file(). Cleanup debug message to refer to correct function.
Jeremy Allison [Mon, 7 Jun 2021 23:25:54 +0000 (16:25 -0700)] 
s3: smbd: open_file(). Cleanup debug message to refer to correct function.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_file(). Cleanup debug message to refer to correct function.
Jeremy Allison [Mon, 7 Jun 2021 23:24:42 +0000 (16:24 -0700)] 
s3: smbd: open_file(). Cleanup debug message to refer to correct function.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_file(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().
Jeremy Allison [Mon, 7 Jun 2021 22:08:06 +0000 (15:08 -0700)] 
s3: smbd: open_file(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_directory(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().
Jeremy Allison [Mon, 7 Jun 2021 22:03:41 +0000 (15:03 -0700)] 
s3: smbd: open_directory(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: check_base_file_access(), smbd_check_access_rights() -> smbd_check_access_r...
Jeremy Allison [Mon, 7 Jun 2021 21:58:39 +0000 (14:58 -0700)] 
s3: smbd: check_base_file_access(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: open_file(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().
Jeremy Allison [Mon, 7 Jun 2021 21:55:38 +0000 (14:55 -0700)] 
s3: smbd: open_file(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In notify, user_can_stat_name_under_fsp(), smbd_check_access_rights ->...
Jeremy Allison [Mon, 7 Jun 2021 18:25:39 +0000 (11:25 -0700)] 
s3: smbd: In notify, user_can_stat_name_under_fsp(), smbd_check_access_rights -> smbd_check_access_rights_fsp

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: ceph_snapshots: In ceph_snap_gmt_convert_dir(), re-use the directory handle...
Jeremy Allison [Mon, 7 Jun 2021 17:26:00 +0000 (10:26 -0700)] 
s3: VFS: ceph_snapshots: In ceph_snap_gmt_convert_dir(), re-use the directory handle for checking SEC_DIR_LIST permission.

Similar change to the one that went into shadow_copy2.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: ceph_snapshots: In ceph_snap_enum_snapdir(), re-use the directory handle...
Jeremy Allison [Mon, 7 Jun 2021 17:22:53 +0000 (10:22 -0700)] 
s3: VFS: ceph_snapshots: In ceph_snap_enum_snapdir(), re-use the directory handle for checking SEC_DIR_LIST permission.

Similar change to the one that went into shadow_copy2.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: vfs_shadow_copy2: Remove check_access_snapdir().
Jeremy Allison [Mon, 7 Jun 2021 16:56:19 +0000 (09:56 -0700)] 
s3: VFS: vfs_shadow_copy2: Remove check_access_snapdir().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: shadow_copy2: In shadow_copy2_get_shadow_copy_data(), check for DIR_LIST...
Jeremy Allison [Mon, 7 Jun 2021 16:47:26 +0000 (09:47 -0700)] 
s3: VFS: shadow_copy2: In shadow_copy2_get_shadow_copy_data(), check for DIR_LIST access once we already have a handle on the snap directory.

There's no sense in opening a synthetic pathref first in
order to check for DIR_LIST access, then open again to
do the SMB_VFS_NEXT_FDOPENDIR() for listing.

Just open once, and check for DIR_LIST access on the
open handle before calling SMB_VFS_NEXT_FDOPENDIR() for listing.

We no longer need check_access_snapdir(), which is
static, so comment it out. Removal next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove can_write_to_file(). Pathname call no longer used.
Jeremy Allison [Mon, 7 Jun 2021 17:14:27 +0000 (10:14 -0700)] 
s3: smbd: Remove can_write_to_file(). Pathname call no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove user_can_write_file().
Jeremy Allison [Fri, 4 Jun 2021 20:46:08 +0000 (13:46 -0700)] 
s3: smbd: Remove user_can_write_file().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove user_can_read_file().
Jeremy Allison [Fri, 4 Jun 2021 20:45:24 +0000 (13:45 -0700)] 
s3: smbd: Remove user_can_read_file().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove is_visible_file().
Jeremy Allison [Fri, 4 Jun 2021 20:44:52 +0000 (13:44 -0700)] 
s3: smbd: Remove is_visible_file().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_normal_ReadDirName().
Jeremy Allison [Fri, 4 Jun 2021 20:44:06 +0000 (13:44 -0700)] 
s3: smbd: Remove dptr_normal_ReadDirName().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Now smbd_dirptr_get_entry() is doing the filtering, dptr_normal_ReadDirName...
Jeremy Allison [Fri, 4 Jun 2021 20:41:50 +0000 (13:41 -0700)] 
s3: smbd: Now smbd_dirptr_get_entry() is doing the filtering, dptr_normal_ReadDirName() is an unneeded wrapper for ReadDirName().

Just call ReadDirName() directly.

This also means:

is_visible_file()
user_can_read_file()
user_can_write_file()

are no longer used, so commen them out for subsequent removal.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Now all callers of is_visible_fsp() pass 'false' for the use_veto parameter...
Jeremy Allison [Fri, 4 Jun 2021 20:32:40 +0000 (13:32 -0700)] 
s3: smbd: Now all callers of is_visible_fsp() pass 'false' for the use_veto parameter, remove it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove is_visible_file() from dptr_ReadDirName().
Jeremy Allison [Fri, 4 Jun 2021 20:27:52 +0000 (13:27 -0700)] 
s3: smbd: Remove is_visible_file() from dptr_ReadDirName().

dptr_ReadDirName() is only called from smbd_dirptr_get_entry(),
which is now doing it's own call to is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In smbd_dirptr_get_entry() add a call to is_visible_fsp().
Jeremy Allison [Fri, 4 Jun 2021 17:10:55 +0000 (10:10 -0700)] 
s3: smbd: In smbd_dirptr_get_entry() add a call to is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In smbd_dirptr_get_entry(), add an early check for VETO_PATH.
Jeremy Allison [Fri, 4 Jun 2021 18:20:08 +0000 (11:20 -0700)] 
s3: smbd: In smbd_dirptr_get_entry(), add an early check for VETO_PATH.

Eventually we will be able to remove the 'bool use_veto' parameter
from is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In can_delete_directory_fsp(), is_visible_file() -> is_visible_fsp().
Jeremy Allison [Fri, 4 Jun 2021 20:21:29 +0000 (13:21 -0700)] 
s3: smbd: In can_delete_directory_fsp(), is_visible_file() -> is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In can_delete_directory_fsp() explicitly call IS_VETO_PATH().
Jeremy Allison [Fri, 4 Jun 2021 19:47:11 +0000 (12:47 -0700)] 
s3: smbd: In can_delete_directory_fsp() explicitly call IS_VETO_PATH().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Allow is_visible_fsp() to cope with POSIX symlinks/MSDFS links.
Jeremy Allison [Fri, 4 Jun 2021 17:09:34 +0000 (10:09 -0700)] 
s3: smbd: Allow is_visible_fsp() to cope with POSIX symlinks/MSDFS links.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: is_visible_file() is now static to dir.c.
Jeremy Allison [Thu, 3 Jun 2021 19:40:54 +0000 (12:40 -0700)] 
s3: smbd: is_visible_file() is now static to dir.c.

Once fully replaced in there it can be removed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Fix old bug in reply_copy() where is_visible_file(), now is_visible_fsp...
Jeremy Allison [Fri, 4 Jun 2021 20:37:03 +0000 (13:37 -0700)] 
s3: smbd: Fix old bug in reply_copy() where is_visible_file(), now is_visible_fsp() wasn't checking VETO files.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: reply_copy(), is_visible_file() -> is_visible_fsp().
Jeremy Allison [Thu, 3 Jun 2021 19:38:18 +0000 (12:38 -0700)] 
s3: smbd: reply_copy(), is_visible_file() -> is_visible_fsp().

Offtopic, the function reply_copy() is insane and should be removed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: rename_internals(), is_visible_file() -> is_visible_fsp().
Jeremy Allison [Thu, 3 Jun 2021 19:28:37 +0000 (12:28 -0700)] 
s3: smbd: rename_internals(), is_visible_file() -> is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In unlink_internals(), is_visible_file() -> is_visible_fsp().
Jeremy Allison [Fri, 4 Jun 2021 18:58:39 +0000 (11:58 -0700)] 
s3: smbd: In unlink_internals(), is_visible_file() -> is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: rmdir_internals(), fix the initial directory scan pass to use is_visible_fsp().
Jeremy Allison [Fri, 4 Jun 2021 19:16:17 +0000 (12:16 -0700)] 
s3: smbd: rmdir_internals(), fix the initial directory scan pass to use is_visible_fsp().

Add the same symlink accomodation as before.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Allow rmdir_internals() to cope with veto'ed symlinks.
Jeremy Allison [Thu, 3 Jun 2021 18:15:50 +0000 (11:15 -0700)] 
s3: smbd: Allow rmdir_internals() to cope with veto'ed symlinks.

We are only dealing with VETO'ed objects
here. If it's a symlink, just delete the
link without caring what it is pointing
to as this operation is safe.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In rmdir_internals(), Change is_visible_file() -> is_visible_fsp().
Jeremy Allison [Thu, 3 Jun 2021 00:51:25 +0000 (17:51 -0700)] 
s3: smbd: In rmdir_internals(), Change is_visible_file() -> is_visible_fsp().

This needs some slight re-arranging, as previously
is_visible_file() preceeds the call to recursive_rmdir().

As we have to move the call to is_visible_fsp()
until after we have direntry_fname->fsp, then
we must also move the recursive_rmdir() to be
after is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change recursive_rmdir(), is_visible_file() -> is_visible_fsp().
Jeremy Allison [Thu, 3 Jun 2021 00:42:27 +0000 (17:42 -0700)] 
s3: smbd: Change recursive_rmdir(), is_visible_file() -> is_visible_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add user_can_write_fsp().
Jeremy Allison [Thu, 3 Jun 2021 00:36:16 +0000 (17:36 -0700)] 
s3: smbd: Add user_can_write_fsp().

Change is_visible_fsp() to use it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add user_can_read_fsp().
Jeremy Allison [Wed, 2 Jun 2021 18:31:45 +0000 (11:31 -0700)] 
s3: smbd: Add user_can_read_fsp().

Change is_visible_fsp() to use it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add is_visible_fsp().
Jeremy Allison [Thu, 3 Jun 2021 00:30:26 +0000 (17:30 -0700)] 
s3: smbd: Add is_visible_fsp().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: set_ea_dos_attribute(), smbd_check_access_rights() -> smbd_check_access_rig...
Jeremy Allison [Wed, 2 Jun 2021 20:39:50 +0000 (13:39 -0700)] 
s3: smbd: set_ea_dos_attribute(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: reply_setatr(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().
Jeremy Allison [Wed, 2 Jun 2021 20:37:30 +0000 (13:37 -0700)] 
s3: smbd: reply_setatr(), smbd_check_access_rights() -> smbd_check_access_rights_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: file_ntimes(), can_write_to_file() -> can_write_to_fsp().
Jeremy Allison [Wed, 2 Jun 2021 19:12:26 +0000 (12:12 -0700)] 
s3: smbd: file_ntimes(), can_write_to_file() -> can_write_to_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: file_set_dosmode(), can_write_to_file() -> can_write_to_fsp().
Jeremy Allison [Wed, 2 Jun 2021 19:01:17 +0000 (12:01 -0700)] 
s3: smbd: file_set_dosmode(), can_write_to_file() -> can_write_to_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: dos_mode_from_sbuf(), can_write_to_file() -> can_write_to_fsp().
Jeremy Allison [Wed, 2 Jun 2021 18:59:07 +0000 (11:59 -0700)] 
s3: smbd: dos_mode_from_sbuf(), can_write_to_file() -> can_write_to_fsp().

Code with MS-DFS link where smb_fname->fsp == NULL.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change acl_group_override() -> acl_group_override_fsp().
Jeremy Allison [Wed, 2 Jun 2021 18:43:41 +0000 (11:43 -0700)] 
s3: smbd: Change acl_group_override() -> acl_group_override_fsp().

We always have a valid fsp here. Inside acl_group_override_fsp()
change can_write_to_file() -> can_write_to_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: set_ea_dos_attribute(), can_write_to_file() -> can_write_to_fsp().
Jeremy Allison [Wed, 2 Jun 2021 18:39:15 +0000 (11:39 -0700)] 
s3: smbd: set_ea_dos_attribute(), can_write_to_file() -> can_write_to_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: call_nt_transact_create(), can_write_to_file() -> can_write_to_fsp().
Jeremy Allison [Wed, 2 Jun 2021 18:40:21 +0000 (11:40 -0700)] 
s3: smbd: call_nt_transact_create(), can_write_to_file() -> can_write_to_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In reply_ntcreate_and_X(), can_write_to_file() -> can_write_to_fsp().
Jeremy Allison [Wed, 2 Jun 2021 18:37:56 +0000 (11:37 -0700)] 
s3: smbd: In reply_ntcreate_and_X(), can_write_to_file() -> can_write_to_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add can_write_to_fsp(). Not yet used.
Jeremy Allison [Wed, 2 Jun 2021 18:36:59 +0000 (11:36 -0700)] 
s3: smbd: Add can_write_to_fsp(). Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: eventlog: get_nt_acl_no_snum(), SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FGET_NT_ACL().
Jeremy Allison [Thu, 3 Jun 2021 00:05:13 +0000 (17:05 -0700)] 
s3: eventlog: get_nt_acl_no_snum(), SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FGET_NT_ACL().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: torture: cmd_get_nt_acl(), SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FGET_NT_ACL()
Jeremy Allison [Wed, 2 Jun 2021 20:32:28 +0000 (13:32 -0700)] 
s3: torture: cmd_get_nt_acl(), SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FGET_NT_ACL()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: get_nt_acl_conn(), SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FGET_NT_ACL()
Jeremy Allison [Wed, 2 Jun 2021 20:29:27 +0000 (13:29 -0700)] 
s3: smbd: get_nt_acl_conn(), SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FGET_NT_ACL()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3/smbd: pysmbd: Ensure SMB_VFS_GET_NT_ACL_AT() has an fsp when called.
Noel Power [Mon, 24 May 2021 22:55:59 +0000 (15:55 -0700)] 
s3/smbd: pysmbd: Ensure SMB_VFS_GET_NT_ACL_AT() has an fsp when called.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3/smbd: pysmbd: SMB_VFS_SYS_ACL_GET_FILE -> SMB_VFS_SYS_ACL_GET_FD
Noel Power [Mon, 24 May 2021 22:52:44 +0000 (15:52 -0700)] 
s3/smbd: pysmbd: SMB_VFS_SYS_ACL_GET_FILE -> SMB_VFS_SYS_ACL_GET_FD

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Inside inherit_new_acl(), change from SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FG...
Jeremy Allison [Tue, 25 May 2021 01:39:52 +0000 (18:39 -0700)] 
s3: smbd: Inside inherit_new_acl(), change from SMB_VFS_GET_NT_ACL_AT() -> SMB_VFS_FGET_NT_ACL().

One more pathname-based call gone.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Pass parent_dir_fname parameter to inherit_new_acl().
Jeremy Allison [Tue, 25 May 2021 01:38:06 +0000 (18:38 -0700)] 
s3: smbd: Pass parent_dir_fname parameter to inherit_new_acl().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove directory_has_default_acl().
Jeremy Allison [Tue, 25 May 2021 00:00:22 +0000 (17:00 -0700)] 
s3: smbd: Remove directory_has_default_acl().

No more users.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change directory_has_default_acl() -> directory_has_default_acl_fsp().
Jeremy Allison [Mon, 24 May 2021 23:59:30 +0000 (16:59 -0700)] 
s3: smbd: Change directory_has_default_acl() -> directory_has_default_acl_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: Add directory_has_default_acl_fsp().
Jeremy Allison [Mon, 24 May 2021 23:58:12 +0000 (16:58 -0700)] 
s3: Add directory_has_default_acl_fsp().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove check_parent_access().
Jeremy Allison [Mon, 24 May 2021 18:17:22 +0000 (11:17 -0700)] 
s3: smbd: Remove check_parent_access().

No more callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change open_file() to use check_parent_access_fsp() instead of check_parent...
Jeremy Allison [Mon, 24 May 2021 18:15:29 +0000 (11:15 -0700)] 
s3: smbd: Change open_file() to use check_parent_access_fsp() instead of check_parent_access().

No more uses of check_parent_access().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In open_file_ntcreate(), remove the local parent_dir_fname and rename the...
Jeremy Allison [Mon, 24 May 2021 23:51:16 +0000 (16:51 -0700)] 
s3: smbd: In open_file_ntcreate(), remove the local parent_dir_fname and rename the passed in parameter to be the same.

open_file() can now use parent_dir_fname->fsp for handle-based
access calls.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In open_file_ntcreate() initialize the local parent_dir_fname from the...
Jeremy Allison [Mon, 24 May 2021 23:49:44 +0000 (16:49 -0700)] 
s3: smbd: In open_file_ntcreate() initialize the local parent_dir_fname from the passed in parent_dir_fname_in.

We can now remove the call to parent_smb_fname().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Pass parent_dir_fname_in, smb_fname_atname_in from create_file_unixpath...
Jeremy Allison [Mon, 24 May 2021 23:47:34 +0000 (16:47 -0700)] 
s3: smbd: Pass parent_dir_fname_in, smb_fname_atname_in from create_file_unixpath() to open_file_ntcreate().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In mkdir_internal(), remove the local parent_dir_fname. We pass it in from...
Jeremy Allison [Mon, 24 May 2021 23:39:35 +0000 (16:39 -0700)] 
s3: smbd: In mkdir_internal(), remove the local parent_dir_fname. We pass it in from the caller now.

This will allow us to change directory_has_default_acl() to
directory_has_default_acl_fsp() later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In mkdir_internal(), use the passed in 'smb_fname_atname' instead of a...
Jeremy Allison [Mon, 24 May 2021 23:36:43 +0000 (16:36 -0700)] 
s3: smbd: In mkdir_internal(), use the passed in 'smb_fname_atname' instead of a local 'base_name' variable.

atname is a better name, as base_name refers to the name without streams
and this is nothing to do with streams.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In mkdir_internal() assign the passed in parent_dir_fname_in, smb_fname_atn...
Jeremy Allison [Mon, 24 May 2021 23:33:58 +0000 (16:33 -0700)] 
s3: smbd: In mkdir_internal() assign the passed in parent_dir_fname_in, smb_fname_atname_in to the local variables.

We don't need the parent_pathref() and more, and as we don't
own parent_dir_fname anymore, don't free it on exit.

Next step will be to remove the local variables.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Pass parent_dir_fname_in, smb_fname_atname_in to mkdir_internal().
Jeremy Allison [Mon, 24 May 2021 23:28:08 +0000 (16:28 -0700)] 
s3: smbd: Pass parent_dir_fname_in, smb_fname_atname_in to mkdir_internal().

Not yet used. Next step will be to use them to replace the
internal parent_dir_fname,base_name variables inside mkdir_internal().

Annotate them so we know what these extra params are.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Pass in the newly created parent_dir_fname and smb_fname_atname to open_dir...
Jeremy Allison [Mon, 24 May 2021 23:13:14 +0000 (16:13 -0700)] 
s3: smbd: Pass in the newly created parent_dir_fname and smb_fname_atname to open_directory().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Get a parent pathref in create_file_unixpath().
Jeremy Allison [Mon, 24 May 2021 23:09:24 +0000 (16:09 -0700)] 
s3: smbd: Get a parent pathref in create_file_unixpath().

Not yet used.

We will be passing this down to open_directory() and
open_file_ntcreate() and using it within create_file_unixpath()
as all of these functions need a parent pathref to check parent
ACLs etc.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change rename_internals_fsp() to use check_parent_access_fsp().
Jeremy Allison [Thu, 20 May 2021 22:32:13 +0000 (15:32 -0700)] 
s3: smbd: Change rename_internals_fsp() to use check_parent_access_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Make mkdir_internal() use check_parent_access_fsp().
Jeremy Allison [Thu, 20 May 2021 22:20:42 +0000 (15:20 -0700)] 
s3: smbd: Make mkdir_internal() use check_parent_access_fsp().

We already have a parent pathref fsp here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add check_parent_access_fsp().
Jeremy Allison [Thu, 20 May 2021 22:17:09 +0000 (15:17 -0700)] 
s3: smbd: Add check_parent_access_fsp().

Next migrate check_parent_access() users over to it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: torture: Change cmd_sys_acl_blob_get_file() to be handle based.
Jeremy Allison [Tue, 8 Jun 2021 22:53:57 +0000 (15:53 -0700)] 
s3: torture: Change cmd_sys_acl_blob_get_file() to be handle based.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: copy_access_posix_acl(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_...
Jeremy Allison [Tue, 8 Jun 2021 20:22:02 +0000 (13:22 -0700)] 
s3: smbd: copy_access_posix_acl(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_FD().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: directory_has_default_posix_acl(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SY...
Jeremy Allison [Tue, 8 Jun 2021 20:20:22 +0000 (13:20 -0700)] 
s3: smbd: directory_has_default_posix_acl(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_FD().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In get_acl_group_bits(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_...
Jeremy Allison [Tue, 8 Jun 2021 20:15:57 +0000 (13:15 -0700)] 
s3: smbd: In get_acl_group_bits(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_FD().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Ensure we only call get_acl_group_bits() with a valid smb_fname->fsp.
Jeremy Allison [Tue, 8 Jun 2021 20:12:55 +0000 (13:12 -0700)] 
s3: smbd: Ensure we only call get_acl_group_bits() with a valid smb_fname->fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3/smbd: make posix_sys_acl_blob_get_fd actually use handle api with the changes...
Noel Power [Thu, 3 Jun 2021 17:49:06 +0000 (10:49 -0700)] 
s3/smbd: make posix_sys_acl_blob_get_fd actually use handle api with the changes to underlying sys_acl_get_fd_fn we now can pass the acl type down

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: torture: cmd_sys_acl_get_file(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GE...
Jeremy Allison [Wed, 2 Jun 2021 17:52:47 +0000 (10:52 -0700)] 
s3: torture: cmd_sys_acl_get_file(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_FD().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: vxfs: Change use of SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_FD().
Jeremy Allison [Wed, 2 Jun 2021 17:47:34 +0000 (10:47 -0700)] 
s3: VFS: vxfs: Change use of SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GET_FD().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In smb_query_posix_acl(), remove a use of SMB_VFS_SYS_ACL_GET_FILE().
Jeremy Allison [Mon, 24 May 2021 22:44:29 +0000 (15:44 -0700)] 
s3: smbd: In smb_query_posix_acl(), remove a use of SMB_VFS_SYS_ACL_GET_FILE().

We can now use SMB_VFS_SYS_ACL_GET_FD() on the directory fsp instead.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoVFS: SMB_VFS_SYS_ACL_GET_FD: Modify api to take additional type param
Noel Power [Fri, 14 May 2021 14:26:46 +0000 (15:26 +0100)] 
VFS: SMB_VFS_SYS_ACL_GET_FD: Modify api to take additional type param

Modify all implementations (and the definitions) related to
SMB_VFS_SYS_ACL_GET_FD to accept additional SMB_ACL_TYPE_T type param.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoVFS: SMB_VFS_SYS_ACL_GET_FD: Add SMB_ACL_TYPE_T type arg
Noel Power [Fri, 14 May 2021 12:30:29 +0000 (13:30 +0100)] 
VFS: SMB_VFS_SYS_ACL_GET_FD: Add SMB_ACL_TYPE_T type arg

preparatory patch for api change to SMB_VFS_SYS_ACL_GET_FD to add new
SMB_ACL_TYPE_T arg to SMB_VFS_SYS_ACL_GET_FD.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>