metze/samba/wip.git
3 weeks agos3:winbindd: make use of samba_sockaddr to avoid compiler warnings
Stefan Metzmacher [Tue, 27 Feb 2024 08:44:54 +0000 (09:44 +0100)]
s3:winbindd: make use of samba_sockaddr to avoid compiler warnings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:winbindd: use winbindd_get_trust_credentials()/ads_connect_creds() in winbindd_ads.c
Stefan Metzmacher [Tue, 27 Feb 2024 08:44:19 +0000 (09:44 +0100)]
s3:winbindd: use winbindd_get_trust_credentials()/ads_connect_creds() in winbindd_ads.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:winbindd: make winbindd_get_trust_credentials() public
Stefan Metzmacher [Tue, 27 Feb 2024 08:23:17 +0000 (09:23 +0100)]
s3:winbindd: make winbindd_get_trust_credentials() public

We'll use it outside of winbindd_cm.c soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: add ads_set_reconnect_fn() and only reconnect if we can get creds
Stefan Metzmacher [Wed, 6 Mar 2024 09:13:11 +0000 (10:13 +0100)]
s3:libads: add ads_set_reconnect_fn() and only reconnect if we can get creds

This reconnect is only useful for long running connections (e.g. in winbindd)
and there we'll make use of it...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: make use of ads_connect_anon() in ldap.c where possible
Stefan Metzmacher [Thu, 28 Apr 2022 16:43:00 +0000 (18:43 +0200)]
s3:libads: make use of ads_connect_anon() in ldap.c where possible

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: add ads_connect_no_bind() helper
Stefan Metzmacher [Tue, 5 Mar 2024 16:45:35 +0000 (17:45 +0100)]
s3:libads: add ads_connect_no_bind() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: add ads_connect_machine() helper
Stefan Metzmacher [Thu, 28 Apr 2022 16:53:03 +0000 (18:53 +0200)]
s3:libads: add ads_connect_machine() helper

3 weeks agos3:libads: add ads_connect_anon() helper
Stefan Metzmacher [Thu, 28 Apr 2022 16:38:17 +0000 (18:38 +0200)]
s3:libads: add ads_connect_anon() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: add ads_simple_creds() helper
Stefan Metzmacher [Thu, 28 Apr 2022 15:51:57 +0000 (17:51 +0200)]
s3:libads: add ads_simple_creds() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: let ads_sasl_spnego_bind() really use spnego to negotiate krb5/ntlmssp
Stefan Metzmacher [Thu, 29 Feb 2024 13:50:31 +0000 (14:50 +0100)]
s3:libads: let ads_sasl_spnego_bind() really use spnego to negotiate krb5/ntlmssp

The gensec layer does kinit if needed...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: split out ads_connect_creds() and call it with ads_legacy_creds()
Stefan Metzmacher [Wed, 27 Apr 2022 11:11:26 +0000 (13:11 +0200)]
s3:libads: split out ads_connect_creds() and call it with ads_legacy_creds()

3 weeks agos3:libads: let ads_sasl_spnego_bind() use cli_credentials_get_unparsed_name()
Stefan Metzmacher [Wed, 27 Apr 2022 10:45:04 +0000 (12:45 +0200)]
s3:libads: let ads_sasl_spnego_bind() use cli_credentials_get_unparsed_name()

We should only operate on the creds structure and
avoid using ads->auth.{user_name,realm}.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: let ads_sasl_spnego_bind() reset krb5_state at the end
Stefan Metzmacher [Wed, 27 Apr 2022 11:39:11 +0000 (13:39 +0200)]
s3:libads: let ads_sasl_spnego_bind() reset krb5_state at the end

In future we'll pass in creds from the caller, so we better
restore the original krb5_state at the end of ads_sasl_spnego_bind().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: let ads_sasl_spnego_bind() use cli_credentials_get_kerberos_state()
Stefan Metzmacher [Wed, 27 Apr 2022 10:32:30 +0000 (12:32 +0200)]
s3:libads: let ads_sasl_spnego_bind() use cli_credentials_get_kerberos_state()

We should only operate on the creds structure and avoid ads->auth.flags

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: split out ads_legacy_creds()
Stefan Metzmacher [Mon, 25 Apr 2022 16:08:33 +0000 (18:08 +0200)]
s3:libads: split out ads_legacy_creds()

This is just a temporary change until the highlevel caller
will pass in a cli_credentials structure and we'll get rid of
ads->auth.{user_name,realm,password}.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: fix compiler warning in ads_mod_ber()
Stefan Metzmacher [Mon, 26 Feb 2024 20:02:08 +0000 (21:02 +0100)]
s3:libads: fix compiler warning in ads_mod_ber()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: move ads->auth.time_offset to ads->config.time_offset
Stefan Metzmacher [Tue, 27 Feb 2024 12:49:08 +0000 (13:49 +0100)]
s3:libads: move ads->auth.time_offset to ads->config.time_offset

