asn/samba-autobuild/.git
3 days agopython/tests: Fix nlink test in smb3unix on btrfs filesystem master
Pavel Filipenský [Mon, 13 May 2024 10:13:38 +0000 (12:13 +0200)]
python/tests: Fix nlink test in smb3unix on btrfs filesystem

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 days agoRestore empty string default for conf.env['icu-libs']
Earl Chew [Sat, 11 May 2024 02:46:28 +0000 (19:46 -0700)]
Restore empty string default for conf.env['icu-libs']

The reworked ICU libraries configuration code used [] as
default for conf.env['icu-libs']. This breaks dependency analysis
in samba_deps.py because SAMBA_SUBSYSTEM() expects deps to be
a string.

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 days agolib/replace: make sure krb5_cc_default[_name]() is no longer used directly
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
lib/replace: make sure krb5_cc_default[_name]() is no longer used directly

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 14 11:22:28 UTC 2024 on atb-devel-224

3 days agoauth/credentials_krb5: let cli_credentials_set_ccache() use smb_force_krb5_cc_default()
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
auth/credentials_krb5: let cli_credentials_set_ccache() use smb_force_krb5_cc_default()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agoauth/credentials_krb5: use system/{gssapi,kerberos}.h
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
auth/credentials_krb5: use system/{gssapi,kerberos}.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agosmbspool: let kerberos_ccache_is_valid() use smb_force_krb5_cc_default_name()
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
smbspool: let kerberos_ccache_is_valid() use smb_force_krb5_cc_default_name()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agosmbspool_krb5_wrapper: let kerberos_get_default_ccache() use smb_force_krb5_cc_defaul...
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
smbspool_krb5_wrapper: let kerberos_get_default_ccache() use smb_force_krb5_cc_default_name()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agosmbspool_krb5_wrapper: remove unused includes
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
smbspool_krb5_wrapper: remove unused includes

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agokrb5_wrap: let smb_krb5_renew_ticket() use smb_force_krb5_cc_default_name()
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
krb5_wrap: let smb_krb5_renew_ticket() use smb_force_krb5_cc_default_name()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agokrb5_wrap: add smb_force_krb5_cc_default[_name]() wrappers
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
krb5_wrap: add smb_force_krb5_cc_default[_name]() wrappers

If we touch the global krb5_ccache we want to make that explicit,
so calling krb5_cc_default[_name] will result in an error during
the next patches.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: let kerberos_kinit_password_ext() require an explicit krb5 ccache
Stefan Metzmacher [Mon, 11 Mar 2024 16:46:45 +0000 (17:46 +0100)]
s3:libads: let kerberos_kinit_password_ext() require an explicit krb5 ccache

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agokrb5_wrap: let ads_krb5_cli_get_ticket() require an explicit krb5 ccache
Stefan Metzmacher [Mon, 11 Mar 2024 16:46:45 +0000 (17:46 +0100)]
krb5_wrap: let ads_krb5_cli_get_ticket() require an explicit krb5 ccache

Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 days agos3:libads: finally remove unused ads_connect[_user_creds]() and related code
Stefan Metzmacher [Tue, 5 Mar 2024 16:55:14 +0000 (17:55 +0100)]
s3:libads: finally remove unused ads_connect[_user_creds]() and related code

