bbaumbach/samba-autobuild/.git
4 years agoselftest: handle proc{killdom,limit}.samba.example.com in dns_hub
Stefan Metzmacher [Thu, 27 Feb 2020 00:47:31 +0000 (01:47 +0100)]
selftest: handle proc{killdom,limit}.samba.example.com in dns_hub

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: allow dns_hub.py to do forwarding to ipv6 servers
Stefan Metzmacher [Wed, 11 Mar 2020 16:09:13 +0000 (17:09 +0100)]
selftest: allow dns_hub.py to do forwarding to ipv6 servers

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: allow dns_hub.py to listen on more than one address
Stefan Metzmacher [Wed, 11 Mar 2020 15:55:33 +0000 (16:55 +0100)]
selftest: allow dns_hub.py to listen on more than one address

This makes it possible to serve ipv4 and ipv6 at the same time.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: make sure dns_hub.py exits on SIGINT
Stefan Metzmacher [Fri, 13 Mar 2020 06:06:05 +0000 (07:06 +0100)]
selftest: make sure dns_hub.py exits on SIGINT

Otherwise we have a deadlock in the python threading
that prevents out EOF detection on stdin to work
if someone aborts 'make test' with strg+c.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosamba_dnsupdate: fix delete (samba-tool) message
Stefan Metzmacher [Tue, 5 Nov 2019 10:25:52 +0000 (11:25 +0100)]
samba_dnsupdate: fix delete (samba-tool) message

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosamba_dnsupdate: fix --no-credentials handling
Stefan Metzmacher [Tue, 5 Nov 2019 10:25:14 +0000 (11:25 +0100)]
samba_dnsupdate: fix --no-credentials handling

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agopython/netcmd/dns: improve exception handling in cmd_add_record()
Stefan Metzmacher [Tue, 5 Nov 2019 10:23:48 +0000 (11:23 +0100)]
python/netcmd/dns: improve exception handling in cmd_add_record()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agopython/netcmd/dns: improve exception handling in cmd_delete_record()
Stefan Metzmacher [Tue, 5 Nov 2019 10:23:48 +0000 (11:23 +0100)]
python/netcmd/dns: improve exception handling in cmd_delete_record()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolibrpc/tests: make use of replace.h in test_ndr*.c
Stefan Metzmacher [Thu, 27 Feb 2020 00:51:18 +0000 (01:51 +0100)]
librpc/tests: make use of replace.h in test_ndr*.c

This fixes the build on FreeBSD 12.1 and maybe other systems.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture/ldb: fix the build on FreeBSD
Stefan Metzmacher [Wed, 6 Nov 2019 07:49:30 +0000 (08:49 +0100)]
s4:torture/ldb: fix the build on FreeBSD

clock_t is 'int' instead' of 'long' there.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:util_sec: fix the build on non-linux platforms
Stefan Metzmacher [Wed, 6 Nov 2019 07:47:31 +0000 (08:47 +0100)]
s3:util_sec: fix the build on non-linux platforms

This fixes a regression introduced by
"util_sec.c: Move __thread variable to global scope"
(5a80f399b51221fb0b8661f30d940ca24e1ce627).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosmbd: use a helper variable in filename_convert_internal()
Ralph Boehme [Thu, 26 Mar 2020 14:08:53 +0000 (15:08 +0100)]
smbd: use a helper variable in filename_convert_internal()

Avoids the complicated pointer-to-pointer dereferencing.

Signed-off-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 Mar 27 02:41:39 UTC 2020 on sn-devel-184

4 years agosmbd: use filename_convert() in smb_file_rename_information()
Ralph Boehme [Thu, 26 Mar 2020 13:49:33 +0000 (14:49 +0100)]
smbd: use filename_convert() in smb_file_rename_information()

Replaces direct calls to resolve_dfspath_wcard() and filename_convert(). On the
way to consolidate all callers of pathname processing onto filename_convert().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: modernize DEBUG in unix_convert()
Ralph Boehme [Wed, 25 Mar 2020 18:00:32 +0000 (19:00 +0100)]
smbd: modernize DEBUG in unix_convert()

