slow/samba-autobuild/.git
3 days agos4: torture: Add a new test lease_rename_with_overwrite. master
Jeremy Allison [Tue, 17 Sep 2024 18:47:31 +0000 (11:47 -0700)]
s4: torture: Add a new test lease_rename_with_overwrite.

Creates and opens two files with leases, then tries
rename-with-overwrite on file_src -> file_dst.

Ensures we get a lease break on file_dst before
getting the access denied response.

Passes against Windows, fails against Samba.

Add knownfail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 days agosync machine password to keytab: handle FreeIPA use case
Alexander Bokovoy [Tue, 3 Sep 2024 05:48:24 +0000 (08:48 +0300)]
sync machine password to keytab: handle FreeIPA use case

FreeIPA uses own procedure to retrieve keytabs and during the setup of
Samba on FreeIPA client the keytab is already present, only machine
account needs to be set in the secrets database.

'sync machine password to keytab' option handling broke this use case by
always attempting to contact a domain controller and failing to do so
(Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=2309199).

The original synchronizing machine account password to keytab feature
did not have a mechanism to disable its logic at all.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Fri Sep 13 13:16:09 UTC 2024 on atb-devel-224

8 days agodocs_xml/vfs_ceph_new: Add new proxy option
Anoop C S [Thu, 5 Sep 2024 06:15:19 +0000 (11:45 +0530)]
docs_xml/vfs_ceph_new: Add new proxy option

Update man page to describe new 'proxy' module option.

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

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): Thu Sep 12 16:51:14 UTC 2024 on atb-devel-224

8 days agowscript_build: Do not link vfs_ceph_new against libcephfs
Anoop C S [Sun, 8 Sep 2024 07:22:59 +0000 (12:52 +0530)]
wscript_build: Do not link vfs_ceph_new against libcephfs

vfs_ceph_new dynamically loads the appropriate libcephfs shared
libraries which means that we don't statically link against it.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Use function pointers for API calls
Anoop C S [Thu, 5 Sep 2024 09:50:28 +0000 (15:20 +0530)]
vfs_ceph_new: Use function pointers for API calls

Replace direct function calls with pointers holding their equivalent
addresses.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Pass module config to userperm helpers
Anoop C S [Thu, 5 Sep 2024 09:46:54 +0000 (15:16 +0530)]
vfs_ceph_new: Pass module config to userperm helpers

userperm helpers will switch to function references instead of direct
invocation of APIs. This would mean the matching config structure is
passed to those helpers.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Hold a config reference in vfs_ceph_fh
Anoop C S [Thu, 5 Sep 2024 08:31:37 +0000 (14:01 +0530)]
vfs_ceph_new: Hold a config reference in vfs_ceph_fh

This is required to perform the cleanup when fsp extension destructor is
called as part of VFS_REMOVE_FSP_EXTENSION where mount information and
function references are to be used in upcoming changes.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Call vfs_ceph_userperm_new with handle->conn
Anoop C S [Thu, 5 Sep 2024 09:20:48 +0000 (14:50 +0530)]
vfs_ceph_new: Call vfs_ceph_userperm_new with handle->conn

vfs_ceph_userperm_new() only need connection structure from handle
for fetching the current unix token. Therefore modify the signature
to accept just handle->conn.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Populate function pointers with addresses
Guenther Deschner [Thu, 5 Sep 2024 08:10:27 +0000 (13:40 +0530)]
vfs_ceph_new: Populate function pointers with addresses

Use dlysm() for assigning addresses to already declared libcephfs
low-level API function pointers.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Add required function pointers to config
Guenther Deschner [Thu, 5 Sep 2024 08:01:13 +0000 (13:31 +0530)]
vfs_ceph_new: Add required function pointers to config

Declare necessary libcephfs low-level APIs as function pointers to be
assigned with corresponding loadable addresses.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Dynamically open library for 'proxy' mode
Guenther Deschner [Thu, 5 Sep 2024 07:49:52 +0000 (13:19 +0530)]
vfs_ceph_new: Dynamically open library for 'proxy' mode

