]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
9 months agosmbtorture: add subtests for overwrite dispositions vs sharemodes
Ralph Boehme [Wed, 2 Oct 2024 12:08:36 +0000 (14:08 +0200)] 
smbtorture: add subtests for overwrite dispositions vs sharemodes

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 849afe05ade140898b1eab9b28d46edc8357c844)

9 months agosmbtorture: fix smb2.notify.mask test
Ralph Boehme [Wed, 2 Oct 2024 16:17:17 +0000 (18:17 +0200)] 
smbtorture: fix smb2.notify.mask test

The strange function custom_smb2_create() was somehow causing
NT_STATUS_DELETE_PENDING failures:

  failure: mask [
  (../../source4/torture/smb2/notify.c:490) Incorrect status NT_STATUS_DELETE_PENDING - should be NT_STATUS_OK
  ]

I couldn't figure out what was causing this exactly, but after doing these
cleanups the error went away.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4591f27ca81dff997ef7474565fc9c373abfa4a9)

9 months agosmbtorture: prepare test_overwrite_read_only_file() for more subtests
Ralph Boehme [Wed, 2 Oct 2024 12:07:49 +0000 (14:07 +0200)] 
smbtorture: prepare test_overwrite_read_only_file() for more subtests

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit f88e52a6f487a216dbb805fabc08e862abb9b643)

9 months agodcesrv_core: better fault codes dcesrv_auth_prepare_auth3()
Stefan Metzmacher [Fri, 13 Nov 2020 01:47:51 +0000 (02:47 +0100)] 
dcesrv_core: better fault codes dcesrv_auth_prepare_auth3()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Oct 10 15:17:46 UTC 2024 on atb-devel-224

(cherry picked from commit 9263ce5752063235836d5f77220b0151df6c9408)

9 months agodcesrv_core: fix the auth3 for large ntlmssp messages
Stefan Metzmacher [Fri, 13 Nov 2020 09:55:43 +0000 (10:55 +0100)] 
dcesrv_core: fix the auth3 for large ntlmssp messages

I know finding any real logic in reading the patch,
doesn't really show what's going on. I tried hard
to simplify it, but this is the only way I found
that fixed the test_auth_pad_ntlm_2889_auth3 test
without breaking other tests...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 8b8e4ff1b19ba06821d774d0e1a8b1cad7f06120)

9 months agogensec:spnego: ignore trailing bytes in SPNEGO_SERVER_START state
Stefan Metzmacher [Wed, 11 Nov 2020 16:03:29 +0000 (17:03 +0100)] 
gensec:spnego: ignore trailing bytes in SPNEGO_SERVER_START state

This matches Windows (at least Server 2012_R2).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 86808d66f30136850f857b749e768c88de3a079f)

9 months agogensec:ntlmssp: only allow messages up to 2888 bytes
Stefan Metzmacher [Thu, 12 Nov 2020 09:00:07 +0000 (10:00 +0100)] 
gensec:ntlmssp: only allow messages up to 2888 bytes

This matches Windows (at least Server 2012_R2).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 55dd8bdb05b4e814beb50d11a6f12c94e5f6e9d5)

9 months agodcesrv_core: alter_context logon failures should result in DCERPC_FAULT_ACCESS_DENIED
Stefan Metzmacher [Thu, 12 Nov 2020 15:41:21 +0000 (16:41 +0100)] 
dcesrv_core: alter_context logon failures should result in DCERPC_FAULT_ACCESS_DENIED

We should use DCERPC_FAULT_ACCESS_DENIED as default for
gensec status results of e.g. NT_STATUS_LOGON_FAILURE or
NT_STATUS_INVALID_PARAMTER.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 31a422b7e58d7a670ebedb7c91f240a3134a9624)

9 months agodcesrv_core: a failure from gensec_update results in NAK_REASON_INVALID_CHECKSUM
Stefan Metzmacher [Thu, 12 Nov 2020 15:41:05 +0000 (16:41 +0100)] 
dcesrv_core: a failure from gensec_update results in NAK_REASON_INVALID_CHECKSUM

We already report that for gensec_start_mech_by_authtype() failures,
but we also need to do that for any invalid authentication.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 97545873ebc2daf9c3daee914a90687625a08225)

9 months agodcerpc_util: let dcerpc_pull_auth_trailer() ignore data_and_pad for bind, alter,...
Stefan Metzmacher [Wed, 11 Nov 2020 16:07:54 +0000 (17:07 +0100)] 
dcerpc_util: let dcerpc_pull_auth_trailer() ignore data_and_pad for bind, alter, auth3

Sometimes Windows sends 3 presentation contexts (NDR32, NDR64,
BindTimeFeatureNegotiation) in the first BIND of an association.

Binding an additional connection to the association seems to
reuse the BIND buffer and just changes the num_contexts field from
3 to 2 and leaves the BindTimeFeatureNegotiation context as padding
in places.

Note, the auth_pad_length field is send as 0 in that case,
which means we need to ignore it completely, as well as any
padding before the auth header.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 85b2dcd93848a590727dac243e8eb3614be75fad)

9 months agodcerpc_util: let dcerpc_pull_auth_trailer() expose the reject reason
Stefan Metzmacher [Wed, 11 Nov 2020 16:59:45 +0000 (17:59 +0100)] 
dcerpc_util: let dcerpc_pull_auth_trailer() expose the reject reason

If dcerpc_pull_auth_trailer() returns NT_STATUS_RPC_PROTOCOL_ERROR
it will return the BIND reject code in auth->auth_context_id.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 7a6a1aae6fa74ab0f55c1160aedd2d79c9a44a90)

9 months agodcerpc_util: let dcerpc_pull_auth_trailer() check that auth_offset is 4 bytes aligned
Stefan Metzmacher [Wed, 11 Nov 2020 16:05:21 +0000 (17:05 +0100)] 
dcerpc_util: let dcerpc_pull_auth_trailer() check that auth_offset is 4 bytes aligned

That what Windows also asserts.

It also makes sure that ndr_pull_dcerpc_auth() will
start with ndr->offset = 0 and don't tries to eat
possible padding.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 890fff1ca0c4e1eb8ef26c4f88aa18aeda3afc4f)