I'm also consolidating on level 10 instead of 5 for "debug" level messages, as
that what's tend to be the canonical debug level these days.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: turn (*orig_path != '/') assert into a normal if check
Ralph Boehme [Wed, 25 Mar 2020 06:56:37 +0000 (07:56 +0100)]
smbd: turn (*orig_path != '/') assert into a normal if check

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: consolidate comments in unix_convert()
Ralph Boehme [Wed, 25 Mar 2020 06:53:29 +0000 (07:53 +0100)]
smbd: consolidate comments in unix_convert()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: modernize unix_convert() replacing True with true
Ralph Boehme [Wed, 25 Mar 2020 06:48:16 +0000 (07:48 +0100)]
smbd: modernize unix_convert() replacing True with true

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: modernize unix_convert() replacing False with false
Ralph Boehme [Wed, 25 Mar 2020 06:47:22 +0000 (07:47 +0100)]
smbd: modernize unix_convert() replacing False with false

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: initialize end to NULL in unix_convert()
Ralph Boehme [Wed, 25 Mar 2020 06:46:22 +0000 (07:46 +0100)]
smbd: initialize end to NULL in unix_convert()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: leave start at NULL, it's not used before being set to smbfname->basename
Ralph Boehme [Wed, 25 Mar 2020 06:45:43 +0000 (07:45 +0100)]
smbd: leave start at NULL, it's not used before being set to smbfname->basename

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotdbtorture: Use ARRAY_DEL_ELEMENT()
Volker Lendecke [Thu, 26 Mar 2020 10:15:28 +0000 (11:15 +0100)]
tdbtorture: Use ARRAY_DEL_ELEMENT()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Mar 26 16:22:00 UTC 2020 on sn-devel-184

