]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
5 months agos3:rpc_cerver: Use dcerpc_lsa_open_policy3() for internal RPC
Stefan Metzmacher [Wed, 12 Feb 2025 13:17:30 +0000 (14:17 +0100)] 
s3:rpc_cerver: Use dcerpc_lsa_open_policy3() for internal RPC

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 months agos3:rpc_client: Add cli_rpc_pipe_reopen_np_noauth()
Stefan Metzmacher [Wed, 12 Feb 2025 11:35:20 +0000 (12:35 +0100)] 
s3:rpc_client: Add cli_rpc_pipe_reopen_np_noauth()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 months agodocs: Update documentation for 'sync machine password to keytab'
Pavel Filipenský [Fri, 14 Feb 2025 16:27:26 +0000 (17:27 +0100)] 
docs: Update documentation for 'sync machine password to keytab'

Use specifier 'spn_prefixes=host' instead of 'host'

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Sat Feb 15 19:21:56 UTC 2025 on atb-devel-224

5 months agos3:libads: Remove specifier for 'host' principal from 'sync machine password to keytab'
Pavel Filipenský [Fri, 14 Feb 2025 16:28:54 +0000 (17:28 +0100)] 
s3:libads: Remove specifier for 'host' principal from 'sync machine password to keytab'

Use specifier 'spn_prefixes=host' instead of 'host'

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 months agopytests: test pysmbd with relative path names via samba-tool ntacl
Björn Baumbach [Thu, 13 Feb 2025 17:05:44 +0000 (18:05 +0100)] 
pytests: test pysmbd with relative path names via samba-tool ntacl

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Fri Feb 14 16:18:19 UTC 2025 on atb-devel-224

5 months agopysmbd: Fix interactive samba-tool use after 0bb35e246141
Volker Lendecke [Wed, 12 Feb 2025 12:45:42 +0000 (13:45 +0100)] 
pysmbd: Fix interactive samba-tool use after 0bb35e246141

samba-tool ntacl also calls into pysmbd, and 0bb35e246141 broke
relative path names. Thanks to Björn Baumbach <bb@sernet.de> for
testing interactively!!

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15806
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 months agopytests: test pysmbd with non-existent file
Björn Baumbach [Wed, 12 Feb 2025 16:15:37 +0000 (17:15 +0100)] 
pytests: test pysmbd with non-existent file

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 months agopysmbd: Init mangle_fns
Volker Lendecke [Mon, 13 Jan 2025 10:45:06 +0000 (11:45 +0100)] 
pysmbd: Init mangle_fns

openat_pathref_fsp() eventually calls mangling functions, so we have
to initialize them.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15807
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 months agos4:kdc: pass the full samba_kdc_db_context to most helper functions
Stefan Metzmacher [Mon, 2 Dec 2024 13:45:18 +0000 (14:45 +0100)] 
s4:kdc: pass the full samba_kdc_db_context to most helper functions

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Feb 14 15:19:24 UTC 2025 on atb-devel-224

5 months agos4:kdc: let struct samba_kdc_entry_pac remember the krbtgt samba_kdc_entry
Stefan Metzmacher [Fri, 29 Nov 2024 11:08:00 +0000 (12:08 +0100)] 
s4:kdc: let struct samba_kdc_entry_pac remember the krbtgt samba_kdc_entry

This will allow us later to find the information needed to do
sid filtering of the pac.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:kdc: always go through samba_kdc_get_device_info_blob()
Stefan Metzmacher [Wed, 29 Jan 2025 15:26:39 +0000 (16:26 +0100)] 
s4:kdc: always go through samba_kdc_get_device_info_blob()

This means we always go through samba_kdc_get_user_info_dc()
both for client and also device pac.

It means we use the same logic regarding samba_krb5_pac_is_trusted()
and calling authsam_update_user_info_dc().

It means we do all logic on struct auth_user_info_dc
and only convert to PAC_DEVICE_INFO at the end.

Before we tried a mix of calling authsam_update_user_info_dc()
on a half constructed auth_user_info_dc,
while trying to apply the diff on auth_user_info_dc
to the also half constructed PAC_DEVICE_INFO.
Which can't work once auth_user_info_dc() will
apply sid filtering and the number of sids
may shrink.

Now we use authsam_update_user_info_dc()
followed by auth_convert_user_info_dc_saminfo3()
and samba_kdc_make_device_info().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agoauth: remember the origin of sids from the PAC
Stefan Metzmacher [Thu, 19 Dec 2024 17:30:49 +0000 (18:30 +0100)] 
auth: remember the origin of sids from the PAC

