]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
8 months agopysmbd: Python code calls smbd code with "." and ".."
Volker Lendecke [Mon, 21 Oct 2024 13:45:47 +0000 (15:45 +0200)] 
pysmbd: Python code calls smbd code with "." and ".."

Soon we will call filename_convert_dirfsp() on these, which can't deal
with paths that are invalid by containing . and .. as path components.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Simplify filename_convert_dirfsp_nosymlink()
Volker Lendecke [Fri, 11 Oct 2024 10:46:53 +0000 (12:46 +0200)] 
smbd: Simplify filename_convert_dirfsp_nosymlink()

Looks more complex, but this avoids calling openat_pathref_fsp, which
eventually calls into non_widelink_open(). We need to open the pretty paranoid
SMB_ASSERT in openat_pathref_fsp_lcomp() a little bit.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agonet: filename_convert_dirfsp() needs mangling initialized
Volker Lendecke [Wed, 23 Oct 2024 15:09:04 +0000 (17:09 +0200)] 
net: filename_convert_dirfsp() needs mangling initialized

We'll call filename_convert_dirfsp() from a lot more places soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Add open_rootdir_pathref_fsp()
Volker Lendecke [Fri, 11 Oct 2024 12:56:21 +0000 (14:56 +0200)] 
smbd: Add open_rootdir_pathref_fsp()

Get a pathref handle on the file system root. This will serve as
"basedir" for filename_convert_dirfsp_rel() to turn an absolute path
into one relative to the handle created here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Factor out filename_convert_dirfsp_rel()
Volker Lendecke [Fri, 11 Oct 2024 09:58:51 +0000 (11:58 +0200)] 
smbd: Factor out filename_convert_dirfsp_rel()

Soon we'll have a caller that needs the last component as a relative
file name. Make sure it does not have to call get_lcomp or so.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Fix following symlinks if basedir != cwd_fsp
Volker Lendecke [Wed, 23 Oct 2024 12:14:39 +0000 (14:14 +0200)] 
smbd: Fix following symlinks if basedir != cwd_fsp

Unused so far, but soon we'll call this routine with a basedir that's
somewhere below the share root.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Slightly simplify filename_convert_dirfsp_nosymlink()
Volker Lendecke [Thu, 10 Oct 2024 08:16:14 +0000 (10:16 +0200)] 
smbd: Slightly simplify filename_convert_dirfsp_nosymlink()

Reference conn->cwd_fsp just once, shrinks next patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Use OpenDir_from_pathref() in rmdir_internals()
Volker Lendecke [Wed, 9 Oct 2024 13:49:10 +0000 (15:49 +0200)] 
smbd: Use OpenDir_from_pathref() in rmdir_internals()

Make strace look nicer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Use OpenDir_from_pathref() in can_delete_directory_fsp()
Volker Lendecke [Wed, 9 Oct 2024 11:36:00 +0000 (13:36 +0200)] 
smbd: Use OpenDir_from_pathref() in can_delete_directory_fsp()

This avoids a full path traversal if /proc/self/fd is available.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Simplify OpenDir_from_pathref()
Volker Lendecke [Thu, 10 Oct 2024 15:16:02 +0000 (17:16 +0200)] 
smbd: Simplify OpenDir_from_pathref()

Use the /proc/self/fd trick to make get_real_filename_fullscan_at look
a bit nicer and faster in strace. Direct SMB_VFS_OPENAT also is
cheaper in user space, we don't need the full fd_openat and
non_widelink_open magic here.

Also avoid opening ".", which can fail where a full path open would
succeed: If the directory in question does not give "x" perms to the
user, we get a handle on the dir as such but can't cd into it.

I haven't seen real-world cases of this, but one of our tests creates
such a scenario. I have further refactoring in my local tree that make
this patch necessary.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Enable fd_openat(cwd_fsp, "/absolute/share/path")
Volker Lendecke [Sat, 19 Oct 2024 15:30:09 +0000 (17:30 +0200)] 
smbd: Enable fd_openat(cwd_fsp, "/absolute/share/path")

So far fd_openat needed to be called with cwd_fsp and "." if you
wanted to open the share root, this enables using the absolute share
path. The next patch will remove sending the "." with cwd_fsp as a
simplification. Enable that with this little change.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Tighten non_wide_link_open() for absolute root share open
Volker Lendecke [Sat, 19 Oct 2024 15:29:01 +0000 (17:29 +0200)] 
smbd: Tighten non_wide_link_open() for absolute root share open