4 years agoldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_set_extended_component()
Volker Lendecke [Thu, 26 Mar 2020 10:12:55 +0000 (11:12 +0100)]
ldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_set_extended_component()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_extended_filter()
Volker Lendecke [Thu, 26 Mar 2020 10:11:35 +0000 (11:11 +0100)]
ldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_extended_filter()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_index_del_value()
Volker Lendecke [Thu, 26 Mar 2020 10:08:07 +0000 (11:08 +0100)]
ldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_index_del_value()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_msg_delete_element()
Volker Lendecke [Thu, 26 Mar 2020 10:06:23 +0000 (11:06 +0100)]
ldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_msg_delete_element()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolibcli: Use ARRAY_DEL_ELEMENT() in security_descriptor_acl_del()
Volker Lendecke [Thu, 26 Mar 2020 10:04:31 +0000 (11:04 +0100)]
libcli: Use ARRAY_DEL_ELEMENT() in security_descriptor_acl_del()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agodsdb: Use ARRAY_DEL_ELEMENT() in dirsync_filter_entry()
Volker Lendecke [Thu, 26 Mar 2020 10:02:02 +0000 (11:02 +0100)]
dsdb: Use ARRAY_DEL_ELEMENT() in dirsync_filter_entry()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs_fruit: Use ARRAY_DEL_ELEMENT() in del_fruit_stream()
Volker Lendecke [Thu, 26 Mar 2020 09:41:30 +0000 (10:41 +0100)]
vfs_fruit: Use ARRAY_DEL_ELEMENT() in del_fruit_stream()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs_fruit: Use ARRAY_DEL_ELEMENT() in filter_empty_rsrc_stream()
Volker Lendecke [Thu, 26 Mar 2020 09:39:24 +0000 (10:39 +0100)]
vfs_fruit: Use ARRAY_DEL_ELEMENT() in filter_empty_rsrc_stream()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolibsmb: Use ARRAY_DEL_ELEMENT() in remove_duplicate_addrs2()
Volker Lendecke [Thu, 26 Mar 2020 09:36:19 +0000 (10:36 +0100)]
libsmb: Use ARRAY_DEL_ELEMENT() in remove_duplicate_addrs2()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Use ARRAY_DEL_ELEMENT() in merge_default_aces()
Volker Lendecke [Thu, 26 Mar 2020 09:34:09 +0000 (10:34 +0100)]
smbd: Use ARRAY_DEL_ELEMENT() in merge_default_aces()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Use ARRAY_DEL_ELEMENT() in smbd_smb1_blocked_locks_cleanup()
Volker Lendecke [Thu, 26 Mar 2020 09:31:47 +0000 (10:31 +0100)]
smbd: Use ARRAY_DEL_ELEMENT() in smbd_smb1_blocked_locks_cleanup()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Use ARRAY_DEL_ELEMENT() in brl_unlock_windows_default()
Volker Lendecke [Wed, 25 Mar 2020 21:37:34 +0000 (22:37 +0100)]
smbd: Use ARRAY_DEL_ELEMENT() in brl_unlock_windows_default()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbcacls: Use ARRAY_DEL_ELEMENT() in sort_acl()
Volker Lendecke [Thu, 26 Mar 2020 10:39:56 +0000 (11:39 +0100)]
smbcacls: Use ARRAY_DEL_ELEMENT() in sort_acl()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosharesec: Use ARRAY_DEL_ELEMENT() in sort_acl()
Volker Lendecke [Thu, 26 Mar 2020 10:39:08 +0000 (11:39 +0100)]
sharesec: Use ARRAY_DEL_ELEMENT() in sort_acl()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolibsmb: Use ARRAY_DEL_ELEMENT() in sort_acl()
Volker Lendecke [Wed, 25 Mar 2020 21:36:48 +0000 (22:36 +0100)]
libsmb: Use ARRAY_DEL_ELEMENT() in sort_acl()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolib: Use ARRAY_DEL_ELEMENT in messaging_dispatch_waiters()
Volker Lendecke [Wed, 25 Mar 2020 21:25:06 +0000 (22:25 +0100)]
lib: Use ARRAY_DEL_ELEMENT in messaging_dispatch_waiters()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolib: Add macro ARRAY_DEL_ELEMENT()
Volker Lendecke [Wed, 25 Mar 2020 21:07:44 +0000 (22:07 +0100)]
lib: Add macro ARRAY_DEL_ELEMENT()

Every time I have to remove an element from within an array I have to
scratch my head about the memmove arguments. Make this easier to use.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agolib: Try nonblocking writes in writev_send()
Volker Lendecke [Thu, 19 Mar 2020 16:00:59 +0000 (17:00 +0100)]
lib: Try nonblocking writes in writev_send()

All callers now use nonblocking sockets, so that we can optimize by
doing early writes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Mar 25 10:41:29 UTC 2020 on sn-devel-184

4 years agolib: Use optimize_empty in writev_send()
Volker Lendecke [Thu, 12 Mar 2020 15:20:25 +0000 (16:20 +0100)]
lib: Use optimize_empty in writev_send()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agowinbind: Set the parent->child sock nonblocking
Volker Lendecke [Fri, 20 Mar 2020 11:17:08 +0000 (12:17 +0100)]
winbind: Set the parent->child sock nonblocking

The parent goes through wb_simple_trans_send(), which deals with short
writes fine.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agolibsmb: Make sure that the TCP socket is non-blocking
Volker Lendecke [Fri, 20 Mar 2020 10:46:43 +0000 (11:46 +0100)]
libsmb: Make sure that the TCP socket is non-blocking

All traffic goes through smbXcli_base.c, and that is prepared to deal
with short writes via the conn->outgoing queue. Instead of making sure
that all callers properly set the socket nonblocking, do it here, so
that we can later optimize sending out data to the server.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agolib: Remove unused SOCKET_FLAG_BLOCK
Volker Lendecke [Fri, 20 Mar 2020 10:31:15 +0000 (11:31 +0100)]
lib: Remove unused SOCKET_FLAG_BLOCK