That was a long way, but now we're cli_credentials/gensec only :-)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net: finally remove net_context->opt_{user_specified,user_name,password}
Stefan Metzmacher [Thu, 7 Mar 2024 13:56:45 +0000 (14:56 +0100)]
s3:net: finally remove net_context->opt_{user_specified,user_name,password}

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net: remove unused net_context->smb_encrypt
Stefan Metzmacher [Thu, 7 Mar 2024 12:50:39 +0000 (13:50 +0100)]
s3:net: remove unused net_context->smb_encrypt

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net: remove unused net_context->opt_kerberos
Stefan Metzmacher [Thu, 7 Mar 2024 12:44:53 +0000 (13:44 +0100)]
s3:net: remove unused net_context->opt_kerberos

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:include: remove unused krb5_env.h
Stefan Metzmacher [Thu, 7 Mar 2024 12:27:06 +0000 (13:27 +0100)]
s3:include: remove unused krb5_env.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_ads: remove unused use_in_memory_ccache()
Stefan Metzmacher [Thu, 7 Mar 2024 11:08:00 +0000 (12:08 +0100)]
s3:net_ads: remove unused use_in_memory_ccache()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_ads: make use of ads_connect_{cldap_only,creds}() in ads_startup_int()
Stefan Metzmacher [Thu, 29 Feb 2024 13:07:05 +0000 (14:07 +0100)]
s3:net_ads: make use of ads_connect_{cldap_only,creds}() in ads_startup_int()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: let ads_krb5_set_password() require an explicit krb5 ccache to operate on
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:libads: let ads_krb5_set_password() require an explicit krb5 ccache to operate on

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: kerberos_set_password() don't need to kinit before ads_krb5_chg_password()
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:libads: kerberos_set_password() don't need to kinit before ads_krb5_chg_password()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: remove unused kdc_host and time_offset arguments to kerberos_set_password()
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:libads: remove unused kdc_host and time_offset arguments to kerberos_set_password()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: remove unused kdc_host and time_offset arguments to ads_krb5_chg_password()
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:libads: remove unused kdc_host and time_offset arguments to ads_krb5_chg_password()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: remove krb5_set_real_time() from ads_krb5_set_password()
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:libads: remove krb5_set_real_time() from ads_krb5_set_password()

Callers typically only pass in 0 anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: remove unused kdc_host argument of ads_krb5_set_password()
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:libads: remove unused kdc_host argument of ads_krb5_set_password()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_ads: require kerberos if we use ads_krb5_set_password() in ads_user_add()
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:net_ads: require kerberos if we use ads_krb5_set_password() in ads_user_add()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_ads: use ADS_SASL_SEAL by default, so that we always get encryption
Stefan Metzmacher [Mon, 11 Mar 2024 16:45:43 +0000 (17:45 +0100)]
s3:net_ads: use ADS_SASL_SEAL by default, so that we always get encryption

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_ads: use cli_credentials_get_principal() in order to call kerberos functions
Stefan Metzmacher [Thu, 7 Mar 2024 13:55:09 +0000 (14:55 +0100)]
s3:net_ads: use cli_credentials_get_principal() in order to call kerberos functions

This is better than the value from cli_credentials_get_username()...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net: remove useless net_prompt_pass() wrapper
Stefan Metzmacher [Thu, 7 Mar 2024 13:54:18 +0000 (14:54 +0100)]
s3:net: remove useless net_prompt_pass() wrapper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_rpc: make use of !c->explicit_credentials for NET_FLAGS_ANONYMOUS
Stefan Metzmacher [Thu, 7 Mar 2024 12:43:13 +0000 (13:43 +0100)]
s3:net_rpc: make use of !c->explicit_credentials for NET_FLAGS_ANONYMOUS

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net: make use of c->explicit_credentials in order to check for valid credentials
Stefan Metzmacher [Thu, 7 Mar 2024 13:47:06 +0000 (14:47 +0100)]
s3:net: make use of c->explicit_credentials in order to check for valid credentials

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net: add net_context->explicit_credentials to check if credentials were passed
Stefan Metzmacher [Thu, 7 Mar 2024 13:40:10 +0000 (14:40 +0100)]
s3:net: add net_context->explicit_credentials to check if credentials were passed

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net: correctly implement --use-ccache as legacy for --use-winbind-ccache for ...
Stefan Metzmacher [Thu, 7 Mar 2024 12:50:39 +0000 (13:50 +0100)]
s3:net: correctly implement --use-ccache as legacy for --use-winbind-ccache for 'net'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_offlinejoin: we don't need to call libnetapi_set_use_kerberos() as we already...
Stefan Metzmacher [Thu, 7 Mar 2024 12:41:51 +0000 (13:41 +0100)]
s3:net_offlinejoin: we don't need to call libnetapi_set_use_kerberos() as we already passed cli_credentials