Make it clear that non_widelink_open being called for absolute paths
is not done during regular operations, i.e. when we have passed our
pathnames through filename_convert_dirfsp and we work on a real
dirfsp.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Ignore twrp in chdir_below_conn()
Volker Lendecke [Sun, 20 Oct 2024 12:41:55 +0000 (14:41 +0200)] 
smbd: Ignore twrp in chdir_below_conn()

We can't deal with snapdir paths in non_widelink_open fully with
snapdirseverywhere active: There is no way for
shadow_copy2_parent_pathname() to work when a snapshot directory is
below the directory that we want to calculate the parent for. What is
the parent directory supposed to point at? I don't know.

For me the only way out is to accept that we should ignore what
happens behind shadow_copy2's path manipulation in core
smbd. This *might* open symlink races, but the whole point of
snapshots is that they are r/o copies of the real active file system
and as such they should be immune to those races.

Found while trying to refactor code around fd_openat()

P.S: This code will go away pretty soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Simplify filename_convert_dirfsp()
Volker Lendecke [Tue, 8 Oct 2024 13:51:06 +0000 (15:51 +0200)] 
smbd: Simplify filename_convert_dirfsp()

If we do the S_ISLNK check in the lower level, the if-condition is
simpler and we get the close_file_free() call for free.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Inline dup_file_fsp() into fcb_or_dos_open()
Volker Lendecke [Thu, 10 Oct 2024 14:34:50 +0000 (16:34 +0200)] 
smbd: Inline dup_file_fsp() into fcb_or_dos_open()

Only used once, an not really complex

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs: Don't ever call openat(-1, ...) for relative paths
Volker Lendecke [Mon, 21 Oct 2024 10:12:27 +0000 (12:12 +0200)] 
vfs: Don't ever call openat(-1, ...) for relative paths

This is always a bug, we should never do this. In one iteration of my
code I was doing this, which led to an invalid fallback code, which
itself lead to an infinite recursion. Make this more obvious with an
assert.

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): Tue Nov 12 15:13:03 UTC 2024 on atb-devel-224

8 months agovfs: Only call openat for valid params in fake_acls_stat
Volker Lendecke [Mon, 11 Nov 2024 16:50:03 +0000 (17:50 +0100)] 
vfs: Only call openat for valid params in fake_acls_stat

openat(-1, "relative path", ..) is invalid. I've tried to also tighten
this down to just relative paths (i.e. base_name[0] != '/'), but
non_widelink_open makes modifications further down that make this more
difficult.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs: Use the getwd-cache only if we have a valid tcon
Volker Lendecke [Mon, 11 Nov 2024 15:19:17 +0000 (16:19 +0100)] 
vfs: Use the getwd-cache only if we have a valid tcon

A valid tcon will have changed fsp_get_pathref_fd() to AT_FDCWD, -100
on Linux.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs: Change the condition when to fill the getwd cache
Volker Lendecke [Mon, 11 Nov 2024 15:16:32 +0000 (16:16 +0100)] 
vfs: Change the condition when to fill the getwd cache

The next patch will add another excluding condition, this change
keeps the if-condition that is changed here simple.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Don't print cwd before tcon is done
Volker Lendecke [Mon, 21 Oct 2024 10:20:55 +0000 (12:20 +0200)] 
smbd: Don't print cwd before tcon is done

vfs_GetWd depends upon a current tcon in fake_acls, otherwise it will
call openat with an invalid dirfd on a relative pathname.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Fix an error resource leak in OpenDir_from_pathref()
Volker Lendecke [Thu, 10 Oct 2024 15:14:10 +0000 (17:14 +0200)] 
smbd: Fix an error resource leak in OpenDir_from_pathref()

We have to undo the fsp allocation and open we've done. Not noticed,
it's probably highly unlikely OpenDir_fsp() fails.

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): Tue Nov 12 13:26:10 UTC 2024 on atb-devel-224

