]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
16 months agosmbd: Fix a comment and an error message
Volker Lendecke [Mon, 22 Jul 2024 17:53:40 +0000 (19:53 +0200)] 
smbd: Fix a comment and an error message

Tested manually, but OBJECT_NAME_NOT_FOUND makes much more sense given
the new semantics of filename_convert_dirfsp.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agosmbd: Save a few lines with a "goto done;"
Volker Lendecke [Mon, 22 Jul 2024 08:41:47 +0000 (10:41 +0200)] 
smbd: Save a few lines with a "goto done;"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolib: Fix a typo
Volker Lendecke [Mon, 29 Jul 2024 10:39:32 +0000 (03:39 -0700)] 
lib: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agovfs: Fix a DBG message
Volker Lendecke [Mon, 29 Jul 2024 10:39:32 +0000 (03:39 -0700)] 
vfs: Fix a DBG message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agosmbclient: Modernize a d_printf
Volker Lendecke [Sun, 21 Jul 2024 10:38:25 +0000 (12:38 +0200)] 
smbclient: Modernize a d_printf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolib: Fix whitespace
Volker Lendecke [Wed, 17 Jul 2024 08:23:26 +0000 (10:23 +0200)] 
lib: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agotsocket: Use iov_buflen
Volker Lendecke [Fri, 12 Jul 2024 15:58:58 +0000 (17:58 +0200)] 
tsocket: Use iov_buflen

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agotsocket: Use iov_buflen
Volker Lendecke [Fri, 12 Jul 2024 15:52:32 +0000 (17:52 +0200)] 
tsocket: Use iov_buflen

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agosmbd: Modernize DEBUGs
Volker Lendecke [Sun, 7 Jul 2024 18:09:46 +0000 (20:09 +0200)] 
smbd: Modernize DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolibsmb: Remove cli_posix_chmod
Volker Lendecke [Fri, 2 Aug 2024 21:09:07 +0000 (23:09 +0200)] 
libsmb: Remove cli_posix_chmod

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agotorture3: Use cli_chmod instead of cli_posix_chmod
Volker Lendecke [Fri, 2 Aug 2024 21:06:17 +0000 (23:06 +0200)] 
torture3: Use cli_chmod instead of cli_posix_chmod

Show that it works the same even for dangling posix symlinks

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agosmbclient: Use cli_chmod instead of cli_posix_chmod
Volker Lendecke [Fri, 2 Aug 2024 11:06:58 +0000 (13:06 +0200)] 
smbclient: Use cli_chmod instead of cli_posix_chmod

Skip the smb1-only SERVER_HAS_UNIX_CIFS(), chmod now also does SMB2

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolibsmb: Add cli_fchmod for smb311 posix extensions
Volker Lendecke [Fri, 2 Aug 2024 10:53:05 +0000 (12:53 +0200)] 
libsmb: Add cli_fchmod for smb311 posix extensions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolibsmb: Add cli_chmod
Volker Lendecke [Fri, 26 Jul 2024 15:27:30 +0000 (17:27 +0200)] 
libsmb: Add cli_chmod

Go via create/fchmod/close. Only fchmod has to be smb2-specific this way.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolibsmb: Add cli_fchmod
Volker Lendecke [Sat, 27 Jul 2024 13:43:55 +0000 (15:43 +0200)] 
libsmb: Add cli_fchmod

Do a posix-level fchmod on a fnum. This will be used for smb2 soon as
well which does not have setpathinfo.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolibsmb: Add cli_smb2_fnum_is_posix
Volker Lendecke [Fri, 2 Aug 2024 09:18:40 +0000 (11:18 +0200)] 
libsmb: Add cli_smb2_fnum_is_posix

Will be used in smb311 unix chmod soon: We should only do the special
setsd on real posix handles. Otherwise we would probably destroy a
valid acl.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agolibsmb: Slightly restructure map_smb2_handle_to_fnum
Volker Lendecke [Fri, 2 Aug 2024 09:04:31 +0000 (11:04 +0200)] 
libsmb: Slightly restructure map_smb2_handle_to_fnum