c->opt_kerberos is derived from c->creds...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libnet_join: pass down cli_credentials *admin_credentials to libnet_{Join,Unjoin...
Stefan Metzmacher [Thu, 28 Apr 2022 15:59:00 +0000 (17:59 +0200)]
s3:libnet_join: pass down cli_credentials *admin_credentials to libnet_{Join,Unjoin}Ctx()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:lib/netapi: make use of ads_simple_creds/libnetapi_get_creds in NetGetJoinableOUs_l
Stefan Metzmacher [Tue, 5 Mar 2024 16:40:48 +0000 (17:40 +0100)]
s3:lib/netapi: make use of ads_simple_creds/libnetapi_get_creds in NetGetJoinableOUs_l

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:lib/netapi: add libnetapi_get_creds()
Stefan Metzmacher [Tue, 5 Mar 2024 16:38:25 +0000 (17:38 +0100)]
s3:lib/netapi: add libnetapi_get_creds()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agolibgpo/pygpo: make use of ads_connect_{creds,machine}()
Stefan Metzmacher [Tue, 5 Mar 2024 16:21:02 +0000 (17:21 +0100)]
libgpo/pygpo: make use of ads_connect_{creds,machine}()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:printing: make use of ads_connect_machine()
Stefan Metzmacher [Thu, 28 Apr 2022 16:58:27 +0000 (18:58 +0200)]
s3:printing: make use of ads_connect_machine()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: make use of ads_connect_simple_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_simple_anon() in ldap.c where possible

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: add ads_connect_simple_anon() helper
Stefan Metzmacher [Thu, 28 Apr 2022 16:38:17 +0000 (18:38 +0200)]
s3:libads: add ads_connect_simple_anon() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agolib/addns: rewrite signed dns update code to use gensec instead of plain gssapi
Stefan Metzmacher [Thu, 7 Mar 2024 11:03:05 +0000 (12:03 +0100)]
lib/addns: rewrite signed dns update code to use gensec instead of plain gssapi

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:utils: let net_update_dns_internal() set status before goto done in all cases
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
s3:utils: let net_update_dns_internal() set status before goto done in all cases

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:winbindd: make use of winbindd_get_trust_credentials() in idmap_ad.c
Stefan Metzmacher [Tue, 27 Feb 2024 08:59:09 +0000 (09:59 +0100)]
s3:winbindd: make use of winbindd_get_trust_credentials() in idmap_ad.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:winbindd: make use of winbindd_get_trust_credentials() in _winbind_LogonControl_TC...
Stefan Metzmacher [Tue, 27 Feb 2024 08:53:04 +0000 (09:53 +0100)]
s3:winbindd: make use of winbindd_get_trust_credentials() in _winbind_LogonControl_TC_VERIFY()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: add ads_connect_creds() helper
Stefan Metzmacher [Wed, 27 Apr 2022 11:11:26 +0000 (13:11 +0200)]
s3:libads: add ads_connect_creds() helper

In future ads_connect_creds() will be used by callers directly instead
of using ads_connect().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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

For now we still do the ads_kinit_password() in ads_legacy_creds()
for callers that rely on the global krb5ccache to be filled.

E.g. the dns update code and the kpasswd code.

But at least ads_connect_internal() and ads_sasl_spnego_bind()
will allow to do the kinit in the gensec layer only if needed...

We'll remove ads_legacy_creds() during the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agotestprogs/blackbox: add better testnames in test_weak_disable_ntlmssp_ldap.sh
Stefan Metzmacher [Wed, 13 Mar 2024 15:53:44 +0000 (16:53 +0100)]
testprogs/blackbox: add better testnames in test_weak_disable_ntlmssp_ldap.sh

This makes it easier to adjust the expected output when it changes in
the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_ads: make use of ads_connect_cldap_only() and ADS_AUTH_GENERATE_KRB5_CONFIG...
Stefan Metzmacher [Thu, 29 Feb 2024 13:08:55 +0000 (14:08 +0100)]
s3:net_ads: make use of ads_connect_cldap_only() and ADS_AUTH_GENERATE_KRB5_CONFIG in net_ads_password()

We don't need a real ldap connection here.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:winbindd: make use of ads_connect_cldap_only() in dcip_check_name_ads()
Stefan Metzmacher [Tue, 5 Mar 2024 16:48:34 +0000 (17:48 +0100)]
s3:winbindd: make use of ads_connect_cldap_only() in dcip_check_name_ads()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:net_ads: make use of ads_connect_cldap_only() in net_ads_check_int()
Stefan Metzmacher [Tue, 5 Mar 2024 16:47:37 +0000 (17:47 +0100)]
s3:net_ads: make use of ads_connect_cldap_only() in net_ads_check_int()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libsmb: make use of ads_connect_cldap_only()
Stefan Metzmacher [Tue, 5 Mar 2024 16:46:10 +0000 (17:46 +0100)]
s3:libsmb: make use of ads_connect_cldap_only()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: also avoid ADS_AUTH_GENERATE_KRB5_CONFIG for ADS_AUTH_ANON_BIND
Stefan Metzmacher [Thu, 7 Mar 2024 08:56:00 +0000 (09:56 +0100)]
s3:libads: also avoid ADS_AUTH_GENERATE_KRB5_CONFIG for ADS_AUTH_ANON_BIND

For anonymous binds we don't need a krb5.conf.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: add ADS_AUTH_GENERATE_KRB5_CONFIG to generate a custom krb5.conf
Stefan Metzmacher [Thu, 7 Mar 2024 08:56:00 +0000 (09:56 +0100)]
s3:libads: add ADS_AUTH_GENERATE_KRB5_CONFIG to generate a custom krb5.conf

That's better then using !ADS_AUTH_NO_BIND. And it allows callers
to be more flexible in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: split out ads_connect_internal() 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_internal() and call it with ads_legacy_creds()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: remove unused LIBADS_CCACHE_NAME define
Stefan Metzmacher [Wed, 28 Feb 2024 16:31:23 +0000 (17:31 +0100)]
s3:libads: remove unused LIBADS_CCACHE_NAME define

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:gse: Pass down the mech to gse_context_init()
Andreas Schneider [Fri, 26 Apr 2024 08:49:33 +0000 (10:49 +0200)]
s3:gse: Pass down the mech to gse_context_init()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 days agos3:gse: Implement gensec_gse_security_by_oid()
Andreas Schneider [Thu, 25 Apr 2024 13:51:40 +0000 (15:51 +0200)]
s3:gse: Implement gensec_gse_security_by_oid()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 days agos3:gse: Use smb_gss_mech_import_cred() in gse_init_server()
Andreas Schneider [Fri, 26 Apr 2024 08:54:47 +0000 (10:54 +0200)]
s3:gse: Use smb_gss_mech_import_cred() in gse_init_server()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 days agolib:krb5_wrap: Implement smb_gss_mech_import_cred()
Andreas Schneider [Fri, 26 Apr 2024 08:40:13 +0000 (10:40 +0200)]
lib:krb5_wrap: Implement smb_gss_mech_import_cred()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 days agos3:libsmb: fix lpcfg_gensec_settings() no memory check in auth_generic_client_prepare()
Stefan Metzmacher [Tue, 12 Mar 2024 10:51:25 +0000 (11:51 +0100)]
s3:libsmb: fix lpcfg_gensec_settings() no memory check in auth_generic_client_prepare()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agotests/ntlm_auth: Do not set a client_password
Stefan Metzmacher [Wed, 13 Mar 2024 09:49:55 +0000 (10:49 +0100)]
tests/ntlm_auth: Do not set a client_password

This fixes test_ntlmssp_gss_spnego_cached_creds

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days 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>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agoblackbox/test_kinit.sh: verify that --use-krb5-ccache= works without KRB5CCNAME
Stefan Metzmacher [Fri, 8 Mar 2024 11:57:06 +0000 (12:57 +0100)]
blackbox/test_kinit.sh: verify that --use-krb5-ccache= works without KRB5CCNAME

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:libads: don't allow ads_kdestroy(NULL) anymore
Stefan Metzmacher [Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)]
s3:libads: don't allow ads_kdestroy(NULL) anymore

