]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 years agoselftest: Add test for combination of anr and paged_results
Andrew Bartlett [Wed, 2 Aug 2023 01:40:03 +0000 (13:40 +1200)] 
selftest: Add test for combination of anr and paged_results

This combination was known to cause a segfault in Samba 4.13, fixed by
5f0590362c5c0c5ee20503a67467f9be2d50e73b in later versions.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agovfs_aio_pthread: fix segfault if samba-tool ntacl get
Jones Syue [Wed, 2 Aug 2023 01:48:40 +0000 (09:48 +0800)] 
vfs_aio_pthread: fix segfault if samba-tool ntacl get

If configured as AD DC and aio_pthread appended into 'vfs objects'[1],
run these commands would get segfault:
1. sudo samba-tool ntacl get .
2. sudo net vfs getntacl sysvol .
gdb said it goes through aio_pthread_openat_fn() @ vfs_aio_pthread.c[2],
and the fsp->conn->sconn->client is null (0x0).

'sconn->client' memory is allocated when a new connection is accpeted:
smbd_accept_connection > smbd_process > smbXsrv_client_create
While running local commands looks like it would not go through
smbXsrv_client_create so the 'client' is null, segfault might happen.
We should not dereference 'client->server_multi_channel_enabled',
if 'client' is null.

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

[1] smb.conf example, samba-4.18.5, ubuntu 22.04.2
[global]
        dns forwarder = 127.0.0.53
        netbios name = U22-JONES-88X1
        realm = U22-JONES-88X1.X88X1.JONES
        server role = active directory domain controller
        workgroup = X88X1
        idmap_ldb:use rfc2307 = yes
        vfs objects = dfs_samba4 acl_xattr aio_pthread

[sysvol]
        path = /var/lib/samba/sysvol
        read only = No

[netlogon]
        path = /var/lib/samba/sysvol/u22-jones-88x1.x88x1.jones/scripts
        read only = No

[2] gdb
(gdb) run /usr/local/samba/bin/samba-tool ntacl get .
Starting program: /usr/local/Python3/bin/python3 /usr/local/samba/bin/samba-tool ntacl get .
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007fffd0eb809e in aio_pthread_openat_fn (handle=0x8d5cc0, dirfsp=0x8c3070, smb_fname=0x18ab4f0, fsp=0x1af3550, flags=196608, mode=0)
    at ../../source3/modules/vfs_aio_pthread.c:467