9 months agotests/dcerpc/raw_protocol: test invalid schannel binds
Stefan Metzmacher [Thu, 12 Nov 2020 10:10:46 +0000 (11:10 +0100)] 
tests/dcerpc/raw_protocol: test invalid schannel binds

Note the ad_member will keep these as expected failures,
as it doesn't provide the netlogon service,
while the knownfail for the ADDC is only temporary.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit f7a3827010a859839a3ae7d0cdf297a15610d286)

9 months agotests/dcerpc/raw_protocol: add more tests for auth_pad alignment
Stefan Metzmacher [Thu, 12 Nov 2020 16:22:19 +0000 (17:22 +0100)] 
tests/dcerpc/raw_protocol: add more tests for auth_pad alignment

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0bc562eb26cad3a5cb8da2da54db86932791f3de)

9 months agotests/dcerpc/raw_protocol: add tests for max auth_padding, auth_len or auth_offset
Stefan Metzmacher [Wed, 11 Nov 2020 00:19:23 +0000 (01:19 +0100)] 
tests/dcerpc/raw_protocol: add tests for max auth_padding, auth_len or auth_offset

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0da9e4d7430c7dbb37783e6152f7672bf29498e9)

9 months agotests/dcerpc/raw_protocol: fix comment in test_spnego_change_auth_type1
Stefan Metzmacher [Tue, 17 Nov 2020 16:44:51 +0000 (17:44 +0100)] 
tests/dcerpc/raw_protocol: fix comment in test_spnego_change_auth_type1

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 7b5c3f9b1f334eb9d7906338e2e64196a6530068)

9 months agotests/dcerpc/raw_protocol: test_no_auth_ctx_request
Stefan Metzmacher [Tue, 17 Nov 2020 09:05:41 +0000 (10:05 +0100)] 
tests/dcerpc/raw_protocol: test_no_auth_ctx_request

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 57fb07f5a3369d679f8918f853303b56e58dfb3d)

9 months agodcesrv_core: introduce dcesrv_connection->transport_max_recv_frag
Stefan Metzmacher [Thu, 12 Nov 2020 15:38:32 +0000 (16:38 +0100)] 
dcesrv_core: introduce dcesrv_connection->transport_max_recv_frag

The max fragment size depends on the transport.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 09e8dd23ce0c08c5c04bd74121f3664f420af877)

9 months agotests/dcerpc/raw_protocol: run test_neg_xmit_ffff_ffff over tcp and smb
Stefan Metzmacher [Mon, 16 Nov 2020 14:01:49 +0000 (15:01 +0100)] 
tests/dcerpc/raw_protocol: run test_neg_xmit_ffff_ffff over tcp and smb

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit a2d894fd37aaa9bce64ad95e01412681a08790ea)

9 months agodcesrv_core: add more verbose debugging for missing association groups
Stefan Metzmacher [Mon, 16 Nov 2020 15:58:35 +0000 (16:58 +0100)] 
dcesrv_core: add more verbose debugging for missing association groups

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit ac5818f2dd348e61b4be35505bee00b330ec4450)

9 months agoRawDCERPCTest: add some more auth_length related asserts
Stefan Metzmacher [Wed, 11 Nov 2020 15:49:25 +0000 (16:49 +0100)] 
RawDCERPCTest: add some more auth_length related asserts

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit bb8ad1f22924b581bfb66555713e98efa91372b2)

9 months agoRawDCERPCTest: split prepare_pdu() and send_pdu_blob() out of send_pdu()
Stefan Metzmacher [Mon, 9 Nov 2020 13:00:43 +0000 (14:00 +0100)] 
RawDCERPCTest: split prepare_pdu() and send_pdu_blob() out of send_pdu()

This will make it possible to alter pdus before sending them to the
server.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 444f9c6624f5c997dfdc4ae0bfb8823a56fbef70)

9 months agos4:librpc: provide py_schannel bindings
Stefan Metzmacher [Thu, 12 Nov 2020 09:34:38 +0000 (10:34 +0100)] 
s4:librpc: provide py_schannel bindings

This will be used in the dcerpc.raw_protocol test.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0acbbeab4db0c8bc8ff655d652e249fecb3c4ef9)

9 months agodcerpc_util: don't allow auth_padding for BIND, ALTER_CONTEXT and AUTH3 pdus
Stefan Metzmacher [Tue, 24 Sep 2024 07:32:24 +0000 (09:32 +0200)] 
dcerpc_util: don't allow auth_padding for BIND, ALTER_CONTEXT and AUTH3 pdus

This is how Windows 2022 (and 2025 preview) behaves...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit be02d4077db1d6c35b2e480937a04b5e70545a6d)

9 months agotests/dcerpc/raw_protocol: add more test for auth padding during ALTER_CONTEXT/AUTH3
Stefan Metzmacher [Tue, 24 Sep 2024 07:56:05 +0000 (09:56 +0200)] 
tests/dcerpc/raw_protocol: add more test for auth padding during ALTER_CONTEXT/AUTH3

The aim is to keep testing the code paths, which are no longer
testing because allow_bind_auth_pad is false now, which
means the existing tests fail directly at the BIND,
but we also want to test the error handling on
ALTER_CONTEXT (and AUTH3).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 9309283ddbcc60cb8dac8ecd3f4bcecfbf8ac732)

9 months agodcesrv_core: return NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED for binds without contexts
Stefan Metzmacher [Tue, 24 Sep 2024 07:05:15 +0000 (09:05 +0200)] 
dcesrv_core: return NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED for binds without contexts

This is the error Windows 2022 (and 2025 preview) return.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 8e6696b2ac6990f3d6bac804c9a0f1a2b8f0ada0)

9 months agodcesrv_core: disconnect after a fault with non AUTH_LEVEL_CONNECT bind
Stefan Metzmacher [Mon, 23 Sep 2024 14:09:39 +0000 (16:09 +0200)] 
dcesrv_core: disconnect after a fault with non AUTH_LEVEL_CONNECT bind

Without an auth context using DCERPC_AUTH_LEVEL_PACKET or higher
the fault to reject requests with an invalid auth level
should trigger a disconnect after sending the fault to
the client.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 31c2f35bba003daee39756e83def0f3d45c19c6b)