There's no reason to pass the LDAP servers time to the kerberos
libraries, as we may talk to a KDC different than the LDAP server!

Also Heimdal handles AS-REQ with KRB5KRB_AP_ERR_SKEW fine and
retries with the time from the krb-error.
MIT records the time from the KDC_ERR_PREAUTH_REQUIRED response
in order to use the KDCs time.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: we only need to gensec_expire_time()...
Stefan Metzmacher [Tue, 27 Feb 2024 12:03:46 +0000 (13:03 +0100)]
s3:libads: we only need to gensec_expire_time()...

The lifetime of a service ticket is never longer than
the lifetime of the TGT...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: remove unused ads->auth.renewable
Stefan Metzmacher [Tue, 27 Feb 2024 11:52:14 +0000 (12:52 +0100)]
s3:libads: remove unused ads->auth.renewable

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:winbindd: remove useless 'renewable' argument to ads_cached_connection_connect()
Stefan Metzmacher [Tue, 5 Mar 2024 12:22:37 +0000 (13:22 +0100)]
s3:winbindd: remove useless 'renewable' argument to ads_cached_connection_connect()

There's really no need to get a reneable ticket for an ldap connection,
we currently always do a kinit for each connection anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libsmb: remove unused cli_session_creds_prepare_krb5()
Stefan Metzmacher [Thu, 29 Feb 2024 13:27:36 +0000 (14:27 +0100)]
s3:libsmb: remove unused cli_session_creds_prepare_krb5()

Kinit will be done within gensec if required.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:gse: get an explicit ccache_name from creds and kinit if required
Stefan Metzmacher [Thu, 14 Apr 2022 13:23:13 +0000 (15:23 +0200)]
s3:gse: get an explicit ccache_name from creds and kinit if required

This means we may call kinit multiple times for now,
but we'll remove the kinit from the callers soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libsmb: explicitly use the default krb5 ccache in cli_session_creds_init() without...
Stefan Metzmacher [Wed, 6 Mar 2024 22:05:00 +0000 (23:05 +0100)]
s3:libsmb: explicitly use the default krb5 ccache in cli_session_creds_init() without a password

This happened implicitly as the gse_krb5 module always used the default
krb5 ccache, but that will change soon.

If kerberos is requested without a fallback to ntlm AND
the caller doesn't provide a password we'll use the
default ccache. This will keep our the following tests
happy once the gse_krb5 module changes the behavior:

 samba3.blackbox.krbsmbspool
 samba3.blackbox.smbget

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:ntlm_auth: explicitly include default krb5 ccache if no explicit username/password...
Stefan Metzmacher [Wed, 6 Mar 2024 20:55:24 +0000 (21:55 +0100)]
s3:ntlm_auth: explicitly include default krb5 ccache if no explicit username/password are given

Before this silently happened because the gse_krb5 module just used the
default ccache, but that will change soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agotests/ntlm_auth_krb5: don't test that a krb5ccache work with an explicit username
Stefan Metzmacher [Thu, 7 Mar 2024 16:59:02 +0000 (17:59 +0100)]
tests/ntlm_auth_krb5: don't test that a krb5ccache work with an explicit username

This test is useless and won't work anymore in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libads: make use of talloc_stackframe() in ads_setup_tls_wrapping()
Stefan Metzmacher [Wed, 24 Apr 2024 07:59:53 +0000 (09:59 +0200)]
s3:libads: make use of talloc_stackframe() in ads_setup_tls_wrapping()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:libsmb: allow store_cldap_reply() to work with a ipv6 response
Stefan Metzmacher [Tue, 7 May 2024 14:53:24 +0000 (14:53 +0000)]
s3:libsmb: allow store_cldap_reply() to work with a ipv6 response

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 weeks agoldb-samba: ldif_read_objectSid avoids VLA
Douglas Bagnall [Sat, 4 May 2024 01:40:35 +0000 (13:40 +1200)]
ldb-samba: ldif_read_objectSid avoids VLA

I don't think this variable length array is any trouble, but people
complain about them (e.g. https://nullprogram.com/blog/2019/10/27/)
because they make things more complex at run-time, and this is a
somewhat performance sensitive path.

DOM_SID_STR_BUFLEN + 1 is 191 -- if that stack allocation is going to
cause trouble, then so was the VLA <= that.

Signed-off-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): Wed May  8 00:26:42 UTC 2024 on atb-devel-224

3 weeks agoldb-samba: ldif_read_objectSid() short-circuits without 'S'
Douglas Bagnall [Sat, 4 May 2024 01:32:39 +0000 (13:32 +1200)]
ldb-samba: ldif_read_objectSid() short-circuits without 'S'

This avoids a memcpy, and level 3 debug verbosity from
dom_sid_parse_endp().

In other places we have something like `|| in->data[1] != '-'`, but
that is not useful here -- the value is either a string SID, or a
binary SID that starts with '\1', or some awful value that we *do*
want to get messages about.