Use dlopen() to load either of the shared libraries(libcephfs.so or
libcephfs_proxy.so) based on the configuration for 'proxy' module
parameter. Further down the line we will define the required APIs
as function pointers within the config structure.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Introduce new parametric option 'proxy'
Guenther Deschner [Thu, 5 Sep 2024 07:43:38 +0000 (13:13 +0530)]
vfs_ceph_new: Introduce new parametric option 'proxy'

Provide early support for consuming yet to come libcephfs proxy[1] for
optimized resource utilization. For better control we make use of an
additional module specific option 'proxy' to specify the intent to load
proxy library. With the default value 'no' a regular cephfs connection
is established. There is also an 'auto' mode which can fall back to the
regular connection if proxy requirements are not met.

[1] https://github.com/ceph/ceph/pull/58376

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

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 days agovfs_ceph_new: Add a new struct to hold ceph module config
Guenther Deschner [Thu, 5 Sep 2024 06:49:52 +0000 (12:19 +0530)]
vfs_ceph_new: Add a new struct to hold ceph module config

Consolidate all required configuration related data under a dedicated
structure named vfs_ceph_config. As of now it includes the location of
configuration file, file system name, ceph client user id and mount
related information. This is expected to grow in future with more
details as and when required. Apart from that small cleanups are also
done to make code more robust.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
9 days agovfs_ceph_new: implement DFS hooks using libcephfs low-level APIs
Shachar Sharon [Mon, 12 Aug 2024 11:45:53 +0000 (14:45 +0300)]
vfs_ceph_new: implement DFS hooks using libcephfs low-level APIs

Refactor the VFS hooks 'create_dfs_pathat_fn' and 'read_dfs_pathat_fn'
in 'vfs_ceph_new.c' to use libcephfs low-level APIs: instead of using
path-based operations (as done in legacy 'vfs_ceph.c') use inode based
operations to create and read msdfs symbolic-links values.

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

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): Wed Sep 11 19:09:41 UTC 2024 on atb-devel-224

10 days agolibndr: Apply endianness flags to subndr
Volker Lendecke [Fri, 30 Aug 2024 15:03:38 +0000 (17:03 +0200)]
libndr: Apply endianness flags to subndr

We're creating a fresh subcontext for a "[MS-RPCE] 2.2.6 Type
Serialization Version 1". Probably nobody has tested a big endian
subcontext yet.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Sep 10 23:04:19 UTC 2024 on atb-devel-224

10 days agolibndr: Align an integer type
Volker Lendecke [Thu, 29 Aug 2024 14:41:21 +0000 (16:41 +0200)]
libndr: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 days agolibndr: Use UINT32_MAX -- no need to count F's
Volker Lendecke [Thu, 29 Aug 2024 09:41:07 +0000 (11:41 +0200)]
libndr: Use UINT32_MAX -- no need to count F's

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 days agolibndr: Remove duplicate prototype
Volker Lendecke [Mon, 26 Aug 2024 13:32:20 +0000 (15:32 +0200)]
libndr: Remove duplicate prototype

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 days agolibndr: We don't need "../" in includes, -I has what is needed
Volker Lendecke [Mon, 26 Aug 2024 10:04:20 +0000 (12:04 +0200)]
libndr: We don't need "../" in includes, -I has what is needed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 days agoutil: Make show_msg call DEBUG just once
Volker Lendecke [Mon, 17 Jun 2024 11:08:47 +0000 (13:08 +0200)]
util: Make show_msg call DEBUG just once

format_debug_text() still splits up lines with separate write-calls, but
DEBUGADD is something that I would like to get rid of.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 days agolib: Align integer types
Volker Lendecke [Mon, 5 Aug 2024 08:31:35 +0000 (10:31 +0200)]
lib: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 days agotests: Improve the error message for bad format chars
Volker Lendecke [Thu, 5 Sep 2024 11:06:23 +0000 (13:06 +0200)]
tests: Improve the error message for bad format chars

Print the faulty character for easier finding it.

I did not find out how to split the format string into two lines such
that self.fail would properly print the whole thing in its exception,
so we have a long line here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 days agolibrpc/ndr: Fix fuzz CI on latest tumbleweed
Noel Power [Mon, 9 Sep 2024 13:58:26 +0000 (14:58 +0100)]
librpc/ndr: Fix fuzz CI on latest tumbleweed

