1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

307 Commits

Author SHA1 Message Date
Ralph Boehme
fde1b98143 vfs_gpfs: add path based fallback for gpfswrap_fstat_x() on pathref handles
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
730f8c49a9 vfs_gpfs: check for O_PATH support in gpfswrap_fstat_x()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
1a3ac7a940 vfs_gpfs: make vfs_gpfs_connect() a no-op on IPC shares
We don't ever expect any filesystem IO operations to be called on an IPC shares,
so there's no need to initialize the module here.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Stefan Metzmacher
070dce224b vfs_gpfs: don't check for struct gpfs_config_data in vfs_gpfs_[l]stat()
This is unused and the config object won't be avilable for IPC$ anymore with the
next commit.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
145e739c44 vfs_gpfs: call SMB_VFS_NEXT_CONNECT() before running some module initialization code
No change in behaviour. Prepares for a subsequent commit that checks for IPC shares.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
f66d3621f5 s3: expect fstatat() and dirfd()
FreeBSD, AIX and Solaris all have this.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
6a0d127437 s3: VFS: gpfs: Remove gpfsacl_sys_acl_blob_get_file().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-09 13:14:31 +00:00
Jeremy Allison
a46e9aaadc s3: VFS: gpfs: Remove gpfsacl_sys_acl_get_file().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-09 13:14:31 +00:00
Jeremy Allison
058ac279a6 s3: VFS: gpfs. Remove gpfsacl_get_nt_acl_at().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-09 13:14:31 +00:00
Noel Power
e59244461f 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>
2021-06-09 13:14:30 +00:00
Jeremy Allison
fb5749fa6b s3: VFS: gpfs. parent_smb_fname() -> SMB_VFS_PARENT_PATHNAME().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-06-02 05:39:30 +00:00
Jeremy Allison
fedbbc9f63 s3: VFS: gpfs: Remove gpfsacl_sys_acl_delete_def_file().
No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2021-05-18 17:29:34 +00:00
Jeremy Allison
1eeb650bdd s3: VFS: gpfs: Add gpfsacl_sys_acl_delete_def_fd().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2021-05-18 17:29:34 +00:00
Samuel Cabrero
fad792aa5c s3: VFS: gpfs: Remove SMB_VFS_NTIMES()
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-04-19 12:28:30 +00:00
Samuel Cabrero
02d624c46f s3: VFS: gpfs: Implement SMB_VFS_FNTIMES()
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-04-19 12:28:30 +00:00
Noel Power
2505719cdd s3/modules: VFS: gpfs: Remove vfs_gpfs_chmod() function
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-04-11 22:27:34 +00:00
Noel Power
0332ddde1a VFS: Remove SMB_VFS_SET_DOS_ATTRIBUTE, no longer used
-------------------
                             /                   \
                            /        REST         \
                           /          IN           \
                          /          PEACE          \
                         /                           \
                         |                           |
                         | SMB_VFS_SET_DOS_ATTRIBUTE |
                         |                           |
                         |                           |
                         |         3 March           |
                         |           2021            |
                         |                           |
                         |                           |
                        *|      *  *  *        * *   | *
                _________)/\\_//(\/(/\)/\//\/\////\\/|_)_______
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Apr  8 18:38:40 UTC 2021 on sn-devel-184
2021-04-08 18:38:40 +00:00
Archana
542ae1055c vfs_gpfs:Logging filename for smbd_gpfs_set_times_path()
Signed-off-by: ArchanaChidirala <archana.chidirala.chidirala@ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Dec 30 10:21:08 UTC 2020 on sn-devel-184
2020-12-30 10:21:08 +00:00
Ralph Boehme
92b1499542 vfs: RIP SMB_VFS_SYS_ACL_SET_FILE()
.--. .-,       .-..-.__
        .'(`.-` \_.-'-./`  |\_( "\__
     __.>\ ';  _;---,._|   / __/`'--)
    /.--.  : |/' _.--.<|  /  | |
_..-'    `\     /' /`  /_/ _/_/
 >_.-``-. `Y  /' _;---.`|/))))
'` .-''. \|:  .'   __, .-'"`
 .'--._ `-:  \/:  /'  '.\             _|_
     /.'`\ :;   /'      `-           `-|-`
    -`    |     |                      |
          :.; : |                  .-'~^~`-.
          |:    |                .' _     _ `.
          |:.   |                | |_) | |_) |
          :. :  |                | | \ | |   |
          : ;   |                |           |
          : ;   |                |  SMB_VFS  |
          : ;   |                |  SYS_ACL  |
          : ;   |                | SET_FILE  |
        .jgs. : ;                |           |
