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

62174 Commits

Author SHA1 Message Date
Anoop C S
3c6ca81aad vfs_glusterfs: Retrieve fs capabilities using vfs_get_fs_capabilities
vfs_glusterfs is supposed to be the last entry when listed with
other vfs modules. This is due to the fact that the connection path
is not local to the server but relative to the virtual remote file
system beneath it. Especially SMB_VFS_FS_CAPABILITIES implementation
from vfs_default is likely to return incorrect results based on the
connection path assumed to be local to the server which might not be
the case with glusterfs module stacked. Therefore it doesn't make sense
to pass through any vfs interface implementations further down the line
to vfs_default.

Instead make use of get_fs_capabilties to start with already known fs
capabilties from connect phase.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Oct  7 13:36:11 UTC 2024 on atb-devel-224
2024-10-07 13:36:11 +00:00
Anoop C S
9524b402f8 vfs_ceph_new: Retrieve fs capabilties using vfs_get_fs_capabilities
Make use of get_fs_capabilties to start with already known fs
capabilties from connect phase.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-07 12:25:30 +00:00
Anoop C S
58cf7a6320 vfs_ceph_new: Populate fs capabilities within vfs_ceph_statvfs
SMB_VFS_STATVFS implementation for vfs_ceph_new failed to fill in the
FsCapabilities field for vfs_statvfs_struct. Insert the minimum
required values for defining the capabilties of a ceph file system.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-07 12:25:30 +00:00
Anoop C S
44e4e1eade vfs_ceph: Retrieve fs capabilties using vfs_get_fs_capabilities
vfs_ceph is supposed to be the last entry when listed with other vfs
modules. This is due to the fact that the connection path is not local
to the server but relative to the virtual remote file system beneath
it. Especially SMB_VFS_FS_CAPABILITIES implementation from vfs_default
is likely to return incorrect results based on the connection path
assumed to be local to the server which might not be the case with
ceph module stacked. Therefore it doesn't make sense to pass through
any vfs interface implementations further down the line to vfs_default.

Instead make use of get_fs_capabilties to start with already known fs
capabilties from connect phase.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-07 12:25:30 +00:00
Anoop C S
0d922d06a7 vfs_ceph: Populate fs capabilities within cephwrap_statvfs
SMB_VFS_STATVFS implementation for vfs_ceph failed to fill in the
FsCapabilities field for vfs_statvfs_struct. Insert the minimum
required values for defining the capabilties of a ceph file system.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-07 12:25:30 +00:00
Anoop C S
9bced4429e vfs_default: Retrieve fs capabilites using vfs_get_fs_capabilties
Make use of get_fs_capabilties to start with already known fs
capabilties from connect phase.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-07 12:25:30 +00:00
Anoop C S
b1fbaefc66 s3/smbd: Add a helper to fetch fs capabilities
We create a new helper function to retrieve the fs capabilties via
STATVFS call. Additionally set other capabilities based on specific
parametric options. This is 99.9% taken from SMB_VFS_FS_CAPABILITIES
implementation of vfs_default in preparation to be called from any
required vfs module.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-07 12:25:30 +00:00
Volker Lendecke
e819d55c4c utils: Fix up 14a5336802
Obvious omission

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sun Oct  6 02:25:09 UTC 2024 on atb-devel-224
2024-10-06 02:25:09 +00:00
Pavel Filipenský
c75b08c0d6 s3:g_lock: Do not let pointers to point outside the input buffer
If num_shared == 0 the shared points at the address outside the buf.
Make it NULL instead.

(gdb) p *lck
$33 = {
  exclusive = {
    pid = 1187098,
    task_id = 0,
    vnn = 4294967295,
    unique_id = 7349874180613937639
  },
  num_shared = 0,
  shared = 0x555555646980 "@kdUUU",
  unique_lock_epoch = 1489043017590848833,
  unique_data_epoch = 11232048132975083808,
  datalen = 0,
  data = 0x555555646980 "@kdUUU"
}