9 months agos4:selftest: only run ad_member with AUTH_LEVEL_CONNECT_LSA=1
Stefan Metzmacher [Mon, 23 Sep 2024 13:13:59 +0000 (15:13 +0200)] 
s4:selftest: only run ad_member with AUTH_LEVEL_CONNECT_LSA=1

We only want to test against
'allow dcerpc auth level connect:lsarpc = yes' once
in order to have the related code tests.
We use the ad_memeber for that special test and
use the default on the tested ADDC.

This reveals some knownfails, which will be fixed in
the next commit...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 93bd5ba609f93ce8298f12f2a7b0ad333e0f48bf)

9 months agotests/dcerpc/raw_protocol: pass against Windows 2022 and require special env vars...
Stefan Metzmacher [Mon, 23 Sep 2024 13:13:59 +0000 (15:13 +0200)] 
tests/dcerpc/raw_protocol: pass against Windows 2022 and require special env vars for legacy servers

Test works against Windows 2022 and works like this:

SMB_CONF_PATH=/dev/null SERVER=172.31.9.118 \
  TARGET_HOSTNAME=w2022-118.w2022-l7.base IGNORE_RANDOM_PAD=1 \
  DOMAIN=W2022-L7 REALM=W2022-L7.BASE \
  USERNAME=administrator PASSWORD=A1b2C3d4 \
  python/samba/tests/dcerpc/raw_protocol.py -v -f TestDCERPC_BIND

Against a legacy Windows2012R2 server this still works:

SMB_CONF_PATH=/dev/null SERVER=172.31.9.188 \
  TARGET_HOSTNAME=w2012r2-188.w2012r2-l6.base ALLOW_BIND_AUTH_PAD=1 \
  LEGACY_BIND_NACK_NO_REASON=1 AUTH_LEVEL_CONNECT_LSA=1 \
  IGNORE_RANDOM_PAD=1 DOMAIN=W2012R2-L6 REALM=W2012R2-L6.BASE \
  USERNAME=administrator PASSWORD=A1b2C3d4 \
  python/samba/tests/dcerpc/raw_protocol.py -v -f TestDCERPC_BIND

Currently Samba behaves like 2012R2, but the next commits
will change that...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 98d908bfd07283878a7a6a630c2bfe5d27b5ffd8)

9 months agoRawDCERPCTest: ignore errors in smb_pipe_socket.close()
Stefan Metzmacher [Sat, 21 Sep 2024 10:32:55 +0000 (12:32 +0200)] 
RawDCERPCTest: ignore errors in smb_pipe_socket.close()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit b51ab42284211981a1ee6c8865845c7dfc985cb4)

9 months agos4:tortore/rpc: let rpc.backupkey without privacy pass against Windows 2022
Stefan Metzmacher [Wed, 25 Sep 2024 21:10:25 +0000 (23:10 +0200)] 
s4:tortore/rpc: let rpc.backupkey without privacy pass against Windows 2022

The server disconnects after the first fault.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 8c6b5b87434e96d4cb695c0a5cf8aa0a0472c6a4)

9 months agos3:smbd: avoid false positives for got_oplock and have_other_lease in delay_for_oplock_fn
Stefan Metzmacher [Fri, 30 Aug 2024 12:16:12 +0000 (14:16 +0200)] 
s3:smbd: avoid false positives for got_oplock and have_other_lease in delay_for_oplock_fn

stat opens should not cause a oplock/lease downgrade if
they don't have a lease attached to itself.

Note that opens broken to NONE still count if they are
non-stat opens...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Oct 10 13:59:18 UTC 2024 on atb-devel-224

(cherry picked from commit dd5b9e08c7a98c54b62d3b097c75faa09cd17da7)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Mon Oct 14 10:52:03 UTC 2024 on atb-devel-224

9 months agos3:smbd: allow reset_share_mode_entry() to handle more than one durable handle
Stefan Metzmacher [Thu, 29 Aug 2024 16:43:14 +0000 (18:43 +0200)] 
s3:smbd: allow reset_share_mode_entry() to handle more than one durable handle

This means that multiple durable handles with RH leases can
co-exist now... Before only the last remaining durable handle
was able to pass the SMB_VFS_DURABLE_DISCONNECT() step.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit b1e5f5d8d2852b66ca4c858d14d367ffe228a88d)

9 months agos3:smbd: let durable_reconnect_fn already check for a disconnected handle with the...
Stefan Metzmacher [Thu, 29 Aug 2024 18:20:23 +0000 (20:20 +0200)] 
s3:smbd: let durable_reconnect_fn already check for a disconnected handle with the correct file_id

We'll soon allow more than one disconnected durable handle, so
we need to find the correct one instead of assuming only a single
one.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 2869bd1a507e7376f0bb0ec68ed4e045b043cfdb)

9 months agos4:torture/smb2: add smb2.durable-v2-open.{keep,purge}-disconnected-* tests
Stefan Metzmacher [Wed, 4 Sep 2024 16:18:43 +0000 (18:18 +0200)] 
s4:torture/smb2: add smb2.durable-v2-open.{keep,purge}-disconnected-* tests

These demonstrate which durables handles are kept and which are purged
because of various opens, writes or renames.

smb2.durable-v2-open.keep-disconnected-rh-with-stat-open
smb2.durable-v2-open.keep-disconnected-rh-with-rh-open
smb2.durable-v2-open.keep-disconnected-rh-with-rwh-open
smb2.durable-v2-open.keep-disconnected-rwh-with-stat-open

smb2.durable-v2-open.purge-disconnected-rwh-with-rwh-open
smb2.durable-v2-open.purge-disconnected-rwh-with-rh-open
smb2.durable-v2-open.purge-disconnected-rh-with-share-none-open
smb2.durable-v2-open.purge-disconnected-rh-with-write
smb2.durable-v2-open.purge-disconnected-rh-with-rename

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15649
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15651
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15708

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 9e98cd5c7a180521026b0d73a330bdaf2c8af73a)

