]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
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>
4 years agos3: smbd: Re-use refuse_symlink_fsp() in set/get security descriptors.
Jeremy Allison [Thu, 20 May 2021 19:26:47 +0000 (12:26 -0700)] 
s3: smbd: Re-use refuse_symlink_fsp() in set/get security descriptors.

Now we have one common function for refusing access on symlinks.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Make refuse_symlink_fsp() public so we can reuse in nttrans.c
Jeremy Allison [Thu, 20 May 2021 19:13:19 +0000 (12:13 -0700)] 
s3: smbd: Make refuse_symlink_fsp() public so we can reuse in nttrans.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change refuse_symlink() -> refuse_symlink_fsp()
Jeremy Allison [Thu, 20 May 2021 19:02:22 +0000 (12:02 -0700)] 
s3: smbd: Change refuse_symlink() -> refuse_symlink_fsp()

Simplify the interals to check for everything that
would make an fsp something that is open on a symlink.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove the NULL fsp use of refuse_symlink().
Jeremy Allison [Thu, 20 May 2021 18:55:45 +0000 (11:55 -0700)] 
s3: smbd: Remove the NULL fsp use of refuse_symlink().

It makes no sense here and will allow us to rename
refuse_symlink() -> refuse_symlink_fsp() and clean it up.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: recursive_rmdir(), when calling synthetic_pathref() for a directory entry...
Jeremy Allison [Mon, 7 Jun 2021 16:14:03 +0000 (09:14 -0700)] 
s3: smbd: recursive_rmdir(), when calling synthetic_pathref() for a directory entry we've already stat()'ed, re-use the stat struct.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: rmdir_internals(), when calling synthetic_pathref() for a directory entry...
Jeremy Allison [Mon, 7 Jun 2021 16:22:28 +0000 (09:22 -0700)] 
s3: smbd: rmdir_internals(), when calling synthetic_pathref() for a directory entry we've already stat()'ed, re-use the stat struct.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: rmdir_internals(). Coding cleanup. Move TALLOC_FREE(dir_hnd) into the gener...
Jeremy Allison [Mon, 7 Jun 2021 16:21:55 +0000 (09:21 -0700)] 
s3: smbd: rmdir_internals(). Coding cleanup. Move TALLOC_FREE(dir_hnd) into the generic exit path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: rmdir_internals(). Coding cleanup. Always use ISDOT(dname) || ISDOTDOT...
Jeremy Allison [Thu, 3 Jun 2021 00:56:59 +0000 (17:56 -0700)] 
s3: smbd: rmdir_internals(). Coding cleanup. Always use ISDOT(dname) || ISDOTDOT(dname).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: smbd_check_access_rights_fsp(), for a symlink handle just check the handle...
Jeremy Allison [Mon, 7 Jun 2021 21:45:24 +0000 (14:45 -0700)] 
s3: smbd: smbd_check_access_rights_fsp(), for a symlink handle just check the handle bits.

For the pathname verison of this function smbd_check_access_rights()
we return the st_mode bits turned into an NT ACL for a symlink.

For a symlink the mode bits are always 'lrwxrwxrwx' which means
smbd_check_access_rights() version always returned NT_STATUS_OK
for any access rights requested on a symlink.

For smbd_check_access_rights_fsp() to a symlink use the handle
access bits as this is a better representation of the access
allowed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Fix smbd_check_access_rights_fsp() to cope with fake/printer fsp's.
Jeremy Allison [Fri, 4 Jun 2021 00:37:57 +0000 (17:37 -0700)] 
s3: smbd: Fix smbd_check_access_rights_fsp() to cope with fake/printer fsp's.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Subtle change to semantics needed for smbd_check_access_rights_fsp().
Jeremy Allison [Fri, 4 Jun 2021 00:05:51 +0000 (17:05 -0700)] 
s3: smbd: Subtle change to semantics needed for smbd_check_access_rights_fsp().

smbd_check_access_rights() is checking permissions on a file *before*
open, so getting ACCESS_DENIED and mapping to NT_STATUS_OK when
reading the security descriptor is fine, as if we really don't have
access the open will fail.