Same for datalen & data.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Sat Oct  5 14:44:46 UTC 2024 on atb-devel-224
2024-10-05 14:44:46 +00:00
Volker Lendecke
ab41b3612a lib: Change ADD_TO_ARRAY to use a tmp variable
This should fix a few Coverity Resource Leak findings. Coverity does
not understand that SMB_ASSERT aborts the program, so it believes if
realloc fails we leak the previous allocation. Those are false
positives, but doing it this way does not cost much.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-02 13:12:30 +00:00
Volker Lendecke
14a5336802 lib: Factor out ADD_TO_MALLOC_ARRAY()
ADD_TO_ARRAY with an explicit NULL mem_ctx is only used in 3
places. I've checked the other places, and I think I made sure that the
mem_ctx being passed in is non-NULL everywhere else.

This makes the "legacy" use with SMB_REALLOC more obvious.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-02 13:12:30 +00:00
Christof Schmitt
30b0fa892a shadow_copy2: Ignore VFS_OPEN_HOW_WITH_BACKUP_INTENT
d1846452e9 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
2024-10-02 08:06:38 +00:00
Andreas Schneider
af011b987a s3:notifyd: Use a watcher per db record
This fixes a O(n²) performance regression in notifyd. The problem was
that we had a watcher per notify instance. This changes the code to have
a watcher per notify db entry.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Oct  1 14:22:43 UTC 2024 on atb-devel-224
2024-10-01 14:22:43 +00:00
Stefan Metzmacher
2c91e81ce6 s3:winbindd: let store_current_dc_in_gencache() take the dcaddr directly
We could avoid relying on smbXcli_conn_remote_sockaddr() as much as
possible, because we aim to remove domain->conn.cli same day...

Also note that find_dc() always filled domain->dcaddr already
when cm_open_connection() calls store_current_dc_in_gencache().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Oct  1 11:01:35 UTC 2024 on atb-devel-224
2024-10-01 11:01:34 +00:00
Stefan Metzmacher
d9183ccc89 s3:winbindd: dcip_check_name() only takes pss as const input value
The makes things easier to understand, because the callers
pass in &domain->dcaddr, which could also used as output value.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Stefan Metzmacher
b375f7dca9 s3:winbindd: set_dc_type_and_flags() doesn't need to do something for primary or internal domains
In the end set_dc_type_and_flags should be removed completely, but
this is a good start in the right direction...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Stefan Metzmacher
b9207b32fc s3:winbindd: let add_trusted_domain() mark domains as initialized when loaded from config
We at least pass SEC_CHAN_LOCAL for internal domains,
only learned domains use SEC_CHAN_NULL.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Stefan Metzmacher
a15f67a00e s3:winbindd: remove unused line in add_trusted_domain()
Review with: git show -U8

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Stefan Metzmacher
749c515bab s3:winbindd: it's 2024 and all AD domains should be native now
No need to use dssetup_DsRoleGetPrimaryDomainInformation that
only adds latency...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Stefan Metzmacher
f2fd860251 s3:winbindd: let cm_connect_lsa() require schannel also for direct trusts
This means as domain member we require it also for our primary domain.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Stefan Metzmacher
ba24faaf91 s3:winbindd: let connect_preferred_dc() pass the dcname to smbsock_connect()
The is not critical, but avoids using the ip address with
fallback to '*SMBSERVER' for connections to port 139.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Stefan Metzmacher
56fc50b0aa s3:libsmb: ads_dc_name() doesn't need to retry if we found a DC in the closest site
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-01 09:53:32 +00:00
Jule Anger
25a6e1c8e7 libsmb: use more precise error status
NO_MEMORY is the only possible error.

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Oct  1 08:15:35 UTC 2024 on atb-devel-224
2024-10-01 08:15:35 +00:00
Stefan Metzmacher
aac22d9eba s3:passdb: ENCTYPE_DES_CBC_MD5 is not longer used in secrets_domain_info_kerberos_keys()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Sep 30 17:03:55 UTC 2024 on atb-devel-224
2024-09-30 17:03:55 +00:00
Stefan Metzmacher
628d7b6f2e s3:rpc_client: pass remote_{name,sockaddr} to rpccli_setup_netlogon_creds[_locked]()
We shouldd not rely on cli_state to be a valid pointer
(at least not when NCACN_IP_TCP is used...)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-09-29 06:56:33 +00:00
Stefan Metzmacher
c3222192a4 s3:rpc_client: add missing TALLOC_FREE(frame) in cli_rpc_pipe_open()
This was missing in commit 637a8e5270.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-09-29 06:56:33 +00:00
Andreas Schneider
bad3fb0c2e s3:tests: Write stderr to file to be able to print it on failure
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2024-09-27 07:55:29 +00:00
Andreas Schneider
59e4ea91f2 s3:tests: Track the status of smbcquotas and not tr
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2024-09-27 07:55:29 +00:00
Andreas Schneider
91f0d7e1c9 s3:client: Improve error message on cli_setatr() failure
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep 27 07:54:34 UTC 2024 on atb-devel-224
2024-09-27 07:54:34 +00:00
Volker Lendecke
93db1c7f3b pylibsmb: Fix a typo
pylibsmb is supposed to be used only internally, at least I hope this
has not made it into an API that is perceived to be publically used.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Sep 26 16:35:55 UTC 2024 on atb-devel-224
2024-09-26 16:35:55 +00:00
Volker Lendecke
342d45eddb posix_ext: Pass unix file type through posix query_directory
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
529951ade5 smbd: Return file type in the posix create context response
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
5a3fd9c0f5 idl: Rename smb3_posix_cc_info.posix_perms to posix_mode
We'll stash the file type in there soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
2182a12c44 pylibsmb: Add unix_mode_to_wire and wire_mode_to_unix
Make the wire-representation of mode_t available for tests

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
03fe0d631d smbd: Simplify unix_perms_from_wire()
Remove enum perm_type: Only the _NEW_ defines were actually used, and
this made the logic harder for me to understand than necessary.