So far the conversion from TGT PAC to
struct auth_user_info_dc back to TGS PAC
looses the information in what part of
the PAC_LOGON_INFO a sid was stored.

With this change we let
make_user_info_dc_{netlogon_validation,pac}()
remember this, so that
auth_convert_user_info_dc_sam{baseinfo,info6}()
can rebuild the information into the desired
parts of the PAC_LOGON_INFO.

This was found and fixed for sid filter related
tests, but it turns out that it already
fixes a few tests from samba.tests.krb5.device_tests.

All other places get an implicit AUTH_SID_ORIGIN_UNKNOWN (=0),
which means we use the same logic as before.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: simplify authsam_make_user_info_dc()
Stefan Metzmacher [Wed, 29 Jan 2025 10:34:42 +0000 (11:34 +0100)] 
s4:auth: simplify authsam_make_user_info_dc()

By using (struct auth_SidAttr) {} we don't leave
uninitialized memory if struct auth_SidAttr changes.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: let authsam_make_user_info_dc() use helper variables for the rodcsid
Stefan Metzmacher [Tue, 11 Feb 2025 20:16:02 +0000 (21:16 +0100)] 
s4:auth: let authsam_make_user_info_dc() use helper variables for the rodcsid

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: let authsam_make_user_info_dc() use helper variables for the groupsid
Stefan Metzmacher [Tue, 11 Feb 2025 20:16:02 +0000 (21:16 +0100)] 
s4:auth: let authsam_make_user_info_dc() use helper variables for the groupsid

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: let auth_domain_admin_user_info_dc() use talloc_zero_array(struct auth_SidAttr)
Stefan Metzmacher [Wed, 29 Jan 2025 10:36:52 +0000 (11:36 +0100)] 
s4:auth: let auth_domain_admin_user_info_dc() use talloc_zero_array(struct auth_SidAttr)

This means we won't leave uninitialized memory if
struct auth_SidAttr changes.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: simplify auth_anonymous_user_info_dc()
Stefan Metzmacher [Wed, 29 Jan 2025 10:34:42 +0000 (11:34 +0100)] 
s4:auth: simplify auth_anonymous_user_info_dc()

By using (struct auth_SidAttr) {} we don't leave
uninitialized memory if struct auth_SidAttr changes.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: simplify auth_system_user_info_dc()
Stefan Metzmacher [Wed, 29 Jan 2025 10:34:42 +0000 (11:34 +0100)] 
s4:auth: simplify auth_system_user_info_dc()

By using (struct auth_SidAttr) {} we don't leave
uninitialized memory if struct auth_SidAttr changes.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: let auth_generate_security_token() use auth_user_info_dc_expand_sids() for...
Stefan Metzmacher [Wed, 29 Jan 2025 10:26:32 +0000 (11:26 +0100)] 
s4:auth: let auth_generate_security_token() use auth_user_info_dc_expand_sids() for device_info

This means we'll also expand local groups for the device,
which was missing before.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth: split auth_user_info_dc_expand_sids() out of auth_generate_security_token()
Stefan Metzmacher [Wed, 29 Jan 2025 10:17:42 +0000 (11:17 +0100)] 
s4:auth: split auth_user_info_dc_expand_sids() out of auth_generate_security_token()

This way we'll be able to reuse it for the device sids in the
next commit.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:dsdb/common: simplify the logic in dsdb_expand_nested_groups()
Stefan Metzmacher [Wed, 29 Jan 2025 09:02:45 +0000 (10:02 +0100)] 
s4:dsdb/common: simplify the logic in dsdb_expand_nested_groups()

By using (struct auth_SidAttr) {} we make sure struct auth_SidAttr
can change without leaving uninitialized memory.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:dsdb/common: use talloc_zero() in samdb_result_dom_sid_attrs()
Stefan Metzmacher [Wed, 29 Jan 2025 08:55:20 +0000 (09:55 +0100)] 
s4:dsdb/common: use talloc_zero() in samdb_result_dom_sid_attrs()

This means struct auth_SidAttr can change without leaving
uninitialized memory.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:auth/ntlm: simplifiy logic in name_to_ntstatus_check_password()
Stefan Metzmacher [Wed, 29 Jan 2025 08:52:37 +0000 (09:52 +0100)] 
s4:auth/ntlm: simplifiy logic in name_to_ntstatus_check_password()