running samba-fuzz CI job on latest tumbleweed docker image results in;

../../librpc/ndr/ndr_orpc.c: In function ‘ndr_print_DUALSTRINGARRAY’:
../../librpc/ndr/ndr_orpc.c:97:49: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
   97 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                                                 ^
../../librpc/ndr/ndr_orpc.c:97:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 13
   97 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../librpc/ndr/ndr_orpc.c:105:49: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  105 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                                                 ^
../../librpc/ndr/ndr_orpc.c:105:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 13
  105 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../librpc/ndr/ndr_orpc.c: In function ‘ndr_print_STRINGARRAY’:
../../librpc/ndr/ndr_orpc.c:159:49: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  159 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                                                 ^
../../librpc/ndr/ndr_orpc.c:159:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 13
  159 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Sep 10 01:22:28 UTC 2024 on atb-devel-224

11 days agonetcmd: user: Fix typo in samba-tool error message
Lyanis Souidi [Mon, 9 Sep 2024 14:34:19 +0000 (16:34 +0200)]
netcmd: user: Fix typo in samba-tool error message

Fix typo in "samba-tool user add" error message when adding a user with
NIS features : the argument for the uid number is --uid-number and not
--uidNumber.

RN: Fix typo in samba-tool error message.

Signed-off-by: Lyanis Souidi <lyanis.souidi@u-pec.fr>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 weeks agolibsecurity: Simplify struct ace_condition_script
Volker Lendecke [Wed, 4 Sep 2024 15:13:44 +0000 (17:13 +0200)]
libsecurity: Simplify struct ace_condition_script

We only need the stack temporarily, no reason to put it in the struct

Signed-off-by: Volker Lendecke <vl@samba.org>
Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Sep  6 14:23:58 UTC 2024 on atb-devel-224

2 weeks agoREADME: Add languages to code blocks for highlighting
Andreas Schneider [Fri, 28 Jun 2024 11:01:24 +0000 (13:01 +0200)]
README: Add languages to code blocks for highlighting

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Sep  5 14:27:30 UTC 2024 on atb-devel-224

2 weeks agosmbd: improve reinit_after_fork error handling
David Disseldorp [Wed, 4 Sep 2024 02:54:09 +0000 (02:54 +0000)]
smbd: improve reinit_after_fork error handling

reinit_after_fork() may panic or return an error on failure. When smbd
is started in interactive mode, it ignores the reinit_after_fork()
return status and unconditionally proceeds to smbd_process().

Similarly, if messaging_reinit() fails within reinit_after_fork() then
it will subsequently call ctdb_async_ctx_reinit() if clustering is
enabled.

There's no reason why these errors shouldn't be handled immediately, so
add appropriate error handling.

Found by code inspection; not seen in the wild.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Sep  4 09:53:01 UTC 2024 on atb-devel-224

2 weeks 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

2 weeks 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>
3 weeks 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

3 weeks agoctdb-tests: Add persistent TDB backup tests
Martin Schwenke [Wed, 10 Apr 2024 06:55:01 +0000 (16:55 +1000)]
ctdb-tests: Add persistent TDB backup tests

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Aug 30 00:08:41 UTC 2024 on atb-devel-224

3 weeks agoctdb-scripts: Add support for backing up persistent TDBs
Martin Schwenke [Fri, 5 Apr 2024 06:12:40 +0000 (17:12 +1100)]
ctdb-scripts: Add support for backing up persistent TDBs

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 weeks agoctdb-scripts: Move database handling to its own event script
Martin Schwenke [Mon, 8 Apr 2024 01:15:24 +0000 (11:15 +1000)]
ctdb-scripts: Move database handling to its own event script

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 weeks agoctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"
Martin Schwenke [Mon, 8 Apr 2024 01:08:33 +0000 (11:08 +1000)]
ctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 weeks agoctdb-scripts: Remove unused variable NFS_HOSTNAME
Martin Schwenke [Wed, 1 May 2024 00:22:05 +0000 (10:22 +1000)]
ctdb-scripts: Remove unused variable NFS_HOSTNAME