9 months agos4:torture/smb2: add smb2.durable-v2-open.{[non]stat[RH]-and,two-same,two-different...
Stefan Metzmacher [Wed, 28 Aug 2024 14:48:27 +0000 (16:48 +0200)] 
s4:torture/smb2: add smb2.durable-v2-open.{[non]stat[RH]-and,two-same,two-different}-lease

These show that it's possible to have durable handles in addition
of stat opens, as well as multiple durable opens with RH leases.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 77c7741f39a0a9789bede7c4722bd3f35d4af3fd)

9 months agos3:smbd: only store durable handles with byte range locks when having WRITE lease
Stefan Metzmacher [Fri, 30 Aug 2024 16:10:16 +0000 (18:10 +0200)] 
s3:smbd: only store durable handles with byte range locks when having WRITE lease

This simplifies the reconnect assumptions, when we want to allow
more than one durable handle on a file for multiple clients with
READ+HANDLE leases.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 0893ae88180137d44f17196234f657d362543ff5)

9 months agos4:torture/smb2: add smb2.durable-v2-open.lock-{oplock,lease,noW-lease}
Stefan Metzmacher [Fri, 30 Aug 2024 15:38:02 +0000 (17:38 +0200)] 
s4:torture/smb2: add smb2.durable-v2-open.lock-{oplock,lease,noW-lease}

This demonstrates that a W lease is required for a
durable handle to be durable when it has byte range locks.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 8884d617310b47375e38c0386433c5e183703454)

9 months agos4:torture/smb2: add smb2.durable-open.lock-noW-lease
Stefan Metzmacher [Fri, 30 Aug 2024 15:38:02 +0000 (17:38 +0200)] 
s4:torture/smb2: add smb2.durable-open.lock-noW-lease

This demonstrates that a W lease is required for a
durable handle to be durable when it has byte range locks.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 1cc1586d84a65046ab7804f17297c6964bb76c23)

9 months agos4:torture/smb2: improve error handling in durable_v2_open.c
Stefan Metzmacher [Fri, 30 Aug 2024 12:22:24 +0000 (14:22 +0200)] 
s4:torture/smb2: improve error handling in durable_v2_open.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 9b2417c2f04857709c25e3665cd783a68edf0cf2)

9 months agos4:torture/smb2: improve error handling in durable_open.c
Stefan Metzmacher [Fri, 30 Aug 2024 12:22:24 +0000 (14:22 +0200)] 
s4:torture/smb2: improve error handling in durable_open.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit e65e1326a0214a7dfff75ea1e528e82c8fc64517)

10 months agonetcmd:domain:policy: Fix missing conversion from tgt_lifetime minutes to 10^(-7...
Andréas Leroux [Wed, 25 Sep 2024 12:42:25 +0000 (14:42 +0200)] 
netcmd:domain:policy: Fix missing conversion from tgt_lifetime minutes to 10^(-7) seconds

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15692
Signed-off-by: Andréas Leroux <aleroux@tranquil.it>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Oct  4 04:01:22 UTC 2024 on atb-devel-224

(backported from commit 3766b6a126f659a43e2e36c66689c136fc22dbc4
 requiring manual merge in the test file imports)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Mon Oct  7 09:45:40 UTC 2024 on atb-devel-224

10 months agoldb:kv_index: help static analysers to not worry (CID 1615192)
Douglas Bagnall [Tue, 30 Jul 2024 21:20:50 +0000 (09:20 +1200)] 
ldb:kv_index: help static analysers to not worry (CID 1615192)

The point of this realloc is that we are not using this array, but
keeping it around to remain a node the talloc tree. We'd prefer to
reduce it to nothing.

Coverity rightly spotted that it was reallocing an array of `struct
ldb_val` to an array of `struct ldb_val *`, which has a different size
and all. But it doesn't matter in this case, because we will never use
it.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
(cherry picked from commit e2a74963fb89f5409c236a0fbe4cd070e1a75a43)

10 months agoldb:kv_index: realloc away old dn list
Douglas Bagnall [Mon, 22 Jul 2024 10:22:15 +0000 (22:22 +1200)] 
ldb:kv_index: realloc away old dn list

We can't just free it, because has the GUID index list as a child, and
these are shared by the new dn list (from the subtransaction we are
committing). But if the dn list is long and the main transaction is
long-lived, we can save a lot of memory by turning this dn list into
an almost empty node in the talloc tree. This returns us to roughly
the situation we had prior to the last commit.

For example, with the repro.sh script on bug 15590 in indexes mode
with 10000 rules, The last 3 commits use this much memory at the end
of an unusually large transaction:

full talloc report on 'struct ldb_context' (total 4012222 bytes in 90058 blocks)
full talloc report on 'struct ldb_context' (total 2405482219 bytes in 90058 blocks)
full talloc report on 'struct ldb_context' (total 4282195 bytes in 90058 blocks)

That is, the last commit increased usage 500 fold, and this commit
brings it back to normal.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 1bf9ede94f0a6b41fb18e880e59a8e390f8c21d3)

10 months agoldb_kv_index: dn_list load sub transaction can re-use keys
Douglas Bagnall [Tue, 25 Jun 2024 23:05:49 +0000 (11:05 +1200)] 
ldb_kv_index: dn_list load sub transaction can re-use keys

We don't want to modify the original list, but we can reuse the keys
if we treat them as immutable and don't free them. That makes it a lot
quicker if there are many keys (i.e. where an index is useful) and may
sub-transactions. In particular, it avoids O(n²) talloc_memdups.

A removed comment that says "We have to free the top level index
memory otherwise we would leak", and this will be addressed in the
next commit.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 5f0198d69843c864f2b98a7c0c6305ad789a68a0)

10 months agos3: SIGHUP handlers use consistent log level 3
Jones Syue [Mon, 2 Sep 2024 09:11:00 +0000 (17:11 +0800)] 
s3: SIGHUP handlers use consistent log level 3

When turn-on 'log level = 3', sending SIGHUP to samba processes, for
example: smbd parent/children, smbd-notifyd, and smbd-cleanupd. Then
monitor log.smbd in order to parse sighup logs, it looks like the log level
is inconsistent among these processes: smbd parent/children use level 1,
and smbd-notifyd/smbd-cleanupd use level 3.

