samba.git
21 months agotevent: version 0.13.0 tevent-0.13.0
Stefan Metzmacher [Mon, 25 Jul 2022 12:16:43 +0000 (14:16 +0200)]
tevent: version 0.13.0

- add tevent_cached_getpid()

Note the changes to ABI/tevent-0.12.1.sigs only
revert the temporary changes made there...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agotevent: tevent_cached_getpid() tests
Stefan Metzmacher [Mon, 25 Jul 2022 12:13:34 +0000 (14:13 +0200)]
tevent: tevent_cached_getpid() tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agotevent: add tevent_cached_getpid() helper
Stefan Metzmacher [Wed, 13 Jul 2022 12:30:47 +0000 (12:30 +0000)]
tevent: add tevent_cached_getpid() helper

This avoids a getpid() syscall per tevent_loop_once() iteration.

We provide tevent_cached_getpid() also as helper for external consumers
in order to have the logic only once.

Note the change to ABI/tevent-0.12.1.sigs will be reverted
with the bump to 0.13.0.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agosmbd: Userspace symlink eval in filename_convert_dirfsp()
Volker Lendecke [Thu, 14 Jul 2022 17:47:23 +0000 (19:47 +0200)]
smbd: Userspace symlink eval in filename_convert_dirfsp()

This converts filename_convert_dirfsp to do symlink evaluation in user
space. It uses openat_pathref_dirfsp_nosymlink() to open the dirpath
and looks at the proper NT_STATUS_STOPPED_ON_SYMLINK response. Using
this avoids filename_convert() and thus unix_convert() completely for
the SMB2_CREATE case.

The tests

samba3.blackbox.smbclient_s3.NT1.plain.Recursive ls across MS-DFS links

now correctly stop the symlink lookup recursion with
NT_STATUS_OBJECT_PATH_NOT_FOUND. Previously we did not correcly pass up the
ELOOP coming back from the stat-call.

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): Mon Jul 25 12:56:08 UTC 2022 on sn-devel-184

21 months agosmbd: Take care of @GMT in SMB1's reply_ntcreate_and_X()
Volker Lendecke [Tue, 12 Jul 2022 15:48:25 +0000 (17:48 +0200)]
smbd: Take care of @GMT in SMB1's reply_ntcreate_and_X()

Next we want to avoid filename_convert() to take care of this. The
SMB2 code has a proper TWRP token anyway, so let's push the
@GMT-handling to the SMB1 code that will be converted to
filename_convert_dirfsp().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agovfs_error_inject: Ignore openat() from openat_pathref_dirfsp_nosymlink()
Volker Lendecke [Sun, 24 Jul 2022 14:47:37 +0000 (16:47 +0200)]
vfs_error_inject: Ignore openat() from openat_pathref_dirfsp_nosymlink()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Add openat_pathref_dirfsp_nosymlink()
Volker Lendecke [Thu, 14 Jul 2022 17:44:04 +0000 (19:44 +0200)]
smbd: Add openat_pathref_dirfsp_nosymlink()

This does a step-by-step path resolution for a directory by splitting
up the path into individual components and does a loop like that

for component in components:
    fd = openat(dirfd, component, O_NOFOLLOW);
    close(dirfd);
    dirfd = fd

and it will report any symlink it finds in a way that will be
indirectly consumable for the smb2 symlink error response.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Make get_real_filename_at public
Volker Lendecke [Thu, 14 Jul 2022 17:37:30 +0000 (19:37 +0200)]
smbd: Make get_real_filename_at public

We'll use this in files.c, which creates a bit of a cyclic
dependency. But files.c has all the lowlevel fsp handling, and we'll
add another routine there next which needs get_real_filename_at()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Some more assert in fd_openat()
Volker Lendecke [Tue, 14 Jun 2022 14:15:15 +0000 (16:15 +0200)]
smbd: Some more assert in fd_openat()