This was passed to CTDB's old smnotify.  This has been replaced by use
of nfs-utils' sm-notify, which doesn't need this.

In test, a fake NFS_HOSTNAME is still needed.  Real sm-notify will get
it from a reverse host lookup of the IP address.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 weeks agoctdb-scripts: Use nfs-utils' sm-notify instead of CTDB's smnotify
Martin Schwenke [Fri, 3 Mar 2017 04:44:08 +0000 (15:44 +1100)]
ctdb-scripts: Use nfs-utils' sm-notify instead of CTDB's smnotify

CTDB's smnotify does not support IPv6 and is difficult to maintain.

So, create directories of files and pass them to NFS util's sm-notify.

There is an implied change here, because NFS utils sm-notify stopped
sending IP addresses as mon_name back in 2010:

  http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commitdiff;h=900df0e7c0b9006d72d8459b30dc2cd69ce495a5

This will change advice given in the wiki to use a hostname for the
cluster with round-robin DNS, since this is what is best supported.

Another behavioural change is that sm-notify only sends "up"
notifications with an odd state.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 weeks agoctdb-failover: Add ctdb_smnotify_helper
Martin Schwenke [Wed, 10 May 2023 02:21:07 +0000 (12:21 +1000)]
ctdb-failover: Add ctdb_smnotify_helper

statd callout will shortly be updated to use NFS utils' sm-notify.
This tiny helper will be used to create on-disk state files used by
sm-notify.  These state files contain endian-specific fields, so
better to write a simple C implementation than to do crazy things in a
shell script (or call out to Python).

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 weeks agos4:torture/smb2: better error handling in create.c
Stefan Metzmacher [Thu, 25 Jul 2024 09:58:37 +0000 (11:58 +0200)]
s4:torture/smb2: better error handling in create.c

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

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): Thu Aug 29 19:47:54 UTC 2024 on atb-devel-224

3 weeks agos4:torture/raw: better error handling in streams.c
Stefan Metzmacher [Thu, 25 Jul 2024 09:06:18 +0000 (11:06 +0200)]
s4:torture/raw: better error handling in streams.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agos4:torture/smb2: make use of torture_assert_*_equal_goto() in streams.c
Stefan Metzmacher [Mon, 8 Jul 2024 07:05:49 +0000 (09:05 +0200)]
s4:torture/smb2: make use of torture_assert_*_equal_goto() in streams.c

We should fail immediately...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agos4:libcli/smb2: let smb2_deltree delete directory streams
Stefan Metzmacher [Thu, 18 Jul 2024 14:22:55 +0000 (16:22 +0200)]
s4:libcli/smb2: let smb2_deltree delete directory streams

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agos4:libcli: allow smb2_composite_unlink* to truncate the file before close
Stefan Metzmacher [Tue, 30 Jul 2024 14:33:15 +0000 (16:33 +0200)]
s4:libcli: allow smb2_composite_unlink* to truncate the file before close

This is needed to delete streams...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agos3:tests: make use of TMPDIR in test_symlink_traversal_*.sh
Stefan Metzmacher [Wed, 7 Aug 2024 14:28:22 +0000 (16:28 +0200)]
s3:tests: make use of TMPDIR in test_symlink_traversal_*.sh

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agolib/torture: add torture_assert_nttime_equal_goto()
Stefan Metzmacher [Tue, 30 Jul 2024 11:57:25 +0000 (13:57 +0200)]
lib/torture: add torture_assert_nttime_equal_goto()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agolibrpc/ndr: remove unused NDR_PUSH_ALLOC_SIZE()
Stefan Metzmacher [Thu, 29 Aug 2024 11:27:48 +0000 (13:27 +0200)]
librpc/ndr: remove unused NDR_PUSH_ALLOC_SIZE()

Pair-Programmed-With: Volker Lendecke <vl@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agolibrpc/ndr: avoid alignment allocation in ndr_push_DATA_BLOB()
Stefan Metzmacher [Thu, 29 Aug 2024 11:26:04 +0000 (13:26 +0200)]
librpc/ndr: avoid alignment allocation in ndr_push_DATA_BLOB()