Nobody in the code set this flag, so remove it

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agolib: Simplify writev_cancel()
Volker Lendecke [Thu, 12 Mar 2020 10:42:41 +0000 (11:42 +0100)]
lib: Simplify writev_cancel()

We can only reasonably cancel a writev request that is still
queued. Once writing has started, cancel is pointless. Simplify the
if-conditions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agothird_party: Update resolv_wrapper to version 1.1.6
Stefan Metzmacher [Wed, 18 Mar 2020 13:51:12 +0000 (14:51 +0100)]
third_party: Update resolv_wrapper to version 1.1.6

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Mar 25 08:33:17 UTC 2020 on sn-devel-184

4 years agothird_party: Update socket_wrapper to version 1.2.4
Stefan Metzmacher [Tue, 10 Mar 2020 12:27:27 +0000 (13:27 +0100)]
third_party: Update socket_wrapper to version 1.2.4

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agothird_party: Update pam_wrapper to version 1.1.2
Andreas Schneider [Fri, 20 Mar 2020 14:25:47 +0000 (15:25 +0100)]
third_party: Update pam_wrapper to version 1.1.2

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agovfs: remove SMB_VFS_OPENDIR()
Ralph Boehme [Mon, 23 Mar 2020 09:44:08 +0000 (10:44 +0100)]
vfs: remove SMB_VFS_OPENDIR()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 24 21:23:43 UTC 2020 on sn-devel-184

4 years agosmbd: use open_internal_dirfsp_at() and OpenDir_fsp() in OpenDir()
Ralph Boehme [Wed, 18 Mar 2020 15:01:17 +0000 (16:01 +0100)]
smbd: use open_internal_dirfsp_at() and OpenDir_fsp() in OpenDir()

This allows consolidating symlink safe processing of pathnames to the low-level
function non_widelink_open() used in the file open codepath via fd_open() and
the new utility function open_internal_dirfsp_at().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add open_internal_dirfsp_at()
Ralph Boehme [Mon, 16 Mar 2020 17:53:15 +0000 (18:53 +0100)]
smbd: add open_internal_dirfsp_at()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: reformat OpenDir() function definition
Ralph Boehme [Mon, 23 Mar 2020 12:56:49 +0000 (13:56 +0100)]
smbd: reformat OpenDir() function definition

Gives a nicer diff in the next commit. No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: update smb_Dir_destructor() to cope with fsp->dptr not being set
Ralph Boehme [Wed, 18 Mar 2020 17:25:33 +0000 (18:25 +0100)]
smbd: update smb_Dir_destructor() to cope with fsp->dptr not being set

Currently the only caller of OpenDir_fsp() is dptr_create() which means
fsp->dptr will always be set by dptr_create().

A subsequent commit will add another caller so that fsp->dptr will end up being
NULL.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove fdopendir() fallback
Ralph Boehme [Wed, 18 Mar 2020 14:59:11 +0000 (15:59 +0100)]
smbd: remove fdopendir() fallback

In order to get rid of SMB_VFS_OPENDIR, we have to require
fdopendir(). Everybody but macOS seems to have it, so RIP opendir() fallback.

This also prepares for a subsequent commit where we're going to start calling
OpenDir_fsp() from inside OpenDir(). Without removing the fallback this would
result in a recursion.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: simplify non_widelink_open()
Ralph Boehme [Tue, 17 Mar 2020 16:35:44 +0000 (17:35 +0100)]
smbd: simplify non_widelink_open()