Before this patch we asserted that if we have a base_fsp then
smb_fname must have a stream name attached. Now we also assert that if
we don't have a base_fsp smb_fname is not a stream.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Simplify open_stream_pathref_fsp()
Volker Lendecke [Tue, 14 Jun 2022 15:17:54 +0000 (17:17 +0200)]
smbd: Simplify open_stream_pathref_fsp()

The main point of this function was to avoid fd_openat() and thus the
expensive non_widelink_open(). Now that fd_openat() has the direct
SMB_VFS_OPENAT() fast-path for streams, we can avoid duplicating the
logic in open_stream_pathref_fsp() again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: open_stream_pathref_fsp() does not need a dirfsp
Volker Lendecke [Mon, 13 Jun 2022 15:31:16 +0000 (17:31 +0200)]
smbd: open_stream_pathref_fsp() does not need a dirfsp

It opens relative to fsp->base_fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Simplify openat_pathref_fullname()
Volker Lendecke [Tue, 14 Jun 2022 15:21:54 +0000 (17:21 +0200)]
smbd: Simplify openat_pathref_fullname()

Don't set O_RDONLY|O_NONBLOCK in two steps into a variable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Open openat_pathref_fullname() for streams
Volker Lendecke [Tue, 14 Jun 2022 15:06:16 +0000 (17:06 +0200)]
smbd: Open openat_pathref_fullname() for streams

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Hand full_fname from openat_pathref_nostream()
Volker Lendecke [Tue, 14 Jun 2022 15:05:09 +0000 (17:05 +0200)]
smbd: Hand full_fname from openat_pathref_nostream()

Rename it to openat_pathref_fullname(), it will be used for stream
open next

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: A stream open does not need O_NOFOLLOW
Volker Lendecke [Tue, 14 Jun 2022 15:03:17 +0000 (17:03 +0200)]
smbd: A stream open does not need O_NOFOLLOW

Would not have hurt either, but this makes the next patch easier to
verify properly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Simplify openat_pathref_fsp()
Volker Lendecke [Mon, 13 Jun 2022 15:50:32 +0000 (17:50 +0200)]
smbd: Simplify openat_pathref_fsp()

Remove the implicit recursion

openat_pathref_fsp->openat_pathref_base_fsp->openat_pathref_fsp

by introducing openat_pathref_nostream() and use
open_stream_pathref_fsp() where possible. openat_pathref_nostream()
will change its name in further refactoring patches, but for
understanding this patch I think this name is good :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Simplify non_widelink_open()
Volker Lendecke [Mon, 13 Jun 2022 15:34:29 +0000 (17:34 +0200)]
smbd: Simplify non_widelink_open()

Now that non_widelink_open() does not see streams opens, we don't need
to take care of fsp->base_fsp anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agoVFS: NULL dirfsp for openat on stream opens
Volker Lendecke [Tue, 14 Jun 2022 14:33:57 +0000 (16:33 +0200)]
VFS: NULL dirfsp for openat on stream opens

The main optimization is to avoid non_widelink_open() for streams
opens based on the fact that all streams opens are relative to
fsp->base_fsp, which is a pathref fsp already.

Neither streams_xattr nor streams_depot referenced dirfsp for the
streams case. Make this more obvious in the callers by passing NULL
and asserting this: non-streams opens and streams opens are just
different things, streams-opens can and do reference a base fsp and
don't need the non_widelink_open logic.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agovfs_shadow_copy2: Don't reference dirfsp for streams
Volker Lendecke [Tue, 14 Jun 2022 14:28:25 +0000 (16:28 +0200)]
vfs_shadow_copy2: Don't reference dirfsp for streams