warning: Source file is more recent than executable.
467             if (fsp->conn->sconn->client->server_multi_channel_enabled) {
(gdb) bt
    at ../../source3/modules/vfs_aio_pthread.c:467
    at ../../source3/smbd/pysmbd.c:320
---Type <return> to continue, or q <return> to quit---
(gdb) f
    at ../../source3/modules/vfs_aio_pthread.c:467
467             if (fsp->conn->sconn->client->server_multi_channel_enabled) {
(gdb) p fsp->conn->sconn->client
$1 = (struct smbXsrv_client *) 0x0
(gdb)

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Add tracing to dsdb_search_dn() similar to gendb_search_v()
Andrew Bartlett [Mon, 31 Jul 2023 04:07:46 +0000 (16:07 +1200)] 
dsdb: Add tracing to dsdb_search_dn() similar to gendb_search_v()

The aim of this tracing is to make it simple to follow the
requests made from the RPC server and similar to LDB now that
gendb_search_v() is no longer the dominant interface.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jul 31 11:49:19 UTC 2023 on atb-devel-224

2 years agodsdb: Add tracing to dsdb_search() similar to gendb_search_v()
Andrew Bartlett [Mon, 31 Jul 2023 04:03:53 +0000 (16:03 +1200)] 
dsdb: Add tracing to dsdb_search() similar to gendb_search_v()

The aim of this tracing is to make it simple to follow the
requests made from the RPC server and similar to LDB now that
gendb_search_v() is no longer the dominant interface.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Add dsdb_search_scope_as_string() and use in ldap_backend.c
Andrew Bartlett [Mon, 31 Jul 2023 04:02:25 +0000 (16:02 +1200)] 
dsdb: Add dsdb_search_scope_as_string() and use in ldap_backend.c

This will be useful when adding debugging to other routines.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agolib/util: Move DEBUG() calls in gendb_search_v to common levels and new DBG_*() pattern
Andrew Bartlett [Mon, 31 Jul 2023 02:02:12 +0000 (14:02 +1200)] 
lib/util: Move DEBUG() calls in gendb_search_v to common levels and new DBG_*() pattern

This moves success logs 6 -> 10, failure logs 4 -> 5.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2 years agolib:krb5_wrap: Fix resource leak in smb_krb5_kt_seek_and_delete_old_entries
Pavel Filipenský [Wed, 26 Jul 2023 20:37:51 +0000 (22:37 +0200)] 
lib:krb5_wrap: Fix resource leak in smb_krb5_kt_seek_and_delete_old_entries

Reported by Red Hat internal covscan
leaked_storage: Variable "cursor" going out of scope leaks the storage it points to.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth:credentials: Fix resource leak in cli_credentials_set_from_ccache()
Pavel Filipenský [Wed, 26 Jul 2023 14:28:36 +0000 (16:28 +0200)] 
auth:credentials: Fix resource leak in cli_credentials_set_from_ccache()

Reported by Red Hat internal covscan
leaked_storage: Variable "princ" going out of scope leaks the storage it points to.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth:kerberos: Fix resource leak in smb_krb5_update_keytab()
Pavel Filipenský [Wed, 26 Jul 2023 14:25:26 +0000 (16:25 +0200)] 
auth:kerberos: Fix resource leak in smb_krb5_update_keytab()

Reported by Red Hat internal covscan
leaked_storage: Variable "keytab" going out of scope leaks the storage it points to.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth:kerberos: Fix resource leak in smb_krb5_get_keytab_container()
Pavel Filipenský [Wed, 26 Jul 2023 14:28:36 +0000 (16:28 +0200)] 
auth:kerberos: Fix resource leak in smb_krb5_get_keytab_container()

Reported by Red Hat internal covscan
leaked_storage: Variable "keytab" going out of scope leaks the storage it points to.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth:kerberos: Fix resource leak in parse_principal()
Pavel Filipenský [Wed, 26 Jul 2023 14:28:36 +0000 (16:28 +0200)] 
auth:kerberos: Fix resource leak in parse_principal()

Reported by Red Hat internal covscan
leaked_storage: Variable "princ" going out of scope leaks the storage it points to.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4:auth: Fix trailing whitespaces in kerberos_util.c
Pavel Filipenský [Wed, 26 Jul 2023 14:07:12 +0000 (16:07 +0200)] 
s4:auth: Fix trailing whitespaces in kerberos_util.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agogp: Cleanup some unused code
David Mulder [Tue, 10 Jan 2023 17:07:33 +0000 (10:07 -0700)] 
gp: Cleanup some unused code

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul 31 10:55:26 UTC 2023 on atb-devel-224

2 years agogp: Ensure centrify crontab user policy performs proper cleanup
David Mulder [Tue, 25 Jul 2023 19:23:10 +0000 (13:23 -0600)] 
gp: Ensure centrify crontab user policy performs proper cleanup

This resolves cleanup issues for user and group
centrify compatible policies. It also ensures the
crontab policies use functions from the scripts
policy, to avoid code duplication and simplify
cleanup.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure script user policy performs proper cleanup
David Mulder [Tue, 10 Jan 2023 20:21:49 +0000 (13:21 -0700)] 
gp: Ensure script user policy performs proper cleanup

This resolves cleanup issues for scripts user
policy.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure smb.conf policy preforms proper cleanup
David Mulder [Tue, 10 Jan 2023 16:57:21 +0000 (09:57 -0700)] 
gp: Ensure smb.conf policy preforms proper cleanup

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure MOTD policy preforms proper cleanup
David Mulder [Tue, 10 Jan 2023 00:19:44 +0000 (17:19 -0700)] 
gp: Ensure MOTD policy preforms proper cleanup

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure Issue policy preforms proper cleanup
David Mulder [Tue, 10 Jan 2023 00:12:53 +0000 (17:12 -0700)] 
gp: Ensure Issue policy preforms proper cleanup

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure Messages policy preforms proper cleanup
David Mulder [Mon, 9 Jan 2023 23:33:59 +0000 (16:33 -0700)] 
gp: Ensure Messages policy preforms proper cleanup

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure Firefox policy preforms proper cleanup
David Mulder [Mon, 9 Jan 2023 22:20:57 +0000 (15:20 -0700)] 
gp: Ensure Firefox policy preforms proper cleanup

Now uses gp_misc_applier to ensure old settings
are properly cleaned up.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Add a misc applier, to assist some gp exts
David Mulder [Mon, 9 Jan 2023 22:19:48 +0000 (15:19 -0700)] 
gp: Add a misc applier, to assist some gp exts

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure Firewalld preforms proper cleanup
David Mulder [Fri, 6 Jan 2023 21:48:12 +0000 (14:48 -0700)] 
gp: Ensure Firewalld preforms proper cleanup

Now uses gp_applier to ensure old settings are
properly cleaned up.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying centrify crontab user policy enforces changes
David Mulder [Tue, 25 Jul 2023 19:48:25 +0000 (13:48 -0600)] 
gp: Test modifying centrify crontab user policy enforces changes

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying script user policy enforces changes
David Mulder [Tue, 25 Jul 2023 19:41:06 +0000 (13:41 -0600)] 
gp: Test modifying script user policy enforces changes

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying smb.conf policy enforces changes
David Mulder [Fri, 10 Feb 2023 21:12:03 +0000 (14:12 -0700)] 
gp: Test modifying smb.conf policy enforces changes

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying Issue policy enforces changes
David Mulder [Fri, 10 Feb 2023 20:55:13 +0000 (13:55 -0700)] 
gp: Test modifying Issue policy enforces changes

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying Messages policy enforces changes
David Mulder [Tue, 25 Jul 2023 18:52:11 +0000 (12:52 -0600)] 
gp: Test modifying Messages policy enforces changes

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying MOTD policy enforces changes
David Mulder [Fri, 10 Feb 2023 20:04:16 +0000 (13:04 -0700)] 
gp: Test modifying MOTD policy enforces changes

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying firefox policy enforces changes
David Mulder [Thu, 9 Feb 2023 22:27:00 +0000 (15:27 -0700)] 
gp: Test modifying firefox policy enforces changes

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Test modifying firewalld policy enforces changes
David Mulder [Fri, 13 Jan 2023 18:15:50 +0000 (11:15 -0700)] 
gp: Test modifying firewalld policy enforces changes

Ensure that modifying the firewalld policy and
re-applying will enforce the correct policy.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Ensure Firewalld tests don't flop
David Mulder [Fri, 6 Jan 2023 21:49:19 +0000 (14:49 -0700)] 
gp: Ensure Firewalld tests don't flop

This test was failing depending on the system it
was run on, since the result depends on whether
firewalld python bindings were installed. This
wasn't failing in CI (and so there is no flopping
test marked), but does fail on some local systems.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodsdb: Use samdb_system_container_dn() in pdb_samba_dsdb_*()
Andrew Bartlett [Thu, 27 Jul 2023 05:18:45 +0000 (17:18 +1200)] 
dsdb: Use samdb_system_container_dn() in pdb_samba_dsdb_*()

This makes more calls to add children, but avoids the cn=system string in the
codebase which makes it easier to audit that this is always being built
correctly.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jul 31 07:20:21 UTC 2023 on atb-devel-224

2 years agodsdb: Use samdb_system_container_dn() in dsdb_trust_*()
Andrew Bartlett [Thu, 27 Jul 2023 05:14:30 +0000 (17:14 +1200)] 
dsdb: Use samdb_system_container_dn() in dsdb_trust_*()

This is now exactly the same actions, but just uses common code to do it.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-rpc_server/backupkey: Use samdb_system_container_dn() in get_lsa_secret()
Andrew Bartlett [Thu, 27 Jul 2023 05:11:39 +0000 (17:11 +1200)] 
s4-rpc_server/backupkey: Use samdb_system_container_dn() in get_lsa_secret()

This is now exactly the same actions, but just uses common code to do it.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-rpc_server/backupkey: Use samdb_system_container_dn() in set_lsa_secret()
Andrew Bartlett [Thu, 27 Jul 2023 05:09:31 +0000 (17:09 +1200)] 
s4-rpc_server/backupkey: Use samdb_system_container_dn() in set_lsa_secret()

This is now exactly the same actions, but just uses common code to do it.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-rpc_server/netlogon: Use samdb_system_container_dn() in fill_trusted_domains_array()
Andrew Bartlett [Thu, 27 Jul 2023 05:00:21 +0000 (17:00 +1200)] 
s4-rpc_server/netlogon: Use samdb_system_container_dn() in fill_trusted_domains_array()

This is now exactly the same actions, but just uses common code to do it.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos4-rpc_server/lsa: Use samdb_system_container_dn() in dcesrv_lsa_get_policy_state()
Andrew Bartlett [Thu, 27 Jul 2023 04:58:13 +0000 (16:58 +1200)] 
s4-rpc_server/lsa: Use samdb_system_container_dn() in dcesrv_lsa_get_policy_state()

This is now exactly the same actions, but just uses common code to do it.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Use samdb_get_system_container_dn() to get Password Settings Container
Andrew Bartlett [Thu, 27 Jul 2023 04:44:10 +0000 (16:44 +1200)] 
dsdb: Use samdb_get_system_container_dn() to get Password Settings Container

By doing this we use the common samdb_get_system_container_dn() routine and we
avoid doing a linerize and parse step on the main DN, instead using the
already stored parse of the DN.  This is more hygenic.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Use samdb_system_container_dn() in samldb.c
Andrew Bartlett [Thu, 27 Jul 2023 04:29:34 +0000 (16:29 +1200)] 
dsdb: Use samdb_system_container_dn() in samldb.c

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodsdb: Add new function samdb_system_container_dn()
Andrew Bartlett [Thu, 27 Jul 2023 04:12:11 +0000 (16:12 +1200)] 
dsdb: Add new function samdb_system_container_dn()

This will replace many calls crafting or searching for this DN
elsewhere in the code.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2 years agoBug #9959: Don't search for CN=System
Arvid Requate [Fri, 26 Aug 2016 14:20:34 +0000 (16:20 +0200)] 
Bug #9959: Don't search for CN=System

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

Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoFor Bug #9959: local talloc frame for next commit
Arvid Requate [Fri, 26 Aug 2016 14:18:57 +0000 (16:18 +0200)] 
For Bug #9959: local talloc frame for next commit

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

Signed-off-by: Arvid Requate <requate@univention.de>
[abartlet@samba.org Added additional talloc_free() in failure paths]
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/modules: Fix DFS links when widelinks = yes
Noel Power [Thu, 27 Jul 2023 12:26:21 +0000 (13:26 +0100)] 
s3/modules: Fix DFS links when widelinks = yes

In openat(), even if we fail to open the file,
propagate stat if and only if the object is a link in
a DFS share. This allows calling code to further process
the link.

Also remove knownfail

Pair-Programmed-With: Jeremy Alison <jra@samba.org>

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jul 29 00:43:52 UTC 2023 on atb-devel-224

2 years agos3/modules: Add flag indicating if connected share is a dfs share
Noel Power [Thu, 27 Jul 2023 16:36:29 +0000 (17:36 +0100)] 
s3/modules: Add flag indicating if connected share is a dfs share

Not used yet, will be used in the next commit to avoid testing
if the connected share is a dfs one.

Pair-Programmed-With: Jeremy Alison <jra@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosefltest: Add new regression test dfs with widelinks = yes
Noel Power [Fri, 28 Jul 2023 08:41:59 +0000 (09:41 +0100)] 
sefltest: Add new regression test dfs with widelinks = yes

Adds a new test trying to cd into dfs path on share with
widelinks enabled, should generate an error (see BUG:)

Add a knownfail so CI continues

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoselftest: Add new dfs share (with widelinks enabled)
Noel Power [Fri, 28 Jul 2023 08:40:57 +0000 (09:40 +0100)] 
selftest: Add new dfs share (with widelinks enabled)

Adds share (to be used in later test) that has dfs node
but additionally has widelinks set to yes

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoldb: change the version to 2.9.0 for Samba 4.20
Jule Anger [Tue, 25 Jul 2023 13:56:59 +0000 (15:56 +0200)] 
ldb: change the version to 2.9.0 for Samba 4.20

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jul 28 11:49:02 UTC 2023 on atb-devel-224

2 years agoWHATSNEW: Start release notes for Samba 4.20.0pre1.
Stefan Metzmacher [Fri, 28 Jul 2023 09:52:19 +0000 (11:52 +0200)] 
WHATSNEW: Start release notes for Samba 4.20.0pre1.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2 years agoVERSION: Bump version up to 4.20.0pre1...
Stefan Metzmacher [Fri, 28 Jul 2023 09:53:50 +0000 (11:53 +0200)] 
VERSION: Bump version up to 4.20.0pre1...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2 years agoVERSION: Disable GIT_SNAPSHOT for the Samba 4.19.0rc1 release. samba-4.19.0rc1
Stefan Metzmacher [Fri, 28 Jul 2023 09:49:28 +0000 (11:49 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the Samba 4.19.0rc1 release.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2 years agoWHATSNEW: Up to Samba 4.19.0rc1.
Jule Anger [Tue, 25 Jul 2023 13:59:19 +0000 (15:59 +0200)] 
WHATSNEW: Up to Samba 4.19.0rc1.

Signed-off-by: Jule Anger <janger@samba.org>
2 years agoldb: release 2.8.0 for use in Samba 4.19.x ldb-2.8.0
Jule Anger [Tue, 18 Jul 2023 08:48:57 +0000 (10:48 +0200)] 
ldb: release 2.8.0 for use in Samba 4.19.x

* CVE-2023-0614 Not-secret but access controlled LDAP attributes can be discovered (bug 15270)
* pyldb: Raise an exception if ldb_dn_get_parent() fails
* Implement ldap_whoami in pyldb and add the RFC4532 LDB_EXTENDED_WHOAMI_OID definition
* Documentation and spelling fixes
* Add ldb_val -> bool,uint64,int64 parsing functions
* Split out ldb_val_as_dn() helper function
* add LDB_CHANGETYPE_MODRDN support to ldb_ldif_to_pyobject()
* add LDB_CHANGETYPE_DELETE support to ldb_ldif_to_pyobject()
* let ldb_ldif_parse_modrdn() handle names without 'rdn_name=' prefix
* Don't create error string if there is no error
* Avoid allocation and memcpy() for every wildcard match candidate
* Make ldb_msg_remove_attr O(n)
* pyldb: Throw error on invalid controls
* pyldb: remove py2 ifdefs
* Call tevent_set_max_debug_level(TEVENT_DEBUG_TRACE)

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

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2 years agoctdb-tools: Improve printing of multi-line event script output
Martin Schwenke [Wed, 12 Jul 2023 00:39:06 +0000 (10:39 +1000)] 
ctdb-tools: Improve printing of multi-line event script output

Multi-line output currently prints like this:

  OUTPUT: aaa
bbb
ccc

This is less beautiful than it could be.

Instead, print multi-line output with no inlining and each line
indented:

  OUTPUT:
    aaa
    bbb
    ccc

However, continue to inline single line output:

  OUTPUT: foo

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-tools: Always print script output in event status
Martin Schwenke [Wed, 12 Jul 2023 00:39:06 +0000 (10:39 +1000)] 
ctdb-tools: Always print script output in event status

When event scripts succeed they generally produce no output.  However,
when a script succeeds and produces output, such output almost
certainly contains warnings.  So, always print script output.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agolibrpc/idl: Remove DCOM and WMI IDL
Andrew Bartlett [Wed, 26 Jul 2023 20:06:48 +0000 (08:06 +1200)] 
librpc/idl: Remove DCOM and WMI IDL

As hinted in f2416493c0c779356606aebf0aceca8fa416b55c the DCOM and WMI
IDL is now unused.  These generate code with PIDL, costing a small
amount of build time but more importantly are fuzzed, which costs an
ongoing amount of CPU time as oss-fuzz tries to find parsing issues.

We do not need to continue this waste, and these can be restored
if this effort is ever to start again.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agodcom: Remove remainder of DCOM test client code
Andrew Bartlett [Wed, 26 Jul 2023 20:17:07 +0000 (08:17 +1200)] 
dcom: Remove remainder of DCOM test client code

This follows f2416493c0c779356606aebf0aceca8fa416b55c, removing the remaining parts
of our DCOM effort.  This can be resumed at a later time, but for now this is untested
(as we have no server) and just uses build time.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agolibrpc:crypto: SAFE_FREE() -> krb5_free_enctypes()
Pavel Filipenský [Thu, 27 Jul 2023 14:30:00 +0000 (16:30 +0200)] 
librpc:crypto: SAFE_FREE() -> krb5_free_enctypes()

Reported by Red Hat internal covscan

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agolibrpc:crypto: SAFE_FREE() -> krb5_free_string()
Pavel Filipenský [Thu, 27 Jul 2023 14:29:19 +0000 (16:29 +0200)] 
librpc:crypto: SAFE_FREE() -> krb5_free_string()

Reported by Red Hat internal covscan

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth:credentials: SAFE_FREE() -> krb5_free_string()
Pavel Filipenský [Thu, 27 Jul 2023 14:28:48 +0000 (16:28 +0200)] 
auth:credentials: SAFE_FREE() -> krb5_free_string()

Reported by Red Hat internal covscan

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth:credentials: SAFE_FREE() -> krb5_free_enctypes()
Pavel Filipenský [Thu, 27 Jul 2023 14:26:57 +0000 (16:26 +0200)] 
auth:credentials: SAFE_FREE() -> krb5_free_enctypes()

Reported by Red Hat internal covscan

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agokrb5_wrap: add krb5_free_string()
Pavel Filipenský [Thu, 27 Jul 2023 20:01:00 +0000 (22:01 +0200)] 
krb5_wrap: add krb5_free_string()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agokrb5_wrap: add krb5_free_enctypes()
Pavel Filipenský [Thu, 27 Jul 2023 14:22:22 +0000 (16:22 +0200)] 
krb5_wrap: add krb5_free_enctypes()

MIT Kerberos implements krb5_free_enctypes(), Heimdal is missing it and
offers krb5_xfree() instead.
This introduces a wrapper krb5_free_enctypes() around krb5_xfree() for
Heimdal.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agosmbd: move tevent_req_post() out of smbd_smb2_create_after_exec()
Ralph Boehme [Fri, 28 Jul 2023 09:16:04 +0000 (11:16 +0200)] 
smbd: move tevent_req_post() out of smbd_smb2_create_after_exec()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2 years agos3: smbd: Sanitize any "server" and "share" components of SMB1 DFS paths to remove...
Jeremy Allison [Wed, 26 Jul 2023 23:39:51 +0000 (16:39 -0700)] 
s3: smbd: Sanitize any "server" and "share" components of SMB1 DFS paths to remove UNIX separators.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Jul 27 10:52:50 UTC 2023 on atb-devel-224

2 years agos3: torture: Add test to show an SMB1 DFS path of "\\x//\\/" crashes smbd.
Jeremy Allison [Wed, 26 Jul 2023 23:37:11 +0000 (16:37 -0700)] 
s3: torture: Add test to show an SMB1 DFS path of "\\x//\\/" crashes smbd.

Adds knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agomdssvc: fix returning file modification date for older Mac releases
Ralph Boehme [Thu, 18 May 2023 16:12:19 +0000 (18:12 +0200)] 
mdssvc: fix returning file modification date for older Mac releases

Mac 10.10 uses kMDItemContentModificationDate instead of
kMDItemFSContentChangeDate.

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

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): Wed Jul 26 23:42:44 UTC 2023 on atb-devel-224

2 years agomdssvc: fix date marshalling
Ralph Boehme [Wed, 17 May 2023 14:38:39 +0000 (16:38 +0200)] 
mdssvc: fix date marshalling

Did this ever work? Possible just copied over from Netatalk and was always
broken... The Mac client expects the timevalue as seconds relative to
2001-01-01 00:00:00 UTC, packed as IEEE float.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agomdssvc: prepare for returning timestamps with sub-seconds granularity
Ralph Boehme [Wed, 17 May 2023 14:37:36 +0000 (16:37 +0200)] 
mdssvc: prepare for returning timestamps with sub-seconds granularity

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agomdssvc: reduce pagesize to 50
Ralph Boehme [Thu, 20 Apr 2023 15:27:20 +0000 (17:27 +0200)] 
mdssvc: reduce pagesize to 50

Lastest macOS queries additional file metadata per search result, which causes
the mashalled paged result set including metadata to exceed the 64 KB result
fragment buffer.

Lacking fragementation support in mdssvc (it's supported by the protocol), for
now just reduce the maximum number of results per search page.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agotests/mdssvc: match hits:total:value to be the actual amount of entries in hits
Ralph Boehme [Fri, 21 Apr 2023 05:07:13 +0000 (07:07 +0200)] 
tests/mdssvc: match hits:total:value to be the actual amount of entries in hits

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agomdssvc: fix enforcement of "elasticsearch:max results"
Ralph Boehme [Thu, 20 Apr 2023 15:58:38 +0000 (17:58 +0200)] 
mdssvc: fix enforcement of "elasticsearch:max results"

This wasn't enforced at all thus a query would return all available matches
without limit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agomdssvc: add and use SL_PAGESIZE
Ralph Boehme [Thu, 20 Apr 2023 15:24:30 +0000 (17:24 +0200)] 
mdssvc: add and use SL_PAGESIZE

SL_PAGESIZE is the number of entries we want to process per paged search result
set. This is different from MAX_SL_RESULTS which ought to be a default maximum
value for total number of results returned for a search query.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agomdssvc: fix long running backend queries
Ralph Boehme [Thu, 23 Mar 2023 15:39:11 +0000 (16:39 +0100)] 
mdssvc: fix long running backend queries

If a query is still running in the backend and we have no results yet, returning
0 triggers a search termination by the client in latest macOS releases. macOS
returns 0x23 in this case.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agomdssvc: set query state for continued queries to SLQ_STATE_RUNNING
Ralph Boehme [Wed, 19 Apr 2023 12:38:45 +0000 (14:38 +0200)] 
mdssvc: set query state for continued queries to SLQ_STATE_RUNNING

SLQ_STATE_RESULTS implies that there are already results attached to the slq
which is not the case. Instead the backend will start processing from where it
left off when it hits the maximum result limit and had set the state to
SLQ_STATE_FULL.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoWHATSNEW: Add TLS cert reload feature
Andrew Bartlett [Fri, 21 Jul 2023 04:56:49 +0000 (16:56 +1200)] 
WHATSNEW: Add TLS cert reload feature

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul 25 21:02:35 UTC 2023 on atb-devel-224

2 years agodoc-xml: Add entry for reload-certs for new LDAP certificate reload function
Andrew Bartlett [Fri, 21 Jul 2023 04:44:54 +0000 (16:44 +1200)] 
doc-xml: Add entry for reload-certs for new LDAP certificate reload function

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agodocs-xml: Fix invalid XML in smbcontrol manpage
Andrew Bartlett [Fri, 21 Jul 2023 04:42:23 +0000 (16:42 +1200)] 
docs-xml: Fix invalid XML in smbcontrol manpage

This was picked by a mode in Emacs.

Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2 years agotestprogs/blackbox: add test_ldap_tls_reload.sh
Jule Anger [Mon, 5 Jun 2023 13:23:11 +0000 (15:23 +0200)] 
testprogs/blackbox: add test_ldap_tls_reload.sh

This tests the reload (and if needed regeneration) of
tls certificates.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:ldap_server: reload tls certificates on smbcontrol reload-certs
Jule Anger [Wed, 1 Mar 2023 09:53:53 +0000 (09:53 +0000)] 
s4:ldap_server: reload tls certificates on smbcontrol reload-certs

Reload certificates with the command 'smbcontrol ldap_server reload-certs'.
The message is send to the master process, who forwards it to the workers
processes.
The master process reload and, if necessary, create the certificates first,
then the workers processes reload them.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:ldap_server: remember dns_host_name in ldap_service
Jule Anger [Tue, 31 Jan 2023 12:50:06 +0000 (13:50 +0100)] 
s4:ldap_server: remember dns_host_name in ldap_service

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:ldap_server: don't store task_server in ldapsrv_service
Jule Anger [Wed, 1 Mar 2023 09:53:53 +0000 (09:53 +0000)] 
s4:ldap_server: don't store task_server in ldapsrv_service

We store individual pointers we need and adjust them
as needed in ldapsrv_post_fork() and the newly added
ldapsrv_before_loop().

This will be required for the next steps.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:tls_tstream: create tstream_tls_params_internal
Jule Anger [Tue, 31 Jan 2023 14:08:31 +0000 (15:08 +0100)] 
s4:tls_tstream: create tstream_tls_params_internal

The following commits will implement the reloading of tls certificates.
Therefore we need to overwrite the interal memory.

Note we need to make sure x509_cred and dh_params from
tstream_tls_params_internal stay alive for the whole lifetime
of this session!

See 'man gnutls_credentials_set' and
'man gnutls_certificate_set_dh_params'.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:smbcontrol: improve destination resolution using names db
jule [Mon, 6 Feb 2023 13:28:36 +0000 (13:28 +0000)] 
s3:smbcontrol: improve destination resolution using names db

With this change it's possible to use 'smbcontrol ldap_server ...'
instead of 'smbcontrol prefork-master-ldap ...'

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:process_prefork: create new messaging context for the master process
Jule Anger [Wed, 1 Mar 2023 10:02:00 +0000 (10:02 +0000)] 
s4:process_prefork: create new messaging context for the master process

In order to allow the before_loop() hook to register messages or event
handlers, we need to fix up task->event_ctx and create a new
task->msg_ctx. It also means the struct task_server pointer
changes in the master before_loop() hook.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:process: add method called before entering the tevent_loop_wait
Jule Anger [Wed, 1 Mar 2023 09:48:18 +0000 (09:48 +0000)] 
s4:process: add method called before entering the tevent_loop_wait

This gives the service a chance to register messaging and/or event handlers
on the correct contexts.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:process_prefork: avoid memory leaks caused by messaging_post_self
Jule Anger [Wed, 1 Mar 2023 09:47:09 +0000 (09:47 +0000)] 
s4:process_prefork: avoid memory leaks caused by messaging_post_self

Sending a message to a process with multiple tevent contexts
can cause a message to get stuck and cause a data leak.

In general it's safer to call imessaging_dgm_unref_ev() before
talloc_free()...

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:winbindd: Fix double close(fd)
Pavel Filipenský [Tue, 25 Jul 2023 09:16:56 +0000 (11:16 +0200)] 
s3:winbindd: Fix double close(fd)

Reported by Red Hat internal coverity

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Tue Jul 25 12:08:49 UTC 2023 on atb-devel-224

2 years agomdscli: correct handling of in-progress searches
Ralph Boehme [Thu, 20 Apr 2023 13:12:49 +0000 (15:12 +0200)] 
mdscli: correct handling of in-progress searches

If a query is still being processed on the server and there no results yet,
macOS returns 0x23.

For now just implements this as dumb polling once a second in mdsearch and the
Python bindings.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jul 24 16:15:16 UTC 2023 on atb-devel-224

2 years agomdscli: increase MAX_SLQ_COUNT
Ralph Boehme [Thu, 20 Apr 2023 14:54:13 +0000 (16:54 +0200)] 
mdscli: increase MAX_SLQ_COUNT

Now that the client supports fragementation, when procesing reassambled large
result sets from macOS Spotlight server, it's possible to hit this limit in the
client. Let's just increase it to some larger value.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2 years agomdscli: increase MAX_SLQ_TOCIDX
Ralph Boehme [Thu, 20 Apr 2023 14:52:19 +0000 (16:52 +0200)] 
mdscli: increase MAX_SLQ_TOCIDX

Now that the client supports fragementation, when procesing reassambled large
result sets from macOS Spotlight server, it's possible to hit this limit in the
client. Let's just increase it to some larger value.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2 years agomdssvc: increase MAX_SLQ_TOC
Ralph Boehme [Thu, 20 Apr 2023 14:50:58 +0000 (16:50 +0200)] 
mdssvc: increase MAX_SLQ_TOC

Now that the client supports fragementation, when procesing reassambled large
result sets from macOS Spotlight server, it's possible to hit this limit in the
client. Let's just increase it to some larger value.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2 years agomdssvc: introduce MAX_MDSCMD_SIZE
Ralph Boehme [Mon, 17 Jul 2023 12:51:54 +0000 (14:51 +0200)] 
mdssvc: introduce MAX_MDSCMD_SIZE

Allow larger value for the reassembled mdscmd's. Now that the client supports
fragementation, when processing reassambled large result sets from macOS
Spotlight server, it's possible to hit this limit in the unmarshalling
code. Let's just increase it to some larger value.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2 years agomdscli: add fragmentation support
Ralph Boehme [Thu, 20 Apr 2023 08:45:52 +0000 (10:45 +0200)] 
mdscli: add fragmentation support

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2 years agomdssvc: remove duplicate define of MAX_SL_FRAGMENT_SIZE
Ralph Boehme [Thu, 20 Apr 2023 12:59:12 +0000 (14:59 +0200)] 
mdssvc: remove duplicate define of MAX_SL_FRAGMENT_SIZE

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2 years agolibrpc/idl: mdssvc: unkn4 field is a fragment indicator
Ralph Boehme [Thu, 20 Apr 2023 08:44:58 +0000 (10:44 +0200)] 
librpc/idl: mdssvc: unkn4 field is a fragment indicator

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2 years agolibsmb: increase a debug level when site-aware DC lookup failed
Ralph Boehme [Thu, 20 Jul 2023 15:08:19 +0000 (17:08 +0200)] 
libsmb: increase a debug level when site-aware DC lookup failed

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Jul 21 16:19:35 UTC 2023 on atb-devel-224

2 years agoCVE-2023-3347: smbd: fix "server signing = mandatory"
Ralph Boehme [Tue, 20 Jun 2023 13:33:02 +0000 (15:33 +0200)] 
CVE-2023-3347: smbd: fix "server signing = mandatory"

This was broken by commit 1f3f6e20dc086a36de52bffd0bc36e15fb19e1c6 because when
calling srv_init_signing() very early after accepting the connection in
smbd_add_connection(), conn->protocol is still PROTOCOL_NONE.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Fri Jul 21 13:03:09 UTC 2023 on atb-devel-224

2 years agoCVE-2023-3347: smbd: remove comment in smbd_smb2_request_process_negprot()
Ralph Boehme [Tue, 20 Jun 2023 16:13:23 +0000 (18:13 +0200)] 
CVE-2023-3347: smbd: remove comment in smbd_smb2_request_process_negprot()

This is just going to bitrot. Anyone who's interested can just grep for
"signing_mandatory" and look up what it does.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
2 years agoCVE-2023-3347: smbd: inline smb2_srv_init_signing() code in srv_init_signing()
Ralph Boehme [Wed, 21 Jun 2023 13:10:58 +0000 (15:10 +0200)] 
CVE-2023-3347: smbd: inline smb2_srv_init_signing() code in srv_init_signing()

It's now a one-line function, imho the overall code is simpler if that code is
just inlined.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
2 years agoCVE-2023-3347: smbd: pass lp_ctx to smb[1|2]_srv_init_signing()
Ralph Boehme [Wed, 21 Jun 2023 13:06:12 +0000 (15:06 +0200)] 
CVE-2023-3347: smbd: pass lp_ctx to smb[1|2]_srv_init_signing()

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>