This patch raises sighup handler's log level from level 1 to level 3, which
is more consistent with smbd-notifyd by Commit 6e5bff80a0a0b ("s3:notifyd:
Handle sigup in notifyd to reparse smb.conf"), and smbd-cleanupd by Commit
57c1e115ecef4 ("smbd: reopen logs on SIGHUP for notifyd and cleanupd").

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

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Sep 25 01:38:02 UTC 2024 on atb-devel-224

(cherry picked from commit 4f3dfb2029c667b6dcd43223fe154dca59143e95)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Fri Oct  4 12:55:29 UTC 2024 on atb-devel-224

10 months agoshadow_copy2: Ignore VFS_OPEN_HOW_WITH_BACKUP_INTENT
Christof Schmitt [Tue, 1 Oct 2024 20:29:56 +0000 (13:29 -0700)] 
shadow_copy2: Ignore VFS_OPEN_HOW_WITH_BACKUP_INTENT

d1846452e96 vfs: Add VFS_OPEN_HOW_WITH_BACKUP_INTENT introduced
VFS_OPEN_HOW_WITH_BACKUP_INTENT for files opened with
FILE_OPEN_FOR_BACKUP_INTENT. shadow_copy2 refuses the open on a file if
any flage in how.resolve is set. Change the check in shadow_copy2 to
allow opening of files with VFS_OPEN_HOW_WITH_BACKUP_INTENT.

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

Signed-off-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 Oct  2 08:06:38 UTC 2024 on atb-devel-224

(cherry picked from commit 30b0fa892ad66bfad92403186f97fd46496e62de)

10 months agos4:lib/messaging: fix interaction between imessaging_reinit and irpc_destructor
Stefan Metzmacher [Tue, 17 Sep 2024 06:29:42 +0000 (08:29 +0200)] 
s4:lib/messaging: fix interaction between imessaging_reinit and irpc_destructor

This was missing in commit 0d096931196524a2d1bf59470bc629dc9231131e.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Sep 18 19:45:56 UTC 2024 on atb-devel-224

(cherry picked from commit a14320461e3abb56f5dacc90ca73bc1143270394)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Wed Oct  2 15:56:24 UTC 2024 on atb-devel-224

10 months agosmbd: remove just created sharemode entry in the error codepaths
Ralph Boehme [Tue, 9 Apr 2024 12:53:32 +0000 (14:53 +0200)] 
smbd: remove just created sharemode entry in the error codepaths

Without this we leave stale sharemode entries around that can lead to all sorts
of havoc.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Sep 19 19:36:19 UTC 2024 on atb-devel-224

(cherry picked from commit 2ff3b9bc0d254a63a913ff9084de3d794fee27d0)

10 months agosmbd: consolidate DH reconnect failure code
Ralph Boehme [Tue, 9 Apr 2024 12:52:44 +0000 (14:52 +0200)] 
smbd: consolidate DH reconnect failure code

No change in behaviour, except that we now
also call fd_close() if vfs_default_durable_cookie()
failed.

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit a91457f97c98fcec1ed062514c364271af1df669)

10 months agos3:tests: let test_durable_handle_reconnect.sh run smb2.durable-v2-regressions.durabl...
Stefan Metzmacher [Mon, 26 Aug 2024 12:42:12 +0000 (14:42 +0200)] 
s3:tests: let test_durable_handle_reconnect.sh run smb2.durable-v2-regressions.durable_v2_reconnect_bug15624

This demonstrates the dead lock after a durable reconnect failed
because the stat info changed, the file can't be accessed anymore
as we leak the incomplete share mode entry in a still running
process.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 14875448ca06a3a28800343a3a326f1a66bccec0)

10 months agos4:torture/smb2: add smb2.durable-v2-regressions.durable_v2_reconnect_bug15624
Stefan Metzmacher [Mon, 26 Aug 2024 12:42:02 +0000 (14:42 +0200)] 
s4:torture/smb2: add smb2.durable-v2-regressions.durable_v2_reconnect_bug15624

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit ef4ef04e7f83b1029446ff8b5fc5fdf4ab33edbd)

10 months agovfs_error_inject: add 'error_inject:durable_reconnect = st_ex_nlink'
Stefan Metzmacher [Mon, 26 Aug 2024 12:11:02 +0000 (14:11 +0200)] 
vfs_error_inject: add 'error_inject:durable_reconnect = st_ex_nlink'

This allows to simulate durable reconnect failures because the stat
information of the file changed.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 692ed832dfff61ad1c9b646b5c8d6f85f25efb99)

10 months agosmbd: add option "smbd:debug events" for tevent handling duration threshold warnings
Ralph Boehme [Wed, 20 Mar 2024 13:28:43 +0000 (14:28 +0100)] 
smbd: add option "smbd:debug events" for tevent handling duration threshold warnings

Can be used to enable printing an error message if tevent event handlers ran
longer then three seconds. Also logs a message with a loglevel of 3 if there
were no events at hall.

Enabled by default with 'log level = 10' or
'smbd profiling level = on'...

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 90d776cb18395ed804f0ab4fd13ef571fc0ad827)

10 months agosmbd: move trace_state variable behind tv variable
Ralph Boehme [Wed, 20 Mar 2024 13:27:27 +0000 (14:27 +0100)] 
smbd: move trace_state variable behind tv variable

Next commit adds timestamp variables to trace_state that want to be initialized
with the current time, so moving behind tv we can then just reuse tv for that.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 679e12aee2f0c283a6f9b9c6008c549a6ca9633e)

10 months agosmbd: add option "smbd lease break:debug hung procs"
Ralph Boehme [Thu, 4 Apr 2024 17:18:19 +0000 (19:18 +0200)] 
smbd: add option "smbd lease break:debug hung procs"

By enabling this a process sending a lease break message to another process
holding a lease will start watching that process and if that process didn't
process the lease break within 10 seconds (cf server_id_watch_waited()), we log
a kernel stack backtrace of that process.

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit d8613d7ee23c4e990285a387eb9ac2eeefff9749)

10 months agosmbd: log share_mode_watch_recv() errors as errors
Ralph Boehme [Fri, 5 Apr 2024 10:15:28 +0000 (12:15 +0200)] 
smbd: log share_mode_watch_recv() errors as errors

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit b45e78871aadca6ae33475bee890736838f44219)

