metze/samba/wip.git
3 months agoHEIMDAL: lib/krb5: don't ignore krb5_init_creds_get_creds() result in krb5_get_init_c... master-krb5
Stefan Metzmacher [Thu, 1 Feb 2024 12:57:56 +0000 (13:57 +0100)]
HEIMDAL: lib/krb5: don't ignore krb5_init_creds_get_creds() result in krb5_get_init_creds_password()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Bjoern Jacke <bj@sernet.de>
3 months agoHEIMDAL: lib/krb5: work around AIX fwrite() caching bug in stdio_store()
Stefan Metzmacher [Thu, 1 Feb 2024 12:58:32 +0000 (13:58 +0100)]
HEIMDAL: lib/krb5: work around AIX fwrite() caching bug in stdio_store()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
3 months agokrb5_wrap: don't ignore krb5_kt_start_seq_get() errors
Stefan Metzmacher [Thu, 1 Feb 2024 12:58:32 +0000 (13:58 +0100)]
krb5_wrap: don't ignore krb5_kt_start_seq_get() errors

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
3 months agoauth/credentials_krb5: make use of smb_gss_krb5_prepare_acceptor_cred()
Stefan Metzmacher [Thu, 22 Aug 2019 17:25:30 +0000 (17:25 +0000)]
auth/credentials_krb5: make use of smb_gss_krb5_prepare_acceptor_cred()

We should check all keys in our in memory keytab
and skip the transited checks unless we're
in standalone/MIT-realm mode.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoauth/credentials_krb5: let cli_credentials_get_server_gss_creds() use an early return
Stefan Metzmacher [Thu, 22 Aug 2019 17:25:09 +0000 (17:25 +0000)]
auth/credentials_krb5: let cli_credentials_get_server_gss_creds() use an early return

This will simplify the next commits.

Check with: git show -w

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos3:gse: let gse_init_server() use smb_gss_krb5_prepare_acceptor_cred()
Stefan Metzmacher [Thu, 22 Aug 2019 17:13:41 +0000 (17:13 +0000)]
s3:gse: let gse_init_server() use smb_gss_krb5_prepare_acceptor_cred()