smbd_check_access_rights_fsp() takes place *after* the open (pathref
or otherwise), so being unable to get the security decriptor should
be reported back to the caller and not mapped to NT_STATUS_OK.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Cleanup - make SearchDir() static.
Jeremy Allison [Fri, 4 Jun 2021 19:27:38 +0000 (12:27 -0700)] 
s3: smbd: Cleanup - make SearchDir() static.

It's only used in dir.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Cleanup - fix the comment for dptr_SearchDir().
Jeremy Allison [Fri, 4 Jun 2021 19:32:34 +0000 (12:32 -0700)] 
s3: smbd: Cleanup - fix the comment for dptr_SearchDir().

It doesn't and never has skipped VETO or unreadable files.

It's only used in call_trans2findnext() in the SMB1 code
given a name already returned to the client to find a
resume position. Even if the client gave us a name that
it had never been given to it (client bug or malicious
client) we'd just start the search from the wrong position,
which doesn't cause problems (we still check for VETO
or unreadable before returning any names).

Worst thing that actually happens is the client messes
up their own search, which is what you'd expect from
giving an incorrect resume name.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In open_directory() move the call to smbd_check_access_rights() until after...
Jeremy Allison [Tue, 8 Jun 2021 03:58:34 +0000 (20:58 -0700)] 
s3: smbd: In open_directory() move the call to smbd_check_access_rights() until after the fsp is set up.

This doesn't matter now, but later we will move to a handle-based call to
check access rights, so we will need the full handle setup.

Add a fd_close(fsp) in the error path now this is done after the fd open.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: In open_file(), remove post-open check for opening a directory.
Jeremy Allison [Tue, 8 Jun 2021 03:55:44 +0000 (20:55 -0700)] 
s3: smbd: In open_file(), remove post-open check for opening a directory.

Now we do an early check for opening a directory, this code
could never have been triggered.

The only case we need to consider now is when the filesystem
object exists as a file when we enter open_file() and another
smbd removes and then re-creates the object as a directory before we
call reopen_from_fsp(). In that case, we will open the object,
and come back out to open_file_ntcreate(), where the race
condition detection code that calls check_same_dev_ino()
will catch the case and error out the client request.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Make open_file() fail early for an existing directory we are trying to...
Jeremy Allison [Mon, 7 Jun 2021 20:10:30 +0000 (13:10 -0700)] 
s3: smbd: Make open_file() fail early for an existing directory we are trying to open.

Makes sure we keep the pathref fd open for the NT_FILE_IS_A_DIRECTORY case.

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: smbd: Cleanup. open_file(). If SMB_VFS_FSTAT() fails report the error.
Jeremy Allison [Mon, 7 Jun 2021 20:16:31 +0000 (13:16 -0700)] 
s3: smbd: Cleanup. open_file(). If SMB_VFS_FSTAT() fails report the error.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Cleanup. open_file(). This returns NTSTATUS, don't set errno explicitly...
Jeremy Allison [Mon, 7 Jun 2021 19:18:13 +0000 (12:18 -0700)] 
s3: smbd: Cleanup. open_file(). This returns NTSTATUS, don't set errno explicitly internally.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Cleanup. open_file_ntcreate(). This returns NTSTATUS, don't set errno expli...
Jeremy Allison [Mon, 7 Jun 2021 19:17:14 +0000 (12:17 -0700)] 
s3: smbd: Cleanup. open_file_ntcreate(). This returns NTSTATUS, don't set errno explicitly internally.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: shadow_copy2: Code cleanup. In shadow_copy2_get_shadow_copy_data() preserve...
Jeremy Allison [Mon, 7 Jun 2021 16:44:23 +0000 (09:44 -0700)] 
s3: VFS: shadow_copy2: Code cleanup. In shadow_copy2_get_shadow_copy_data() preserve errno accross cleanup syscalls.

This VFS function should really return an NTSTATUS but that is
a patch for another day.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: posixacl: Fix the fallback code in posixacl_sys_acl_set_fd().
Jeremy Allison [Wed, 9 Jun 2021 00:36:50 +0000 (17:36 -0700)] 
s3: VFS: posixacl: Fix the fallback code in posixacl_sys_acl_set_fd().