Using (struct auth_SidAttr) {} means we won't leave
uninitialized memory arround if struct auth_SidAttr will
change in the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agolibcli/security: simplify logic in add_sid_to_array_attrs()
Stefan Metzmacher [Wed, 29 Jan 2025 08:43:44 +0000 (09:43 +0100)] 
libcli/security: simplify logic in add_sid_to_array_attrs()

(struct auth_SidAttr) {} makes sure we don't leave uninitialized
memory in case struct auth_SidAttr will change (which will happen in
the next commits).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agoauth: simplify logic in make_user_info_dc_{netlogon_validation,pac}()
Stefan Metzmacher [Wed, 29 Jan 2025 08:36:32 +0000 (09:36 +0100)] 
auth: simplify logic in make_user_info_dc_{netlogon_validation,pac}()

It's better to use (struct auth_SidAttr) {} in order to
intialize all members.

struct auth_SidAttr will change in the next commits
and this makes it easier to review that we don't
leave some parts uninitialized.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agoauth: let make_user_info_dc_netlogon_validation allocate the sid array in one go
Stefan Metzmacher [Wed, 29 Jan 2025 08:36:32 +0000 (09:36 +0100)] 
auth: let make_user_info_dc_netlogon_validation allocate the sid array in one go

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agoauth: let make_user_info_dc_netlogon_validation validate all parameters first
Stefan Metzmacher [Wed, 29 Jan 2025 08:36:32 +0000 (09:36 +0100)] 
auth: let make_user_info_dc_netlogon_validation validate all parameters first

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agoauth: remove sid-filtering comment in make_user_info_dc_netlogon_validation
Stefan Metzmacher [Wed, 29 Jan 2025 08:36:32 +0000 (09:36 +0100)] 
auth: remove sid-filtering comment in make_user_info_dc_netlogon_validation

sid filtering will be done at a different level...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agoauth.idl: make sure ndr_{push,pull}_auth_SidAttr() is never used
Stefan Metzmacher [Tue, 28 Jan 2025 18:49:23 +0000 (19:49 +0100)] 
auth.idl: make sure ndr_{push,pull}_auth_SidAttr() is never used

auth_SidAttr is currently not used for any IPC traffic,
with this change demonstrates that and makes sure it
stays that way.

It means we are free to change auth_SidAttr without the
need to change any ipc protocol version.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agolibcli/security: add some more global_sid_ values required for SID filtering
Stefan Metzmacher [Thu, 1 Feb 2018 15:23:02 +0000 (16:23 +0100)] 
libcli/security: add some more global_sid_ values required for SID filtering

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agondr_claims: only use compression if it actually reduces the size
Stefan Metzmacher [Wed, 15 Jan 2025 09:30:53 +0000 (10:30 +0100)] 
ndr_claims: only use compression if it actually reduces the size

I have captures showing that claims compression depends on the payload
itself and how well it compresses, instead of the pure length of the
payload.

E.g. a single string claim with a value of 68 'a'
characters has an unpressed size of 336
and compressed size is 335.
While a single string with random string s1
has an unpressed size of 504 and it's still
uncompressed on the wire.
A different random string s2 also has an unpressed
size of 504, but it is compressed into a size of 502.

So it really depends if the compression makes it actually
smaller than the uncompressed version.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Feb 14 11:56:49 UTC 2025 on atb-devel-224

5 months agopython:tests/krb5: only expect compressed claims if the compression reduces the size
Stefan Metzmacher [Wed, 15 Jan 2025 11:24:04 +0000 (12:24 +0100)] 
python:tests/krb5: only expect compressed claims if the compression reduces the size

I have captures showing that claims compression depends on the payload
itself and how well it compresses, instead of the pure length of the
payload.

E.g. a single string claim with a value of 68 'a'
characters has an unpressed size of 336
and compressed size is 335.
While a single string with random string s1
has an unpressed size of 504 and it's still
uncompressed on the wire.
A different random string s2 also has an unpressed
size of 504, but it is compressed into a size of 502.

So it really depends if the compression makes it actually
smaller than the uncompressed version.