A stream open is always relative to fsp->base_fsp. This already holds
the full path name in fsp->base_fsp->fsp_name, so we don't really need
the full_path_from_dirfsp_atname(). full_path_from_dirfsp_atname() is
not really bad, but the next patches will avoid having a dirfsp for
stream opens overall.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Make fsp_attach_smb_fname() talloc_move() the name to the fsp
Volker Lendecke [Tue, 14 Jun 2022 14:52:39 +0000 (16:52 +0200)]
smbd: Make fsp_attach_smb_fname() talloc_move() the name to the fsp

For the current callers this does not make a difference, they have
already allocated *_smb_fname as a talloc child of fsp, but the next
patches will add one where it does.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Update fsp->fsp_flags.is_directory in vfs_stat_fsp()
Volker Lendecke [Thu, 30 Jun 2022 08:45:54 +0000 (10:45 +0200)]
smbd: Update fsp->fsp_flags.is_directory in vfs_stat_fsp()

The type of a fsp should never change, but if this call to
vfs_stat_fsp() is the very first one on this fsp, we must update this
flag.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agolibcli: Modernize a few DEBUG statements
Volker Lendecke [Sat, 2 Jul 2022 07:43:35 +0000 (09:43 +0200)]
libcli: Modernize a few DEBUG statements

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agotest3: Fix a debug message
Volker Lendecke [Tue, 12 Jul 2022 07:11:41 +0000 (09:11 +0200)]
test3: Fix a debug message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Factor out extract_snapshot_token() from canonicalize_snapshot_path()
Volker Lendecke [Thu, 14 Jul 2022 13:13:40 +0000 (15:13 +0200)]
smbd: Factor out extract_snapshot_token() from canonicalize_snapshot_path()

We'll use this elsewhere soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Simplify canonicalize_snapshot_path()
Volker Lendecke [Tue, 12 Jul 2022 15:08:19 +0000 (17:08 +0200)]
smbd: Simplify canonicalize_snapshot_path()

All we need to do is to convert the @GMT-Token and move the
rest. Before this patch we did a lot of talloc to move the @GMT token
to the beginning of the path only to cut it off immediately
again. Merge that logic into a simple memmove()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Don't create a fsp->base_fsp for a "::$DATA" stream
Volker Lendecke [Mon, 13 Jun 2022 14:15:21 +0000 (16:15 +0200)]
smbd: Don't create a fsp->base_fsp for a "::$DATA" stream

"::$DATA" is the main file, we don't need the overhead of base_fsp here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agotorture3: Fix an error check in torture_delete_fn()
Volker Lendecke [Tue, 28 Jun 2022 09:58:19 +0000 (11:58 +0200)]
torture3: Fix an error check in torture_delete_fn()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agoregistry3: Align an integer type
Volker Lendecke [Fri, 1 Jul 2022 16:24:53 +0000 (18:24 +0200)]
registry3: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agoregistry3: Align function types to what is returned
Volker Lendecke [Fri, 1 Jul 2022 16:24:31 +0000 (18:24 +0200)]
registry3: Align function types to what is returned

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agolib: Simplify canonicalize_absolute_path()
Volker Lendecke [Tue, 5 Jul 2022 11:48:18 +0000 (13:48 +0200)]
lib: Simplify canonicalize_absolute_path()

We don't need the separate "wrote_slash" boolean variable, we can just
look at what we wrote into p[-1]

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agolib: Remove a few #include "includes.h"
Volker Lendecke [Sat, 25 Jun 2022 09:07:44 +0000 (11:07 +0200)]
lib: Remove a few #include "includes.h"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Avoid a "? True : False"
Volker Lendecke [Fri, 17 Jun 2022 07:38:24 +0000 (09:38 +0200)]
smbd: Avoid a "? True : False"

Just came across this, looked weird...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agosmbd: Open up openat_internal_dir_from_pathref() for general dirs
Volker Lendecke [Fri, 15 Jul 2022 13:26:33 +0000 (15:26 +0200)]
smbd: Open up openat_internal_dir_from_pathref() for general dirs