This replaces the work of ldif_comparision_objectSid_isString().

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agolib/fuzzing: add fuzz_stable_sort_r_unstable
Douglas Bagnall [Wed, 1 May 2024 05:16:38 +0000 (17:16 +1200)]
lib/fuzzing: add fuzz_stable_sort_r_unstable

This should find out how well stable_sort copes with an unstable
non-transitive comparison function.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb: note a transitivity problem in ldb_comparison_fold
Douglas Bagnall [Tue, 30 Apr 2024 00:41:25 +0000 (12:41 +1200)]
ldb: note a transitivity problem in ldb_comparison_fold

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb:attrib_handlers: reduce non-transitive behaviour in ldb_comparison_fold
Douglas Bagnall [Fri, 26 Apr 2024 03:58:44 +0000 (15:58 +1200)]
ldb:attrib_handlers: reduce non-transitive behaviour in ldb_comparison_fold

If two strings are invalid UTF-8, the string is first compared with
memcmp(), which compares as unsigned char.

If the strings are of different lengths and one is a substring of the
other, the memcmp() returns 0 and a second comparison is made which
assumes the next character in the shorter string is '\0' -- but this
comparison was done using SIGNED chars (on most systems). That leads
to non-transitive comparisons.

Consider the strings {"a\xff", "a", "ab\xff"} under that system.

   "a\xff"  < "a",      because (char)0xff == -1.

   "ab\xff" > "a",     because  'b' == 98.

   "ab\xff" < "a\xff", because memcmp("ab\xff", "a\xff", 2) avoiding the
                       signed char tiebreaker.

(Before c49c48afe09a1a78989628bbffd49dd3efc154dd, the final character
might br arbitrarily cast into another character -- in latin-1, for
example, the 0xff here would have been seen as 'ÿ', which would be
uppercased to 'Ÿ', which is U+0178, which would be truncated to
'\x78', a positive char.

On the other hand e.g. 0xfe, 'þ', would have mapped to 0xde, 'Þ',
remaining negative).

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb:attrib_handlers: use NUMERIC_CMP in ldb_comparison_fold
Douglas Bagnall [Thu, 11 Apr 2024 01:21:25 +0000 (13:21 +1200)]
ldb:attrib_handlers: use NUMERIC_CMP in ldb_comparison_fold

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb-samba: remove unused ldif_comparision_objectSid_isString()
Douglas Bagnall [Wed, 17 Apr 2024 13:49:11 +0000 (01:49 +1200)]
ldb-samba: remove unused ldif_comparision_objectSid_isString()

This is unused because it does things badly, by just guessing and
not allowing valid sids that start with "s-". All the places that used
to use it were calling ldif_read_objectSid() or similar which correctly
check for string SIDs by actually trying to parse them. That begins
with looking for the "S-"/"s-", so this shortcut is not saving any real
work.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb-samba: simplify extended_dn_read_SID()
Douglas Bagnall [Wed, 17 Apr 2024 13:44:03 +0000 (01:44 +1200)]
ldb-samba: simplify extended_dn_read_SID()

This will allow the reading of SIDs that start with "s-", which
Windows allows, and we allow elsewhere.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb-samba: simplify ldif_canonicalise_objectSid()
Douglas Bagnall [Wed, 17 Apr 2024 13:42:27 +0000 (01:42 +1200)]
ldb-samba: simplify ldif_canonicalise_objectSid()

ldif_comparision_objectSid_isString() is doing not useful or accurate,
and ldif_read_objectSid() checks properly.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb-samba: simplify ldif_comparison_objectSid()
Douglas Bagnall [Wed, 17 Apr 2024 12:38:17 +0000 (00:38 +1200)]
ldb-samba: simplify ldif_comparison_objectSid()

The ldif_comparision_objectSid_isString() call is both wrong
(disallowing "s-") and redundant, because ldif_read_objectSid() calls
dom_sid_parse(), which does the check properly.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agopytest: sid_strings: Samba DN object refuses sub-auth overflow
Douglas Bagnall [Thu, 2 May 2024 23:29:31 +0000 (11:29 +1200)]
pytest: sid_strings: Samba DN object refuses sub-auth overflow

We were mistakenly asserting something that did not happen with
Windows, because Samba already won't parse the DN string.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agopytest: sid_strings: adjust to match Windows 2016
Douglas Bagnall [Thu, 2 May 2024 23:24:02 +0000 (11:24 +1200)]
pytest: sid_strings: adjust to match Windows 2016

9 hex-digit subauths like '0xABCDef123' will not fit in 32 bits, so
should be rejected on parsing.

In other situations, such as defaultSecurityDescriptor, overflowing
SID subauths on Windows will saturate to 0xffffffff, resulting in a
valid but probably meaningless SID. It is possible that in previous
testing we saw that here, but it is more likely I got confused. In any
case, now I see them being rejected, and that is good.