10 months agos3/lib: add option "serverid watch:debug script"
Ralph Boehme [Thu, 25 Apr 2024 13:17:08 +0000 (15:17 +0200)] 
s3/lib: add option "serverid watch:debug script"

This takes just PID and NODE:PID on a cluster.

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 7add7dbf1aee13b4d9ab70d1a5312c8ff30d9e00)

10 months agos3/lib: add option "serverid watch:debug = yes" to print kernel stack of hanging...
Ralph Boehme [Thu, 4 Apr 2024 10:31:05 +0000 (12:31 +0200)] 
s3/lib: add option "serverid watch:debug = yes" to print kernel stack of hanging process

We only do if sys_have_proc_fds() returns true, so it's most likely
linux...

Enabled by default with log level 10...

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 5c57e840527432c4b1a7ec94894939022a9e9622)

10 months agos3/lib: add next helper variable in server_id_watch_*
Ralph Boehme [Thu, 25 Apr 2024 13:24:57 +0000 (15:24 +0200)] 
s3/lib: add next helper variable in server_id_watch_*

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit d76edcd48437715c7541b5b1e6a56245c25f460b)

10 months agoVERSION: Bump version up to Samba 4.20.6...
Jule Anger [Tue, 17 Sep 2024 11:35:31 +0000 (13:35 +0200)] 
VERSION: Bump version up to Samba 4.20.6...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
10 months agoVERSION: Disable GIT_SNAPSHOT for the 4.20.5 release. samba-4.20.5
Jule Anger [Tue, 17 Sep 2024 11:35:08 +0000 (13:35 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the 4.20.5 release.

Signed-off-by: Jule Anger <janger@samba.org>
10 months agoWHATSNEW: Add release notes for Samba 4.20.5.
Jule Anger [Tue, 17 Sep 2024 11:34:37 +0000 (13:34 +0200)] 
WHATSNEW: Add release notes for Samba 4.20.5.

Signed-off-by: Jule Anger <janger@samba.org>
11 months agosmbd: use metadata_fsp(fsp) in copy_access_posix_acl() for SMB_VFS_SYS_ACL_SET_FD
Ralph Boehme [Fri, 5 Jul 2024 14:22:18 +0000 (16:22 +0200)] 
smbd: use metadata_fsp(fsp) in copy_access_posix_acl() for SMB_VFS_SYS_ACL_SET_FD

When inherting permissions on the created stream, we call into the VFS to fetch
the streams security descriptor via inherit_access_posix_acl() ->
copy_access_posix_acl() -> SMB_VFS_SYS_ACL_SET_FD() passing the stream fsp which
triggers the assert SMB_ASSERT(!fsp_is_alternate_stream(fsp)) in
vfswrap_sys_acl_set_fd() in vfs_default.

Just passing the base fsp to the VFS fixes this.

vfs_streams_depot which *does use* distinct backend filesystem files for the
streams, currently does not apply permissions to the stream files at all, so the
incomplete behaviour of vfs_streams_depot is not affected by this change.

If in the future someone want to fix this defficiency in vfs_streams_depot, the
module code can use fsp->stream_fsp to base decisions in VFS ops whether the
module should carry out some action.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep  2 08:55:28 UTC 2024 on atb-devel-224

(cherry picked from commit ecb8a99a2c7ba36f9adc50ef13cd8465a0c49b19)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Fri Sep  6 15:26:57 UTC 2024 on atb-devel-224

11 months agosmbtorture: test creating stream doesn't crash when using "inherit permissions =...
Ralph Boehme [Sat, 6 Jul 2024 15:10:21 +0000 (17:10 +0200)] 
smbtorture: test creating stream doesn't crash when using "inherit permissions = yes"

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 09835608307ff2580f1aada84d44feddae17c80f)

11 months agovfs_ceph_new: handle case of readlinkat with empty name string
Shachar Sharon [Tue, 20 Aug 2024 09:45:07 +0000 (12:45 +0300)] 
vfs_ceph_new: handle case of readlinkat with empty name string

Commit 53c9269b (vfs_ceph_new: use low-level APIs for symlink/readlink)
introduced readlinkat using libcephfs low-level APIs. However, it does
not handle properly the case where readlinkat operates on empty name
string (see man readlinkat(2)), such as:

  fd = openat(dirfd, symname, O_PATH | O_NOFOLLOW, 0);
  readlinkat(fd, "", buf, bufsiz);

Handle this special case of readlinkat with empty name string by using
a reference to the symlink inode itself.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-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): Fri Aug 30 10:42:27 UTC 2024 on atb-devel-224

(cherry picked from commit 22182f90e8e7876a9895f77e736d2b96b18b174f)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Mon Sep  2 13:41:57 UTC 2024 on atb-devel-224

11 months agovfs_ceph_new: add missing newline in debug-logging
Shachar Sharon [Tue, 20 Aug 2024 09:06:40 +0000 (12:06 +0300)] 
vfs_ceph_new: add missing newline in debug-logging