8 months agolibsmb: Use SMB2_0_INFO_FILE instead of a simple "1"
Volker Lendecke [Tue, 1 Oct 2024 13:28:51 +0000 (15:28 +0200)] 
libsmb: Use SMB2_0_INFO_FILE instead of a simple "1"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Simplify smbd_smb2_query_directory_send()
Volker Lendecke [Wed, 9 Oct 2024 05:35:26 +0000 (07:35 +0200)] 
smbd: Simplify smbd_smb2_query_directory_send()

Use reopen_from_fsp(), this will use the /proc/self/fd/<fd> trick if
available, no need to go through non_widelink_open

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: reopen_from_fsp also works for full fsps
Volker Lendecke [Wed, 9 Oct 2024 07:30:12 +0000 (09:30 +0200)] 
smbd: reopen_from_fsp also works for full fsps

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Make reopen_from_fsp() public
Volker Lendecke [Wed, 9 Oct 2024 05:32:55 +0000 (07:32 +0200)] 
smbd: Make reopen_from_fsp() public

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs: Fix streams_xattr_openat
Volker Lendecke [Wed, 9 Oct 2024 10:00:28 +0000 (12:00 +0200)] 
vfs: Fix streams_xattr_openat

This emulates openat, and trying to open a non-existing file should
result in ENOENT and not ENOATTR

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs: Simplify streams_xattr_openat()
Volker Lendecke [Wed, 9 Oct 2024 09:59:58 +0000 (11:59 +0200)] 
vfs: Simplify streams_xattr_openat()

Don't go via NTSTATUS in error handling

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs: Convert streams_xattr_get_name() to return 0/errno
Volker Lendecke [Wed, 9 Oct 2024 09:17:20 +0000 (11:17 +0200)] 
vfs: Convert streams_xattr_get_name() to return 0/errno

This function is pretty simple, this avoids a few calls to
map_errno_from_nt_status in the callers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Convert get_ea_value_fsp() to return 0/errno
Volker Lendecke [Wed, 9 Oct 2024 09:07:11 +0000 (11:07 +0200)] 
smbd: Convert get_ea_value_fsp() to return 0/errno

Avoid a map_errno_from_nt_status()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Convert refuse_symlink_fsp() to bool
Volker Lendecke [Wed, 9 Oct 2024 08:50:15 +0000 (10:50 +0200)] 
smbd: Convert refuse_symlink_fsp() to bool

I want to simplify get_ea_value_fsp next

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agosmbd: Simplify make_connection_snum()
Volker Lendecke [Fri, 11 Oct 2024 11:29:33 +0000 (13:29 +0200)] 
smbd: Simplify make_connection_snum()

Avoid nested if's, don't check for ISDIR twice

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agopylibsmb: Add NFS reparse tag types
Volker Lendecke [Mon, 17 Jun 2024 15:02:09 +0000 (17:02 +0200)] 
pylibsmb: Add NFS reparse tag types

To be used in tests later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibsmb: Fix a "cast increases required alignment" warning
Volker Lendecke [Tue, 1 Oct 2024 13:35:25 +0000 (15:35 +0200)] 
libsmb: Fix a "cast increases required alignment" warning

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibsmb: Fix trailing whitespace
Volker Lendecke [Wed, 25 Sep 2024 14:54:11 +0000 (16:54 +0200)] 
libsmb: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolsasrv: Simplify dcesrv_lsa_AddRemoveAccountRights()
Volker Lendecke [Fri, 20 Sep 2024 13:46:01 +0000 (15:46 +0200)] 
lsasrv: Simplify dcesrv_lsa_AddRemoveAccountRights()

Use dom_sid_string_buf, no need to talloc.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolib: Simplify nybble_to_hex_*
Volker Lendecke [Tue, 10 Sep 2024 06:46:30 +0000 (08:46 +0200)] 
lib: Simplify nybble_to_hex_*

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agoldb: User hexchars_upper from replace.h
Volker Lendecke [Tue, 10 Sep 2024 08:02:04 +0000 (10:02 +0200)] 
ldb: User hexchars_upper from replace.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibreplace: Introduce hexchars_{upper|lower}
Volker Lendecke [Tue, 10 Sep 2024 06:45:31 +0000 (08:45 +0200)] 
libreplace: Introduce hexchars_{upper|lower}

We use that in quite a few places in our code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibcli: Convert an int to a size_t
Volker Lendecke [Tue, 15 Oct 2024 11:46:05 +0000 (13:46 +0200)] 
libcli: Convert an int to a size_t