The saturating defaultSecurityDescriptor case is tested in
SidStringBehavioursThatWindowsAllows.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agopytest: sid_strings: Windows does allow lowercase s-1-... SIDs
Douglas Bagnall [Thu, 2 May 2024 23:19:16 +0000 (11:19 +1200)]
pytest: sid_strings: Windows does allow lowercase s-1-... SIDs

And so should we.

Right now, these tests won't pass against Windows because they rely on
ldb pre-parsing of the SIDs, so they fail before Windows gets to see
them. Running them against Windows looks something like this, BTW:

    SAMBA_SID_STRINGS_SKIP_LOCAL=1  \
    SMB_CONF_PATH=st/ad_dc/etc/smb.conf \
    PYTHONPATH=bin/default/python \
    DC_SERVER=192.168.122.126 \
    DC_USERNAME=Administrator DC_PASSWORD='xxx' \
    python3 python/samba/tests/sid_strings.py

When things are right, the only failing tests should be from the
SidStringBehavioursThatSambaPrefers suite.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agopytest: sid_strings: use more reliable well known SID
Douglas Bagnall [Thu, 2 May 2024 02:24:18 +0000 (14:24 +1200)]
pytest: sid_strings: use more reliable well known SID

It seems as if the well-known SID S-1-5-32-579
(DOMAIN_ALIAS_RID_ACCESS_CONTROL_ASSISTANCE_OPS) is
not always present -- specifically, it was not there on the
Windows machine used to develop these tests, but it is there on
the one I am now using.

S-1-5-32-545 (DOMAIN_ALIAS_RID_USERS) is surely going to exist,
so we use that instead.

That changes some of the assertions, making some NO_SUCH_OBJECTs
into successes.

For these tests we are only interested in the parsing of the SIDs, not
their meaning, so it's OK to change it.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb-samba: ldif_write_schemaInfo() uses correct size
Douglas Bagnall [Sat, 13 Apr 2024 10:39:49 +0000 (22:39 +1200)]
ldb-samba: ldif_write_schemaInfo() uses correct size

repsFromToBlob is much bigger, so this only meant we briefly allocated
more than we needed.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agolib:util: codepoint_cmpi: be transitive and case-insensitive
Douglas Bagnall [Sat, 13 Apr 2024 05:53:24 +0000 (17:53 +1200)]
lib:util: codepoint_cmpi: be transitive and case-insensitive

the less/greater conparisons were not case-sensitive, which made the whole
function non-transitive.

I think codepoint_cmpi() is currently only used for equality tests, so
nothing will change.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agolib:util:tests: more tests for codepoint_cmpi
Douglas Bagnall [Sat, 13 Apr 2024 05:07:20 +0000 (17:07 +1200)]
lib:util:tests: more tests for codepoint_cmpi

is codepoint_cmpi as case-insensitive as it claims when it comes to
inequalities? (no, it is not!).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agos4:dsdb:mod: repl_md: message sort uses NUMERIC_CMP()
Douglas Bagnall [Fri, 12 Apr 2024 08:28:04 +0000 (20:28 +1200)]
s4:dsdb:mod: repl_md: message sort uses NUMERIC_CMP()

No change at all in the result, just saving lines and branches.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agos4:rpc_srv:getncchanges: USN sort uses qsort() instead of ldb_qsort()
Douglas Bagnall [Fri, 12 Apr 2024 06:33:47 +0000 (18:33 +1200)]
s4:rpc_srv:getncchanges: USN sort uses qsort() instead of ldb_qsort()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agos4:rpc_srv:getncchanges: 4.5 anc emulation uses qsort(), not ldb_qsort()
Douglas Bagnall [Fri, 12 Apr 2024 06:32:42 +0000 (18:32 +1200)]
s4:rpc_srv:getncchanges: 4.5 anc emulation uses qsort(), not ldb_qsort()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agos4:dsdb:mod: repl_md: make message_sort transitive
Douglas Bagnall [Fri, 12 Apr 2024 06:11:47 +0000 (18:11 +1200)]
s4:dsdb:mod: repl_md: make message_sort transitive

Before we had (with a TODO of regret):

       if (!a1 || !a2) {
               return strcasecmp(e1->name, e2->name);
       }

so, given {name:"A", id 2}, {name:"B", NO id}, {name:"C", id 1},

 A < B by name
 B < C by name
 A > C by id

Now the sort order is always A > C > B.

This sort could have caused mysterious crashes in repl_meta_data if
the schema is out of sync.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb:tools: ldbsearch doesn't need ldb_qsort()
Douglas Bagnall [Fri, 12 Apr 2024 06:11:12 +0000 (18:11 +1200)]
ldb:tools: ldbsearch doesn't need ldb_qsort()

When the opaque context blob is not used, we might as well
use a real qsort().

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agos4:dsdb:util_trusts: simplify the NULL case in dns_cmp
Douglas Bagnall [Wed, 1 May 2024 04:26:14 +0000 (16:26 +1200)]
s4:dsdb:util_trusts: simplify the NULL case in dns_cmp