This makes the tests more reliable against Windows DCs
with existing claims defined.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agopython:tests: add ClaimsTransformationTests to security.py
Stefan Metzmacher [Mon, 3 Feb 2025 16:15:28 +0000 (17:15 +0100)] 
python:tests: add ClaimsTransformationTests to security.py

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agolibcli/security: add py_claims_tf_policy_{parse_rules,wrap_xml}()
Stefan Metzmacher [Fri, 17 Jan 2025 12:24:28 +0000 (13:24 +0100)] 
libcli/security: add py_claims_tf_policy_{parse_rules,wrap_xml}()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agolibcli/security: add claims_tf_policy_[un]wrap_xml() for msDS-TransformationRules
Stefan Metzmacher [Mon, 3 Feb 2025 13:31:23 +0000 (14:31 +0100)] 
libcli/security: add claims_tf_policy_[un]wrap_xml() for msDS-TransformationRules

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agolibcli/security: add claims_tf_rule_set_parse_blob() for MS-CTA rules
Stefan Metzmacher [Mon, 13 Jan 2025 23:35:24 +0000 (00:35 +0100)] 
libcli/security: add claims_tf_rule_set_parse_blob() for MS-CTA rules

It parses [MS-CTA] rules into structures.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agoclaims.idl: add some helper structs for claims transformation [MS-CTA]
Stefan Metzmacher [Mon, 3 Feb 2025 12:56:54 +0000 (13:56 +0100)] 
claims.idl: add some helper structs for claims transformation [MS-CTA]

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agomdssvc: support a few more attributes
Ralph Boehme [Wed, 29 Jan 2025 14:11:16 +0000 (15:11 +0100)] 
mdssvc: support a few more attributes

This adds support for the following Spotlight Metadata Attributes:

  _kMDItemFileName (another alias for kMDItemFSName and kMDItemDisplayName)
  kMDItemLastUsedDate
  kMDItemContentCreationDate
  kMDItemLogicalSize (another alias for kMDItemFSSize)

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 months agovfs_ceph_new:minor logging improvement
Shweta Sodani [Wed, 5 Feb 2025 05:51:37 +0000 (11:21 +0530)] 
vfs_ceph_new:minor logging improvement

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

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Feb 14 10:57:50 UTC 2025 on atb-devel-224

5 months agodocs-xml:smbdotconf: Document new options for 'sync machinepassword to keytab'
Pavel Filipenský [Tue, 14 Jan 2025 10:29:54 +0000 (11:29 +0100)] 
docs-xml:smbdotconf: Document new options for 'sync machinepassword to keytab'

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Thu Feb 13 18:45:21 UTC 2025 on atb-devel-224

5 months agos3: Add new keytab specifiers
Pavel Filipenský [Mon, 20 Jan 2025 15:00:51 +0000 (16:00 +0100)] 
s3: Add new keytab specifiers

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 months agondr: fix coda logic around in ndr_pull_security_ace()
Douglas Bagnall [Thu, 9 Jan 2025 03:14:05 +0000 (16:14 +1300)] 
ndr: fix coda logic around in ndr_pull_security_ace()

Sometimes an access allowed object ACE has unneeded trailing bytes,
like this:

                      aces: struct security_ace
                          type                     : SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT (5)
                          flags                    : 0x00 (0)
                                 0: SEC_ACE_FLAG_OBJECT_INHERIT
                                 0: SEC_ACE_FLAG_CONTAINER_INHERIT
                                 0: SEC_ACE_FLAG_NO_PROPAGATE_INHERIT
                                 0: SEC_ACE_FLAG_INHERIT_ONLY
                                 0: SEC_ACE_FLAG_INHERITED_ACE
                              0x00: SEC_ACE_FLAG_VALID_INHERIT (0)
                                 0: SEC_ACE_FLAG_SUCCESSFUL_ACCESS
                                 0: SEC_ACE_FLAG_FAILED_ACCESS
                          size                     : 0x0048 (72)
                          access_mask              : 0x00000100 (256)
                          object                   : union security_ace_object_ctr(case 1)
                          object: struct security_ace_object
                              flags                    : 0x00000001 (1)
                                     1: SEC_ACE_OBJECT_TYPE_PRESENT
                                     0: SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
                              type                     : union security_ace_object_type(case 1)
                              type                     : edacfd8f-ffb3-11d1-b41d-00a0c968f939
                              inherited_type           : union security_ace_object_inherited_type(case 0)
                          trustee                  : S-1-3-0
                          coda                     : union security_ace_coda(case 5)
                          ignored                  : DATA_BLOB length=32
  [0000] 00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ........ ........
  [0010] 00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ........ ........