As fsp->is_directory is already correctly populated by our callers, we can drop
the complicated and possibly broken logic that relies on O_DIRECTORY being
defined.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_shadow_copy2: use create_internal_dirfsp_at() and SMB_VFS_FDOPENDIR()
Ralph Boehme [Sun, 22 Mar 2020 11:21:10 +0000 (12:21 +0100)]
vfs_shadow_copy2: use create_internal_dirfsp_at() and SMB_VFS_FDOPENDIR()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add create_internal_dirfsp_at()
Ralph Boehme [Mon, 23 Mar 2020 10:36:42 +0000 (11:36 +0100)]
smbd: add create_internal_dirfsp_at()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_shadow_copy: use OpenDir() in shadow_copy_get_shadow_copy_data()
Ralph Boehme [Thu, 19 Mar 2020 11:03:27 +0000 (12:03 +0100)]
vfs_shadow_copy: use OpenDir() in shadow_copy_get_shadow_copy_data()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_depot: use OpenDir() in walk_streams()
Ralph Boehme [Thu, 19 Mar 2020 11:03:27 +0000 (12:03 +0100)]
vfs_streams_depot: use OpenDir() in walk_streams()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: use OpenDir() in fruit_disk_free()
Ralph Boehme [Thu, 19 Mar 2020 11:03:27 +0000 (12:03 +0100)]
vfs_fruit: use OpenDir() in fruit_disk_free()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: pass e->d_name directly to fruit_tmsize_do_dirent()
Ralph Boehme [Thu, 19 Mar 2020 11:42:45 +0000 (12:42 +0100)]
vfs_fruit: pass e->d_name directly to fruit_tmsize_do_dirent()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: let fruit_get_num_bands() take bundle as const
Ralph Boehme [Thu, 19 Mar 2020 11:39:44 +0000 (12:39 +0100)]
vfs_fruit: let fruit_get_num_bands() take bundle as const

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: use OpenDir() instead of SMB_VFS_OPENDIR() in fruit_get_num_bands()
Ralph Boehme [Thu, 19 Mar 2020 11:03:27 +0000 (12:03 +0100)]
vfs_fruit: use OpenDir() instead of SMB_VFS_OPENDIR() in fruit_get_num_bands()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: use OpenDir() in ceph_snap_gmt_convert_dir()
Ralph Boehme [Thu, 19 Mar 2020 11:03:27 +0000 (12:03 +0100)]
vfs_ceph_snapshots: use OpenDir() in ceph_snap_gmt_convert_dir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_ceph_snapshots: use OpenDir() in ceph_snap_enum_snapdir()
Ralph Boehme [Thu, 19 Mar 2020 11:03:27 +0000 (12:03 +0100)]
vfs_ceph_snapshots: use OpenDir() in ceph_snap_enum_snapdir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfstest: use OpenDir()
Ralph Boehme [Wed, 18 Mar 2020 16:40:29 +0000 (17:40 +0100)]
vfstest: use OpenDir()

Note that as ReadDirName() returns translated names (in Windows "encoding"), in
cmd_translate_name() test we have to translate back to UNIX "encoding" to check
if the filename matches the user requested path which is also in UNIX
"encoding".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use canonicalize_connect_path() in create_conn_struct_as_root()
Ralph Boehme [Thu, 19 Mar 2020 10:19:48 +0000 (11:19 +0100)]
smbd: use canonicalize_connect_path() in create_conn_struct_as_root()

This fix ensures create_conn_struct_as_root() works the same way as
make_connection_snum() used in smbd for SMB sessions. Without this any caller of
create_conn_struct_as_root() will fail to use work on shares if the sharepath
contains a symlink.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: make canonicalize_connect_path() public
Ralph Boehme [Thu, 19 Mar 2020 10:19:34 +0000 (11:19 +0100)]
smbd: make canonicalize_connect_path() public

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use OpenDir() in form_junctions()
Ralph Boehme [Wed, 18 Mar 2020 15:12:09 +0000 (16:12 +0100)]
smbd: use OpenDir() in form_junctions()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use OpenDir() in count_dfs_links()
Ralph Boehme [Wed, 18 Mar 2020 11:05:06 +0000 (12:05 +0100)]
smbd: use OpenDir() in count_dfs_links()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: move fruit_unlink_internal() back into fruit_unlinkat()
Ralph Boehme [Thu, 19 Mar 2020 13:07:23 +0000 (14:07 +0100)]
vfs_fruit: move fruit_unlink_internal() back into fruit_unlinkat()