In this comparison function a NULL string is treated as the ancestor
of all names, but you need to look hard to see that.

By pulling the logic for NULLs to the front, hopefully we have to look
less hard.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agos4:dsdb:util_trusts: describe dns_cmp return values
Douglas Bagnall [Fri, 12 Apr 2024 09:28:31 +0000 (21:28 +1200)]
s4:dsdb:util_trusts: describe dns_cmp return values

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb:tests: add a test for dotted i uppercase
Douglas Bagnall [Tue, 16 Apr 2024 11:31:45 +0000 (23:31 +1200)]
ldb:tests: add a test for dotted i uppercase

This didn't fail in the tr_TR locale before recent changes for
https://bugzilla.samba.org/show_bug.cgi?id=15637, because this is a
different casefold codepath. But it could fail if that other path goes
wrong, so we might as well have the test.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks agoldb: avoid NULL deref in ldb_db_compare
Douglas Bagnall [Fri, 26 Apr 2024 03:24:47 +0000 (15:24 +1200)]
ldb: avoid NULL deref in ldb_db_compare

This also sorts NULLs after invalid DNs, which matches the comment
above.

CID 1596622.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 weeks ago.gitlab-ci: Remove tags no longer provided by gitlab.com
Andrew Bartlett [Tue, 7 May 2024 10:32:08 +0000 (22:32 +1200)]
.gitlab-ci: Remove tags no longer provided by gitlab.com

GitLab.com removed a number of tags from their hosted
runners and this meant our CI was being redirected to
our private runners at a larger cost to the Samba Team.

The new infrastructure is much larger than when we last
selected runners so we can just use the default, even for
the code coverage build.

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

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue May  7 13:40:55 UTC 2024 on atb-devel-224

3 weeks agos3:libsmb: let cli_session_creds_init() keep the value from 'client use kerberos'
Stefan Metzmacher [Thu, 7 Mar 2024 14:31:39 +0000 (15:31 +0100)]
s3:libsmb: let cli_session_creds_init() keep the value from 'client use kerberos'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue May  7 12:33:29 UTC 2024 on atb-devel-224

3 weeks agos3:winbindd: pass a NULL ccache to kerberos_return_pac() for a MEMORY ccache
Stefan Metzmacher [Wed, 28 Feb 2024 16:28:43 +0000 (17:28 +0100)]
s3:winbindd: pass a NULL ccache to kerberos_return_pac() for a MEMORY ccache

It means kerberos_return_pac() will use smb_krb5_cc_new_unique_memory().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agos3:libads: use smb_krb5_cc_new_unique_memory() in kerberos_return_pac()
Stefan Metzmacher [Wed, 28 Feb 2024 16:27:39 +0000 (17:27 +0100)]
s3:libads: use smb_krb5_cc_new_unique_memory() in kerberos_return_pac()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: use smb_krb5_cc_new_unique_memory() in cli_credentials_new_ccache()
Stefan Metzmacher [Tue, 27 Feb 2024 15:38:42 +0000 (16:38 +0100)]
auth/credentials: use smb_krb5_cc_new_unique_memory() in cli_credentials_new_ccache()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: use smb_krb5_cc_new_unique_memory() in cli_credentials_shallow_ccache()
Stefan Metzmacher [Tue, 27 Feb 2024 15:21:02 +0000 (16:21 +0100)]
auth/credentials: use smb_krb5_cc_new_unique_memory() in cli_credentials_shallow_ccache()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: use smb_krb5_cc_new_unique_memory() in smb_gss_krb5_copy_ccache()
Stefan Metzmacher [Tue, 27 Feb 2024 15:19:58 +0000 (16:19 +0100)]
auth/credentials: use smb_krb5_cc_new_unique_memory() in smb_gss_krb5_copy_ccache()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: use smb_krb5_cc_new_unique_memory() in krb5_cc_remove_cred_wrap()
Stefan Metzmacher [Tue, 27 Feb 2024 14:49:09 +0000 (15:49 +0100)]
auth/credentials: use smb_krb5_cc_new_unique_memory() in krb5_cc_remove_cred_wrap()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agolib/krb5_wrap: make use of smb_krb5_cc_new_unique_memory() in smb_krb5_kinit_s4u2_cca...
Stefan Metzmacher [Tue, 27 Feb 2024 14:47:15 +0000 (15:47 +0100)]
lib/krb5_wrap: make use of smb_krb5_cc_new_unique_memory() in smb_krb5_kinit_s4u2_ccache()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agolib/krb5_wrap: add smb_krb5_cc_new_unique_memory()
Stefan Metzmacher [Tue, 27 Feb 2024 14:42:37 +0000 (15:42 +0100)]
lib/krb5_wrap: add smb_krb5_cc_new_unique_memory()