which we need to pull in order to ignore.

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): Thu Feb 13 15:15:40 UTC 2025 on atb-devel-224

5 months agopytest: add ndr packing tests for security descriptors
Douglas Bagnall [Wed, 12 Feb 2025 02:29:28 +0000 (15:29 +1300)] 
pytest: add ndr packing tests for security descriptors

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
5 months agos3:tldap: add some const to 'const char * const *attrs'
Stefan Metzmacher [Tue, 11 Feb 2025 15:42:22 +0000 (16:42 +0100)] 
s3:tldap: add some const to 'const char * const *attrs'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Feb 13 13:14:02 UTC 2025 on atb-devel-224

5 months agos3:tldap: avoid using talloc_tos()
Stefan Metzmacher [Tue, 11 Feb 2025 14:33:35 +0000 (15:33 +0100)] 
s3:tldap: avoid using talloc_tos()

Async code should never use it without
creating its own stackframe!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
5 months agovfs_streams_depot: Introduce streams_depot_config_data
Volker Lendecke [Wed, 30 Sep 2020 12:36:40 +0000 (14:36 +0200)] 
vfs_streams_depot: Introduce streams_depot_config_data

Read the vfs parameters just once: lp_parm_* are not free with their
string comparisons, calling them over and over again is unnecessary

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Feb 13 09:40:22 UTC 2025 on atb-devel-224

5 months agovfs: Allow WITH_BACKUP_INTENT in vfs openat functions
Volker Lendecke [Thu, 23 Jan 2025 12:42:48 +0000 (13:42 +0100)] 
vfs: Allow WITH_BACKUP_INTENT in vfs openat functions

BACKUP_INTENT has no real meaning so far throughout our code, so we
should ignore and thus allow it in our openat-intercepting functions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: move dead code into a comment
Stefan Metzmacher [Tue, 11 Feb 2025 16:09:17 +0000 (17:09 +0100)] 
winbindd: move dead code into a comment

We need to re-activate this once we support multitple domains
in out own forest.

Fixes CID 1642726:  Control flow issues  (UNREACHABLE)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Feb 11 23:18:02 UTC 2025 on atb-devel-224

5 months agolibnet4: free tevent request even on error
Björn Baumbach [Mon, 10 Feb 2025 16:42:12 +0000 (17:42 +0100)] 
libnet4: free tevent request even on error

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Tue Feb 11 11:05:37 UTC 2025 on atb-devel-224

5 months agodrsuapi.idl: fix source_dsa spelling
Stefan Metzmacher [Fri, 10 Jan 2025 12:12:55 +0000 (13:12 +0100)] 
drsuapi.idl: fix source_dsa spelling

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Feb  8 19:49:33 UTC 2025 on atb-devel-224

5 months agosecurity.idl: DOMAIN_RID_{FOREST,EXTERNAL}_TRUST_ACCOUNTS
Stefan Metzmacher [Mon, 13 Jan 2025 22:25:35 +0000 (23:25 +0100)] 
security.idl: DOMAIN_RID_{FOREST,EXTERNAL}_TRUST_ACCOUNTS

These seem to be new in Windows 2025.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agosecurity.idl: add SID_NT_THIS_ORGANIZATION_CERTIFICATE
Stefan Metzmacher [Tue, 28 Jan 2025 13:29:58 +0000 (14:29 +0100)] 
security.idl: add SID_NT_THIS_ORGANIZATION_CERTIFICATE

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agosecurity.idl: change ORGANISATION into ORGANIZATION
Stefan Metzmacher [Wed, 4 Dec 2024 17:24:04 +0000 (18:24 +0100)] 
security.idl: change ORGANISATION into ORGANIZATION

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agodrsblobs.idl: make some scannerInfo related stuff public
Stefan Metzmacher [Wed, 5 Feb 2025 12:16:03 +0000 (13:16 +0100)] 
drsblobs.idl: make some scannerInfo related stuff public

This is needed in order to use ndr_pack() on them
in python code.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agodrsblobs.idl: use dom_sid0 in ForestTrustDataDomainInfo
Stefan Metzmacher [Tue, 17 Dec 2024 16:49:52 +0000 (17:49 +0100)] 
drsblobs.idl: use dom_sid0 in ForestTrustDataDomainInfo