On the other hand, it forced you to think about what this is. Now you
could theoretically miss applying masks. Still, I like it better with
this patch.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
bf82e232d1 smbd: Factor out create/directory mode/mask logic
Don't write down that logic twice

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
2ba46540c9 smbd: Slightly simplify unix_perms_from_wire()
Avoid an else-branch, we return before

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
6084914e22 libsmb: Move unix_filetype_to_wire() to libcli/smb
Mostly symmetry reasons, we have the opposite function here as well

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
4c9aa5fa15 libsmb: Rename and simplify unix_filetype_from_wire()
Align naming with the perms functions, use the fact that the unix
types are numbered the way they are

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
977fb57d22 libsmb: Remove duplicate prototypes
libcli/smb/smb_util.h also has these

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Volker Lendecke
13a9417f0d smbd: Return reparse tag in smb311 unix query dir
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
677a6125bc s3:rpc_client: let cli_rpc_pipe_open_schannel() use rpccli_connect_netlogon() for netlogon
This way we could reuse the connection already created...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
d1a3c74eb9 s3:rpc_client: pass remote_{name,sockaddr} to rpccli_connect_netlogon()
Otherwise this can only work with NCACN_NP...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
10d34de8d3 s3:libnet: make use of rpccli_connect_netlogon() instead of reimplement the logic
We only need the logic to setup a full netlogon connection once...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
3e8747944f s3:rpc_client: let rpccli_connect_netlogon() reuse the existing connection
We either use security context multiplexing if negotiated and
just do an alter_context on the existing connection or
we create a new connection within the same association group.

This is basically what windows clients are doing...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
bbea955c3d s3:rpc_client: allow rpccli_setup_netlogon_creds_locked() to return netlogon_pipe
Let the caller decide if it wants to keep the netlogon connection...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
7a68a90ba8 s3:rpc_client: make rpccli_setup_netlogon_creds_locked() static
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
14fe854ec5 s3:rpc_client: split out cli_rpc_pipe_client_auth_schannel()
This will allow us to use it without creating a new
association group and transport connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
dd79808415 s3:rpc_client: add cli_rpc_pipe_client_prepare_alter() helper
This will allow to do an alter context if security context multiplexing
is negotiated or opening a new connection in the same association group.

The old connection will be kept open, but not used anymore...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00
Stefan Metzmacher
899c9f2d68 s3:rpc_client: make real use of rpc_client_{association,connection}
This will allow NCACN_NP and NCACN_IP_TCP to support
alter_context with security context multiplexing
or otherwise more than one connection per association group.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26 15:22:46 +00:00