This should not happen, if we ever need that behaviour
we should add an ads_kdestroy_default() helper.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 days agos3:winbindd: don't use ads_kdestroy(NULL) in winbindd_raw_kerberos_login()
Stefan Metzmacher [Tue, 14 May 2024 07:02:07 +0000 (09:02 +0200)]
s3:winbindd: don't use ads_kdestroy(NULL) in winbindd_raw_kerberos_login()

This fixes a problem introduced in the commit:

commit e6c693b705686a590d2fa8f434ff015d8926a349
Author: Stefan Metzmacher <metze@samba.org>
Date:   Wed Feb 28 17:28:43 2024 +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().

    ...

Before that commit cc was never NULL as generate_krb5_ccache()
returned "MEMORY:winbindd_pam_ccache" as fallback.

So we called ads_kdestroy("MEMORY:winbindd_pam_ccache").

Now we have cc == NULL if user_ccache_file == NULL.

and kerberos_return_pac() uses smb_krb5_cc_new_unique_memory()
and krb5_cc_destroy() internally.

It means unless user_ccache_file != NULL we should not
call ads_kdestroy(cc) as cc is NULL and means we would destroy
any global default krb5 ccache.

Review with: git show -U25

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 days 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>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 10 01:35:18 UTC 2024 on atb-devel-224