We already use ndr_size_dom_sid0() and when ForestTrustDataDomainInfo
is used as part of ForestTrustDataScannerInfo, sid_size is 0
and the subcontext for the sid is skipped.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agodrsblobs.idl: introduce ForestTrustDataScannerInfo
Stefan Metzmacher [Tue, 17 Dec 2024 16:44:44 +0000 (17:44 +0100)] 
drsblobs.idl: introduce ForestTrustDataScannerInfo

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agodrsblobs.idl: split explicit binary data and unknown data for ForestTrustData
Stefan Metzmacher [Tue, 17 Dec 2024 14:40:49 +0000 (15:40 +0100)] 
drsblobs.idl: split explicit binary data and unknown data for ForestTrustData

For know FOREST_TRUST_SCANNER_INFO unknown.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agodrsblobs.idl: set NDR_PAHEX for ForestTrustDataBinaryData
Stefan Metzmacher [Tue, 17 Dec 2024 13:53:00 +0000 (14:53 +0100)] 
drsblobs.idl: set NDR_PAHEX for ForestTrustDataBinaryData

The dump_data hexdump is much easier to read...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:torture/ndr: add a ForestTrustInfo ndr test with FOREST_TRUST_SCANNER_INFO
Stefan Metzmacher [Tue, 17 Dec 2024 13:40:32 +0000 (14:40 +0100)] 
s4:torture/ndr: add a ForestTrustInfo ndr test with FOREST_TRUST_SCANNER_INFO

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agodrsblobs.idl: add support for ForestTrustInfo with FOREST_TRUST_SCANNER_INFO
Stefan Metzmacher [Tue, 17 Dec 2024 11:30:56 +0000 (12:30 +0100)] 
drsblobs.idl: add support for ForestTrustInfo with FOREST_TRUST_SCANNER_INFO

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
5 months agos4:kdc: let samba_kdc_trust_message2entry don't support WITHIN_FOREST and PIM_TRUST
Stefan Metzmacher [Fri, 20 Dec 2024 18:50:53 +0000 (19:50 +0100)] 
s4:kdc: let samba_kdc_trust_message2entry don't support WITHIN_FOREST and PIM_TRUST

These are not supported yet.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Feb  8 16:23:30 UTC 2025 on atb-devel-224

5 months agowinbindd: don't support PIM_TRUST and WITHIN_FOREST
Stefan Metzmacher [Mon, 23 Dec 2024 13:55:39 +0000 (14:55 +0100)] 
winbindd: don't support PIM_TRUST and WITHIN_FOREST

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server/lsa: PIM trusts are not supported yet
Stefan Metzmacher [Thu, 19 Dec 2024 19:43:43 +0000 (20:43 +0100)] 
s4:rpc_server/lsa: PIM trusts are not supported yet

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server/lsa: a PIM trust requires FOREST_TRANSITIVE
Stefan Metzmacher [Thu, 19 Dec 2024 19:43:18 +0000 (20:43 +0100)] 
s4:rpc_server/lsa: a PIM trust requires FOREST_TRANSITIVE

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server/lsa: WITHIN_FOREST together with FOREST_TRANSITIVE is invalid
Stefan Metzmacher [Thu, 19 Dec 2024 18:34:59 +0000 (19:34 +0100)] 
s4:rpc_server/lsa: WITHIN_FOREST together with FOREST_TRANSITIVE is invalid

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server/lsa: don't allow WITHIN_FOREST trusts
Stefan Metzmacher [Thu, 19 Dec 2024 18:26:10 +0000 (19:26 +0100)] 
s4:rpc_server/lsa: don't allow WITHIN_FOREST trusts

They are not supported yet.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server/lsa: don't allow WITHIN_FOREST together with CROSS_ORGANIZATION
Stefan Metzmacher [Thu, 19 Dec 2024 18:22:47 +0000 (19:22 +0100)] 
s4:rpc_server/lsa: don't allow WITHIN_FOREST together with CROSS_ORGANIZATION

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server: dcesrv_lsa_DeleteObject needs to close the handles
Stefan Metzmacher [Thu, 30 Jan 2025 18:03:32 +0000 (19:03 +0100)] 
s4:rpc_server: dcesrv_lsa_DeleteObject needs to close the handles

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server/lsa: let dcesrv_lsa_CreateTrustedDomain check for valid netbios name...
Stefan Metzmacher [Thu, 30 Jan 2025 18:07:08 +0000 (19:07 +0100)] 
s4:rpc_server/lsa: let dcesrv_lsa_CreateTrustedDomain check for valid netbios name length

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:dsdb/common: check for valid netbios name length for trusts
Stefan Metzmacher [Thu, 30 Jan 2025 18:10:03 +0000 (19:10 +0100)] 
s4:dsdb/common: check for valid netbios name length for trusts

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agopython:tests: let lsa_utils.py use valid netbios names
Stefan Metzmacher [Wed, 5 Feb 2025 12:12:48 +0000 (13:12 +0100)] 
python:tests: let lsa_utils.py use valid netbios names