This generates a memory credential cache that is
not visible to a (the default) credential cache collection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agos3:gse: don't call krb5_cc_resolve() as server
Stefan Metzmacher [Thu, 29 Feb 2024 15:15:37 +0000 (16:15 +0100)]
s3:gse: don't call krb5_cc_resolve() as server

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agos3:gse: avoid prompting for a password that we don't use in the end
Stefan Metzmacher [Thu, 14 Apr 2022 12:23:23 +0000 (14:23 +0200)]
s3:gse: avoid prompting for a password that we don't use in the end

Currently we rely on a valid default credential cache being available
and don't make use of the password.

In future we'll do a kinit on demand, but that's for another day.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agos3:gse: make use of gensec_kerberos_possible()
Stefan Metzmacher [Tue, 5 Mar 2024 14:33:51 +0000 (15:33 +0100)]
s3:gse: make use of gensec_kerberos_possible()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agos4:gensec_gssapi: make use of gensec_kerberos_possible()
Stefan Metzmacher [Tue, 5 Mar 2024 14:33:51 +0000 (15:33 +0100)]
s4:gensec_gssapi: make use of gensec_kerberos_possible()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/gensec: add gensec_get_unparsed_target_principal() helper
Stefan Metzmacher [Tue, 5 Mar 2024 14:32:59 +0000 (15:32 +0100)]
auth/gensec: add gensec_get_unparsed_target_principal() helper

This will be useful for debugging.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/gensec: add gensec_kerberos_possible() helper
Stefan Metzmacher [Tue, 5 Mar 2024 13:41:39 +0000 (14:41 +0100)]
auth/gensec: add gensec_kerberos_possible() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agos3:client: avoid cli_credentials_get_password() to check for a specified password
Stefan Metzmacher [Thu, 14 Apr 2022 11:49:39 +0000 (13:49 +0200)]
s3:client: avoid cli_credentials_get_password() to check for a specified password

Using cli_credentials_get_password_obtained() is more lightweight as
it avoids a possible password prompt.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth:creds: Add test for cli_credentials_get_username_obtained()
Andreas Schneider [Tue, 7 May 2024 05:45:50 +0000 (07:45 +0200)]
auth:creds: Add test for cli_credentials_get_username_obtained()

Signed-off-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: add cli_credentials_get_username_obtained()
Stefan Metzmacher [Wed, 13 Mar 2024 16:50:34 +0000 (17:50 +0100)]
auth/credentials: add cli_credentials_get_username_obtained()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth:creds: Add test for cli_credentials_get_password_obtained()
Andreas Schneider [Tue, 7 May 2024 05:44:22 +0000 (07:44 +0200)]
auth:creds: Add test for cli_credentials_get_password_obtained()

Signed-off-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: add cli_credentials_get_password_obtained()
Stefan Metzmacher [Thu, 14 Apr 2022 11:46:18 +0000 (13:46 +0200)]
auth/credentials: add cli_credentials_get_password_obtained()

It's often useful to know if a password was already explicitly
specified without triggering the password callback function.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agolib/cmdline: skip the password prompt if we have a valid krb5 ccache
Stefan Metzmacher [Thu, 14 Apr 2022 11:34:37 +0000 (13:34 +0200)]
lib/cmdline: skip the password prompt if we have a valid krb5 ccache

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: add cli_credentials_get_ccache_name_obtained()
Stefan Metzmacher [Thu, 14 Apr 2022 11:29:47 +0000 (13:29 +0200)]
auth/credentials: add cli_credentials_get_ccache_name_obtained()

It's often good to know if a credential structure already has
a valid kerberos credential cache attached, without the side
effect of doing a kinit and prompt for a password.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth:creds: Add test for cli_credentials_get_principal_obtained()
Andreas Schneider [Tue, 7 May 2024 05:54:46 +0000 (07:54 +0200)]
auth:creds: Add test for cli_credentials_get_principal_obtained()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
3 weeks agoauth/credentials: add cli_credentials_get_principal_obtained()
Stefan Metzmacher [Wed, 13 Mar 2024 16:50:56 +0000 (17:50 +0100)]
auth/credentials: add cli_credentials_get_principal_obtained()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agosmbd: Implement FSCTL_DELETE_REPARSE_POINT
Volker Lendecke [Mon, 6 May 2024 14:59:44 +0000 (16:59 +0200)]
smbd: Implement FSCTL_DELETE_REPARSE_POINT

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May  6 21:55:03 UTC 2024 on atb-devel-224

3 weeks agotests: Test FSCTL_DELETE_REPARSE_POINT
Volker Lendecke [Mon, 6 May 2024 14:35:25 +0000 (16:35 +0200)]
tests: Test FSCTL_DELETE_REPARSE_POINT

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agotests: Run reparse tests
Volker Lendecke [Fri, 3 May 2024 13:03:30 +0000 (15:03 +0200)]
tests: Run reparse tests

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agotests: Expected failures in reparse point tests should not be errors
Volker Lendecke [Sun, 5 May 2024 10:16:39 +0000 (12:16 +0200)]
tests: Expected failures in reparse point tests should not be errors