Pass the persistent/volatile handle as uint64's. Why? I found the
talloc_memdup() slightly misleading, and smbXcli handles those 2 id's
separately. map_smb2_handle_to_fnum() is the function to create the
smb2_hnd.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agosmbd: protect check_smb2_posix_chmod_ace against invalid trustees
Volker Lendecke [Fri, 2 Aug 2024 11:06:28 +0000 (13:06 +0200)] 
smbd: protect check_smb2_posix_chmod_ace against invalid trustees

Found because I got this wrong in new code coming soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
16 months agotdb: version 1.4.12 tdb-1.4.12
Stefan Metzmacher [Tue, 6 Aug 2024 13:11:36 +0000 (15:11 +0200)] 
tdb: version 1.4.12

* Regression fix for ABI problem
  TDB_1_4_11 vs. TDB_1.4.11

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Aug  6 16:16:27 UTC 2024 on atb-devel-224

16 months agoautobuild: Add ABI checks for libtalloc, libtevent and libtdb
Andreas Schneider [Tue, 6 Aug 2024 12:43:29 +0000 (14:43 +0200)] 
autobuild: Add ABI checks for libtalloc, libtevent and libtdb

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

Signed-off-by: Andreas Schneider <asn@samba.org>
16 months agoctdb-doc: document nodes list configuration parameter
John Mulligan [Fri, 2 Aug 2024 17:58:59 +0000 (13:58 -0400)] 
ctdb-doc: document nodes list configuration parameter

Add the initial documentation of the node list configuration parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Aug  6 01:50:12 UTC 2024 on atb-devel-224

16 months agoctdb-tests: add a nodestatus test that uses the nodes list command
John Mulligan [Wed, 31 Jul 2024 22:30:24 +0000 (18:30 -0400)] 
ctdb-tests: add a nodestatus test that uses the nodes list command

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-tests: add reloadnodes unit tests that use the nodes list command
John Mulligan [Wed, 31 Jul 2024 20:30:13 +0000 (16:30 -0400)] 
ctdb-tests: add reloadnodes unit tests that use the nodes list command

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-tests: add USENODESCOMMAND directive to fake ctdb
John Mulligan [Wed, 31 Jul 2024 20:29:44 +0000 (16:29 -0400)] 
ctdb-tests: add USENODESCOMMAND directive to fake ctdb

Add a single line USENODESCOMMAND directive to the fake ctdb in order to
enable use of a nodes script instead of a nodes file. For simplicity
the fake ctdb always uses `nodes.sh` in the CTDB_BASE.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-tests: add unit test coverage for listnodes with command
John Mulligan [Wed, 31 Jul 2024 19:36:26 +0000 (15:36 -0400)] 
ctdb-tests: add unit test coverage for listnodes with command

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-tools: update cli tool to optionally load nodes from command
John Mulligan [Fri, 7 Jun 2024 15:12:17 +0000 (11:12 -0400)] 
ctdb-tools: update cli tool to optionally load nodes from command

Similar to the recent changes to the ctdb server code, add the ability
to load the nodes from a subprocess stdout.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-conf: add boolean arg for verbosity when loading config
John Mulligan [Thu, 1 Aug 2024 18:25:38 +0000 (14:25 -0400)] 
ctdb-conf: add boolean arg for verbosity when loading config

In a future commit we will add support for loading the config file from
the `ctdb` command line tool. Prior to this change the config file load
func always called D_NOTICE that causes the command to emit new text and
thus break all the tests that rely on the specific test output (not to
mention something users could notice). This change plumbs a new
`verbose` argument into some of the config file loading functions.
Generally, all existing functions will have verbose set to true to match
the existing behavior. Future callers of this function can set it to
false in order to avoid emitting the extra text.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-server: rename ctdb_load_nodes_file to ctdb_load_nodes
John Mulligan [Thu, 6 Jun 2024 17:53:43 +0000 (13:53 -0400)] 
ctdb-server: rename ctdb_load_nodes_file to ctdb_load_nodes

Rename ctdb_load_nodes_file to ctdb_load_nodes as it can now load nodes
from more than a regular file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-server: rename nodes_file field to nodes_source
John Mulligan [Thu, 6 Jun 2024 17:50:02 +0000 (13:50 -0400)] 
ctdb-server: rename nodes_file field to nodes_source