Commit d00f20f3 ("vfs_ceph_new: debug-log upon libcephfs low-level
calls") introduced debug-logging before each call to libcephfs low-level
APIs. Unfortunately, one of the logging messages missed the terminating
newline ('\n') character.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: John Mulligan <jmulligan@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Aug 21 14:18:07 UTC 2024 on atb-devel-224

(cherry picked from commit cbba4008a7fb9e6e91d0568f25ac481b60fda96f)

11 months agosmb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses
David Disseldorp [Fri, 23 Aug 2024 12:55:58 +0000 (12:55 +0000)] 
smb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses

As per MS-FSA 2.1.5.10.22 FSCTL_QUERY_ALLOCATED_RANGES, if response
range entries exceed in_max_output, then we should respond with
STATUS_BUFFER_OVERFLOW and a truncated output buffer.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15699

Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Aug 28 08:54:11 UTC 2024 on atb-devel-224

(cherry picked from commit 5e278a52646a48e3671270e5b57ec5b852f9fb4b)

11 months agos4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation
David Disseldorp [Fri, 23 Aug 2024 13:01:24 +0000 (13:01 +0000)] 
s4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation

FSCTL_QUERY_ALLOCATED_RANGES responses with more than one range should
be truncated to account for a ioctl.smb2.in.max_output_response limit.
Add a test for this.

Flag the new test knownfail; fix in subsequent commit.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
(cherry picked from commit 5cf57f1f539021f1490285516d8cfb2a2ab483e0)

11 months agoRevert "s4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation"
Jule Anger [Mon, 2 Sep 2024 10:59:28 +0000 (12:59 +0200)] 
Revert "s4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation"

This reverts commit 13470db5f70a194a098339148c247a79776a774c.

Wrong patchset applied. This is the one for 4.21. The correct patchset
will be the subsequent commits.

See: https://bugzilla.samba.org/show_bug.cgi?id=15699

Signed-off-by: Jule Anger <janger@samba.org>
11 months agoRevert "smb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses"
Jule Anger [Mon, 2 Sep 2024 10:58:38 +0000 (12:58 +0200)] 
Revert "smb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses"

This reverts commit 4bb2b46bac8dad426e1b2f0942ded6908c47f7d5.

Wrong patchset applied. This is the one for 4.21. The correct patchset
will be the subsequent commits.

See: https://bugzilla.samba.org/show_bug.cgi?id=15699

Signed-off-by: Jule Anger <janger@samba.org>
11 months agosmb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses
David Disseldorp [Fri, 23 Aug 2024 12:55:58 +0000 (12:55 +0000)] 
smb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses

As per MS-FSA 2.1.5.10.22 FSCTL_QUERY_ALLOCATED_RANGES, if response
range entries exceed in_max_output, then we should respond with
STATUS_BUFFER_OVERFLOW and a truncated output buffer.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15699

Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Aug 28 08:54:11 UTC 2024 on atb-devel-224

(cherry picked from commit 5e278a52646a48e3671270e5b57ec5b852f9fb4b)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Fri Aug 30 09:01:54 UTC 2024 on atb-devel-224

11 months agos4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation
David Disseldorp [Fri, 23 Aug 2024 13:01:24 +0000 (13:01 +0000)] 
s4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation

FSCTL_QUERY_ALLOCATED_RANGES responses with more than one range should
be truncated to account for a ioctl.smb2.in.max_output_response limit.
Add a test for this.

Flag the new test knownfail; fix in subsequent commit.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
(cherry picked from commit 5cf57f1f539021f1490285516d8cfb2a2ab483e0)

11 months agos3:smbd: fix NULL dereference in case of readlink failure
Shachar Sharon [Thu, 22 Aug 2024 11:44:28 +0000 (14:44 +0300)] 
s3:smbd: fix NULL dereference in case of readlink failure

When VFS readlinkat hook returns with error the following sequence
yields NULL-pointer dereference (SIGSEGV):

  symlink_target_below_conn (source3/smbd/open.c)
    char *target = NULL;
    ...
    readlink_talloc (source3/smbd/files.c)
      SMB_VFS_READLINKAT
        smb_vfs_call_readlinkat (source3/smbd/vfs.c)
          handle->fns->readlinkat_fn --> returns error

  status = safe_symlink_target_path(.., target /* NULL */ ..)
    safe_symlink_target_path (source3/smbd/filename.c)
      if (target[0] == '/') { /* NULL pointer dereference */

A failure in VFS module's readlinkat hook may happen due to run-time
error (e.g., network failure which cases libcephfs to disconnect from
MDS).

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15700
Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Aug 23 09:27:06 UTC 2024 on atb-devel-224

(cherry picked from commit 168966a053045476a84044aa73f66722eb702fe0)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Mon Aug 26 15:45:20 UTC 2024 on atb-devel-224

11 months agovfs_ceph{_new}: do not set errno upon successful call to libcephfs
Shachar Sharon [Tue, 30 Jul 2024 06:55:44 +0000 (09:55 +0300)] 
vfs_ceph{_new}: do not set errno upon successful call to libcephfs

There is code in Samba that expects errno from a previous system call
to be preserved through a subsequent system call. Thus, avoid setting
"errno = 0" in status_code() and lstatus_code() upon successful return
from libcephfs API call.

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>
(cherry picked from commit a7f4e2bd47c7f4728f3ac8d90af693156a69c557)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Thu Aug 22 10:34:46 UTC 2024 on atb-devel-224

11 months agovfs_ceph: explicit cast to uint64_t upon failure of ceph_statfs
Shachar Sharon [Thu, 30 May 2024 08:02:37 +0000 (11:02 +0300)] 
vfs_ceph: explicit cast to uint64_t upon failure of ceph_statfs

When a call to 'ceph_statfs' from with 'cephwrap_disk_free' returns
non-zero status do an explicit cast to uint64_t for the negative (-1)
value returned by 'status_code'.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit a7d34ec597fe810090d28bfda636b7450ecb06e5)

11 months agovfs_ceph: replace WRAP_RETURN macro with convenience helpers
Shachar Sharon [Thu, 23 May 2024 14:15:40 +0000 (17:15 +0300)] 
vfs_ceph: replace WRAP_RETURN macro with convenience helpers

The WRAP_RETURN is a non-hygienic macro, and as such has the potential
of creating bogus code (e.g. 'return WRAP_RETURN(ret);' which existed
in the code in the past but did not yield any compiler warning). Prefer
simple convenience helper functions instead, which are also type safe.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit 691a397b2707f2924e3f6910c9c574e01d811a97)

11 months agovfs_ceph: re-map unimplemented hooks
Shachar Sharon [Wed, 22 May 2024 13:11:57 +0000 (16:11 +0300)] 
vfs_ceph: re-map unimplemented hooks

Code cleanup: prefer standard convenience helpers for unimplemented
VFS hooks.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit ee72f127c34f27ca496243631b2e7141de2bd59d)

11 months agovfs_ceph: align lines-length with coding standard
Shachar Sharon [Sun, 26 May 2024 13:24:06 +0000 (16:24 +0300)] 
vfs_ceph: align lines-length with coding standard

Coding standard requires following Linux kernel style guide, with an
explicit statement that "Maximum Line Width is 80 Characters". Align
vfs_ceph.c with this convention: split long lines into multiple lines
and use 'git clang-format' to do auto-formatting based on Samba project
'.clang-format' settings.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit b7e3f93ef0f17a5c85385f2e5a333fcf965766b5)