We weren't maping or using the incoming SMB_ACL_TYPE_T type
parameter correctly.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: VFS: posixacl: Missing acl_free() in error code path.
Jeremy Allison [Wed, 9 Jun 2021 00:10:59 +0000 (17:10 -0700)] 
s3: VFS: posixacl: Missing acl_free() in error code path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: fix pathref unlinking in create_file_unixpath()
Jeremy Allison [Tue, 8 Jun 2021 16:53:18 +0000 (18:53 +0200)] 
smbd: fix pathref unlinking in create_file_unixpath()

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

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

The asserts below:

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

ensure the required invarients are met.

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

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

4 years agolib:cmdline: Use getprogname() to avoid possible issues with setproctitle()
Stefan Metzmacher [Fri, 4 Jun 2021 15:55:46 +0000 (17:55 +0200)] 
lib:cmdline: Use getprogname() to avoid possible issues with setproctitle()

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun  8 14:58:58 UTC 2021 on sn-devel-184

4 years agos3:cmdline: Use D_ERR() instead of DBG_ERR() for talloc log
Stefan Metzmacher [Fri, 4 Jun 2021 06:58:09 +0000 (08:58 +0200)] 
s3:cmdline: Use D_ERR() instead of DBG_ERR() for talloc log

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolib:cmdline: Also set logfile for the debug system
Andreas Schneider [Tue, 8 Jun 2021 11:25:58 +0000 (13:25 +0200)] 
lib:cmdline: Also set logfile for the debug system

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jun  8 12:35:34 UTC 2021 on sn-devel-184

4 years agolib: Slightly simplify server_id_set_disconnected()
Volker Lendecke [Thu, 17 Dec 2020 10:37:47 +0000 (11:37 +0100)] 
lib: Slightly simplify server_id_set_disconnected()

The NULL assert is not really required, it will crash nicely if that's
not fulfilled.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun  4 17:34:06 UTC 2021 on sn-devel-184

4 years agosmbd: Simplify share_mode_entry_do()
Volker Lendecke [Thu, 17 Dec 2020 11:36:42 +0000 (12:36 +0100)] 
smbd: Simplify share_mode_entry_do()

Looking at the logic of "ha[d|ve]_share_mode_entry" d->modified=true
can only happen if we remove the last share mode entry . Make this
more explicit, avoid booleans.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibnet: Initialize pointers
Volker Lendecke [Tue, 29 Dec 2020 12:41:42 +0000 (13:41 +0100)] 
libnet: Initialize pointers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibnet: Align a few integer types
Volker Lendecke [Tue, 29 Dec 2020 12:41:24 +0000 (13:41 +0100)] 
libnet: Align a few integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonsswitch: Fix a typo
Volker Lendecke [Thu, 6 May 2021 09:43:51 +0000 (11:43 +0200)] 
nsswitch: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Use correct PRIu16 for printf of a uint16
Volker Lendecke [Mon, 3 May 2021 12:59:13 +0000 (14:59 +0200)] 
rpc_server: Use correct PRIu16 for printf of a uint16

Don't rely on correct casting

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotevent: Remove single-use ev_str_list_[length|add]
Volker Lendecke [Mon, 3 May 2021 20:03:47 +0000 (22:03 +0200)] 
tevent: Remove single-use ev_str_list_[length|add]

This also adds proper error checks, the previous code could (very
theoretically) have leaked memory if an intermediate _add had failed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Open tdb files with O_CLOEXEC
Volker Lendecke [Fri, 7 May 2021 05:32:37 +0000 (07:32 +0200)] 
lib: Open tdb files with O_CLOEXEC

After an exec() the fd's don't make sense anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Avoid a cast
Volker Lendecke [Thu, 13 May 2021 18:24:09 +0000 (20:24 +0200)] 
rpc_server: Avoid a cast

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Factor out remove_from_jobs_list()
Volker Lendecke [Thu, 13 May 2021 18:08:30 +0000 (20:08 +0200)] 
printing: Factor out remove_from_jobs_list()

remove_from_jobs_changed() and remove_from_jobs_added() only differed
by the keystr.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Simplify pack_devicemode()
Volker Lendecke [Wed, 12 May 2021 16:22:52 +0000 (18:22 +0200)] 
printing: Simplify pack_devicemode()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>