Rename the `struct ctdb_context` field nodes_file to nodes_source to
better match that the field may indicate something other than a true
file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-server: use the new "nodes list" configuration option
John Mulligan [Thu, 6 Jun 2024 14:00:10 +0000 (10:00 -0400)] 
ctdb-server: use the new "nodes list" configuration option

Use the new "nodes list" configuration option. Executing the given path
if the path is prefixed by a `!`. The use case is to decouple the nodes
file from the shared storage, especially in the case where the shared
storage is provided by a vfs module.

For an example, imagine a script that runs `curl` on a URL for a
highly-available web server where the URL provides the content
of the nodes file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-conf: add "nodes list" configuration option
John Mulligan [Thu, 6 Jun 2024 14:00:09 +0000 (10:00 -0400)] 
ctdb-conf: add "nodes list" configuration option

Add a "nodes list" configuration option to the [cluster] section of the
ctdb server config. This option will be used similarly to the `cluster
lock` parameter works. When unset it defaults to the same value as
before (/etc/ctdb/nodes). If given a path that is not prefixed by `!` it
instead loads the nodes file from the given path If given a path
prefixed by `!` then it executes the path as a command and reads the
standard output as if it were the content of the nodes file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoctdb-conf: add ctdb_read_nodes_cmd function
John Mulligan [Thu, 6 Jun 2024 14:00:10 +0000 (10:00 -0400)] 
ctdb-conf: add ctdb_read_nodes_cmd function

Add ctdb_read_nodes_cmd a function that works similarly to
ctdb_read_nodes_file but reads the nodes list from the stdout of a
subprocess instead of a file in the file system.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agowafsamba: Fix ABI symbol name generation
Andreas Schneider [Mon, 5 Aug 2024 12:51:01 +0000 (14:51 +0200)] 
wafsamba: Fix ABI symbol name generation

Commit 0bc5b6f29307ce758774c1b2f48ce62315fdc7f9 changed the script
for generating the ABI symbol version. It broke the ABI by changing all
dots to underscores.

This reverts the commit partially to preserve the dots in the version
part.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Aug  6 00:42:56 UTC 2024 on atb-devel-224

16 months agovfs_ceph_new: Unconditionally use ceph_select_filesystem
Anoop C S [Fri, 2 Aug 2024 05:40:28 +0000 (11:10 +0530)] 
vfs_ceph_new: Unconditionally use ceph_select_filesystem

Currently we don't have an explicit check for the presence of
ceph_select_filesystem() libcephfs API as it is always found to
be present with the minimum ceph version that is supported with
Samba right now. Therefore under this assumption directly call
ceph_select_filesystem() without any #ifdefs. Please note that
this change is already part of vfs_ceph via ef0068cd.

ref: https://gitlab.com/samba-team/samba/-/merge_requests/3715
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15686
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Aug  5 16:06:47 UTC 2024 on atb-devel-224

16 months agodocs-xml/manpages: add entry for vfs_ceph_new
Shachar Sharon [Tue, 20 Feb 2024 17:37:45 +0000 (19:37 +0200)] 
docs-xml/manpages: add entry for vfs_ceph_new

Create man entry for the newly added vfs_ceph_new module: almost
identical to existing vfs_ceph, except to the configuration entry:

  [sharename]
  vfs objects = ceph_new
  ...

Adds a bit of info for the motivation behind this new module.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agodocs-xml: Delete descriptions for removed commands "net ads keytab add" and "net...
Pavel Filipenský [Thu, 1 Aug 2024 20:39:58 +0000 (22:39 +0200)] 
docs-xml: Delete descriptions for removed commands "net ads keytab add" and "net ads keytab add_update_ads"

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon Aug  5 13:29:25 UTC 2024 on atb-devel-224

16 months agodocs-xml: Fix trailing whitespace in net.8.xml
Pavel Filipenský [Thu, 1 Aug 2024 20:39:56 +0000 (22:39 +0200)] 
docs-xml: Fix trailing whitespace in net.8.xml

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agodocs:smbdotconf: Improve formatting of 'sync machine password to keytab'
Pavel Filipenský [Thu, 1 Aug 2024 19:49:19 +0000 (21:49 +0200)] 
docs:smbdotconf: Improve formatting of 'sync machine password to keytab'

Hint: review this commit with ignoring white space changes.

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
16 months agoldb: Fix ldb public library header files being unusable
Jo Sutton [Thu, 1 Aug 2024 22:14:52 +0000 (10:14 +1200)] 
ldb: Fix ldb public library header files being unusable