7 days agoCombine ICU libraries icu-i18n and icu-uc into a single dependency
Earl Chew [Sat, 16 Dec 2023 16:48:36 +0000 (08:48 -0800)]
Combine ICU libraries icu-i18n and icu-uc into a single dependency

Rather than probing for icu-i18n, icu-uc, and icudata libraries
separately, only probe for icu-i18n, and icu-uc, as direct dependencies
This avoids overlinking with icudata, and allows the package
to build even when ICU is not installed as a system library.

RN: Only use icu-i18n and icu-uc to express ICU dependency

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

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 days agoImprove CHECK_LIB interaction with CHECK_PKG
Earl Chew [Sun, 17 Dec 2023 01:47:09 +0000 (17:47 -0800)]
Improve CHECK_LIB interaction with CHECK_PKG

When checking for shared libraries, only name the target library
if it was not previously discoverd by pkg-config --libs and now
available from uselib_store. This avoids using both sources of
information which results in the library being named twice on
the command line.

Once the library is confirmed by CHECK_LIB, append the library if
not already present, to avoid dropping libraries that were
previously discovered by CHECK_PKG.

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

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 days agoAugment library_flags() to return libraries
Earl Chew [Sun, 17 Dec 2023 16:37:33 +0000 (08:37 -0800)]
Augment library_flags() to return libraries

Extend library_flags() to return the libraries provided by
pkg-config --libs.

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

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 days agoselftest: add test for User.get_primary_group method
Rob van der Linde [Tue, 30 Apr 2024 11:54:13 +0000 (23:54 +1200)]
selftest: add test for User.get_primary_group method

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 days agopython: models: add get_primary_group method to User model
Rob van der Linde [Tue, 30 Apr 2024 11:43:30 +0000 (23:43 +1200)]
python: models: add get_primary_group method to User model

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 days agopython: models: rename argument ldb to samdb
Rob van der Linde [Tue, 30 Apr 2024 11:42:05 +0000 (23:42 +1200)]
python: models: rename argument ldb to samdb

This argument is actually an instance of SamDB (which inherits from Ldb).

This should have been called samdb.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 days agotests/ntacls: unblock failing gitlab pipelines because test_setntacl_forcenative
Stefan Metzmacher [Wed, 8 May 2024 16:03:54 +0000 (18:03 +0200)]
tests/ntacls: unblock failing gitlab pipelines because test_setntacl_forcenative

This expects PermissionError: [Errno 1] Operation not permitted,
but it seems that setxattr() for security.NTACL works on gitlab
runners without being root.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 days ago.gitlab-ci-main.yml: debug kernel details of the current runner
Stefan Metzmacher [Wed, 8 May 2024 14:12:06 +0000 (16:12 +0200)]
.gitlab-ci-main.yml: debug kernel details of the current runner

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
9 days 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

9 days 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>
9 days 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>
9 days 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>