We open "." fixed here, and fd_openat (or rather SMB_VFS_OPENAT) will
tell us if "dirfsp" does not point at a proper directory

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agolib: On FreeBSD util_paths.c does not find struct stat
Volker Lendecke [Fri, 22 Jul 2022 17:08:10 +0000 (19:08 +0200)]
lib: On FreeBSD util_paths.c does not find struct stat

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): Sun Jul 24 00:25:49 UTC 2022 on sn-devel-184

21 months agolib: Fix the 32-bit build
Volker Lendecke [Fri, 22 Jul 2022 17:25:20 +0000 (19:25 +0200)]
lib: Fix the 32-bit build

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agotorture: Fix the 32-bit build
Volker Lendecke [Fri, 22 Jul 2022 17:25:37 +0000 (19:25 +0200)]
torture: Fix the 32-bit build

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agolib: Fix the FreeBSD build
Volker Lendecke [Fri, 22 Jul 2022 17:36:59 +0000 (19:36 +0200)]
lib: Fix the FreeBSD build

"time_t" only comes in via a proper include of <time.h>

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agowinbind: Fix a "format string is not a string literal" warning
Volker Lendecke [Fri, 22 Jul 2022 17:34:57 +0000 (19:34 +0200)]
winbind: Fix a "format string is not a string literal" warning

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agowinbind: Fix the 32-bit build
Volker Lendecke [Fri, 22 Jul 2022 17:17:15 +0000 (19:17 +0200)]
winbind: Fix the 32-bit build

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agogpo: samba-gpupdate use s3 param for registry conf
David Mulder [Mon, 18 Jul 2022 15:19:24 +0000 (09:19 -0600)]
gpo: samba-gpupdate use s3 param for registry conf

Cause samba-gpupdate to use an s3 param so that
it can load settings from registry configuration.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul 22 20:40:51 UTC 2022 on sn-devel-184

21 months agoctdb-build: Add missing dependency on talloc
Martin Schwenke [Fri, 22 Jul 2022 01:41:57 +0000 (11:41 +1000)]
ctdb-build: Add missing dependency on talloc

The include isn't strictly necessary, since it is included via
common/reqid.c anyway.  However, it is a useful hint.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Jul 22 17:01:00 UTC 2022 on sn-devel-184

21 months agoctdb-tests: Work around unreadable file test failure when root
Martin Schwenke [Fri, 22 Jul 2022 01:05:21 +0000 (11:05 +1000)]
ctdb-tests: Work around unreadable file test failure when root

root can read files for which the mode prohibits reading, so this test
case fails when run as root.  Work around this when running as root.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: Use "git config" as last resort to parse nfs.conf
Martin Schwenke [Thu, 21 Jul 2022 04:22:25 +0000 (14:22 +1000)]
ctdb-scripts: Use "git config" as last resort to parse nfs.conf

Some versions of nfs-utils (e.g. recent CentOS 7) use /etc/nfs.conf
but do not include the nfsconf utility to extract values from the
file.  However, git has an excellent conf file parser, so use it as a
last resort.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: Avoid ShellCheck warning SC2295
Martin Schwenke [Fri, 27 May 2022 13:23:48 +0000 (23:23 +1000)]
ctdb-scripts: Avoid ShellCheck warning SC2295

For example:

In /home/martins/samba/samba/ctdb/tools/onnode line 304:
    [ "$nodes" != "${nodes%[ ${nl}]*}" ] && verbose=true
                             ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns.

Did you mean:
    [ "$nodes" != "${nodes%[ "${nl}"]*}" ] && verbose=true

For more information:
  https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b...

Who knew?  Thanks ShellCheck!

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-common: Use POSIX if_nameindex() to check interface existence
Martin Schwenke [Tue, 5 Jul 2022 02:31:57 +0000 (12:31 +1000)]
ctdb-common: Use POSIX if_nameindex() to check interface existence