An accidental negation means that ldb_version.h is not installed when
ldb is built as a public library.

This is a regression introduced by commit
625fb48326ec62a33ce0abdbfb0f6f3d33d7cc64.

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Sun Aug  4 01:35:55 UTC 2024 on atb-devel-224

16 months agopython:tests: Remove unused variable
Jo Sutton [Thu, 1 Aug 2024 03:51:03 +0000 (15:51 +1200)] 
python:tests: Remove unused variable

assertMatch() returns None, which isn’t very useful.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agopython:provision: Do not suppress errors produced setting up BIND database
Jo Sutton [Thu, 1 Aug 2024 03:47:13 +0000 (15:47 +1200)] 
python:provision: Do not suppress errors produced setting up BIND database

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agolib:cmdline: Load network interfaces in _samba_cmdline_load_config_s4()
Jo Sutton [Tue, 30 Jul 2024 04:55:17 +0000 (16:55 +1200)] 
lib:cmdline: Load network interfaces in _samba_cmdline_load_config_s4()

This makes the samba.tests.domain_backup tests start working again when
they are run standalone. Without the load_interfaces() call,
smb_sysvol_conn() fails to make a connection to the sysvol share.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agos3:libsmb: Return a more sensible error if no interfaces are available
Jo Sutton [Tue, 30 Jul 2024 03:46:14 +0000 (15:46 +1200)] 
s3:libsmb: Return a more sensible error if no interfaces are available

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agos3:libsmb: Fix invalid array dereference
Jo Sutton [Tue, 30 Jul 2024 03:42:32 +0000 (15:42 +1200)] 
s3:libsmb: Fix invalid array dereference

If ‘num_addrs’ is equal to zero, name_queries_send() will pass an
invalid address to name_query_send().

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agopython:tests: Account for new user ‘joe’
Jo Sutton [Tue, 30 Jul 2024 02:49:11 +0000 (14:49 +1200)] 
python:tests: Account for new user ‘joe’

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agodsdb periodic: Produce a debugging message if kccsrv_samba_kcc() fails
Jo Sutton [Tue, 30 Jul 2024 01:53:57 +0000 (13:53 +1200)] 
dsdb periodic: Produce a debugging message if kccsrv_samba_kcc() fails

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agoldb-samba: Fix code spelling
Jo Sutton [Mon, 29 Jul 2024 23:10:03 +0000 (11:10 +1200)] 
ldb-samba: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agobuildtools: Fix code spelling
Jo Sutton [Mon, 29 Jul 2024 05:04:54 +0000 (17:04 +1200)] 
buildtools: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agobuildtools: Remove trailing whitespace
Jo Sutton [Mon, 29 Jul 2024 05:04:46 +0000 (17:04 +1200)] 
buildtools: Remove trailing whitespace

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agos4-kcc: Remove nonfunctional fallback code
Jo Sutton [Mon, 29 Jul 2024 02:45:49 +0000 (14:45 +1200)] 
s4-kcc: Remove nonfunctional fallback code

The following line in the pre‐2003 attributes fallback code:

attrs = post_2003_attrs;

presumably should have read

attrs = pre_2003_attrs;

As it is this fallback, added in commit
2fc233b78f35e4bc5062869d77985567d61d0f8a and subsequently modified in
commit 783ff68628fee6d5681b3a9abd80b74a78588926, does not do what it was
intended to do.

Besides, attempting a failed search again, just with different
attributes, will presumably not yield any more of a result.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agopython:netcmd: Explicitly delete samdb variables
Jo Sutton [Thu, 18 Jul 2024 22:21:56 +0000 (10:21 +1200)] 
python:netcmd: Explicitly delete samdb variables