I think this makes fruit_unlinkat() easier to read. No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: remove internal directory cleanup logic
Ralph Boehme [Tue, 17 Mar 2020 18:03:53 +0000 (19:03 +0100)]
vfs_fruit: remove internal directory cleanup logic

Currently fruit does a cleanup run on a directory when it is being removed: it
lists the directory and does an explicit unlink on any found file that is a
genuine AppleDouble file.

This is not realy needed: the ._ AppleDouble sidecar files are either vetoed by
default, so cleanup can be turned on by the built-in "delete veto files"
options. Or, if the user sets "fruit:veto_appledouble", the client will see the
file in a directory list as ordinary files, so the client is responsible for
deleting them first before removing the parent directory.

tl;dr

One caller of SMB_VFS_OPENDIR() less. :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Fix string compare in DnsHandler() of dns_hub.py
Andreas Schneider [Fri, 13 Mar 2020 14:15:53 +0000 (15:15 +0100)]
selftest: Fix string compare in DnsHandler() of dns_hub.py

dns_hub.py:115: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if forwarder is 'ignore':
dns_hub.py:117: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif forwarder is 'fail':

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Mar 24 14:31:25 UTC 2020 on sn-devel-184

4 years agoctdb-recoverd: Avoid dereferencing NULL rec->nodemap
Martin Schwenke [Sun, 22 Mar 2020 02:46:46 +0000 (13:46 +1100)]
ctdb-recoverd: Avoid dereferencing NULL rec->nodemap

Inside the nested event loop in ctdb_ctrl_getnodemap(), various
asynchronous handlers may dereference rec->nodemap, which will be
NULL.

One example is lost_reclock_handler(), which causes rec->nodemap to be
unconditionally dereferenced in list_of_nodes() via this call chain:

  list_of_nodes()
  list_of_active_nodes()
  set_recovery_mode()
  force_election()
  lost_reclock_handler()

Instead of attempting to trace all of the cases, just avoid leaving
rec->nodemap set to NULL.  Attempting to use an old value is generally
harmless, especially since it will be the same as the new value in
most cases.

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

Reported-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Mar 24 01:22:45 UTC 2020 on sn-devel-184

4 years agoctdb-daemon: Don't allow attach from recovery if recovery is not active
Martin Schwenke [Tue, 25 Feb 2020 06:32:56 +0000 (17:32 +1100)]
ctdb-daemon: Don't allow attach from recovery if recovery is not active

Neither the recovery daemon nor the recovery helper should attach
databases outside of the recovery process.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Remove more unused old client database functions
Martin Schwenke [Mon, 24 Feb 2020 19:20:32 +0000 (06:20 +1100)]
ctdb-daemon: Remove more unused old client database functions

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Remove old code for creating missing databases
Martin Schwenke [Mon, 24 Feb 2020 08:51:19 +0000 (19:51 +1100)]
ctdb-recovery: Remove old code for creating missing databases

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Create database on nodes where it is missing
Martin Schwenke [Mon, 24 Feb 2020 00:31:33 +0000 (11:31 +1100)]
ctdb-recovery: Create database on nodes where it is missing

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Fetch database name from all nodes where it is attached
Martin Schwenke [Sun, 23 Feb 2020 23:26:34 +0000 (10:26 +1100)]
ctdb-recovery: Fetch database name from all nodes where it is attached

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Pass db structure for each database recovery
Martin Schwenke [Fri, 21 Feb 2020 05:51:10 +0000 (16:51 +1100)]
ctdb-recovery: Pass db structure for each database recovery

Instead of db_id and db_flags.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: GET_DBMAP from all nodes
Martin Schwenke [Fri, 21 Feb 2020 05:10:05 +0000 (16:10 +1100)]
ctdb-recovery: GET_DBMAP from all nodes

This builds a complete list of databases across the cluster so it can
be used to create databases on the nodes where they are missing.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Replace use of ctdb_dbid_map with local db_list
Martin Schwenke [Fri, 21 Feb 2020 01:24:39 +0000 (12:24 +1100)]
ctdb-recovery: Replace use of ctdb_dbid_map with local db_list