We should check all keys in our in memory keytab
and skip the transited checks unless we're in
standalone/MIT-realm mode.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agokrb5_wrap: add smb_gss_krb5_prepare_acceptor_cred()
Stefan Metzmacher [Thu, 22 Aug 2019 16:52:15 +0000 (16:52 +0000)]
krb5_wrap: add smb_gss_krb5_prepare_acceptor_cred()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoconfigure_mitkrb5: check for GSS_KRB5_CRED_SKIP_TRANSIT_CHECK_X
Stefan Metzmacher [Thu, 22 Aug 2019 16:09:47 +0000 (16:09 +0000)]
configure_mitkrb5: check for GSS_KRB5_CRED_SKIP_TRANSIT_CHECK_X

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos4:heimdal_build: define HAVE_GSS_KRB5_CRED_{SKIP_TRANSIT_CHECK,ITERATE_ACCEPTOR_KEYT...
Stefan Metzmacher [Thu, 22 Aug 2019 16:09:47 +0000 (16:09 +0000)]
s4:heimdal_build: define HAVE_GSS_KRB5_CRED_{SKIP_TRANSIT_CHECK,ITERATE_ACCEPTOR_KEYTAB}_X

We can only do that for our own copy of heimdal, see
https://github.com/heimdal/heimdal/pull/656

In future we may want to use
source4/heimdal_build/wscript_configure only for
our in tree copy of heimdal and do real configure
checks for the system heimdal build.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoHEIMDAL:lib/gssapi/krb5: add GSS_KRB5_CRED_ITERATE_ACCEPTOR_KEYTAB_X
Stefan Metzmacher [Thu, 22 Aug 2019 08:30:01 +0000 (10:30 +0200)]
HEIMDAL:lib/gssapi/krb5: add GSS_KRB5_CRED_ITERATE_ACCEPTOR_KEYTAB_X

This allows krb5_rd_req_in_set_iterate_keytab() to be used via the
gssapi layer.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoHEIMDAL:lib/krb5: add krb5_rd_req_in_set_iterate_keytab()
Stefan Metzmacher [Sat, 20 Jul 2019 10:15:04 +0000 (10:15 +0000)]
HEIMDAL:lib/krb5: add krb5_rd_req_in_set_iterate_keytab()

A caller might not know the kvno maintained by the KDC.
And most often there's need to know it.

So this function makes it possible to force the keytab
iteration in order to get a consistent behavior.
Otherwise it's possible to get a different behavior
if the guessed kvno in the keytab accidentally matches
the kvno of the ticket and we'll give up if the
key is not able to decrypt the ticket.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoHEIMDAL:lib/krb5: let krb5_rd_req_ctx() fallback only on KRB5KRB_AP_ERR_BAD_INTEGRITY
Stefan Metzmacher [Sat, 20 Jul 2019 10:15:04 +0000 (10:15 +0000)]
HEIMDAL:lib/krb5: let krb5_rd_req_ctx() fallback only on KRB5KRB_AP_ERR_BAD_INTEGRITY

This avoids hidding a real error like KRB5KRB_AP_ERR_ILL_CR_TKT.

We only want to retry with the next key if the decryption
failed.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoHEIMDAL:lib/gssapi/krb5: add GSS_KRB5_CRED_SKIP_TRANSIT_CHECK_X
Stefan Metzmacher [Fri, 18 Aug 2017 13:33:17 +0000 (15:33 +0200)]
HEIMDAL:lib/gssapi/krb5: add GSS_KRB5_CRED_SKIP_TRANSIT_CHECK_X

This allows KRB5_VERIFY_AP_REQ_SKIP_TRANSITED_CHECK (on the acceptor)
to be controlled via the gssapi layer.

Members of Active Directory domains should just rely on there
KDCs (domain controllers) to do SID-Filtering (and name checking)
on trust boundaries, I have verified this with a modified Samba KDC
and a Windows 2012R2 DC. The Windows DC rejects invalid cross-realm tickets
with KRB5KDC_ERR_POLICY, before generating a new (service or referral)
ticket. So any service ticket is already policy checked by the KDC
even if this does not result in setting the transited_policy_checked in the ticket.

This means an accepting service can tell gss_accept_sec_context()
to skip any transited checking, as the trust topoligy is only
fully known to the KDC anyway.

The detailed background for this can be found in the bug report
and the mailing list:
https://lists.samba.org/archive/samba-technical/2019-September/thread.html#134285
https://lists.samba.org/archive/samba-technical/2019-November/thread.html#134553
http://mailman.mit.edu/pipermail/krbdev/ should also have references.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoHEIMDAL:lib/krb5: add [libdefaults] acceptor_skip_transit_check and KRB5_VERIFY_AP_RE...
Stefan Metzmacher [Fri, 18 Aug 2017 13:33:17 +0000 (15:33 +0200)]
HEIMDAL:lib/krb5: add [libdefaults] acceptor_skip_transit_check and KRB5_VERIFY_AP_REQ_SKIP_TRANSITED_CHECK

In active directory a domain member replies on (trusts) the [K]DCs
of the domain. It's the job of the [K]DCs to only generate useful
tickets as they know about the trust topology.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoHEIMDAL:lib/krb5: add krb5_rd_req_in_set_verify_ap_req_flags()
Stefan Metzmacher [Fri, 18 Aug 2017 13:33:17 +0000 (15:33 +0200)]
HEIMDAL:lib/krb5: add krb5_rd_req_in_set_verify_ap_req_flags()

In the next commits we want to be able to pass down
things like KRB5_VERIFY_AP_REQ_NO_TRANSITED_CHECK.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoschema_samba4.ldif: allocate GSS_KRB5_CRED_ITERATE_ACCEPTOR_KEYTAB_X from our OID...
Stefan Metzmacher [Tue, 17 Aug 2021 15:35:27 +0000 (17:35 +0200)]
schema_samba4.ldif: allocate GSS_KRB5_CRED_ITERATE_ACCEPTOR_KEYTAB_X from our OID space

This will be in (at least our own copy of) Heimdal.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agosamba.schema: allocate GSS_KRB5_CRED_SKIP_TRANSIT_CHECK_X from our OID space
Stefan Metzmacher [Tue, 17 Aug 2021 15:35:27 +0000 (17:35 +0200)]
samba.schema: allocate GSS_KRB5_CRED_SKIP_TRANSIT_CHECK_X from our OID space

This will be used in MIT kerberos and (at least our own copy of) Heimdal.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoHEIMDAL: make-proto.pl make JSON:PP optional
Stefan Metzmacher [Tue, 1 Aug 2023 12:40:33 +0000 (14:40 +0200)]
HEIMDAL: make-proto.pl make JSON:PP optional

3 months agos3:libnet: add a debug message to libnet_keytab_add_to_keytab_entries()
Stefan Metzmacher [Thu, 3 Feb 2022 17:27:19 +0000 (18:27 +0100)]
s3:libnet: add a debug message to libnet_keytab_add_to_keytab_entries()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos3:libnet: add support for trusted domains in libnet_dssync_keytab.c
Stefan Metzmacher [Thu, 3 Feb 2022 17:27:19 +0000 (18:27 +0100)]
s3:libnet: add support for trusted domains in libnet_dssync_keytab.c

It means that keytabs generated via 'net rpc vampire keytab' are
able to decrypt cross-realm tickets in wireshark.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos3:libnet: split out store_or_fetch_attribute() from parse_user() in libnet_dssync_ke...
Stefan Metzmacher [Thu, 3 Feb 2022 13:48:03 +0000 (14:48 +0100)]
s3:libnet: split out store_or_fetch_attribute() from parse_user() in libnet_dssync_keytab.c

This way we can easily re-use the logic in the next commits...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos3:libnet: split out parse_user() in libnet_dssync_keytab.c
Stefan Metzmacher [Thu, 3 Feb 2022 13:48:03 +0000 (14:48 +0100)]
s3:libnet: split out parse_user() in libnet_dssync_keytab.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos3:libnet: let parse_user() in libnet_dssync_keytab.c work without nt hash
Stefan Metzmacher [Thu, 3 Feb 2022 13:48:03 +0000 (14:48 +0100)]
s3:libnet: let parse_user() in libnet_dssync_keytab.c work without nt hash

It happens in setups with 'nt hash store = never'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos4:kdc: also provide cross-realm keys via samba_kdc_seq()
Stefan Metzmacher [Thu, 3 Feb 2022 13:14:06 +0000 (14:14 +0100)]
s4:kdc: also provide cross-realm keys via samba_kdc_seq()

This means that 'samba-tool domain exportkeytab' is able to
export them.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agos3/rpc_client: cleanup unmarshalling of variant types from row columns
Noel Power [Wed, 10 Jan 2024 14:43:58 +0000 (14:43 +0000)]
s3/rpc_client: cleanup unmarshalling of variant types from row columns

Prior to this change fn 'extract_variant_addresses' actually returns offsets
to the variant stored not the addresses, additionally the param in the
signature of the method is named offset where the param in reality is a
base address.
This change makes fn 'extract_variant_addresses' actually return addresses
instead of offsets and also changes the name of the incoming param. The
resulting changes are propaged to callers which hopefully makes what the
code is actually doing a little clearer

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Jan 30 17:22:37 UTC 2024 on atb-devel-224

3 months agos3/utils: use full 64 bit address for getrows (with 64bit offsets)
Noel Power [Mon, 8 Jan 2024 15:56:38 +0000 (15:56 +0000)]
s3/utils: use full 64 bit address for getrows (with 64bit offsets)

if 64bit offsets are used the hi 32-bits of address are stored in
the ulreserved2 member of the message header field and the low 32-bits
are stored in the ulclientbase member of the cpmgetrows message

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 months agos3/rpc_client: Remove stray unnecessary comment
Noel Power [Wed, 10 Jan 2024 10:59:23 +0000 (10:59 +0000)]
s3/rpc_client: Remove stray unnecessary comment

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 months agos3/rpc_client: change type of offset to uint64_t
Noel Power [Mon, 8 Jan 2024 15:12:35 +0000 (15:12 +0000)]
s3/rpc_client: change type of offset to uint64_t

Offset can be a 32 or 64 bit address depending on the indexing addressing
mode negotiated by the client
With a 32 bit param we can only specify a 32 bit base address. This change
alone doesn't affect anything as it is the client itself that choses and
passes the base address offset and wspsearch is the only current user of
this code.
In this case even with 64bit addressing negotiated the address passed
represents only the lower 32-bits part of the address.
However, for coverage purposes it would be better for the client to use an
address that covers the full 64bit range of the address (when 64 bit
addressing is negotiated).
This change will alow the wspsearch client in a future commit to pass a
base address value with both the hi and low 32 bits values set to make up
the full 64 bit address.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 months agolibrpc/idl: remove duplicate definitition
Noel Power [Tue, 19 Dec 2023 11:35:58 +0000 (11:35 +0000)]
librpc/idl: remove duplicate definitition

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 months agolibrpc/idl: fix typo in wsp_csort member
Noel Power [Thu, 16 Nov 2023 09:22:56 +0000 (09:22 +0000)]
librpc/idl: fix typo in wsp_csort member

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 months agolibrpc/wsp: Unknown property used in 'current directory' searches
Noel Power [Mon, 18 Dec 2023 11:37:38 +0000 (11:37 +0000)]
librpc/wsp: Unknown property used in 'current directory' searches

This property seems to be used instead of 'Scope' when the windows
search UI has selected current dir

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 months agodocs-xml: Build and install man page for wspsearch
Anoop C S [Tue, 30 Jan 2024 09:03:07 +0000 (14:33 +0530)]
docs-xml: Build and install man page for wspsearch

Commit 49b6137f7c2244aeb3cf9b65fc9d46fcf0b8dc55 switched the default
to install `wspsearch` client from False to True but missed to build
and install the corresponding man page. Therefore adding wspsearch.1
to the list of man pages to be built and installed by default.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Jan 30 14:38:58 UTC 2024 on atb-devel-224

3 months agopython:gp: Fix logging with gp
Andreas Schneider [Mon, 29 Jan 2024 16:46:30 +0000 (17:46 +0100)]
python:gp: Fix logging with gp

This allows enable INFO level logging with: `samba-gpupdate -d3`

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jan 30 07:18:05 UTC 2024 on atb-devel-224

3 months agoldb: change the version to 2.10.0 for Samba 4.21
Jule Anger [Mon, 29 Jan 2024 14:34:26 +0000 (15:34 +0100)]
ldb: change the version to 2.10.0 for Samba 4.21

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Mon Jan 29 15:43:45 UTC 2024 on atb-devel-224

3 months agoWHATSNEW: Start release notes for Samba 4.21.0pre1.
Jule Anger [Mon, 29 Jan 2024 14:32:15 +0000 (15:32 +0100)]
WHATSNEW: Start release notes for Samba 4.21.0pre1.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoVERSION: Bump version up to 4.21.0pre1...
Jule Anger [Mon, 29 Jan 2024 14:29:43 +0000 (15:29 +0100)]
VERSION: Bump version up to 4.21.0pre1...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoVERSION: Disable GIT_SNAPSHOT for the Samba 4.20.0rc1 release. samba-upstream/tags/samba-4.20.0rc1
Jule Anger [Mon, 29 Jan 2024 14:28:20 +0000 (15:28 +0100)]
VERSION: Disable GIT_SNAPSHOT for the Samba 4.20.0rc1 release.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoWHATSNEW: Up to Samba 4.20.0rc1.
Jule Anger [Mon, 29 Jan 2024 14:26:37 +0000 (15:26 +0100)]
WHATSNEW: Up to Samba 4.20.0rc1.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agoldb: release 2.9.0 for use in Samba 4.20.x samba-upstream/tags/ldb-2.9.0
Jule Anger [Mon, 29 Jan 2024 14:08:08 +0000 (15:08 +0100)]
ldb: release 2.9.0 for use in Samba 4.20.x

- documentation fixes
- build with Python 3.12 (bug #15513)
- a lot of additional error checking in
  the python bindings
- minor code fixes

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

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agotevent: release 0.16.1 samba-upstream/tags/tevent-0.16.1
Jule Anger [Mon, 29 Jan 2024 14:08:08 +0000 (15:08 +0100)]
tevent: release 0.16.1

- build with Python 3.12 (bug #15513)
- documentation fixes

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

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agotdb: release 1.4.10 samba-upstream/tags/tdb-1.4.10
Jule Anger [Mon, 29 Jan 2024 14:08:08 +0000 (15:08 +0100)]
tdb: release 1.4.10

- build with Python 3.12 (bug #15513)
- documentation fixes
- minor build fixes

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

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agotalloc: release 2.4.2 samba-upstream/tags/talloc-2.4.2
Jule Anger [Mon, 29 Jan 2024 14:08:08 +0000 (15:08 +0100)]
talloc: release 2.4.2

- build with Python 3.12 (bug #15513)
- documentation fixes

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

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 months agopython:gp: Improve working of log messages to avoid confusion
Andreas Schneider [Mon, 22 Jan 2024 14:46:24 +0000 (15:46 +0100)]
python:gp: Improve working of log messages to avoid confusion

We should not use the word "Failed". We are totally fine if we can't
connect to NDES in the meantime. This logs:

Try to get root or server certificates.
Unable to install root certificates (requires NDES).
Installing the server certificate only.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 29 10:37:29 UTC 2024 on atb-devel-224

3 months agopython:gp: Log an error if update fails
Andreas Schneider [Mon, 22 Jan 2024 14:05:24 +0000 (15:05 +0100)]
python:gp: Log an error if update fails

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 months agopython:gp: Do not print an error if template already exists
Andreas Schneider [Mon, 22 Jan 2024 14:05:02 +0000 (15:05 +0100)]
python:gp: Do not print an error if template already exists

We will get an exit status for duplicate in future:
https://www.pagure.io/certmonger/issue/269
We can't really fix that right now, as older version of certmonger
don't support the `-v` option.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 months agopython:gp: Do not print an error, if CA already exists
Andreas Schneider [Mon, 22 Jan 2024 14:04:36 +0000 (15:04 +0100)]
python:gp: Do not print an error, if CA already exists

We will get an exit status for duplicate in future:
https://www.pagure.io/certmonger/issue/269
We can't really fix that right now, as older version of certmonger
don't support the `-v` option.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 months agopython:gp: Improve logging for certificate enrollment
Andreas Schneider [Mon, 22 Jan 2024 13:07:47 +0000 (14:07 +0100)]
python:gp: Improve logging for certificate enrollment

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 months agopython:gp: Avoid path check for cepces-submit
Andreas Schneider [Mon, 22 Jan 2024 13:14:30 +0000 (14:14 +0100)]
python:gp: Avoid path check for cepces-submit

find_cepces_submit() uses which(), which returns None if not found.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 months agovfs_ceph: Use ceph_fdopendir() when available for SMB_VFS_FDOPENDIR
Anoop C S [Tue, 16 Jan 2024 06:17:27 +0000 (11:47 +0530)]
vfs_ceph: Use ceph_fdopendir() when available for SMB_VFS_FDOPENDIR

Signed-off-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): Sat Jan 27 00:01:12 UTC 2024 on atb-devel-224

3 months agosmb2_tcon: add "smb3 share cap:{CONTINUOUS AVAILABILITY,SCALE OUT,CLUSTER,ASYMMETRIC...
Stefan Metzmacher [Tue, 31 Jul 2012 06:55:20 +0000 (08:55 +0200)]
smb2_tcon: add "smb3 share cap:{CONTINUOUS AVAILABILITY,SCALE OUT,CLUSTER,ASYMMETRIC}" options

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jan 26 18:04:10 UTC 2024 on atb-devel-224

3 months agopython:tests/rpcd_witness_samba_only: add tests for 'net witness force-response'
Stefan Metzmacher [Mon, 22 Jan 2024 18:27:03 +0000 (19:27 +0100)]
python:tests/rpcd_witness_samba_only: add tests for 'net witness force-response'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:utils: add 'net witness force-response'
Stefan Metzmacher [Fri, 15 Dec 2023 13:49:37 +0000 (14:49 +0100)]
s3:utils: add 'net witness force-response'

This allows generating any possible AsyncNotify response
for the specified selection of witness registrations
from rpcd_witness_registration.tdb.

This can be used by developers to test the (windows)
client behavior to specific AsyncNotify responses.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agopython:tests/rpcd_witness_samba_only: add tests for 'net witness force-unregister'
Stefan Metzmacher [Mon, 15 Jan 2024 13:20:00 +0000 (14:20 +0100)]
python:tests/rpcd_witness_samba_only: add tests for 'net witness force-unregister'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:utils: add 'net witness force-unregister'
Stefan Metzmacher [Fri, 15 Dec 2023 13:49:37 +0000 (14:49 +0100)]
s3:utils: add 'net witness force-unregister'

This allows removing of the specified selection
of witness registrations from rpcd_witness_registration.tdb.

Any pending AsyncNotify will get WERR_NOT_FOUND.

Typically this triggers a clean re-registration on the client.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agopython:tests/rpcd_witness_samba_only: add tests for 'net witness {client,share}-move'
Stefan Metzmacher [Mon, 15 Jan 2024 13:20:00 +0000 (14:20 +0100)]
python:tests/rpcd_witness_samba_only: add tests for 'net witness {client,share}-move'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:utils: add 'net witness client-move' and 'net witness share-move'
Stefan Metzmacher [Fri, 15 Dec 2023 13:49:37 +0000 (14:49 +0100)]
s3:utils: add 'net witness client-move' and 'net witness share-move'

These can be used to generate CLIENT_MOVE or SHARE_MOVE message
to the specified selection of witness registrations from
rpcd_witness_registration.tdb

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:rpc_server/witness: add handling of MSG_RPCD_WITNESS_REGISTRATION_UPDATE messages
Stefan Metzmacher [Wed, 20 Dec 2023 18:22:25 +0000 (19:22 +0100)]
s3:rpc_server/witness: add handling of MSG_RPCD_WITNESS_REGISTRATION_UPDATE messages

This implements the server side features for the
'net witness [client-move,...]' commands in the end.

These are administrator driven notifications for the witness client.

RPCD_WITNESS_REGISTRATION_UPDATE_FORCE_RESPONSE and
RPCD_WITNESS_REGISTRATION_UPDATE_FORCE_UNREGISTER will be very useful
for later automated testing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:rpcd_witness.idl: add rpcd_witness_registration_updateB message definitions
Stefan Metzmacher [Thu, 21 Dec 2023 14:03:05 +0000 (15:03 +0100)]
s3:rpcd_witness.idl: add rpcd_witness_registration_updateB message definitions

This will be used for rpcd_witness_registration_updateB messages
in 'net witness [client-move,...]' commands later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agomessaging.idl: add MSG_RPCD_WITNESS_REGISTRATION_UPDATE
Stefan Metzmacher [Thu, 21 Dec 2023 14:03:05 +0000 (15:03 +0100)]
messaging.idl: add MSG_RPCD_WITNESS_REGISTRATION_UPDATE

This will be used for rpcd_witness_registration_updateB messages
in 'net witness [client-move,...]' commands later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agopython:tests/rpcd_witness_samba_only: add tests for 'net witness list'
Stefan Metzmacher [Fri, 12 Jan 2024 16:30:41 +0000 (17:30 +0100)]
python:tests/rpcd_witness_samba_only: add tests for 'net witness list'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:utils: add 'net witness list' command
Stefan Metzmacher [Fri, 15 Dec 2023 13:49:37 +0000 (14:49 +0100)]
s3:utils: add 'net witness list' command

It lists the entries from the rpcd_witness_registration.tdb.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:rpc_server/witness: let Register[Ex] store rpcd_witness_registration.tdb records
Stefan Metzmacher [Fri, 24 Nov 2023 16:15:36 +0000 (17:15 +0100)]
s3:rpc_server/witness: let Register[Ex] store rpcd_witness_registration.tdb records

This will allow 'net witness list' to be implemented in the end.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:rpcd_witness.idl: introduce definitions for rpcd_witness_registration.tdb records
Stefan Metzmacher [Thu, 21 Dec 2023 14:03:05 +0000 (15:03 +0100)]
s3:rpcd_witness.idl: introduce definitions for rpcd_witness_registration.tdb records

A rpcd_witness_registration.tdb will be added shortly in order to
implement useful 'net witness [list,client-move,...]' commands
in the end.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agopython/blackbox: add rpcd_witness_samba_only.py test
Stefan Metzmacher [Wed, 10 Jan 2024 14:11:24 +0000 (15:11 +0100)]
python/blackbox: add rpcd_witness_samba_only.py test

This tests the witness service and its interaction with
ctdb.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agopython/tests: add TestCase.get_loadparm(s3=True) support
Stefan Metzmacher [Fri, 12 Jan 2024 15:56:58 +0000 (16:56 +0100)]
python/tests: add TestCase.get_loadparm(s3=True) support

This will be used for tests with registry shares,
as the top level loadparm system doesn't support them.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agoscript/autobuild.py: also pass PYTHONPATH to make test of 'samba-ctdb'
Stefan Metzmacher [Mon, 15 Jan 2024 12:06:57 +0000 (13:06 +0100)]
script/autobuild.py: also pass PYTHONPATH to make test of 'samba-ctdb'

Otherwise tests won't find the custom tdb python bindings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agoselftest/Samba: export CTDB_PREFIX in clusteredmember testenv
Stefan Metzmacher [Fri, 12 Jan 2024 16:09:51 +0000 (17:09 +0100)]
selftest/Samba: export CTDB_PREFIX in clusteredmember testenv

It means ctdb/tests/local_daemons.sh will be easily useable

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agoselftest/Samba3: start samba_dcerpcd in clusteredmember
Stefan Metzmacher [Fri, 12 Jan 2024 16:08:06 +0000 (17:08 +0100)]
selftest/Samba3: start samba_dcerpcd in clusteredmember

This enables the rpcd_witness to be available.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agoselftest/Samba3: remove unused variable in setup_clusteredmember
Stefan Metzmacher [Fri, 12 Jan 2024 16:06:05 +0000 (17:06 +0100)]
selftest/Samba3: remove unused variable in setup_clusteredmember

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agoselftest/Samba3: get NETBIOSNAME correct for clusteredmember
Stefan Metzmacher [Fri, 12 Jan 2024 16:03:38 +0000 (17:03 +0100)]
selftest/Samba3: get NETBIOSNAME correct for clusteredmember

It was missed in commit
7598b9069d3b983f8eb3b89b8459ec993ee43c80

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:rpc_server/witness: add implementation based on CTDB_SRVID_IPREALLOCATED and ctdbd...
Stefan Metzmacher [Wed, 9 Aug 2023 18:24:52 +0000 (20:24 +0200)]
s3:rpc_server/witness: add implementation based on CTDB_SRVID_IPREALLOCATED and ctdbd_all_ip_foreach()

The design is relatively simple in the end:

- We use ctdbd_all_ip_foreach() in order to build an
  in memory list of interfaces(ip addresses) and
  record if:
  - they are currently available or not
  - if they node local or not

- The current list is would we use for the
  GetInterfaceList() call.

- Register[Ex] will create an in memory structure
  holding a queue for pending AsyncNotify requests.

- Unregister() will cancel pending AsyncNotify requests and
  let them return NOT_FOUND.

- CTDB_SRVID_IPREALLOCATED messages will cause we refresh
  with ctdbd_all_ip_foreach():
  - this will detect changes in the interface state
    and remove stale interfaces.
  - for each change the list of registrations is checked
    for a matching ip address and a RESOURCE_CHANGE
    will be scheduled in the queue of the registration,
    the started queue will trigger AsyncNotify responses

- We also register the connections with ctdb in order
  to give other nodes a chance to generate tickle-acks
  for the witness tcp connections.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:rpc_server: add basic rpcd_witness template
Stefan Metzmacher [Wed, 9 Aug 2023 10:18:05 +0000 (12:18 +0200)]
s3:rpc_server: add basic rpcd_witness template

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:ctdbd_conn: add ctdbd_all_ip_foreach() helper
Stefan Metzmacher [Fri, 11 Aug 2023 11:07:46 +0000 (13:07 +0200)]
s3:ctdbd_conn: add ctdbd_all_ip_foreach() helper

This can we used to traverse through all ip addresses ctdb knows
about.

The caller can select node ips and/or public ips.

This will we useful to monitor the addresses from a witness
service...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:ctdbd_conn: split out ctdbd_control_get_nodemap()
Stefan Metzmacher [Fri, 11 Aug 2023 09:51:04 +0000 (11:51 +0200)]
s3:ctdbd_conn: split out ctdbd_control_get_nodemap()

This will simplify future changes...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agos3:ctdbd_conn: pass vnn to ctdbd_control_get_public_ips()
Stefan Metzmacher [Fri, 11 Aug 2023 09:30:07 +0000 (11:30 +0200)]
s3:ctdbd_conn: pass vnn to ctdbd_control_get_public_ips()

In future we also want to ask other nodes for their public_ips.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agowitness.idl: make witness_interfaceList public to that ndr_print works in python
Stefan Metzmacher [Fri, 12 Jan 2024 15:54:32 +0000 (16:54 +0100)]
witness.idl: make witness_interfaceList public to that ndr_print works in python

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agosmbstatus: let --json include session.{creation,expiration,auth}_time
Stefan Metzmacher [Tue, 9 Jan 2024 15:46:06 +0000 (16:46 +0100)]
smbstatus: let --json include session.{creation,expiration,auth}_time

This is very useful in order to predict NETWORK_SESSION_EXPIRED
messages...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
3 months agovfs_ceph: Implement SMB_VFS_FSTATAT
Anoop C S [Tue, 9 Jan 2024 05:41:40 +0000 (11:11 +0530)]
vfs_ceph: Implement SMB_VFS_FSTATAT

Signed-off-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 Jan 26 16:56:59 UTC 2024 on atb-devel-224

3 months agosource3/wscript: Announce deprecation of old Ceph version support
Anoop C S [Thu, 25 Jan 2024 17:26:26 +0000 (22:56 +0530)]
source3/wscript: Announce deprecation of old Ceph version support

*at() variants for various libcephfs APIs were added with Ceph v17.x.
Any other version less than v17.x is soon to be considered EOL[1] which
we will now indicate with the help of a warning message during configure
time. Going further such a situation will result in disabling the module
altogether with the next major Samba version after v4.20.

[1] https://docs.ceph.com/en/latest/releases/#ceph-releases-index

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
3 months agovfs_ceph: Indicate a successful connection in logs
Anoop C S [Fri, 5 Jan 2024 07:15:14 +0000 (12:45 +0530)]
vfs_ceph: Indicate a successful connection in logs

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
3 months agovfs_ceph: Fix a usage in comments
Anoop C S [Mon, 18 Dec 2023 15:57:44 +0000 (21:27 +0530)]
vfs_ceph: Fix a usage in comments

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
3 months agoWHATSNEW: Add entry for new save/restore options for smbcacls
Noel Power [Tue, 9 Jan 2024 11:02:28 +0000 (11:02 +0000)]
WHATSNEW: Add entry for new save/restore options for smbcacls

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Jan 26 11:30:07 UTC 2024 on atb-devel-224

3 months agoWHATSNEW: Add entry for wspsearch client utility
Noel Power [Mon, 8 Jan 2024 17:01:26 +0000 (17:01 +0000)]
WHATSNEW: Add entry for wspsearch client utility

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 months agos3: Make build of wspsearch client enabled by default
Noel Power [Mon, 8 Jan 2024 16:45:16 +0000 (16:45 +0000)]
s3: Make build of wspsearch client enabled by default

Although wspsearch client is experimental it is probably better to
enable its building by default so it gets has some opportunity to be
used/tested by users.

Signed-off-by: Noel Power <noel.power@suse.com>
3 months agoRevert "vfs_acl_xattr.c: prefer capabilities over become_root"
Anoop C S [Wed, 24 Jan 2024 09:36:53 +0000 (15:06 +0530)]
Revert "vfs_acl_xattr.c: prefer capabilities over become_root"

This reverts commit 0e3836e3961f2b7c39173ce1023d3c92addef630.

With capabilities preferred over become_root() we failed to achieve
the basic goal of storing NT ACLs in xattrs using vfs_acl_xattr. This
is due to the fact that apart from CAP_DAC_OVERRIDE it is manadatory
to have CAP_SYS_ADMIN for write access to xattrs from security
namespace[1]. Despite the option to configure the xattr name within
the module we should not anticipate and miss to consider xattrs from
security namespace which is far more protected even with our default
name "security.NTACL".

Theorotically we could make it work by adding another capability on
top of existing ones. But given the functions designed around this
area we may not be able to come up with a cleaner change which can
handle the fallback mechanism to become_root(). Any failure to set
the very first capability would put us in become_root() path where
further capabilities are mostly not required. Thus reverting to old
behaviour to always become_root() until we have a cleaner approach
to handle the fallback while modifying multiple capabilities at once.

[1] https://www.man7.org/linux/man-pages/man7/xattr.7.html

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 months agosmbd: Some README.Coding in smbd_do_qfilepathinfo()
Volker Lendecke [Wed, 3 Jan 2024 09:34:42 +0000 (10:34 +0100)]
smbd: Some README.Coding in smbd_do_qfilepathinfo()

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): Wed Jan 24 00:35:33 UTC 2024 on atb-devel-224

3 months agosamr_server: Modernize a DBG statement
Volker Lendecke [Mon, 18 Dec 2023 21:03:07 +0000 (22:03 +0100)]
samr_server: Modernize a DBG statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 months agosamr_server: Avoid a DEBUGADD()
Volker Lendecke [Mon, 18 Dec 2023 21:00:26 +0000 (22:00 +0100)]
samr_server: Avoid a DEBUGADD()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 months agolib: Simplify grant_privilege_bitmap()
Volker Lendecke [Mon, 18 Dec 2023 20:40:46 +0000 (21:40 +0100)]
lib: Simplify grant_privilege_bitmap()

ZERO_STRUCT on a uint64_t doesn't really make sense...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 months agolib: Modernize (and fix) a DBG statement
Volker Lendecke [Mon, 18 Dec 2023 20:39:47 +0000 (21:39 +0100)]
lib: Modernize (and fix) a DBG statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 months agolibsmb: Fix whitespace and a typo
Volker Lendecke [Mon, 18 Dec 2023 20:13:56 +0000 (21:13 +0100)]
libsmb: Fix whitespace and a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 months agolib: Avoid 70k of r/w memory
Volker Lendecke [Mon, 22 Jan 2024 20:21:54 +0000 (21:21 +0100)]
lib: Avoid 70k of r/w memory

This adds more .text than it strips .data, but .text is shared between
all processes, .data is copied.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 months agolib: Simplify hresult.c
Volker Lendecke [Mon, 22 Jan 2024 19:57:31 +0000 (20:57 +0100)]
lib: Simplify hresult.c

Functions don't need a ; at the end.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 months agos3:passdb: Fix memory leak caused by recursion of get_global_sam_sid()
Andreas Schneider [Tue, 23 Jan 2024 10:07:19 +0000 (11:07 +0100)]
s3:passdb: Fix memory leak caused by recursion of get_global_sam_sid()

Direct leak of 68 byte(s) in 1 object(s) allocated from:
    #0 0x7f4f39cdc03f in malloc (/lib64/libasan.so.8+0xdc03f) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
    #1 0x7f4f36fbe427 in malloc_ ../../source3/lib/util_malloc.c:38
    #2 0x7f4f394b5e19 in pdb_generate_sam_sid ../../source3/passdb/machine_sid.c:90
    #3 0x7f4f394b5e19 in get_global_sam_sid ../../source3/passdb/machine_sid.c:211
    #4 0x7f4f394af366 in secrets_store_domain_sid ../../source3/passdb/machine_account_secrets.c:143
    #5 0x7f4f394b5eb5 in pdb_generate_sam_sid ../../source3/passdb/machine_sid.c:110
    #6 0x7f4f394b5eb5 in get_global_sam_sid ../../source3/passdb/machine_sid.c:211
    #7 0x7f4f394af366 in secrets_store_domain_sid ../../source3/passdb/machine_account_secrets.c:143
    #8 0x557a1f11d62c in net_setlocalsid ../../source3/utils/net.c:416
    #9 0x557a1f1c9972 in net_run_function ../../source3/utils/net_util.c:464
    #10 0x557a1f121129 in main ../../source3/utils/net.c:1372
    #11 0x7f4f34c281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jan 23 14:30:58 UTC 2024 on atb-devel-224

3 months agos3:libads: Fix memory leaks in ads_create_machine_acct()
Andreas Schneider [Tue, 31 Oct 2023 13:04:31 +0000 (14:04 +0100)]
s3:libads: Fix memory leaks in ads_create_machine_acct()

Indirect leak of 291 byte(s) in 2 object(s) allocated from:
    #0 0x7fd77b6dc03f in malloc (/lib64/libasan.so.8+0xdc03f) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
    #1 0x7fd77b094bc2 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7fd77b096034 in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7fd77b096034 in __talloc_strlendup ../../lib/talloc/talloc.c:2454
    #4 0x7fd77b096034 in talloc_strdup ../../lib/talloc/talloc.c:2470
    #5 0x7fd779996633 in add_string_to_array ../../lib/util/util_strlist.c:504
    #6 0x7fd77b10c754 in ads_create_machine_acct ../../source3/libads/ldap.c:2662
    #7 0x7fd77b46705f in libnet_join_precreate_machine_acct ../../source3/libnet/libnet_join.c:390
    #8 0x7fd77b46705f in libnet_DomainJoin ../../source3/libnet/libnet_join.c:2852
    #9 0x7fd77b46705f in libnet_Join ../../source3/libnet/libnet_join.c:3036
    #10 0x55fb9788d91a in net_ads_join ../../source3/utils/net_ads.c:1853
    #11 0x55fb9793ab86 in net_join ../../source3/utils/net_join.c:45
    #12 0x55fb9793084f in net_run_function ../../source3/utils/net_util.c:454
    #13 0x55fb97889859 in main ../../source3/utils/net.c:1372
    #14 0x7fd7768281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 months agos3:passdb: Do not leak memory in pdb_tdb
Andreas Schneider [Fri, 27 Oct 2023 10:09:53 +0000 (12:09 +0200)]
s3:passdb: Do not leak memory in pdb_tdb

==19938==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 77 byte(s) in 1 object(s) allocated from:
    #0 0x7f7d482841f8 in strdup (/lib64/libasan.so.8+0x841f8) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
    #1 0x7f7d47204846  (bin/shared/libsamba-util.so.0+0x4c846) (BuildId: 43b084eb9013442ac68eb1fc17649f142cbb0f94)
    #2 0x7f7d40b1d97a in pdb_init_tdbsam ../../source3/passdb/pdb_tdb.c:1361
    #3 0x7f7d4715f266  (bin/shared/libsamba-passdb.so.0+0x76266) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
    #4 0x7f7d4715f57a  (bin/shared/libsamba-passdb.so.0+0x7657a) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
    #5 0x7f7d47163700  (bin/shared/libsamba-passdb.so.0+0x7a700) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
    #6 0x55a9177d3853 in main ../../source3/smbd/server.c:1928
    #7 0x7f7d434281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 months agogp: Skip site GP list if no site is found
David Mulder [Fri, 5 Jan 2024 15:47:07 +0000 (08:47 -0700)]
gp: Skip site GP list if no site is found

[MS-GPOL] 3.2.5.1.4 Site Search says if the site
search returns ERROR_NO_SITENAME, the GP site
search should be skipped.

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

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jan 23 11:20:35 UTC 2024 on atb-devel-224

3 months agogpo: Do not get templates list on first run
Gabriel Nagy [Fri, 19 Jan 2024 09:36:19 +0000 (11:36 +0200)]
gpo: Do not get templates list on first run

This is a visual fix and has no impact on functionality apart from
cleaner log messages.

The point of this is to get the list of supported templates in order to
compute a diff between the current applied templates and the updated
list, so we are able to unapply and reapply the policy in case there are
differences.

However this code path is executed on first applies as well, at which
point the root CA is not yet set up. This causes the
`get_supported_templates` call to fail, which is not a hard failure but
still pollutes the logs. In this case it's safe to avoid executing the
command as the policy will be applied regardless.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 22 16:48:57 UTC 2024 on atb-devel-224

3 months agogpo: Decode base64 root cert before importing
Gabriel Nagy [Thu, 18 Jan 2024 18:23:24 +0000 (20:23 +0200)]
gpo: Decode base64 root cert before importing

The reasoning behind this is described in the previous commit message,
but essentially this should either be wrapped in certificate blocks and
imported as PEM, or converted back to binary and imported as DER.

I've opted for the latter since it's how it used to work before it
regressed in 157335ee93e.

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

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 months agogpo: Test certificate policy without NDES
Gabriel Nagy [Mon, 8 Jan 2024 16:05:08 +0000 (18:05 +0200)]
gpo: Test certificate policy without NDES

As of 8231eaf856b, the NDES feature is no longer required on Windows, as
cert auto-enroll can use the certificate from the LDAP request.

However, 157335ee93e changed the implementation to convert the LDAP
certificate to base64 due to it failing to cleanly convert to a string.

Because of insufficient test coverage I missed handling the part where
NDES is disabled or not reachable and the LDAP certificate was imported.
The call to load_der_x509_certificate now fails with an error because it
expects binary data, yet it receives a base64 encoded string.

This adds a test to confirm the issue.

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

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>