This makes our intent clear, and avoids accidental attempts to use these
objects after they have been ‘disconnect()’ed.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agotests/krb5: Remove unneeded machine account creation
Jo Sutton [Thu, 18 Jul 2024 01:53:09 +0000 (13:53 +1200)] 
tests/krb5: Remove unneeded machine account creation

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agotests/krb5: Remove unneeded parameter ‘samdb’
Jo Sutton [Thu, 18 Jul 2024 01:51:52 +0000 (13:51 +1200)] 
tests/krb5: Remove unneeded parameter ‘samdb’

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agos4:dsdb: Fix code spelling
Jo Sutton [Tue, 16 Jul 2024 01:32:32 +0000 (13:32 +1200)] 
s4:dsdb: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agos4:dsdb: Remove trailing whitespace
Jo Sutton [Thu, 1 Aug 2024 23:26:49 +0000 (11:26 +1200)] 
s4:dsdb: Remove trailing whitespace

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agos3:libnet: Fix code spelling
Jo Sutton [Tue, 9 Jul 2024 00:57:13 +0000 (12:57 +1200)] 
s3:libnet: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agopython:tests: Fix code spelling
Jo Sutton [Thu, 1 Aug 2024 03:50:44 +0000 (15:50 +1200)] 
python:tests: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agopython:tests: Fix code spelling
Jo Sutton [Tue, 16 Jul 2024 03:53:05 +0000 (15:53 +1200)] 
python:tests: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agolibcli:auth: Fix code spelling
Jo Sutton [Tue, 16 Jul 2024 01:32:05 +0000 (13:32 +1200)] 
libcli:auth: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agolib:util: Fix code spelling
Jo Sutton [Tue, 9 Jul 2024 00:52:03 +0000 (12:52 +1200)] 
lib:util: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agolib:cmdline: Fix code spelling
Jo Sutton [Tue, 16 Jul 2024 23:28:02 +0000 (11:28 +1200)] 
lib:cmdline: Fix code spelling

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agobuildtools: Use isinstance() to compare types
Jo Sutton [Tue, 2 Jul 2024 04:40:49 +0000 (16:40 +1200)] 
buildtools: Use isinstance() to compare types

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
16 months agos4:torture: Fix memory leak
Andreas Schneider [Thu, 1 Aug 2024 07:32:49 +0000 (09:32 +0200)] 
s4:torture: Fix memory leak

Direct leak of 102 byte(s) in 1 object(s) allocated from:
    #0 0x7f35322fc7d7 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f3531e43bc2 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7f3531e45034 in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7f3531e45034 in __talloc_strlendup ../../lib/talloc/talloc.c:2454
    #4 0x7f3531e45034 in talloc_strdup ../../lib/talloc/talloc.c:2470
    #5 0x7f352f90264b in smbcli_parse_unc ../../source4/libcli/cliconnect.c:269
    #6 0x55fbf83aa207 in torture_parse_target ../../source4/torture/smbtorture.c:192
    #7 0x55fbf83ae031 in main ../../source4/torture/smbtorture.c:744
    #8 0x7f352ca2a1ef in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

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): Thu Aug  1 16:55:43 UTC 2024 on atb-devel-224

16 months agos4:torture: Remove trailing spaces from smbtorture.c
Andreas Schneider [Thu, 1 Aug 2024 08:22:38 +0000 (10:22 +0200)] 
s4:torture: Remove trailing spaces from smbtorture.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
16 months agodocs: Document parametric form of hide and veto files
Volker Lendecke [Tue, 30 Jul 2024 12:06:21 +0000 (14:06 +0200)] 
docs: Document parametric form of hide and veto files

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jul 31 09:41:54 UTC 2024 on atb-devel-224

16 months agolib: Remove "token" parameter from set_namearray
Volker Lendecke [Tue, 30 Jul 2024 11:55:57 +0000 (13:55 +0200)] 
lib: Remove "token" parameter from set_namearray

Not needed anymore

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
16 months agolib: Remove per-user support from append_to_namearray
Volker Lendecke [Tue, 30 Jul 2024 11:30:21 +0000 (13:30 +0200)] 
lib: Remove per-user support from append_to_namearray

This is done in check_user_ok now

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
16 months agotests: Test parametric per-user syntax for hide/veto files
Volker Lendecke [Tue, 30 Jul 2024 12:11:53 +0000 (14:11 +0200)] 
tests: Test parametric per-user syntax for hide/veto files

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
16 months agosmbd: Respect per-user hide and veto files with parametric options
Volker Lendecke [Mon, 29 Jul 2024 15:49:49 +0000 (17:49 +0200)] 
smbd: Respect per-user hide and veto files with parametric options

For my taste this is a nicer configuration syntax than

/../username1/file1/../username2/file2/