11 months agolib/param: Don't treat a missing include file as an error in handle_include().
Pavel Filipenský [Tue, 20 Aug 2024 15:15:46 +0000 (17:15 +0200)] 
lib/param: Don't treat a missing include file as an error in handle_include().

Same fix as in commit 09d7690

'samba-tool domain provision -d10' fails if the included file does not
exist:

lpcfg_load: refreshing parameters from /etc/samba/smb.conf
Processing section "[global]"
Can't find include file /etc/samba/usershares.conf
pm_process() returned No
ERROR: Unable to load default file
  File "/usr/lib64/python3.12/site-packages/samba/netcmd/domain/provision.py", line 183, in run
    lp = sambaopts.get_loadparm()
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/samba/getopt.py", line 282, in get_loadparm
    self._lp.load_default()

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Aug 21 00:04:19 UTC 2024 on atb-devel-224

(cherry picked from commit ffc75c569c69ce22a39b5d1df8cb4906095c8654)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Thu Aug 22 09:01:31 UTC 2024 on atb-devel-224

11 months agos3:smb2_server: return NT_STATUS_NETWORK_SESSION_EXPIRED for compound requests
Stefan Metzmacher [Tue, 13 Aug 2024 12:07:06 +0000 (14:07 +0200)] 
s3:smb2_server: return NT_STATUS_NETWORK_SESSION_EXPIRED for compound requests

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Aug 13 22:29:28 UTC 2024 on atb-devel-224

(cherry picked from commit 4df1bfd07012dd3d2d2921281e6d6e309303b88d)

Autobuild-User(v4-20-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-20-test): Tue Aug 20 12:47:54 UTC 2024 on atb-devel-224

11 months agos4:torture/smb2: let smb2.session.expire2* also check compound requests
Stefan Metzmacher [Tue, 13 Aug 2024 10:47:59 +0000 (12:47 +0200)] 
s4:torture/smb2: let smb2.session.expire2* also check compound requests

This shows that all compound related requests should get
NT_STATUS_NETWORK_SESSION_EXPIRED.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f6009aa73b9234df1e6ab689de322487ad1394ed)

11 months agodocs-xml/manpages: 'ceph_new' prefix for config-param of vfs_ceph_new
Shachar Sharon [Mon, 5 Aug 2024 16:12:29 +0000 (19:12 +0300)] 
docs-xml/manpages: 'ceph_new' prefix for config-param of vfs_ceph_new

With 'ceph_new' prefix used by vfs_ceph_new for config parameters,
update the relevant man-page accordingly.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Aug  8 13:54:34 UTC 2024 on atb-devel-224

(cherry picked from commit 68f0835c8e1c5029cd831c267b75c02185b206c7)

11 months agovfs_ceph_new: use 'ceph_new' for config-param prefix
Shachar Sharon [Mon, 5 Aug 2024 13:21:10 +0000 (16:21 +0300)] 
vfs_ceph_new: use 'ceph_new' for config-param prefix

Use explicit 'ceph_new' prefix to each of the ceph specific config
parameters to avoid confusion with legacy 'vfs_ceph' module. Hence,
users will have in their smb.conf a format similar to:

...
[smbshare]
        vfs objects = ceph_new
        ceph_new: config_file = /etc/ceph/ceph.conf
        ceph_new: user_id = user1
        ceph_new: filesystem = fs1
        ...

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit aca4cf8327dcaef782dedd98a63a020469c45cdb)

11 months agovfs_ceph_new: handle errno properly for 'readdir'
Shachar Sharon [Tue, 30 Jul 2024 14:36:09 +0000 (17:36 +0300)] 
vfs_ceph_new: handle errno properly for 'readdir'

Take special care for readdir errno setting: in case of error, update
errno by libcephfs (and protect from possible over-write by debug
logging); in the case of successful result or end-of-stream restore
errno to its previous value before calling the readdir_fn VFS hook.

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): Wed Aug  7 14:20:02 UTC 2024 on atb-devel-224

(cherry picked from commit aa043a5808b73fc272de585c1446372fa3f21d08)

11 months agovfs_ceph{_new}: do not set errno upon successful call to libcephfs
Shachar Sharon [Tue, 30 Jul 2024 06:55:44 +0000 (09:55 +0300)] 
vfs_ceph{_new}: do not set errno upon successful call to libcephfs

There is code in Samba that expects errno from a previous system call
to be preserved through a subsequent system call. Thus, avoid setting
"errno = 0" in status_code() and lstatus_code() upon successful return
from libcephfs API call.

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>
(cherry picked from commit a7f4e2bd47c7f4728f3ac8d90af693156a69c557)

11 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

(cherry picked from commit de2f76fa47e6e672ce353ea9d3dc4019965c6491)

11 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>
(cherry picked from commit d8c84a2993b84ebb69011c33c1b5d44801c15363)

11 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

(cherry picked from commit 3bb6d441bf047bef6d95675057cecd3865a25540)

11 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>
(cherry picked from commit d00f20f30f4e77463e82d202099682b7ef68260f)

11 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>
(cherry picked from commit 0a8445e891c64d703d44258b2eef85296265c55f)

11 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>
(cherry picked from commit e714e5ddc50a771e743f5e63f686c106abe33b75)

11 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>
(cherry picked from commit 83011357fb834e92505f17d6f65d5f32e3d37ec0)

11 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>
(cherry picked from commit 9a70bd606728110ad91cab547a4e31350010bb68)

11 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>
(cherry picked from commit b536bf1fa87fb794e2992ab5368f41fdba80e3ad)

11 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>
(cherry picked from commit e15586fc6097565208011c556282d83eeec2230b)

11 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>
(cherry picked from commit 30c1a613fee3f625c0559e49e037af9fad04c3b8)

11 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>
(cherry picked from commit 29bbe0f52d4ffae9dbb070ffc525acf99203444b)

11 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>
(cherry picked from commit 53c9269b219a54236500d22d8a4c7f2ed582faaf)

11 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>
(cherry picked from commit 362a7cf8664270145bff815347e447797cc1a643)