This works as an unprivileged user, so avoids unnecessary errors when
running in test mode (and not as root):

  2022-02-18T12:21:12.436491+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket
  2022-02-18T12:21:12.436534+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket
  2022-02-18T12:21:12.436557+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket
  2022-02-18T12:21:12.436577+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket

The corresponding porting test would now become pointless because it
would just confirm that "fake" does not exist.  Attempt to make it
useful by using a less likely name than "fake" and attempting to
detect the loopback interface.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoreplace: Add check for if_nameindex()
Martin Schwenke [Thu, 21 Jul 2022 01:25:37 +0000 (11:25 +1000)]
replace: Add check for if_nameindex()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-daemon: Modernise debug in ctdb_add_public_address()
Martin Schwenke [Tue, 5 Jul 2022 02:17:05 +0000 (12:17 +1000)]
ctdb-daemon: Modernise debug in ctdb_add_public_address()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-daemon: Avoid spurious error sending ARPs for released IP
Martin Schwenke [Thu, 23 Jun 2022 04:30:34 +0000 (14:30 +1000)]
ctdb-daemon: Avoid spurious error sending ARPs for released IP

A public IP address can be released in between (and probably before)
attempts to send ARPs.  One situation when this can occur is when a
cluster is shutting down: node A shuts down first, public IPs from
node A are taken over by node B, node B is shutdown.

Notice this when it occurs and cancel further attempts to send ARPs.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-daemon: Modernise debug in ctdb_control_send_arp()
Martin Schwenke [Tue, 5 Jul 2022 09:33:15 +0000 (19:33 +1000)]
ctdb-daemon: Modernise debug in ctdb_control_send_arp()

For the tickle ACK logging, render the connection in a buffer.  This
produces more complete information.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-protocol: Add separator argument to ctdb_connection_to_buf()
Martin Schwenke [Tue, 19 Jul 2022 01:53:15 +0000 (11:53 +1000)]
ctdb-protocol: Add separator argument to ctdb_connection_to_buf()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-daemon: Drop unused ban_state element from CTDB node structure
Martin Schwenke [Wed, 29 Jul 2020 03:39:03 +0000 (13:39 +1000)]
ctdb-daemon: Drop unused ban_state element from CTDB node structure

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-recoverd: Clean up banning culprit code
Martin Schwenke [Wed, 29 Jul 2020 03:30:04 +0000 (13:30 +1000)]
ctdb-recoverd: Clean up banning culprit code

Make this fully self-contained in the recovery daemon and avoid
indexing by PNN.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-recoverd: Add pnn field to banning state structure
Martin Schwenke [Wed, 29 Jul 2020 02:15:03 +0000 (12:15 +1000)]
ctdb-recoverd: Add pnn field to banning state structure

This structure is now standalone, so indexing by PNN can be avoided
via a subsequent commit.  Index by culprit here to make this commit
simple.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-recoverd: Add function node_flags() and use it in elections
Martin Schwenke [Wed, 29 Jul 2020 07:57:53 +0000 (17:57 +1000)]
ctdb-recoverd: Add function node_flags() and use it in elections

Indexing a node map by PNN is suboptimal.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: Only run unhealthy call-out when passing threshold
Martin Schwenke [Fri, 10 Jun 2022 00:32:01 +0000 (10:32 +1000)]
ctdb-scripts: Only run unhealthy call-out when passing threshold

For memory usage, no need to dump all of this data on every failed
monitor event.  The first call will be enough to diagnose the problem.
The node will then go unhealthy, drop clients and memory usage should
then drop.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Jul 22 07:32:54 UTC 2022 on sn-devel-184

21 months agoctdb-scripts: Always check memory usage
Martin Schwenke [Fri, 10 Jun 2022 00:03:41 +0000 (10:03 +1000)]
ctdb-scripts: Always check memory usage

If filesystem usage exceeds the unhealthy threshold then checking
memory usage checking is not done.  Always do them both.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: Avoid ShellCheck info SC2162
Martin Schwenke [Fri, 10 Jun 2022 00:28:56 +0000 (10:28 +1000)]
ctdb-scripts: Avoid ShellCheck info SC2162