More appropriate for an array length

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolib: Modernize a DEBUG
Volker Lendecke [Thu, 3 Oct 2024 09:04:15 +0000 (11:04 +0200)] 
lib: Modernize a DEBUG

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agoidl: Fix trailing whitespace
Volker Lendecke [Mon, 30 Sep 2024 10:55:25 +0000 (12:55 +0200)] 
idl: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolib: simplify smbpasswd_sethexpwd() with hex_encode_buf()
Volker Lendecke [Fri, 20 Sep 2024 13:17:33 +0000 (15:17 +0200)] 
lib: simplify smbpasswd_sethexpwd() with hex_encode_buf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolib: simplify smbpasswd_gethexpwd() with strhex_to_str()
Volker Lendecke [Fri, 20 Sep 2024 13:14:48 +0000 (15:14 +0200)] 
lib: simplify smbpasswd_gethexpwd() with strhex_to_str()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibcli: Try to fix CID 1609583 Overflowed constant
Volker Lendecke [Mon, 4 Nov 2024 17:26:43 +0000 (18:26 +0100)] 
libcli: Try to fix CID 1609583 Overflowed constant

Coverity does not like the --i

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs_fruit: Align a few integer types
Volker Lendecke [Mon, 4 Nov 2024 17:19:48 +0000 (18:19 +0100)] 
vfs_fruit: Align a few integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agovfs_fruit: Simplify filter_empty_rsrc_stream()
Volker Lendecke [Mon, 4 Nov 2024 17:17:16 +0000 (18:17 +0100)] 
vfs_fruit: Simplify filter_empty_rsrc_stream()

Inspired by Coverity finding CID 1609584 Overflowed constant -- not
sure it fixes it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibndr: Early overflow detection
Volker Lendecke [Mon, 30 Sep 2024 13:45:16 +0000 (15:45 +0200)] 
libndr: Early overflow detection

This is an addition without an overflow check. Do it right there.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibndr: Simplify data flow in ndr_push_relative_ptr2
Volker Lendecke [Mon, 30 Sep 2024 10:07:30 +0000 (12:07 +0200)] 
libndr: Simplify data flow in ndr_push_relative_ptr2

Consolidate saving/replacing ndr->offset right around the push_uint32

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 months agolibgpo:admx:: s/the the\b/the/
Douglas Bagnall [Fri, 13 Sep 2024 02:23:12 +0000 (14:23 +1200)] 
libgpo:admx:: s/the the\b/the/

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Nov 12 09:21:53 UTC 2024 on atb-devel-224

8 months agolib/replace: memset_explicit() only takes three arguments
Thomas Klausner [Sun, 10 Nov 2024 07:37:17 +0000 (08:37 +0100)] 
lib/replace: memset_explicit() only takes three arguments

Signed-off-by: Thomas Klausner <wiz@gatalith.at>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Nov 11 16:47:46 UTC 2024 on atb-devel-224

8 months agoWHATSNEW: Add client netlogon ping protocol parameter
Volker Lendecke [Fri, 8 Nov 2024 15:39:42 +0000 (16:39 +0100)] 
WHATSNEW: Add client netlogon ping protocol parameter

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Nov 11 15:15:29 UTC 2024 on atb-devel-224

8 months agotests: Run ad members with new netlogon ping protocol settings
Volker Lendecke [Wed, 6 Nov 2024 13:30:30 +0000 (14:30 +0100)] 
tests: Run ad members with new netlogon ping protocol settings

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibcli: Make cldap_error_reply() static to cldap_server.c
Volker Lendecke [Fri, 1 Nov 2024 11:49:55 +0000 (12:49 +0100)] 
libcli: Make cldap_error_reply() static to cldap_server.c

Only used there

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibcli: Remove two unused functions
Volker Lendecke [Fri, 1 Nov 2024 11:44:42 +0000 (12:44 +0100)] 
libcli: Remove two unused functions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet: Simplify becomeDC
Volker Lendecke [Fri, 25 Oct 2024 12:53:09 +0000 (14:53 +0200)] 
libnet: Simplify becomeDC