Is this too expensive? I don't think so. The scanning only happens an
tcon time, and it only walks the parametric options. If this turns out
to be a performance problem, we should think about smarter data
structures for parametric options instead of just a linked list of
string triples for everything.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
16 months agolib: Factor out append_namearray from set_namearray
Volker Lendecke [Tue, 30 Jul 2024 11:07:22 +0000 (13:07 +0200)] 
lib: Factor out append_namearray from set_namearray

We'll have to add to an existing namearray soon.

This turns one talloc_array() into a set of reallocs. This is slower,
but set_namearray is only used for smb.conf entries where we don't
expect hundreds or more entries to add. I've done this to avoid array
length calculations, but if it turns out to be too slow we can get
smarter again.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
16 months agoloadparm: Add lp_wi_scan_share_parametrics
Volker Lendecke [Mon, 29 Jul 2024 14:17:21 +0000 (07:17 -0700)] 
loadparm: Add lp_wi_scan_share_parametrics

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
16 months agoloadparm: Factor out lp_wi_scan_parametrics
Volker Lendecke [Mon, 29 Jul 2024 13:27:51 +0000 (06:27 -0700)] 
loadparm: Factor out lp_wi_scan_parametrics

We'll scan share parametrics soon as well.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
16 months agos4:torture/smb2: add 'smb2.bench.session-setup'
Stefan Metzmacher [Tue, 18 Jun 2024 14:44:37 +0000 (16:44 +0200)] 
s4:torture/smb2: add 'smb2.bench.session-setup'

This test loops over session-setup/logoff as fast as possible,
for nprocs * qdepth loops.

It was created to demonstrate the krb5 replay cache problem
(at least with MIT kerberos before 1.18, I've tested with
1.15 only).

This forces kerberos with the machine account:

time smbtorture //fileserver.example.com/ipc\$ \
        smb2.bench.session-setup \
        --option="torture:timelimit=600" \
        --option="torture:nprocs=50" \
        --option="torture:qdepth=1" \
        --machine-pass \
        --use-kerberos=required

This forces ntlmssp with the machine account:

time smbtorture //fileserver.example.com/ipc\$ \
        smb2.bench.session-setup \
        --option="torture:timelimit=600" \
        --option="torture:nprocs=50" \
        --option="torture:qdepth=1" \
        --machine-pass \
        --use-kerberos=off

This forces anonymous ntlmssp (without depending
on the DC performance):

time smbtorture //fileserver.example.com/ipc\$ \
        smb2.bench.session-setup \
        --option="torture:timelimit=600" \
        --option="torture:nprocs=50" \
        --option="torture:qdepth=1" \
        -U% \
        --use-kerberos=off

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jul 30 15:18:42 UTC 2024 on atb-devel-224

16 months agovfs_ceph_new: common prefix to debug-log messages
Shachar Sharon [Tue, 16 Jul 2024 11:33:16 +0000 (14:33 +0300)] 
vfs_ceph_new: common prefix to debug-log messages

Keep logging consistent: add "[CEPH] " prefix to DBG_DEBUG log messages
where missing.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Jul 29 15:58:15 UTC 2024 on atb-devel-224

16 months agovfs_ceph_new: debug-log upon libcephfs low-level calls
Shachar Sharon [Wed, 26 Jun 2024 14:24:37 +0000 (17:24 +0300)] 
vfs_ceph_new: debug-log upon libcephfs low-level calls

Add developer's debug-logging upon each call to libcephfs' low-level
APIs.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for xattr ops
Shachar Sharon [Sun, 23 Jun 2024 11:57:10 +0000 (14:57 +0300)] 
vfs_ceph_new: use low-level APIs for xattr ops

Implement extended-attributes operations using libcephfs' low-level
APIs. Whenever possible, use the open file-handle from fsp-extension to
resolve inode-reference and user-permissions. Otherwise, resolve both
on-the-fly.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for mknodat
Shachar Sharon [Sun, 23 Jun 2024 10:08:25 +0000 (13:08 +0300)] 
vfs_ceph_new: use low-level APIs for mknodat

Implement mknodat operations using libcephfs' low-level APIs. Requires
parent directory to have valid inode-ref associated with its fsp
extension.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for renameat
Shachar Sharon [Sun, 23 Jun 2024 09:47:19 +0000 (12:47 +0300)] 
vfs_ceph_new: use low-level APIs for renameat