SC2162 (info): read without -r will mangle backslashes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: Reduce length of very long lines
Martin Schwenke [Wed, 29 Jun 2022 22:55:28 +0000 (08:55 +1000)]
ctdb-scripts: Reduce length of very long lines

Use printf to allow easier line breaks and use some early returns.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: De-clutter validate_percentage()
Martin Schwenke [Fri, 10 Jun 2022 00:17:28 +0000 (10:17 +1000)]
ctdb-scripts: De-clutter validate_percentage()

It always takes 2 arguments.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: Reformat using shfmt -w -p -i 0 -fn
Martin Schwenke [Fri, 10 Jun 2022 00:13:22 +0000 (10:13 +1000)]
ctdb-scripts: Reformat using shfmt -w -p -i 0 -fn

About to modify this file, so reformat first as per recent Samba
convention.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agoctdb-scripts: Avoid ShellCheck warning SC2164
Martin Schwenke [Fri, 10 Jun 2022 00:11:27 +0000 (10:11 +1000)]
ctdb-scripts: Avoid ShellCheck warning SC2164

SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

A problem can only occur if /etc/ctdb/ or an important subdirectory is
removed, which means the script itself would not be found.  Use && to
silence ShellCheck.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
21 months agosmbd: Bypass the vfs_gethandle data for default share IPC$
dinesh [Thu, 26 May 2022 05:06:04 +0000 (10:36 +0530)]
smbd: Bypass the vfs_gethandle data for default share IPC$

During gpfs_connect for default share of IPC$ not setting the handle data but during the vfs_gpfs_capabilities
for the default share IPC$ the get handle data was called and observing error log failed to get vfs_handle->data!
so to bypass this error log the condition check if IS_IPC share is added in make_connection_snum while calling SMB_VFS_FS_CAPABILITIES

Signed-off-by:Dinesh <dinesh.kumar.reddy@ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul 22 05:27:53 UTC 2022 on sn-devel-184

21 months agothird_party: Update socket_wrapper to version 1.3.4
Andreas Schneider [Thu, 21 Jul 2022 12:55:31 +0000 (14:55 +0200)]
third_party: Update socket_wrapper to version 1.3.4

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
21 months agos3:winbind: Add additional debug level check to wb_lookupsids_send()
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Add additional debug level check to wb_lookupsids_send()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jul 21 14:41:53 UTC 2022 on sn-devel-184