We need to put them into knownfail.d individually

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agosmbd: Implement fsctl_set_reparse_point
Volker Lendecke [Fri, 2 Dec 2022 10:56:08 +0000 (11:56 +0100)]
smbd: Implement fsctl_set_reparse_point

Store the data in the "user.SmbReparse" xattr. Only allow this on
regular files. Windows does it for directories too, but we can not
allow this: Setting a symlink reparse point in a xattr on a directory
would go unnoticed by our openat2-optimization. If someone really
needs this, we could have a VFS module disallowing openat2 and doing
the appropriate checks on every openat-call.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agosmbd: Implement fsctl_get_reparse_point
Volker Lendecke [Sun, 5 May 2024 09:14:45 +0000 (11:14 +0200)]
smbd: Implement fsctl_get_reparse_point

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agotests: Clean up behind ourselves in test_create_reparse
Volker Lendecke [Fri, 3 May 2024 12:52:42 +0000 (14:52 +0200)]
tests: Clean up behind ourselves in test_create_reparse

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agotests: Codify IO_REPARSE_TAG_MISMATCH behaviour
Volker Lendecke [Fri, 3 May 2024 12:49:46 +0000 (14:49 +0200)]
tests: Codify IO_REPARSE_TAG_MISMATCH behaviour

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agotests: Clarify a reparse point test
Volker Lendecke [Fri, 3 May 2024 12:49:24 +0000 (14:49 +0200)]
tests: Clarify a reparse point test

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agos3: smbd: smb2-posix: Add SAMBA_XATTR_REPARSE_ATTRIB "user.SmbReparse" name.
Jeremy Allison [Tue, 18 Sep 2018 16:03:22 +0000 (09:03 -0700)]
s3: smbd: smb2-posix: Add SAMBA_XATTR_REPARSE_ATTRIB "user.SmbReparse" name.

Ensure it's prohibited for normal user access.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agoselftest: Default to "tmp" share in reparsepoints.py
Volker Lendecke [Mon, 2 Jan 2023 12:56:12 +0000 (13:56 +0100)]
selftest: Default to "tmp" share in reparsepoints.py

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agosmbd: Use reparse_buffer_check() in fsctl_set_reparse_point()
Volker Lendecke [Thu, 2 May 2024 14:34:43 +0000 (16:34 +0200)]
smbd: Use reparse_buffer_check() in fsctl_set_reparse_point()

check_reparse_data_buffer() was duplicated code

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agosmbd: Prepare to return the reparse tag from fsctl_get_reparse_point
Volker Lendecke [Sat, 4 May 2024 09:19:14 +0000 (11:19 +0200)]
smbd: Prepare to return the reparse tag from fsctl_get_reparse_point

We'll need this in many places, for example when listing directories

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agosmbd: Change the output of fsctl_get_reparse_point to uint8
Volker Lendecke [Sat, 4 May 2024 17:32:03 +0000 (19:32 +0200)]
smbd: Change the output of fsctl_get_reparse_point to uint8

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agoreparse: Tighten reparse point length check
Volker Lendecke [Sat, 4 May 2024 08:54:27 +0000 (10:54 +0200)]
reparse: Tighten reparse point length check

test_create_reparse shows that the length checks need to be precise,
not just checking for overflow.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 weeks agosmbd: Return FILE_ATTRIBUTE_REPARSE_POINT from "user.DOSATTRIB"
Volker Lendecke [Fri, 2 Dec 2022 14:02:18 +0000 (15:02 +0100)]
smbd: Return FILE_ATTRIBUTE_REPARSE_POINT from "user.DOSATTRIB"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 weeks agos4:dsdb: Fix stack use after scope in gkdi_create_root_key()
Andreas Schneider [Tue, 30 Apr 2024 07:16:40 +0000 (09:16 +0200)]
s4:dsdb: Fix stack use after scope in gkdi_create_root_key()