createtrustrelax has 16 characters, but only 15 are allowed
and they are typically uppercase.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:rpc_server/lsa: no longer send MSG_WINBIND_RELOAD_TRUSTED_DOMAINS
Stefan Metzmacher [Thu, 30 Jan 2025 18:04:28 +0000 (19:04 +0100)] 
s4:rpc_server/lsa: no longer send MSG_WINBIND_RELOAD_TRUSTED_DOMAINS

This is done by the "trust_notify" ldb module now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos4:dsdb/ldb_modules: add trust_notify module
Stefan Metzmacher [Thu, 6 Feb 2025 19:11:20 +0000 (20:11 +0100)] 
s4:dsdb/ldb_modules: add trust_notify module

This will notify winbindd if critical aspects
of the trusted domain topology are changed.

It means it will also happen when the changes are
replicated from other DCs.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: introduce update_trusted_domains_dc()
Stefan Metzmacher [Tue, 4 Feb 2025 17:32:59 +0000 (18:32 +0100)] 
winbindd: introduce update_trusted_domains_dc()

Reloading trusts should reload every aspect of
the trust and also remove deleted trusts from
the winbindd _domain_list.

But pending requests still continue.

With this commit it is required that
async state structures use struct winbindd_domain_ref
instead of raw struct winbindd_domain pointers,
in order to usage of stale pointers.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct winbindd_domain_info_state
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct winbindd_domain_info_state

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct wb_lookupsids_domain
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct wb_lookupsids_domain

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct winbindd_list_groups_domstate
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct winbindd_list_groups_domstate

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct winbindd_list_users_domstate
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct winbindd_list_users_domstate

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct trustdom_state
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct trustdom_state

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct getgrent_state
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct getgrent_state

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct getpwent_state
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct getpwent_state

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct wb_query_user_list_state
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct wb_query_user_list_state

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: use struct winbindd_domain_ref in struct wbint_bh_raw_call_state
Stefan Metzmacher [Fri, 7 Feb 2025 12:57:45 +0000 (13:57 +0100)] 
winbindd: use struct winbindd_domain_ref in struct wbint_bh_raw_call_state

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Note this is most likely not really needed because
the requests are in the domain or child tevent queue,
before the domain will be free'ed.
But we better use the winbindd_domain_ref in
all async state!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: add struct winbindd_domain_ref infrastructure
Stefan Metzmacher [Fri, 7 Feb 2025 12:43:10 +0000 (13:43 +0100)] 
winbindd: add struct winbindd_domain_ref infrastructure

In the next commits it will be possible that
struct winbindd_domain instances become stale
because trusted domains were reloaded.

That means aync state structure should not use
pointers to 'struct winbindd_domain' as they
can become stale!

Instead they should use 'struct winbindd_domain_ref domain'
in the async state and use winbindd_domain_ref_set/get()
to manage the 'struct winbindd_domain' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: winbindd_child->domain is a talloc grant parent if valid
Stefan Metzmacher [Fri, 7 Feb 2025 15:16:25 +0000 (16:16 +0100)] 
winbindd: winbindd_child->domain is a talloc grant parent if valid

This comment makes it easier to spot if we still have
'struct winbindd_domain' pointers in state structures,
which should be replaced by struct winbindd_domain_ref,
in order to handle stale domains after reloading trusts.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: assert that wbint_binding_handle() gets a valid memory context
Stefan Metzmacher [Fri, 7 Feb 2025 15:10:59 +0000 (16:10 +0100)] 
winbindd: assert that wbint_binding_handle() gets a valid memory context

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: let setup_child() use a useful mem_ctx for talloc memory
Stefan Metzmacher [Fri, 7 Feb 2025 15:09:39 +0000 (16:09 +0100)] 
winbindd: let setup_child() use a useful mem_ctx for talloc memory

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: make wb_domain_request_* more robust
Stefan Metzmacher [Fri, 7 Feb 2025 14:46:33 +0000 (15:46 +0100)] 
winbindd: make wb_domain_request_* more robust