This will be used to build a merged list of databases from all nodes,
allowing the recovery helper to create missing databases.

It would be possible to also include the db_name field in this
structure but that would cause a lot of churn.  This field is used
locally in the recovery of each database so can continue to live in
the relevant state structure(s).

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Respect CTDB_CTRL_FLAG_ATTACH_RECOVERY when attaching databases
Martin Schwenke [Wed, 26 Feb 2020 00:50:09 +0000 (11:50 +1100)]
ctdb-daemon: Respect CTDB_CTRL_FLAG_ATTACH_RECOVERY when attaching databases

This is currently only set by the recovery daemon when it attaches
missing databases, so there is no obvious behaviour change.  However,
attaching missing databases can now be moved to the recovery helper as
long as it sets this flag.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Use CTDB_CTRL_FLAG_ATTACH_RECOVERY to attach during recovery
Martin Schwenke [Fri, 21 Feb 2020 00:13:05 +0000 (11:13 +1100)]
ctdb-recovery: Use CTDB_CTRL_FLAG_ATTACH_RECOVERY to attach during recovery

ctdb_ctrl_createdb() is only called by the recovery daemon, so this is
a safe, temporary change.  This is temporary because
ctdb_ctrl_createdb(), create_missing_remote_databases() and
create_missing_local_databases() will all go away soon.

Note that this doesn't cause a change in behaviour.  The main daemon
will still only defer attaches from non-recoverd processes during
recovery.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-protocol: Add control flag CTDB_CTRL_FLAG_ATTACH_RECOVERY
Martin Schwenke [Fri, 21 Feb 2020 00:04:14 +0000 (11:04 +1100)]
ctdb-protocol: Add control flag CTDB_CTRL_FLAG_ATTACH_RECOVERY

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Remove unused old client database functions
Martin Schwenke [Wed, 26 Feb 2020 06:03:49 +0000 (17:03 +1100)]
ctdb-daemon: Remove unused old client database functions

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Fix database attach deferral logic
Martin Schwenke [Thu, 20 Feb 2020 02:48:13 +0000 (13:48 +1100)]
ctdb-daemon: Fix database attach deferral logic

Commit 3cc230b5eeca749ab68d19cfda969f72c269f1f6 says:

  Dont allow clients to connect to databases untile we are well past
  and through the initial recovery phase

It is unclear what this commit was attempting to do.  The commit
message implies that more attaches should be deferred but the code
change adds a conjunction that causes less attaches to be deferred.
In particular, no attaches will be deferred after startup is complete.
This seems wrong.

To implement what seems to be stated in the commit message an "or"
needs to be used so that non-recovery daemon attaches are deferred
either when in recovery or before startup is complete.  Making this
change highlights that attaches need to be allowed during the
"startup" event because this is when smbd is started.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Refactor banning a node into separate computation
Amitay Isaacs [Mon, 2 Mar 2020 05:16:26 +0000 (16:16 +1100)]
ctdb-recovery: Refactor banning a node into separate computation

If a node is marked for banning, confirm that it's not become inactive
during the recovery.  If yes, then don't ban the node.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-recovery: Don't trust nodemap obtained from local node
Amitay Isaacs [Tue, 18 Feb 2020 05:17:00 +0000 (16:17 +1100)]
ctdb-recovery: Don't trust nodemap obtained from local node

It's possible to have a node stopped, but recovery master not yet
updated flags on the local ctdb daemon when recovery is started.  So do
not trust the list of active nodes obtained from the local node.  Query
the connected nodes to calculate the list of active nodes.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-recovery: Consolidate node state
Amitay Isaacs [Mon, 2 Mar 2020 04:07:21 +0000 (15:07 +1100)]
ctdb-recovery: Consolidate node state