-."-/\\\/:::.    `\."-._'."-"_\\-|           |///."-
" -."-.\\"-."//.-".`-."_\\-.".-\\`=.........=`//-".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-17 18:56:29 +00:00
Ralph Boehme
ba07df5e0d vfs_gpfs: add support for SMB_ACL_TYPE_DEFAULT in gpfsacl_sys_acl_set_fd()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-17 18:56:28 +00:00
Ralph Boehme
8d0ea8bafa vfs: add acl type arg to SMB_VFS_SYS_ACL_SET_FD()
No change in behaviour, the new arg is not yet used in any module.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-17 18:56:28 +00:00
Ralph Boehme
04b4dc8649 vfs: RIP SMB_VFS_GET_DOS_ATTRIBUTES()
(\  _  /)
                ( \ O / )
                 (// \\)
                    X
                   / \
                  /___\
           _____/      \\_____
          |         +         ||
          |                   ||
          |   SMB_VFS_GET_    ||
          | DOS_ATTRIBUTES()  ||
          |                   ||
          |                   ||
          |                   ||
          |  _     ___   _    ||
          | | \     |   | \   ||
          | |  |    |   |  |  ||
          | |_/     |   |_/   ||
          | | \     |   |     ||
          | |  \    |   |     ||
          | |   \. _|_. | .   ||
          |                   ||
  *     * | *   **    * **    |**     **
   \)),.,\(/.,(//,,..,,\||(,,.,\\,.((//

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:32 +00:00
Ralph Boehme
da93d88e30 vfs_gpfs: fix bogus compiler warning
The next commit adds the first call inside Samba to the VFS function
SMB_VFS_FGET_DOS_ATTRIBUTES() and therefor also to
vfs_gpfs_fget_dos_attributes().  No idea why gcc is generating this warning:

[4127/4716] Compiling source3/modules/vfs_aio_fork.c
../../source3/modules/vfs_gpfs.c: In function ‘vfs_gpfs_fget_dos_attributes’:
../../source3/modules/vfs_gpfs.c:1728:2: error: ‘file_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1728 |  update_stat_ex_file_id(&fsp->fsp_name->st, file_id);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors

This change fixes the error.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:31 +00:00
Ralph Boehme
450d7f134c smbd: use fsp_get_pathref_fd() for fstat() calls
If we can access the path to a file, by default we have FILE_READ_ATTRIBUTES
from the containing directory. See the section: "Algorithm to Check Access to an
Existing File" in MS-FSA.pdf.

So it's also safe to use a root opened pathref fd, as the root open is done on
the final component after a chdir() to the parent directory was done while still
impersonating the use. Qed.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:30 +00:00
Ralph Boehme
9db3ff2573 smbd: use fsp_get_io_fd() when accessing a file or it's associated metadata
In all places where we access or modify a file or it's associated metadata, we
use fsp_get_io_fd() to fetch the low-level fd from the fsp. This ensures we
don't accidentally use a pathref fsp where the fd would be opened as root on
systems lacking O_PATH.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-12-16 09:08:30 +00:00
Ralph Boehme
32588c023e vfs: remove SMB_VFS_OPEN()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 20:38:34 +00:00
Ralph Boehme
91b7ef1c78 vfs_gpfs: implement SMB_VFS_OPENAT()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-21 20:38:33 +00:00
Jeremy Allison
4f44294c04 s3: VFS: gpfs. Remove get_nt_acl_fn().
No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-07 19:27:37 +00:00
Jeremy Allison
731f8ac8a0 s3: VFS: gpfs. Add gpfsacl_get_nt_acl_at().
Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-07 19:27:35 +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
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
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
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
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
049488f6a5 smbd: move files_struct.is_sparse to a bitfield
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-03 19:05:44 +00:00
Ralph Boehme
7c386c08dc smbd: move files_struct.kernel_share_modes_taken to a bitfield
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-04-03 19:05:43 +00:00
Ralph Wuerthner
6be818b47b vfs_gpfs: Remove discard_const_p() from gpfswrap_quotactl() calls
Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Mon Feb  3 21:53:05 UTC 2020 on sn-devel-184
2020-02-03 21:53:05 +00:00
Ralph Wuerthner
ea45cba9ee vfs_gpfs: Remove discard_const_p() from gpfs_putacl() calls
Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2020-02-03 20:27:37 +00:00
Ralph Wuerthner
508ae8ee7a vfs_gpfs: Remove discard_const_p() from gpfswrap_quotactl() calls
Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2020-02-03 20:27:37 +00:00
Christof Schmitt
a39c4d9bed vfs_gpfs: Preserve errno across unbecome_root call
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-21 22:08:41 +00:00
Christof Schmitt
fed2c3edc5 vfs_gpfs: Cleanup lease mapping function
Shorten the function a bit by directly returning the mapped value.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-21 22:08:41 +00:00
Christof Schmitt
4958478278 vfs_gpfs: Change lease helper function to only provide mapping
The set_gpfs_lease function first maps the lease argument to the GPFS
version and then issues the API call. Change this to only do the mapping
in the helper function.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-21 22:08:41 +00:00
Christof Schmitt
96252a0ec4 vfs_gpfs: Remove function call from "if" statement
Follow the current coding guidelines to first issue the function call
and then check the return code.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-21 22:08:41 +00:00
Christof Schmitt
d9c992a7a9 vfs_gpfs: Reformat function definition of vfs_gpfs_setlease
Remove trailing whitespace and put each argument on a seperate line.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-21 22:08:40 +00:00
Christof Schmitt
22cd011bc4 vfs_gpfs: Remove call to linux_set_lease_capability
The API call is already done as root user (become_root), so that the
lease contains the root user. The lease capability is already implied by
the root user, so the explicit call to linux_set_lease_capability is not
required.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-21 22:08:40 +00:00
Christof Schmitt
4ff13c0174 vfs_gpfs: Update message for requesting sharemode on stream
User newer debug macro and print full path to affected file.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan  8 01:26:46 UTC 2020 on sn-devel-184
2020-01-08 01:26:46 +00:00
Christof Schmitt
5c20ef88ab vfs_gpfs: Log failed gpfs_set_share call as error
Any other error code from gpfs_set_share should never happen. Print a
error message in case this is ever encountered.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-08 00:01:37 +00:00
Christof Schmitt
47a2c6707b vfs_gpfs: Print message when share modes are disabled in file system
GPFS file systems can be configured without support for share modes. As
this results in an unique error code, print a message explaining this
situation and the required config changes.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-08 00:01:37 +00:00
Christof Schmitt
191e375d20 vfs_gpfs: Explicitly log when share mode has been denied
As this denies access to a file, provide a better error message for
easier troubleshooting.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-08 00:01:37 +00:00
Christof Schmitt
a64978e0dc vfs_gpfs: Use early return in sharemode function
This removes one level of indentation.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-08 00:01:37 +00:00