==20978==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7f4f91ff51a0 at pc 0x7f4f94cf93d6 bp 0x7ffdb90fc510 sp 0x7ffdb90fbcd0
READ of size 64 at 0x7f4f91ff51a0 thread T0
    #0 0x7f4f94cf93d5 in memcpy ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115
    #1 0x7f4f933bdb67 in ldb_val_dup ../../lib/ldb/common/ldb_msg.c:325
    #2 0x7f4f933c11d1 in ldb_msg_copy ../../lib/ldb/common/ldb_msg.c:1182
    #3 0x7f4f933c13d2 in ldb_msg_normalize ../../lib/ldb/common/ldb_msg.c:1235
    #4 0x7f4f933ab556 in ldb_request ../../lib/ldb/common/ldb.c:1196
    #5 0x7f4f8e82b1d4 in dsdb_autotransaction_request ../../source4/dsdb/common/util.c:1220
    #6 0x7f4f8e831c8a in dsdb_add ../../source4/dsdb/common/util.c:5354
    #7 0x7f4f8e853a01 in gkdi_create_root_key ../../source4/dsdb/gmsa/gkdi.c:493
    #8 0x7f4f8e853a01 in gkdi_new_root_key ../../source4/dsdb/gmsa/gkdi.c:551
    #9 0x7f4f8cd4ca52 in py_dsdb_create_gkdi_root_key ../../source4/dsdb/pydsdb.c:1388
    #10 0x7f4f947ce01c  (/lib64/libpython3.11.so.1.0+0x1ce01c) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #11 0x7f4f947de4c0 in _PyObject_Call (/lib64/libpython3.11.so.1.0+0x1de4c0) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #12 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #13 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #14 0x7f4f947de5d8  (/lib64/libpython3.11.so.1.0+0x1de5d8) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #15 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #16 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #17 0x7f4f947edabb  (/lib64/libpython3.11.so.1.0+0x1edabb) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #18 0x7f4f947de5d8  (/lib64/libpython3.11.so.1.0+0x1de5d8) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #19 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #20 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #21 0x7f4f947ed9fb  (/lib64/libpython3.11.so.1.0+0x1ed9fb) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #22 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #23 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #24 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #25 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #26 0x7f4f94839997 in PyEval_EvalCode (/lib64/libpython3.11.so.1.0+0x239997) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #27 0x7f4f94856862  (/lib64/libpython3.11.so.1.0+0x256862) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #28 0x7f4f94852e59  (/lib64/libpython3.11.so.1.0+0x252e59) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #29 0x7f4f94868fb1  (/lib64/libpython3.11.so.1.0+0x268fb1) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #30 0x7f4f948687a3 in _PyRun_SimpleFileObject (/lib64/libpython3.11.so.1.0+0x2687a3) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #31 0x7f4f94868453 in _PyRun_AnyFileObject (/lib64/libpython3.11.so.1.0+0x268453) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #32 0x7f4f94861c53 in Py_RunMain (/lib64/libpython3.11.so.1.0+0x261c53) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #33 0x7f4f94829996 in Py_BytesMain (/lib64/libpython3.11.so.1.0+0x229996) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #34 0x7f4f9422a1ef in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #35 0x7f4f9422a2b8 in __libc_start_main_impl ../csu/libc-start.c:360
    #36 0x5604497e3084 in _start (/usr/bin/python3.11+0x1084) (BuildId: f5d6e3bdbf9098a6ddde0b7f2e07ffc9ad1b1dc3)

Address 0x7f4f91ff51a0 is located in stack of thread T0 at offset 416 in frame
    #0 0x7f4f8e852b37 in gkdi_new_root_key ../../source4/dsdb/gmsa/gkdi.c:537

  This frame has 12 object(s):
    [32, 40) 'root_key_dn' (line 539)
    [64, 72) 'res' (line 540)
    [96, 104) 'server_config_res' (line 118)
    [128, 136) 'kdf_algorithm' (line 128)
    [160, 168) 'domain_dn' (line 388)
    [192, 208) 'kdf_parameters_blob' (line 129)
    [224, 240) 'root_key_data_blob' (line 353)
    [256, 272) 'guid_blob' (line 467)
    [288, 312) 'kdf_parameters' (line 226)
    [352, 368) 'root_key_id' (line 116)
    [384, 400) 'guid_buf' (line 466)
    [416, 480) 'root_key_data' (line 352) <== Memory access at offset 416 is inside this variable

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <jsutton@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri May  3 12:20:55 UTC 2024 on atb-devel-224

4 weeks agosmbd: Remove unused [push_pull]_file_id_24
Volker Lendecke [Tue, 30 Apr 2024 09:43:58 +0000 (11:43 +0200)]
smbd: Remove unused [push_pull]_file_id_24

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 30 23:48:21 UTC 2024 on atb-devel-224

4 weeks agosmbd: Use struct oplock_break_message for MSG_SMB_KERNEL_BREAK
Volker Lendecke [Tue, 30 Apr 2024 09:41:50 +0000 (11:41 +0200)]
smbd: Use struct oplock_break_message for MSG_SMB_KERNEL_BREAK

Signed-off-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: Remove message_to_share_mode_entry and vice versa
Volker Lendecke [Tue, 30 Apr 2024 08:37:06 +0000 (10:37 +0200)]
smbd: Remove message_to_share_mode_entry and vice versa

Used only for closing files from rpc srvsvc these days

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 weeks agosmbd: Use struct oplock_break_message for MSG_CLOSE_FILE
Volker Lendecke [Tue, 30 Apr 2024 08:35:06 +0000 (10:35 +0200)]
smbd: Use struct oplock_break_message for MSG_CLOSE_FILE

We only need to transmit the file_id and share_file_id. Next patch
will show why :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 weeks agosmbd: Fix a typo
Volker Lendecke [Tue, 30 Apr 2024 08:31:37 +0000 (10:31 +0200)]
smbd: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>