Implement renameat operations using libcephfs' low-level APIs. Requires
both directories to have valid inode-ref associated with their fsp
extension.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for linkat
Shachar Sharon [Thu, 20 Jun 2024 19:46:52 +0000 (22:46 +0300)] 
vfs_ceph_new: use low-level APIs for linkat

Implement link operations using libcephfs' low-level APIs. Requires two
phase operation: resolve (by-lookup) reference to inode and then do the
actual (hard) link operation using parent dir-inode reference to the
locally-cached inode.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for ftruncate/fallocate
Shachar Sharon [Thu, 20 Jun 2024 11:58:34 +0000 (14:58 +0300)] 
vfs_ceph_new: use low-level APIs for ftruncate/fallocate

Implement ftruncate/fallocate operations using libcephfs' low-level
APIs. Requires open ceph Fh* associated with fsp (extension).

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for fsync
Shachar Sharon [Thu, 20 Jun 2024 09:43:39 +0000 (12:43 +0300)] 
vfs_ceph_new: use low-level APIs for fsync

Implement fsync operation using libcephfs' low-level APIs. Requires
open ceph Fh* associated with fsp (extension).

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for lseek
Shachar Sharon [Thu, 20 Jun 2024 09:23:03 +0000 (12:23 +0300)] 
vfs_ceph_new: use low-level APIs for lseek

Implement lseek operation using libcephfs' low-level APIs. Requires
open ceph Fh* associated with fsp (extension).

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for read/write
Shachar Sharon [Wed, 19 Jun 2024 14:52:45 +0000 (17:52 +0300)] 
vfs_ceph_new: use low-level APIs for read/write

Implement read/write IO operations using libcephfs' low-level APIs.
Requires open ceph Fh* associated with fsp (extension) to complete both
pread/pwrite as well as async I/O operations.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for symlink/readlink
Shachar Sharon [Wed, 26 Jun 2024 10:46:54 +0000 (13:46 +0300)] 
vfs_ceph_new: use low-level APIs for symlink/readlink

Implement unlinkat using libcephfs low-level APIs. For readlink
operation need to resolve child inode by-lookup and then used the inode
reference for the actual low-level readlink.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for unlinkat
Shachar Sharon [Wed, 19 Jun 2024 11:27:24 +0000 (14:27 +0300)] 
vfs_ceph_new: use low-level APIs for unlinkat

Implement unlinkat using libcephfs low-level APIs. Operate using parent
directory's open file-handle. When flags has AT_REMOVEDIR bit set call
low-level rmdir; otherwise, do normal unlink.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for fntimes
Shachar Sharon [Wed, 19 Jun 2024 10:59:53 +0000 (13:59 +0300)] 
vfs_ceph_new: use low-level APIs for fntimes

Implement fntimes hook using libcephfs' low-level APIs. Convert
smb_file_time to ceph_statx plus proper field mask on-the-fly upon
issuing low-level call to libcephfs.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for fchown/fchmod
Shachar Sharon [Wed, 19 Jun 2024 09:48:14 +0000 (12:48 +0300)] 
vfs_ceph_new: use low-level APIs for fchown/fchmod

Use libcephfs' low-level APIs to implement 'fchown' and 'fchmod' using
open file-handle. If fsp does not have an open cephfs Fh reference,
set errno to EBADF and return -1 to VFS.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: proper error handling to readdir
Shachar Sharon [Wed, 17 Jul 2024 08:41:13 +0000 (11:41 +0300)] 
vfs_ceph_new: proper error handling to readdir

Error handling in the case of 'ceph_readdir' is done by setting 'errno'
deep within libcephfs code. In case of error, emit proper debug message
and re-update errno to avoid possible over-write by logging mechanism.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for readdir ops
Shachar Sharon [Mon, 24 Jun 2024 10:33:05 +0000 (13:33 +0300)] 
vfs_ceph_new: use low-level APIs for readdir ops

Implement readdir and rewinddir operations using libcephfs' low-level
APIs. Casts the opaque DIR pointer into struct vfs_ceph_dirp (the first
member of struct vfs_ceph_fh) to resolve the ceph_dir_result pointer
which libcephfs expects for readdir operations.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for mkdirat
Shachar Sharon [Wed, 19 Jun 2024 08:55:27 +0000 (11:55 +0300)] 
vfs_ceph_new: use low-level APIs for mkdirat