We don't need struct winbindd_domain_ref, but
we should clear the pointers before removing
the queue entry.

And we should start the queue every time
before remove ourself.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: wbint_bh_raw_call_child_done() doesn't have state->domain
Stefan Metzmacher [Fri, 7 Feb 2025 14:24:50 +0000 (15:24 +0100)] 
winbindd: wbint_bh_raw_call_child_done() doesn't have state->domain

Only child or domain binding handles are possible!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: let wb_lookupsid_send() use a stack variable for struct winbindd_domain
Stefan Metzmacher [Fri, 7 Feb 2025 14:10:20 +0000 (15:10 +0100)] 
winbindd: let wb_lookupsid_send() use a stack variable for struct winbindd_domain

It's not needed to be on struct wb_lookupsid_state.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: remove unused free_domain_list()
Stefan Metzmacher [Tue, 4 Feb 2025 10:40:36 +0000 (11:40 +0100)] 
winbindd: remove unused free_domain_list()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agowinbindd: let add_trusted_domain() check sid and dns_name are not changed
Stefan Metzmacher [Tue, 4 Feb 2025 09:16:15 +0000 (10:16 +0100)] 
winbindd: let add_trusted_domain() check sid and dns_name are not changed

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 months agolibnet4: check return value of DC lookup
Björn Baumbach [Fri, 7 Feb 2025 11:03:18 +0000 (12:03 +0100)] 
libnet4: check return value of DC lookup

Avoids possible segmentation fault when the lookup fails.

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

Pair-programmed-with: Volker Lendecke <vl@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Sat Feb  8 03:30:27 UTC 2025 on atb-devel-224

6 months agosamba-tool contact: remove useless versionopts references
Douglas Bagnall [Thu, 30 Jan 2025 22:50:48 +0000 (11:50 +1300)] 
samba-tool contact: remove useless versionopts references

These are now redundant as all samba-tool sub-commands handle
-V/--version automatically.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 months agopy:get_opts:VersionOptions prints version in --help
Douglas Bagnall [Thu, 30 Jan 2025 08:22:04 +0000 (21:22 +1300)] 
py:get_opts:VersionOptions prints version in --help

Because it might as well. Like this:

  Version Options:
    -V, --version       Display version number (4.22.2)

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 months agosamba-tool: --version shortcircuits option evaluation
Douglas Bagnall [Wed, 15 Jan 2025 02:32:18 +0000 (15:32 +1300)] 
samba-tool: --version shortcircuits option evaluation

This means in

   bin/samba-tool spn -h -V

the -V takes precedence over the -h, as with the 'net' tool.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 months agosamba-tool: all subcommands know --version
Douglas Bagnall [Wed, 15 Jan 2025 02:33:18 +0000 (15:33 +1300)] 
samba-tool: all subcommands know --version

Before `samba-tool -V` would give you the version,
but `samba-tool spn -V` would complain.

An ad-hoc selection of sub-commands already supported --version,
depending on whether VersionOptions was manually added to the
takes_options dict. The .run() methods of these subcommands all take a
'versionopts' keyword argument, but never use it. If it was set (i.e.,
argv contained "--version"), the process never gets to .run(), so the
value of versionopts.version is always None in run(). After this
commit we can remove VersionOptions/versionopts from sub-commands.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 months agosamba-tool: do not complain of no sub-command with '-V'
Douglas Bagnall [Wed, 15 Jan 2025 02:07:38 +0000 (15:07 +1300)] 
samba-tool: do not complain of no sub-command with '-V'

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 months agopytest: samba-tool --version tests
Douglas Bagnall [Thu, 30 Jan 2025 08:22:53 +0000 (21:22 +1300)] 
pytest: samba-tool --version tests

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 months agovfs_shadow_copy2: Use VFS interface to derive mount point
Anoop C S [Thu, 6 Feb 2025 12:20:10 +0000 (17:50 +0530)] 
vfs_shadow_copy2: Use VFS interface to derive mount point

shadow_copy2_find_mount_point() does direct stat() calls locally while
trying to automatically detect the mount point. This cannot be always
true as there are virtual file systems like CephFS, GlusterFS etc.
without their share path locally available on the system. Instead use
the VFS interface to make the stat calls hit the underlying file system
irrespective of their local presence in the system.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: John Mulligan <jmulligan@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Feb  7 06:23:12 UTC 2025 on atb-devel-224