21 months agos3:winbind: Add additional debug level check to winbindd_getsidaliases_send()
Pavel Filipenský [Tue, 19 Jul 2022 14:25:13 +0000 (16:25 +0200)]
s3:winbind: Add additional debug level check to winbindd_getsidaliases_send()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Add additional debug level check to winbindd_getgroups_recv()
Pavel Filipenský [Tue, 19 Jul 2022 14:21:57 +0000 (16:21 +0200)]
s3:winbind: Add additional debug level check to winbindd_getgroups_recv()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Add additional debug level check to wb_gettoken_recv()
Pavel Filipenský [Tue, 19 Jul 2022 14:48:09 +0000 (16:48 +0200)]
s3:winbind: Add additional debug level check to wb_gettoken_recv()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getsidaliases.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getsidaliases.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_xids_to_sids.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_xids_to_sids.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_sids_to_xids.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_sids_to_xids.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_list_users.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_list_users.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_list_groups.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_list_groups.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getusersids.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getusersids.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getuserdomgroups.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getuserdomgroups.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getpwent.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getpwent.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgroups.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgroups.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgrnam.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:11 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgrnam.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgrgid.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgrgid.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgrent.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in winbindd_getgrent.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_lookupsids.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_lookupsids.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_xids2sids.c
Pavel Filipenský [Tue, 19 Jul 2022 09:11:53 +0000 (11:11 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_xids2sids.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_sids2xids.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_sids2xids.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_queryuser.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_queryuser.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_query_user_list.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_query_user_list.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_query_group_list.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_query_group_list.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_next_pwent.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_next_pwent.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_lookupusergroups.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_lookupusergroups.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_lookupuseraliases.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_lookupuseraliases.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_group_members.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_group_members.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agos3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_gettoken.c
Pavel Filipenský [Mon, 18 Jul 2022 13:28:10 +0000 (15:28 +0200)]
s3:winbind: Change '%u' to '%PRIu32' for uint32_t in wb_gettoken.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agoREADME.Coding: PRINT format specifiers PRIuxx
Pavel Filipenský [Tue, 19 Jul 2022 09:46:13 +0000 (11:46 +0200)]
README.Coding: PRINT format specifiers PRIuxx

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
21 months agoAdd a .clang-format file
Andreas Schneider [Tue, 19 Jul 2022 13:38:27 +0000 (15:38 +0200)]
Add a .clang-format file

How to use:

Install 'git-format-clang' which is part of the clang suite (Fedora:
git-clang-format, openSUSE: clang-tools).

Now do your changes and stage them with `git add`. Once they are staged
format the code using `git clang-format` before you commit.

Now the formatting changed can be viewed with `git diff` against the
staged changes.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jul 20 18:23:49 UTC 2022 on sn-devel-184

21 months agotestprogs: Reformat common_test_fns.inc
Andreas Schneider [Wed, 8 Jun 2022 12:49:51 +0000 (14:49 +0200)]
testprogs: Reformat common_test_fns.inc

shfmt -w -p -i 0 -fn testprogs/blackbox/common_test_fns.inc

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Wed Jul 20 11:59:26 UTC 2022 on sn-devel-184

21 months agotestprogs: Reformat common-links.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:04 +0000 (15:46 +0200)]
testprogs: Reformat common-links.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/common-links.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
21 months agowaf: Check for -Wno-error=array-bounds flags
Andreas Schneider [Mon, 18 Jul 2022 08:39:05 +0000 (10:39 +0200)]
waf: Check for -Wno-error=array-bounds flags

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

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 Jul 19 12:17:35 UTC 2022 on sn-devel-184

21 months agos3:tests: Add test to access msdfs path with smbget
Andreas Schneider [Tue, 12 Jul 2022 09:19:13 +0000 (11:19 +0200)]
s3:tests: Add test to access msdfs path with smbget

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 19 00:10:10 UTC 2022 on sn-devel-184

21 months agos3:rpcclient: Goto done in cmd_samr_setuserinfo_int()
Andreas Schneider [Thu, 19 Aug 2021 10:09:28 +0000 (12:09 +0200)]
s3:rpcclient: Goto done in cmd_samr_setuserinfo_int()

We need to free the frame or we will run into:
    smb_panic (why=0x7fa8c511aa88 "Frame not freed in order.")

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jul 18 21:21:59 UTC 2022 on sn-devel-184

21 months agos3:winbind: Add additional debug level check to wb_xids2sids_recv()
Andreas Schneider [Mon, 18 Jul 2022 11:28:50 +0000 (13:28 +0200)]
s3:winbind: Add additional debug level check to wb_xids2sids_recv()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jul 18 14:44:07 UTC 2022 on sn-devel-184

21 months agos3:winbind: Fix pointer access in wb_xids2sids_recv()
Andreas Schneider [Mon, 18 Jul 2022 07:20:22 +0000 (09:20 +0200)]
s3:winbind: Fix pointer access in wb_xids2sids_recv()

CID 1507348
CID 1507349

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:winbind: Add additional debug level check to wb_lookupusergroups_recv()
Andreas Schneider [Mon, 18 Jul 2022 11:26:58 +0000 (13:26 +0200)]
s3:winbind: Add additional debug level check to wb_lookupusergroups_recv()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>