Checking for "" does not need a call to strcmp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agodocs: Fix a typo in a parameter file name
Volker Lendecke [Thu, 24 Oct 2024 14:44:09 +0000 (16:44 +0200)] 
docs: Fix a typo in a parameter file name

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibcli: Move "struct cldap_netlogon" definition to torture
Volker Lendecke [Fri, 1 Nov 2024 11:41:57 +0000 (12:41 +0100)] 
libcli: Move "struct cldap_netlogon" definition to torture

This structure is only used in torture/ldap/netlogon.c now for
historic reasons. Replacing it with something else would be the right
thing to do...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibcli: Remove cldap_netlogon() and friends
Volker Lendecke [Fri, 1 Nov 2024 11:39:58 +0000 (12:39 +0100)] 
libcli: Remove cldap_netlogon() and friends

Replaced with netlogon_pings()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotorture4: Replace direct netlogon ping calls with netlogon_pings()
Volker Lendecke [Fri, 1 Nov 2024 11:36:59 +0000 (12:36 +0100)] 
torture4: Replace direct netlogon ping calls with netlogon_pings()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotorture4: Add ldap.netlogon-ping test
Volker Lendecke [Fri, 1 Nov 2024 09:07:16 +0000 (10:07 +0100)] 
torture4: Add ldap.netlogon-ping test

This will supersede the direct cldap based netlogon tests

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotorture4: Use netlogon_pings() in rpc.lsa tests
Volker Lendecke [Wed, 30 Oct 2024 17:22:57 +0000 (18:22 +0100)] 
torture4: Use netlogon_pings() in rpc.lsa tests

Allow LDAPS netlogon ping

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotorture4: Use netlogon_pings_send/recv in bench-cldap
Volker Lendecke [Thu, 31 Oct 2024 17:05:00 +0000 (18:05 +0100)] 
torture4: Use netlogon_pings_send/recv in bench-cldap

This slightly changes behaviour: It uses separate client sockets per
ping instead of just one, but it allows to compare CLDAP with LDAP and
LDAPS (spoiler: LDAPS is *much* slower...)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet4: Use netlogon_pings() in finddcs_cldap
Volker Lendecke [Tue, 29 Oct 2024 14:35:37 +0000 (15:35 +0100)] 
libnet4: Use netlogon_pings() in finddcs_cldap

Enable LDAPS lookups

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet4: Use netlogon_pings() in unbecome_dc
Volker Lendecke [Tue, 29 Oct 2024 12:06:13 +0000 (13:06 +0100)] 
libnet4: Use netlogon_pings() in unbecome_dc

Enable LDAPS lookups

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet4: Use netlogon_pings() in become_dc
Volker Lendecke [Tue, 29 Oct 2024 11:43:53 +0000 (12:43 +0100)] 
libnet4: Use netlogon_pings() in become_dc

Allow LDAPS netlogon pings

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet4: Use netlogon_pings() in findsite
Volker Lendecke [Tue, 29 Oct 2024 11:12:57 +0000 (12:12 +0100)] 
libnet4: Use netlogon_pings() in findsite

Enable LDAPS lookups

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet: Initialize variables in libnet_FindSite()
Volker Lendecke [Mon, 28 Oct 2024 12:52:30 +0000 (13:52 +0100)] 
libnet: Initialize variables in libnet_FindSite()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet: Simplify error return in libnet_FindSite()
Volker Lendecke [Mon, 28 Oct 2024 07:58:54 +0000 (08:58 +0100)] 
libnet: Simplify error return in libnet_FindSite()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet: Save a few lines with talloc_move()
Volker Lendecke [Mon, 28 Oct 2024 07:55:33 +0000 (08:55 +0100)] 
libnet: Save a few lines with talloc_move()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibads: Move check_cldap_reply_required_flags() to netlogon_ping.c
Volker Lendecke [Mon, 28 Oct 2024 14:01:57 +0000 (15:01 +0100)] 
libads: Move check_cldap_reply_required_flags() to netlogon_ping.c

netlogon_ping.c depends on it but itself has fewer dependencies than
cldap.c, so we can use it in more places

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibads: Simplify ads_fill_cldap_reply()
Volker Lendecke [Mon, 28 Oct 2024 12:20:56 +0000 (13:20 +0100)] 
libads: Simplify ads_fill_cldap_reply()