Pair-Programmed-With: Volker Lendecke <vl@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agolibndr: Streamline ndr_token_retrieve_cmp_fn
Volker Lendecke [Wed, 28 Aug 2024 10:32:45 +0000 (12:32 +0200)]
libndr: Streamline ndr_token_retrieve_cmp_fn

Rename the public function to ndr_token_peek_cmp_fn, the only user
does not remove the token. Factor out ndr_token_find to move the
token-removing logic to ndr_token_retrieve, the only caller that does
remove the token.

Keep libndr at 6.0.0, this has not been released yet.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Aug 29 08:40:52 UTC 2024 on atb-devel-224

3 weeks agolibndr: Simplify ndr_token_retrieve_cmp_fn()
Volker Lendecke [Wed, 28 Aug 2024 10:08:57 +0000 (12:08 +0200)]
libndr: Simplify ndr_token_retrieve_cmp_fn()

Avoid an if-statement inside by passing a pointer-comparing function

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agolibcli/smb: Fix failure of Smb3UnixTests.test_create_context_reparse
Noel Power [Wed, 28 Aug 2024 15:19:27 +0000 (16:19 +0100)]
libcli/smb: Fix failure of Smb3UnixTests.test_create_context_reparse

On tumbleweed at least the definition in py_reparse_put of 'reserved' as
'unsigned' causes the tag value to be overwritten. Note: ParseTuple is
given a format of 'Kk' where
  K = unsigned long long (for tag)
  k = unsigned long      (for reserved)

The problem is 'reserved' is defined as 'unsigned' which on a
64 bit linux system has size 4. The size however of the 'unsigned long' type
on the same 64 bit system is 8. This causes 'tag' to be overwritten by
the value of 'reserved' because it's destination size is smaller than
expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15702
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Aug 28 18:38:01 UTC 2024 on atb-devel-224

3 weeks 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

3 weeks 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>
3 weeks agodsdb:cracknames: free more on error (CID 240724)
Douglas Bagnall [Wed, 31 Jul 2024 01:39:46 +0000 (13:39 +1200)]
dsdb:cracknames: free more on error (CID 240724)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Aug 28 05:39:36 UTC 2024 on atb-devel-224

3 weeks agodsdb:util: dsdb_module_dn initialises on failure
Douglas Bagnall [Wed, 31 Jul 2024 01:31:02 +0000 (13:31 +1200)]
dsdb:util: dsdb_module_dn initialises on failure

I think this may be a root cause of some Coverity false positives.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agodsdb:mod:operational: initialise a pointer (CID 1499411)
Douglas Bagnall [Wed, 31 Jul 2024 01:27:40 +0000 (13:27 +1200)]
dsdb:mod:operational: initialise a pointer (CID 1499411)

A Coverity false positive (we check for error) but it is worth
doing per README.Coding

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agondr:dnsp: avoid theoretical int overflow (CID 1609418)
Douglas Bagnall [Tue, 30 Jul 2024 22:41:54 +0000 (10:41 +1200)]
ndr:dnsp: avoid theoretical int overflow (CID 1609418)

Coverity points out that if the string is longer than INT_MAX, the int
will overflow and the cast to uint8_t will discard bits.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks 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>
3 weeks agos4:drs:test:getncchanges skips some tests with reserved_usn = 0
Douglas Bagnall [Thu, 8 Aug 2024 23:48:06 +0000 (11:48 +1200)]
s4:drs:test:getncchanges skips some tests with reserved_usn = 0

These tests are not affected by the reserved_usn change, so there is
no need to run them twice.

The test_repl_get_tgt_multivalued_links fails with or without
reserved_usn set to zero, but it fails differently in either case.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agos4:drs:test:getncchanges: remove timeout failure
Douglas Bagnall [Thu, 8 Aug 2024 23:29:11 +0000 (11:29 +1200)]
s4:drs:test:getncchanges: remove timeout failure

We don't need a timeout failure any more, since replication should
always work. Leaving the timeout in might sometimes cause a flapping
test if replication is being slow for some reason.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agos4:drsuapi:getncchanges: allow 0 reserved_usn reply
Douglas Bagnall [Wed, 7 Aug 2024 05:25:30 +0000 (17:25 +1200)]
s4:drsuapi:getncchanges: allow 0 reserved_usn reply