This avoids passing multiple arguments to async computation.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-recovery: Fetched vnnmap is never used, so don't fetch it
Amitay Isaacs [Mon, 2 Mar 2020 02:59:42 +0000 (13:59 +1100)]
ctdb-recovery: Fetched vnnmap is never used, so don't fetch it

New vnnmap is constructed using the information from all the connected
nodes.  So there is no need to fetch the vnnmap from recovery master.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agos3: libsmbclient.h: add missing time.h include
Aurelien Aptel [Fri, 13 Mar 2020 12:42:53 +0000 (13:42 +0100)]
s3: libsmbclient.h: add missing time.h include

A recent change added a struct with timespec members in the public
libsmbclient header. This type is defined in time.h which was not
included thus making users of libsmbclient not build properly.

    /.../libsmbclient.h:158:18: error: field 'btime_ts' has incomplete type
      struct timespec btime_ts;

Fixes: bf13fe0f222 ("s3: libsmbclient: Add internal/external structures needed for readdirplus.")
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Mar 23 20:47:44 UTC 2020 on sn-devel-184

4 years agos4-librpc: Simplify bytes or unicode input checking in python GUID() bindings
Andrew Bartlett [Sat, 14 Mar 2020 21:47:32 +0000 (10:47 +1300)]
s4-librpc: Simplify bytes or unicode input checking in python GUID() bindings

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agopy3: Remove #define IsPy3BytesOrString(pystr)
Andrew Bartlett [Sat, 14 Mar 2020 21:43:16 +0000 (10:43 +1300)]
py3: Remove #define IsPy3BytesOrString(pystr)

This was

  (PyUnicode_Check(pystr) || PyBytes_Check(pystr))

This allows us to end the use of Python 2/3 compatability macros.

The one caller will be simplified in the next commit

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <nopower@samba.org>
4 years agopy3: Remove #define IsPy3Bytes PyBytes_Check
Andrew Bartlett [Sat, 14 Mar 2020 21:40:46 +0000 (10:40 +1300)]
py3: Remove #define IsPy3Bytes PyBytes_Check

This allows us to end the use of Python 2/3 compatability macros.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agopy3: Remove #define PyInt_FromLong PyLong_FromLong
Andrew Bartlett [Sat, 14 Mar 2020 21:36:59 +0000 (10:36 +1300)]
py3: Remove #define PyInt_FromLong PyLong_FromLong

This allows us to end the use of Python 2/3 compatability macros.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power
4 years agopy3: Remove #define PyInt_AsLong PyLong_AsLong
Andrew Bartlett [Sat, 14 Mar 2020 21:32:11 +0000 (10:32 +1300)]
py3: Remove #define PyInt_AsLong PyLong_AsLong

This allows us to end the use of Python 2/3 compatability macros.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agopy3: Remove #define PyInt_Type PyLong_Type
Andrew Bartlett [Sat, 14 Mar 2020 21:26:22 +0000 (10:26 +1300)]
py3: Remove #define PyInt_Type PyLong_Type

This allows us to end the use of Python 2/3 compatability macros.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agopidl: Remove reference to PyInt_Type from error string when we wanted a sensible...
Andrew Bartlett [Sat, 14 Mar 2020 21:15:15 +0000 (10:15 +1300)]
pidl: Remove reference to PyInt_Type from error string when we wanted a sensible Long

PyInt_Type is no longer a thing in Python3, we will remove the compatability
reference shortly.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agopidl: Remove duplicate "if (PyLong_Check($cvar)" clauses
Andrew Bartlett [Sat, 14 Mar 2020 21:10:24 +0000 (10:10 +1300)]
pidl: Remove duplicate "if (PyLong_Check($cvar)" clauses

Since we moved to Python3, these have been dead code, and it is clearer
now that we have removed the compatability define.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agopy3: Remove #define PyInt_Check PyLong_Check
Andrew Bartlett [Sat, 14 Mar 2020 21:04:52 +0000 (10:04 +1300)]
py3: Remove #define PyInt_Check PyLong_Check

This will allow us to remove some unused code in the PIDL-generated
python bindings.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>