Both callers now guarantee via the filter in netlogon_pings() that the
reply contains DCs that have the required flags set. Remove those
checks from ads_fill_cldap_reply()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibads: Pass "required_flags" through ads_cldap_netlogon_5()
Volker Lendecke [Mon, 28 Oct 2024 12:19:08 +0000 (13:19 +0100)] 
libads: Pass "required_flags" through ads_cldap_netlogon_5()

... down to netlogon_pings(). Passing 0 right now, this will change
for some callers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibads: Pass "required_flags" through ads_cldap_netlogon()
Volker Lendecke [Mon, 28 Oct 2024 12:16:46 +0000 (13:16 +0100)] 
libads: Pass "required_flags" through ads_cldap_netlogon()

... down to netlogon_pings()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibads: Make ads_cldap_netlogon() static
Volker Lendecke [Mon, 28 Oct 2024 11:08:42 +0000 (12:08 +0100)] 
libads: Make ads_cldap_netlogon() static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibads: remove cldap_multi_netlogon
Volker Lendecke [Fri, 25 Oct 2024 15:42:18 +0000 (17:42 +0200)] 
libads: remove cldap_multi_netlogon

Replaced by netlogon_pings()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibsmb: Use netlogon_pings() in dsgetdcname
Volker Lendecke [Mon, 28 Oct 2024 11:06:05 +0000 (12:06 +0100)] 
libsmb: Use netlogon_pings() in dsgetdcname

Use parallel requests and req_flags filtering provided by
netlogon_pings()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agokerberos: Use netlogon_pings()
Volker Lendecke [Fri, 25 Oct 2024 15:38:04 +0000 (17:38 +0200)] 
kerberos: Use netlogon_pings()

This also makes sure we've got a KDC via DS_KDC_REQUIRED

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agoldap: Use netlogon_pings
Volker Lendecke [Fri, 25 Oct 2024 15:25:13 +0000 (17:25 +0200)] 
ldap: Use netlogon_pings

This already requests the flags that ads_fill_cldap_reply() will later
check for, so netlogon_pings will only feed sufficient DCs into
ads_fill_cldap_reply.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agocldap: Use netlogon_pings()
Volker Lendecke [Fri, 25 Oct 2024 14:45:29 +0000 (16:45 +0200)] 
cldap: Use netlogon_pings()

Allow LDAPS for ads_cldap_netlogon()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibads: Add netlogon_pings()
Volker Lendecke [Thu, 24 Oct 2024 11:55:35 +0000 (13:55 +0200)] 
libads: Add netlogon_pings()

This encapsulates our logic that we send CLDAP requests on UDP/389,
sending them with 100msec timeouts until someone replies. It also
contains the code to do this over LDAP/389 or LDAPS/636.

It also contains code to filter for domain controller flags like
DS_ONLY_LDAP_NEEDED, this logic exists in several places right now.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotldap: Add tldap_context_create_from_plain_stream()
Volker Lendecke [Thu, 31 Oct 2024 16:04:44 +0000 (17:04 +0100)] 
tldap: Add tldap_context_create_from_plain_stream()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agoparam: Add "client netlogon ping protocol"
Volker Lendecke [Thu, 24 Oct 2024 14:52:46 +0000 (16:52 +0200)] 
param: Add "client netlogon ping protocol"

Allow "net ads join" in environments where UDP/389 is blocked. Code
will follow.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolib: Add a few required includes
Volker Lendecke [Thu, 24 Oct 2024 14:15:55 +0000 (16:15 +0200)] 
lib: Add a few required includes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agobuild: Remove the big samba3util dependency from TLDAP
Volker Lendecke [Mon, 28 Oct 2024 09:44:47 +0000 (10:44 +0100)] 
build: Remove the big samba3util dependency from TLDAP

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agobuild: Make util_tsock its own subsystem
Volker Lendecke [Mon, 28 Oct 2024 09:40:26 +0000 (10:40 +0100)] 
build: Make util_tsock its own subsystem

One step to strip TLDAP deps

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agoparam: Remove parameter "cldap port"
Volker Lendecke [Mon, 28 Oct 2024 12:46:20 +0000 (13:46 +0100)] 
param: Remove parameter "cldap port"

This was not used consistently across all of our code base, and I
don't see a reason why this should ever not be port 389.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agocldap: Make finddcs.out.netlogon a pointer
Volker Lendecke [Wed, 30 Oct 2024 10:10:28 +0000 (11:10 +0100)] 
cldap: Make finddcs.out.netlogon a pointer