Azure AD will set reserved_usn to zero when we expect it to be
the number we gave them.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agos4:drsuapi:getncchanges: use DBG_ERR() macro
Douglas Bagnall [Thu, 13 Jun 2024 05:23:23 +0000 (17:23 +1200)]
s4:drsuapi:getncchanges: use DBG_ERR() macro

The next commit will indent this more, so it's a bit squished up.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agos4:drsuapi:getncchanges: fix whitespace
Douglas Bagnall [Wed, 7 Aug 2024 05:05:48 +0000 (17:05 +1200)]
s4:drsuapi:getncchanges: fix whitespace

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agos4:drs:tests: repeat getncchanges test with zero reserved_usn
Douglas Bagnall [Wed, 14 Aug 2024 01:26:37 +0000 (13:26 +1200)]
s4:drs:tests: repeat getncchanges test with zero reserved_usn

This emulates the behaviour of Azure AD.

As this is quite slow we will later reduce the test load in this case,
but for now we want to run all the getncchanges tests this way.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agos4:drs:tests: add hook for changing highwatermark
Douglas Bagnall [Thu, 8 Aug 2024 22:16:29 +0000 (10:16 +1200)]
s4:drs:tests: add hook for changing highwatermark

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agos4:drs:test:getncchanges: add a timeout failure
Douglas Bagnall [Thu, 8 Aug 2024 23:20:38 +0000 (11:20 +1200)]
s4:drs:test:getncchanges: add a timeout failure

In the next commit we are going to add tests in which the client
modifies the highwatermark in a way that resets replication (on Samba
only). After that we'll fix it.

If we leave the test in an eternal loop, the commit history will not
be bisectable, so we are temporarily going to turn long waits into
failures.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
3 weeks agolibcli:auth: Remove unreachable code (CID 1272968)
Joseph Sutton [Thu, 5 Oct 2023 23:36:13 +0000 (12:36 +1300)]
libcli:auth: Remove unreachable code (CID 1272968)

For us to reach the statement ‘if (0 < len1)’, ‘len1’ must be equal to
‘len2’, and they must not both be equal to zero. That cannot be the case
if ‘len1’ is equal to zero, and therefore the ‘else’ branch cannot be
reached.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 weeks agoutil:charset: Remove unreachable code (CID 1272948)
Joseph Sutton [Thu, 5 Oct 2023 21:54:57 +0000 (10:54 +1300)]
util:charset: Remove unreachable code (CID 1272948)

Suppose that ‘slen’ is equal to (size_t)-1. A few lines up, we had:

    if (lastp != 0) goto slow_path;

Therefore, ‘lastp’ must evaluate to false.

Now suppose that ‘slen’ is not equal to (size_t)-1. In that case, we
would have executed:

    if (slen != 0) goto slow_path;

Therefore, ‘slen’ must evaluate to false.

Consequently, this code can be seen to be unreachable.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 weeks agolibrpc: Speed up GUID_buf_string()
Jo Sutton [Wed, 1 Mar 2023 01:54:14 +0000 (14:54 +1300)]
librpc: Speed up GUID_buf_string()

This is faster than calling snprintf().

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 weeks agolib/util: Speed up slow data-blob-to-hex functions
Jo Sutton [Wed, 1 Mar 2023 01:50:45 +0000 (14:50 +1300)]
lib/util: Speed up slow data-blob-to-hex functions

This is much faster than calling sprintf() for every byte of data, and
improves the performance of functions outputting binary DNs.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 weeks agobootstrap: Migrate to Rocky8
David Mulder [Tue, 27 Aug 2024 15:32:43 +0000 (09:32 -0600)]
bootstrap: Migrate to Rocky8

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Aug 28 00:24:35 UTC 2024 on atb-devel-224

3 weeks agoidl: dnsp.h references NTTIME
Volker Lendecke [Sun, 25 Aug 2024 17:50:34 +0000 (19:50 +0200)]
idl: dnsp.h references NTTIME

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Aug 27 08:36:11 UTC 2024 on atb-devel-224