Implement 'mkdirat' hook using libcephfs' low-level APIs, via the open
file-handle reference to parent directory.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for fdopendir
Shachar Sharon [Tue, 18 Jun 2024 14:20:59 +0000 (17:20 +0300)] 
vfs_ceph_new: use low-level APIs for fdopendir

Implement fdopendir using libcephfs low-level API and cached (via fsp)
open file-handle. Embed the result within cached vfs_ceph_fh so it may
be used properly by closedir.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for fstatat
Shachar Sharon [Wed, 19 Jun 2024 09:35:11 +0000 (12:35 +0300)] 
vfs_ceph_new: use low-level APIs for fstatat

Use libcephfs' low-level APIs to do lookup-by-name via parent's open
reference followed by getattr on the inode itself.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for fstat
Shachar Sharon [Mon, 24 Jun 2024 08:39:43 +0000 (11:39 +0300)] 
vfs_ceph_new: use low-level APIs for fstat

Use libcephfs' low-level APIs and apply the same logic as stat, but
via explicit inode-reference.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for open/close
Shachar Sharon [Tue, 18 Jun 2024 12:02:52 +0000 (15:02 +0300)] 
vfs_ceph_new: use low-level APIs for open/close

Implement openat, close and closedir and hooks using libcephfs'
low-level APIs. Cache the open Fh* from libcephfs and its related
meta-data using VFS fsp-extension mechanism.

Upon open-create of new vfs_ceph_fh store the caller credentials
(ceph's UserPerm*) within the same context object for subsequent calls.
In addition, provide a "pseudo" fd numbering which is reported back to
VFS layer and used as debugging hints.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: ref cephmount_cached entry in handle->data
Shachar Sharon [Tue, 18 Jun 2024 09:58:52 +0000 (12:58 +0300)] 
vfs_ceph_new: ref cephmount_cached entry in handle->data

Allow direct access to ceph-mount cached-entry via 'handle->data'
private pointer. Required in order to allow more complex cached-state
with each cephfs mount. Users should now use the local-helper function
'cmount_of' to access the underlying ceph_mount_info.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for lchown
Shachar Sharon [Mon, 17 Jun 2024 13:59:05 +0000 (16:59 +0300)] 
vfs_ceph_new: use low-level APIs for lchown

Use libcephfs' low-level API ceph_ll_setattr to implement VFS lchown_fn
hook. Use to standard pattern of iget/iput to allow operation by Inode
reference.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for statfs
Shachar Sharon [Mon, 17 Jun 2024 15:02:07 +0000 (18:02 +0300)] 
vfs_ceph_new: use low-level APIs for statfs

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for lstat
Shachar Sharon [Mon, 17 Jun 2024 12:57:42 +0000 (15:57 +0300)] 
vfs_ceph_new: use low-level APIs for lstat

Use libcephfs' low-level APIs and apply the same logic as stat, but
using AT_SYMLINK_NOFOLLOW flags.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for stat
Shachar Sharon [Mon, 17 Jun 2024 09:11:18 +0000 (12:11 +0300)] 
vfs_ceph_new: use low-level APIs for stat

Start migrating to libcephfs' low-level APIs, using explicit Inode*
reference. Implement the VFS 'stat' hook using a ceph_ll_getattr
function, encapsulated with a pair of iget/iput to hold a
pinned-to-cache Inode* instance.

Upon calling to libcephfs this new code crates and destroys on-the-fly
a Ceph UserPerm instance based on the uig, gid and groups from
'handle->conn->session_info->unix_token'. This logic ensures that the
correct caller-credentials are passed-on to cephfs (instead of those
set upon connection-creation in legacy 'vfs_ceph.c').

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
16 months agovfs_ceph_new: use low-level APIs for disk_free
Shachar Sharon [Sun, 16 Jun 2024 11:50:08 +0000 (14:50 +0300)] 
vfs_ceph_new: use low-level APIs for disk_free

Start using libcephfs low-level APIs: get reference to root inode and
use it to query statfs. Requires an explicit put-inode to avoid resource
leakage by libcephfs.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>