struct netlogon_samlogon_response has subpointers, this patch enables
a proper talloc hierarchy.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agocldap: Make cldap_netlogon.out.netlogon a pointer
Volker Lendecke [Wed, 30 Oct 2024 10:07:53 +0000 (11:07 +0100)] 
cldap: Make cldap_netlogon.out.netlogon a pointer

struct netlogon_samlogon_response has subpointers, this patch enables
a proper talloc hierarchy.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolib: Fix trailing whitespace
Volker Lendecke [Wed, 30 Oct 2024 09:54:12 +0000 (10:54 +0100)] 
lib: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agocldap: Remove cldap_netlogon->in.map_response
Volker Lendecke [Tue, 29 Oct 2024 08:02:19 +0000 (09:02 +0100)] 
cldap: Remove cldap_netlogon->in.map_response

We should not pass booleans down where the caller can do the same
thing with equal effort

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet4: Call map_netlogon_samlogon_response directly
Volker Lendecke [Tue, 29 Oct 2024 08:01:43 +0000 (09:01 +0100)] 
libnet4: Call map_netlogon_samlogon_response directly

Avoid using a boolean flag passed down

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet4: Call map_netlogon_samlogon_response directly
Volker Lendecke [Tue, 29 Oct 2024 08:00:34 +0000 (09:00 +0100)] 
libnet4: Call map_netlogon_samlogon_response directly

Avoid using a boolean flag passed down

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibnet4: Call map_netlogon_samlogon_response directly
Volker Lendecke [Tue, 29 Oct 2024 07:59:29 +0000 (08:59 +0100)] 
libnet4: Call map_netlogon_samlogon_response directly

Avoid using a boolean flag passed down

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agolibcli4: Call map_netlogon_samlogon_response directly
Volker Lendecke [Tue, 29 Oct 2024 07:57:53 +0000 (08:57 +0100)] 
libcli4: Call map_netlogon_samlogon_response directly

Avoid using a boolean flag passed down

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotorture4: Simplifiy [tcp|udp]_ldap_netlogon()
Volker Lendecke [Tue, 29 Oct 2024 07:55:13 +0000 (08:55 +0100)] 
torture4: Simplifiy [tcp|udp]_ldap_netlogon()

Both callers set "map_response=true", so we don't need that flag here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotldap_tls: Remove tldap_[gs]et_starttls_needed()
Volker Lendecke [Thu, 7 Nov 2024 10:17:12 +0000 (11:17 +0100)] 
tldap_tls: Remove tldap_[gs]et_starttls_needed()

The caller setting up a tldap connection is aware of whether to use
starttls, which is one single ldap extended operation before the tls
crypto starts. There is no complex logic behind this that is
worthwhile to be hidden behind a flag and an API. If there was more to
it than just a simple call to tldap_extended(), I would all be for
passing down that flag, but for this case I would argue the logic
after this patch is simpler.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotldap_tls: Move creation of tls_params out of tldap_tls_connect()
Volker Lendecke [Thu, 7 Nov 2024 09:53:48 +0000 (10:53 +0100)] 
tldap_tls: Move creation of tls_params out of tldap_tls_connect()

Soon we will have a tldap user which does not want to verify the
certs. Instead of passing another boolean down, hand in pre-created
tstream_tls_params.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agotstream_tls: Add tstream_tls_params_peer_name()
Volker Lendecke [Thu, 7 Nov 2024 09:48:52 +0000 (10:48 +0100)] 
tstream_tls: Add tstream_tls_params_peer_name()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 months agosmbtorture: use torture_assert_ntstatus_equal_goto() in CHECK_STATUS() in unlink.c
Ralph Boehme [Sat, 2 Nov 2024 14:49:41 +0000 (16:49 +0200)] 
smbtorture: use torture_assert_ntstatus_equal_goto() in CHECK_STATUS() in unlink.c

fixup

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Nov 11 14:01:18 UTC 2024 on atb-devel-224

8 months agosmbtorture: move hardlink test in test_ntrename() to its own test
Ralph Boehme [Fri, 8 Nov 2024 13:13:28 +0000 (14:13 +0100)] 
smbtorture: move hardlink test in test_ntrename() to its own test

Some filesystems may not support hardlinks.

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