3 weeks agoidl: misc.idl references DATA_BLOB
Volker Lendecke [Sun, 25 Aug 2024 17:51:00 +0000 (19:51 +0200)]
idl: misc.idl references DATA_BLOB

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agopidl: Add headerhelper idl property
Volker Lendecke [Fri, 23 Aug 2024 14:39:58 +0000 (16:39 +0200)]
pidl: Add headerhelper idl property

Add includes to for example misc.h if needed, so that misc.h can be
directly included without prerequisites

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agolib: Make a few functions static
Volker Lendecke [Sun, 25 Aug 2024 17:29:24 +0000 (19:29 +0200)]
lib: Make a few functions static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agolibsmb: Simplify pdb_sethexpwd with hex_byte()
Volker Lendecke [Sun, 25 Aug 2024 10:08:49 +0000 (12:08 +0200)]
libsmb: Simplify pdb_sethexpwd with hex_byte()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agopidl:Samba4/Header: only include ntstatus.h if required
Stefan Metzmacher [Fri, 23 Aug 2024 15:25:34 +0000 (17:25 +0200)]
pidl:Samba4/Header: only include ntstatus.h if required

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agopidl: add scalarTypeUsed() helper to find if a type was actually used...
Stefan Metzmacher [Fri, 23 Aug 2024 15:24:19 +0000 (17:24 +0200)]
pidl: add scalarTypeUsed() helper to find if a type was actually used...

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agolib: Add libcli/util/ntstatus.h in a few headers where it's needed
Volker Lendecke [Fri, 23 Aug 2024 13:53:51 +0000 (15:53 +0200)]
lib: Add libcli/util/ntstatus.h in a few headers where it's needed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agoidl: Remove unused KRB5_EDATA_NTSTATUS
Volker Lendecke [Fri, 23 Aug 2024 13:39:30 +0000 (15:39 +0200)]
idl: Remove unused KRB5_EDATA_NTSTATUS

I think the last user went away with e2028837b95 in 2017

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agosmbd: Inline set_sticky_write_time_path into set_sticky_write_time_fsp
Volker Lendecke [Thu, 25 Jul 2024 11:23:21 +0000 (13:23 +0200)]
smbd: Inline set_sticky_write_time_path into set_sticky_write_time_fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agosmbd: Modernize a few DEBUGs
Volker Lendecke [Mon, 5 Aug 2024 11:45:07 +0000 (13:45 +0200)]
smbd: Modernize a few DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agosmbd: Introduce "ace" helper variable
Volker Lendecke [Mon, 5 Aug 2024 11:42:09 +0000 (13:42 +0200)]
smbd: Introduce "ace" helper variable

Use "psd->dacl->aces[0]" once instead of 3 times

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agoidl: security.idl compiles with only secace.h
Volker Lendecke [Thu, 22 Aug 2024 16:00:12 +0000 (18:00 +0200)]
idl: security.idl compiles with only secace.h

It does not need all of security.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agopidl: replace.h is sufficient in ndr_*.c
Volker Lendecke [Thu, 22 Aug 2024 15:20:07 +0000 (17:20 +0200)]
pidl: replace.h is sufficient in ndr_*.c

Avoid a few uses of includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agolib: Add a few explicit includes
Volker Lendecke [Thu, 22 Aug 2024 16:25:06 +0000 (18:25 +0200)]
lib: Add a few explicit includes

Required to trim down includes from gen_ndr/*security*

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agolibndr: Use _talloc_array() to benefit from overflow protection
Volker Lendecke [Wed, 21 Aug 2024 12:03:22 +0000 (14:03 +0200)]
libndr: Use _talloc_array() to benefit from overflow protection

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agolibndr: Remove 368 bytes from R/W data into R/O text segment
Volker Lendecke [Wed, 21 Aug 2024 11:46:20 +0000 (13:46 +0200)]
libndr: Remove 368 bytes from R/W data into R/O text segment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agosmbd: Modernize a few DEBUGs
Volker Lendecke [Wed, 21 Aug 2024 09:14:45 +0000 (11:14 +0200)]
smbd: Modernize a few DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agoctdb: Add a NULL check to convert_node_map_to_list()
Volker Lendecke [Tue, 20 Aug 2024 10:48:20 +0000 (12:48 +0200)]
ctdb: Add a NULL check to convert_node_map_to_list()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
3 weeks agosource3/wscript: Introduce auto mode to build ceph vfs modules
Anoop C S [Mon, 5 Aug 2024 13:21:49 +0000 (18:51 +0530)]
source3/wscript: Introduce auto mode to build ceph vfs modules

Use 'auto' mode as the default for building ceph vfs modules so that an
explicit --enable-cephfs can reliably fail in the absence of required
dependencies.

ref: https://lists.samba.org/archive/samba/2024-August/249569.html

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): Tue Aug 27 06:18:51 UTC 2024 on atb-devel-224

4 weeks 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

4 weeks agos3:tests: Fix spelling error
Martin Schwenke [Tue, 13 Aug 2024 11:55:34 +0000 (21:55 +1000)]
s3:tests: Fix spelling error

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Aug 22 10:38:09 UTC 2024 on atb-devel-224

4 weeks agocodespell: Ignore CTDB bin/
Martin Schwenke [Tue, 13 Aug 2024 11:43:48 +0000 (21:43 +1000)]
codespell: Ignore CTDB bin/

This might be hanging around if standalone CTDB builds have been done.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 weeks 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

4 weeks agolibsmb: Remove cli_state->rap_error
Volker Lendecke [Tue, 20 Aug 2024 13:13:52 +0000 (15:13 +0200)]
libsmb: Remove cli_state->rap_error

I could not find any caller which uses rap_error outside of the
routine implementing the rap client call itself.

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): Wed Aug 21 12:49:45 UTC 2024 on atb-devel-224

4 weeks agolibsmb: Remove unused cli_NetWkstaUserLogoff()
Volker Lendecke [Mon, 19 Aug 2024 12:17:42 +0000 (14:17 +0200)]
libsmb: Remove unused cli_NetWkstaUserLogoff()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 weeks agolibsmb: Remove unused cli_ns_check_server_type()
Volker Lendecke [Mon, 19 Aug 2024 12:16:40 +0000 (14:16 +0200)]
libsmb: Remove unused cli_ns_check_server_type()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 weeks agoWHATSNEW: add 'vfs mkdir use tmp name' option
Stefan Metzmacher [Mon, 12 Aug 2024 12:41:47 +0000 (14:41 +0200)]
WHATSNEW: add 'vfs mkdir use tmp name' option

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

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 Aug 21 09:18:00 UTC 2024 on atb-devel-224

4 weeks agos3:smbd: let mkdir_internal() try VFS_RENAME_HOW_NO_REPLACE first
Stefan Metzmacher [Wed, 7 Aug 2024 15:01:53 +0000 (17:01 +0200)]
s3:smbd: let mkdir_internal() try VFS_RENAME_HOW_NO_REPLACE first

With renameat2(RENAME_NOREPLACE) being available
it's even better, as we don't even have the short
window where the incomplete directory is visible
to others.

The flow will be this:

tmp_name = ".::TMPNAME:D:$PID:client_name"
mkdirat(tmp_name, mode=client_mode);
prepare_acls(tmp_name);
renameat2(tmp_name, client_name, NOREPLACE);
if (EEXIST) {
   unlinkat(tmp_name);
   return EEXIST;
}
if (EINVAL) {
   /* fallback if NOREPLACE is not supported */
   mkdirat(client_name, mode=0);
   if (EEXIST) {
      unlinkat(tmp_name);
      return EEXIST;
   }
   renameat(tmp_name, client_name);
}

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 weeks agos3:vfs_default: implement VFS_RENAME_HOW_NO_REPLACE in vfswrap_renameat()
Stefan Metzmacher [Wed, 7 Aug 2024 11:14:23 +0000 (13:14 +0200)]
s3:vfs_default: implement VFS_RENAME_HOW_NO_REPLACE in vfswrap_renameat()

We can use renameat2() without ifdef as libreplace always provides it.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 weeks agos3:vfs: add VFS_RENAME_HOW_NO_REPLACE
Stefan Metzmacher [Wed, 7 Aug 2024 11:05:07 +0000 (13:05 +0200)]
s3:vfs: add VFS_RENAME_HOW_NO_REPLACE

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>