]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
14 months agos3:utils: Use talloc instead of malloc functions
Andreas Schneider [Thu, 6 Jun 2024 15:37:32 +0000 (17:37 +0200)] 
s3:utils: Use talloc instead of malloc functions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  6 21:32:53 UTC 2024 on atb-devel-224

14 months agos3:util: Use a talloc stackframe in rpc_trustdom_establish()
Andreas Schneider [Tue, 30 Apr 2024 07:55:15 +0000 (09:55 +0200)] 
s3:util: Use a talloc stackframe in rpc_trustdom_establish()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:utils: Use a destructor in rpc_trustdom_establish()
Andreas Schneider [Thu, 6 Jun 2024 15:31:10 +0000 (17:31 +0200)] 
s3:utils: Use a destructor in rpc_trustdom_establish()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:utils: Remove overwrite of opt_workgroup in rpc_trustdom_establish()
Andreas Schneider [Tue, 30 Apr 2024 07:46:33 +0000 (09:46 +0200)] 
s3:utils: Remove overwrite of opt_workgroup in  rpc_trustdom_establish()

This is not used anywhere in that functions or the functions we are
calling. It was replaced by command line cli credentials stored in
c->creds. This fixes a memory leak.

Direct leak of 12 byte(s) in 1 object(s) allocated from:
    #0 0x7f17fdaf5830 in strdup ../../../../libsanitizer/asan/asan_interceptors.cpp:578
    #1 0x7f17fc7e7339 in smb_xstrdup ../../lib/util/util.c:752
    #2 0x55f079bf0723 in rpc_trustdom_establish ../../source3/utils/net_rpc.c:6591
    #3 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464
    #4 0x55f079bdbecf in rpc_trustdom ../../source3/utils/net_rpc.c:7483
    #5 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464
    #6 0x55f079bfe7de in net_rpc ../../source3/utils/net_rpc.c:8413
    #7 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464
    #8 0x55f079baa0a8 in main ../../source3/utils/net.c:1436
    #9 0x7f17f8a2a1ef in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython: Add test for checking the SHA256SUM
Andreas Schneider [Thu, 6 Jun 2024 08:12:08 +0000 (10:12 +0200)] 
python: Add test for checking the SHA256SUM

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:netcmd: Create a SHA256SUM file with checksums
Andreas Schneider [Wed, 15 Feb 2023 07:10:03 +0000 (08:10 +0100)] 
python:netcmd: Create a SHA256SUM file with checksums

This allows to verify the backup tarball contents with:

  sha256sum -c SHA256SUM

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:netcmd: Only put regular files into the tarball
Andreas Schneider [Wed, 15 Feb 2023 07:05:42 +0000 (08:05 +0100)] 
python:netcmd: Only put regular files into the tarball

We also have ldapi, other sockets or pipes around, we don't want to
add. This will be relevant for adding checksums later.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:utils: DNS_UTIL depends on libads headers so we need to depend on 'ads'
Stefan Metzmacher [Thu, 6 Jun 2024 08:39:33 +0000 (10:39 +0200)] 
s3:utils: DNS_UTIL depends on libads headers so we need to depend on 'ads'

Otherwise we don't get the correct header include paths and krb5.h in
a non default location won't be found.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:libsmb: we no longer need libads/kerberos_proto.h in namequery.c
Stefan Metzmacher [Thu, 6 Jun 2024 08:38:48 +0000 (10:38 +0200)] 
s3:libsmb: we no longer need libads/kerberos_proto.h in namequery.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: no-op dns updates with ACCESS_DENIED should be ignored
Stefan Metzmacher [Thu, 30 May 2024 12:52:22 +0000 (14:52 +0200)] 
s4:dns_server: no-op dns updates with ACCESS_DENIED should be ignored

If the client does not have permissions to update the record,
but the record already has the data the update tries to apply,
it's a no-op that should result in success instead of failing.

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

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): Thu Jun  6 03:18:16 UTC 2024 on atb-devel-224

14 months agos4:dns_server: correctly sign dns update responses with gss-tsig like Windows
Stefan Metzmacher [Thu, 30 May 2024 12:39:28 +0000 (14:39 +0200)] 
s4:dns_server: correctly sign dns update responses with gss-tsig like Windows

This means we no longer generate strange errors/warnings
in the Windows event log nor in the nsupdate -g output.

Note: this is a only difference between gss-tsig and
the legacy gss.microsoft.com algorithms.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: dns_verify_tsig should return REFUSED on error
Stefan Metzmacher [Thu, 30 May 2024 12:42:53 +0000 (14:42 +0200)] 
s4:dns_server: dns_verify_tsig should return REFUSED on error

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: also search DNS_QTYPE_TKEY in the answers section if it's the last...
Stefan Metzmacher [Thu, 30 May 2024 12:41:21 +0000 (14:41 +0200)] 
s4:dns_server: also search DNS_QTYPE_TKEY in the answers section if it's the last section

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: use tkey->algorithm if available in dns_sign_tsig()
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: use tkey->algorithm if available in dns_sign_tsig()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: use the client provided algorithm for the fake TSIG structure
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: use the client provided algorithm for the fake TSIG structure

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: only allow gss-tsig and gss.microsoft.com for TSIG
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: only allow gss-tsig and gss.microsoft.com for TSIG

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: only allow gss-tsig and gss.microsoft.com for TKEY
Stefan Metzmacher [Fri, 31 May 2024 06:38:24 +0000 (08:38 +0200)] 
s4:dns_server: only allow gss-tsig and gss.microsoft.com for TKEY

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dns_server: failed dns updates should result in REFUSED for ACCESS_DENIED
Stefan Metzmacher [Fri, 31 May 2024 06:36:40 +0000 (08:36 +0200)] 
s4:dns_server: failed dns updates should result in REFUSED for ACCESS_DENIED

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: add test_update_tsig_record_access_denied()
Stefan Metzmacher [Wed, 29 May 2024 09:40:51 +0000 (11:40 +0200)] 
python:tests/dns_tkey: add test_update_tsig_record_access_denied()

This demonstrates that access_denied is only generated if the client
really generates a change in the database.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:selftest/tests: pass USERNAME_UNPRIV=$DOMAIN_USER to samba.tests.dns_tkey
Stefan Metzmacher [Wed, 29 May 2024 09:39:56 +0000 (11:39 +0200)] 
s4:selftest/tests: pass USERNAME_UNPRIV=$DOMAIN_USER to samba.tests.dns_tkey

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: add get_unpriv_creds() helper
Stefan Metzmacher [Wed, 29 May 2024 09:39:56 +0000 (11:39 +0200)] 
python:tests/dns_base: add get_unpriv_creds() helper

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: let test_update_tsig_windows() actually pass against windows...
Stefan Metzmacher [Wed, 29 May 2024 11:17:54 +0000 (13:17 +0200)] 
python:tests/dns_tkey: let test_update_tsig_windows() actually pass against windows 2022

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let verify_packet() work against Windows
Stefan Metzmacher [Wed, 29 May 2024 11:17:54 +0000 (13:17 +0200)] 
python:tests/dns_base: let verify_packet() work against Windows

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: test bad and changing tsig algorithms
Stefan Metzmacher [Wed, 29 May 2024 15:26:39 +0000 (17:26 +0200)] 
python:tests/dns_tkey: test bad and changing tsig algorithms

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: add gss.microsoft.com tsig updates
Stefan Metzmacher [Wed, 29 May 2024 15:18:34 +0000 (17:18 +0200)] 
python:tests/dns_tkey: add gss.microsoft.com tsig updates

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: let us have test_update_gss_tsig_tkey_req_{additional,answers}()
Stefan Metzmacher [Wed, 29 May 2024 12:15:45 +0000 (14:15 +0200)] 
python:tests/dns_tkey: let us have test_update_gss_tsig_tkey_req_{additional,answers}()

Also test using the additional record in the answers section.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: test TKEY with gss-tsig, gss.microsoft.com and invalid algorithms
Stefan Metzmacher [Wed, 29 May 2024 14:41:12 +0000 (16:41 +0200)] 
python:tests/dns_tkey: test TKEY with gss-tsig, gss.microsoft.com and invalid algorithms

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: maintain a dict with tkey related state
Stefan Metzmacher [Wed, 29 May 2024 12:10:52 +0000 (14:10 +0200)] 
python:tests/dns_base: maintain a dict with tkey related state

This will allow tests to backup the whole state
and mix them.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let dns_transaction_udp() take allow_{remaining,truncated...
Stefan Metzmacher [Wed, 29 May 2024 12:14:11 +0000 (14:14 +0200)] 
python:tests/dns_base: let dns_transaction_udp() take allow_{remaining,truncated}=True

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: pass tkey_trans(expected_rcode)
Stefan Metzmacher [Wed, 29 May 2024 14:07:53 +0000 (16:07 +0200)] 
python:tests/dns_base: pass tkey_trans(expected_rcode)

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let tkey_trans() take tkey_req_in_answers
Stefan Metzmacher [Wed, 29 May 2024 12:08:13 +0000 (14:08 +0200)] 
python:tests/dns_base: let tkey_trans() take tkey_req_in_answers

It's possible to put the additional into the answers section,
so we should be able to test that.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let tkey_trans() and sign_packet() take algorithm_name as...
Stefan Metzmacher [Wed, 29 May 2024 11:17:54 +0000 (13:17 +0200)] 
python:tests/dns_base: let tkey_trans() and sign_packet() take algorithm_name as argument

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_tkey: make use of self.assert_echoed_dns_error()
Stefan Metzmacher [Wed, 29 May 2024 11:35:58 +0000 (13:35 +0200)] 
python:tests/dns_tkey: make use of self.assert_echoed_dns_error()

Failed DNS updates just echo the request flaged as response,
all other elements are unchanged.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: add self.assert_echoed_dns_error()
Stefan Metzmacher [Wed, 29 May 2024 11:35:58 +0000 (13:35 +0200)] 
python:tests/dns_base: add self.assert_echoed_dns_error()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: let dns_transaction_tcp() handle short receives
Stefan Metzmacher [Fri, 31 May 2024 06:07:24 +0000 (08:07 +0200)] 
python:tests/dns_base: let dns_transaction_tcp() handle short receives

With socket_wrapper we only get 1500 byte chunks...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: use ndr_deepcopy() and ndr_pack() in verify_packet()
Stefan Metzmacher [Wed, 29 May 2024 11:16:40 +0000 (13:16 +0200)] 
python:tests/dns_base: use ndr_deepcopy() and ndr_pack() in verify_packet()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython:tests/dns_base: generate a real signature in bad_sign_packet()
Stefan Metzmacher [Wed, 29 May 2024 11:11:24 +0000 (13:11 +0200)] 
python:tests/dns_base: generate a real signature in bad_sign_packet()

We just destroy the signature bytes but keep the header unchanged.

This makes it easier to look at it in wireshark.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolib/addns: remove unused kerberos/gssapi includes in dns.h
Stefan Metzmacher [Wed, 5 Jun 2024 15:46:53 +0000 (17:46 +0200)] 
lib/addns: remove unused kerberos/gssapi includes in dns.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agobuild: Make "samba4" public libraries provided (mostly) for OpenChange private
Andrew Bartlett [Sun, 26 May 2024 21:24:13 +0000 (09:24 +1200)] 
build: Make "samba4" public libraries provided (mostly) for OpenChange private

These libraries, mostly with ABI versions of 0.0.1 were made public in
the early development of Samba4 and have not been seriously considered
since.  Most are to allow OpenChange to build.

While the OpenChange server is no longer actively used, the MAPI
client is used and we need to allow packages to be built that will
allow the Evolution MAPI client to still work.

Some appear to be mistakes (dcerpc-samr), historical abberations
(tevent-util) or ideas that did not go very far (the samba-policy
library for example).

To allow any remaining users to access them, they are not made private
in the build system but are instead listed so that they can be made
public again via ./configure with the same --private-libraries='!LIB'
syntax introduced to make ldb private by default.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun  5 21:47:24 UTC 2024 on atb-devel-224

14 months agobuild: Remove incorrect pyembed=True from samba-policy
Andrew Bartlett [Sun, 26 May 2024 19:28:33 +0000 (07:28 +1200)] 
build: Remove incorrect pyembed=True from samba-policy

This is a normal C library, used by python but does not use
any python itself (nor by dependencies any longer).

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
14 months agos4-libnet: Split up samba-net into samba-net and samba-net-join
Andrew Bartlett [Mon, 27 May 2024 07:44:38 +0000 (19:44 +1200)] 
s4-libnet: Split up samba-net into samba-net and samba-net-join

samba-net-join links to python and so needs the variable name
with the python ABI tag, while samba-net is a normal C library
and can be included in a package without python dependencies.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
14 months agotests/krb5: Calculate correct gMSA password to fix flapping test
Jo Sutton [Tue, 28 May 2024 04:59:30 +0000 (16:59 +1200)] 
tests/krb5: Calculate correct gMSA password to fix flapping test

If this test happens to be run in the five minute window prior to the
next ten‐hour GKDI interval — about once every one hundred and twenty
runs — the ‘current’ password requested from LDAP will actually be the
future password, which won’t match what’s in the database.

Instead of taking the password from LDAP, calculate it ourselves with
expected_gmsa_password_blob().

[330(7038)/334 at 43m51s] samba.tests.krb5.gmsa_tests(ad_dc:local)
UNEXPECTED(failure): samba.tests.krb5.gmsa_tests.samba.tests.krb5.gmsa_tests.GmsaTests.test_retrieving_managed_password_triggers_keys_update(ad_dc:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "/builds/samba-testbase/samba-def-build/bin/python/samba/tests/krb5/gmsa_tests.py", line 1091, in test_retrieving_managed_password_triggers_keys_update
    self.assertEqual(creds.get_nt_hash(), nt_hash)
AssertionError: b'\xcf[\xe8:\xc7-\xd4V\xce\t\xfc\xcd\x06.T\x8a' != b'c\xc5\x97k\x17"G\x1e\x81>\xacV\x9d.*\x14'

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jun  4 20:52:09 UTC 2024 on atb-devel-224

14 months agotests/krb5: Reset local database time in a cleaner (and nearly equivalent) fashion
Jo Sutton [Tue, 28 May 2024 04:53:22 +0000 (16:53 +1200)] 
tests/krb5: Reset local database time in a cleaner (and nearly equivalent) fashion

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos4:dsdb: Use talloc_get_type_abort()
Jo Sutton [Tue, 28 May 2024 02:24:51 +0000 (14:24 +1200)] 
s4:dsdb: Use talloc_get_type_abort()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotests/krb5: Make use of update_password() method
Jo Sutton [Mon, 27 May 2024 05:53:17 +0000 (17:53 +1200)] 
tests/krb5: Make use of update_password() method

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoldb: Fix typo
Jo Sutton [Fri, 12 Apr 2024 03:10:33 +0000 (15:10 +1200)] 
ldb: Fix typo

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:winbind: Fix idmap_ad creating an invalid local krb5.conf
Andreas Schneider [Tue, 28 May 2024 11:54:24 +0000 (13:54 +0200)] 
s3:winbind: Fix idmap_ad creating an invalid local krb5.conf

In case of a trusted domain, we are providing the realm of the primary
trust but specify the KDC IP of the trusted domain. This leads to
Kerberos ticket requests to the trusted domain KDC which doesn't know
about the machine account. However we need a ticket from our primary
trust KDC.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:libads: Do not fail if we don't get an IP passed down
Andreas Schneider [Tue, 28 May 2024 11:53:51 +0000 (13:53 +0200)] 
s3:libads: Do not fail if we don't get an IP passed down

The IP should be optional and we should look it up if not provided.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agos3:libads: Allow get_kdc_ip_string() to lookup the KDCs IP
Andreas Schneider [Tue, 28 May 2024 11:51:53 +0000 (13:51 +0200)] 
s3:libads: Allow get_kdc_ip_string() to lookup the KDCs IP

Remove the requirement to provide an IP address. We should look up the
IP of the KDC and use it for the specified realm/workgroup.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agosmbd: list reparse tag in QUERY_DIRECTORY
Volker Lendecke [Mon, 2 Jan 2023 15:35:16 +0000 (16:35 +0100)] 
smbd: list reparse tag in QUERY_DIRECTORY

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 Jun  4 17:39:21 UTC 2024 on atb-devel-224

14 months agotests: Check that query_directory lists the reparse tag
Volker Lendecke [Mon, 2 Jan 2023 15:01:28 +0000 (16:01 +0100)] 
tests: Check that query_directory lists the reparse tag

With the source3/ based clilist.c, we can't test all infolevels where
this matters (see callers of get_dirent_ea_size()). But porting the
source4 based all-infolevel search code into source3/libsmb or doing
this one the reparse point test in the source4 infrastructure to me
seems like a lot of effort for moderate gain.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
14 months agos3:rpc_server: Check query level according to MS-NRPC
Jo Sutton [Tue, 28 May 2024 03:12:36 +0000 (15:12 +1200)] 
s3:rpc_server: Check query level according to MS-NRPC

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Jun  4 09:39:42 UTC 2024 on atb-devel-224

14 months agos3:rpc_server: Check function code according to MS-NRPC
Jo Sutton [Tue, 28 May 2024 03:10:51 +0000 (15:10 +1200)] 
s3:rpc_server: Check function code according to MS-NRPC

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
14 months agos3/rpc_server: Fix dereference of client pointer
Noel Power [Mon, 25 Sep 2023 08:58:33 +0000 (09:58 +0100)] 
s3/rpc_server: Fix dereference of client pointer

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
14 months agos4/torture: Test with level 4 with NETLOGON_CONTROL_SET_DBFLAG function
Noel Power [Sun, 24 Sep 2023 00:03:37 +0000 (01:03 +0100)] 
s4/torture: Test with level 4 with NETLOGON_CONTROL_SET_DBFLAG function

Change levels tested from 1 - 3 to 1 - 4 for NETLOGON_CONTROL_SET_DBFLAG

This change triggers a core dump in the server and so we add a knownfail
here. Following commit will fix (and remove known fail)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agos4/torture: Prepare to handle Level 4 check with unknown func code
Noel Power [Mon, 25 Sep 2023 09:30:30 +0000 (10:30 +0100)] 
s4/torture: Prepare to handle Level 4 check with unknown func code

A future (next) commit will change the NETLOGON_CONTROL_SET_DBFLAG test
to use levels 1 - 4 (current test just tests 1 - 3). A side affect of
this test is that the following test will now test passing an unknown
function code against against Level 4 (previously level 3).

Unfortunately s4 and s3 netlogon server results differ when handling
a level 4 request with an unknown function code.
  s3 server returns WERR_NOT_SUPPORTED and
  s4 server returns WERR_INVALID_PARAMETER.

For level 3 both return WERR_NOT_SUPPORTED.

MS-NRPC doesn't seem to specifically indicate the required response in
this case.

this commit modifies the test to cater for either response (for either
level) A future commit could explore the test response combinations more
thorougly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15465
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agolib: Align an integer type
Volker Lendecke [Thu, 23 May 2024 14:13:58 +0000 (16:13 +0200)] 
lib: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jun  4 08:16:58 UTC 2024 on atb-devel-224

14 months agolib: Fix an error path memleak
Volker Lendecke [Thu, 23 May 2024 14:12:53 +0000 (16:12 +0200)] 
lib: Fix an error path memleak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolib: Use talloc_asprintf_addbufin _ber_read_OID_String_impl
Volker Lendecke [Thu, 23 May 2024 14:06:37 +0000 (16:06 +0200)] 
lib: Use talloc_asprintf_addbufin _ber_read_OID_String_impl

Just one NULL check required

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolib: Use unsigned long in ber_write_OID_String
Volker Lendecke [Thu, 23 May 2024 14:04:52 +0000 (16:04 +0200)] 
lib: Use unsigned long in ber_write_OID_String

This is what smb_strtoul returns, so use it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolib: gensec.h references NTTIME, add time.h
Volker Lendecke [Thu, 23 May 2024 13:48:55 +0000 (15:48 +0200)] 
lib: gensec.h references NTTIME, add time.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agowbclient: Fix a typo
Volker Lendecke [Fri, 24 May 2024 16:34:05 +0000 (18:34 +0200)] 
wbclient: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agowinbind: Modernize a few DEBUGs
Volker Lendecke [Fri, 24 May 2024 16:48:29 +0000 (18:48 +0200)] 
winbind: Modernize a few DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agosmbd: Fix whitespace
Volker Lendecke [Sat, 25 May 2024 10:17:46 +0000 (12:17 +0200)] 
smbd: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolibsmb: Use SMB2_0_INFO_SECURITY instead of raw "3"
Volker Lendecke [Sat, 25 May 2024 10:41:58 +0000 (12:41 +0200)] 
libsmb: Use SMB2_0_INFO_SECURITY instead of raw "3"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agogensec: Simplify gensec_security_by_fn()
Volker Lendecke [Wed, 29 May 2024 15:11:51 +0000 (17:11 +0200)] 
gensec: Simplify gensec_security_by_fn()

We don't need that intermediate talloc ctx, we only allocate backends
and don't pass it anywhere else.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agogensec: Filter out disabled mechs in gensec_security_mechs()
Volker Lendecke [Wed, 29 May 2024 15:08:26 +0000 (17:08 +0200)] 
gensec: Filter out disabled mechs in gensec_security_mechs()

Every single caller of gensec_security_mechs() had to manually filter
out disabled mechanisms. Don't offer them from the start.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agogensec: Refactor gensec_security_mechs()
Volker Lendecke [Tue, 28 May 2024 16:49:41 +0000 (18:49 +0200)] 
gensec: Refactor gensec_security_mechs()

The decision whether to offer a mechanism was split between
gensec_security_mechs() and gensec_use_kerberos_mechs() with two
booleans passed down. Consolidate that decision into one
gensec_offer_mech() function that queries all information on its own.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agogensec: Simplify gensec_security_by_*
Volker Lendecke [Tue, 28 May 2024 13:52:05 +0000 (15:52 +0200)] 
gensec: Simplify gensec_security_by_*

Centralize looping over all backends

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotorture: Remove some pointless local variables
Volker Lendecke [Tue, 28 May 2024 12:52:25 +0000 (14:52 +0200)] 
torture: Remove some pointless local variables

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolib: Use cli_credentials_add_gensec_features in a few places
Volker Lendecke [Tue, 28 May 2024 10:38:18 +0000 (12:38 +0200)] 
lib: Use cli_credentials_add_gensec_features in a few places

Capture a common pattern

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agocreds: Add cli_credentials_add_gensec_features
Volker Lendecke [Tue, 28 May 2024 10:32:58 +0000 (12:32 +0200)] 
creds: Add cli_credentials_add_gensec_features

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agolibsmb: Slightly simplify cli_session_creds_init
Volker Lendecke [Tue, 28 May 2024 10:23:35 +0000 (12:23 +0200)] 
libsmb: Slightly simplify cli_session_creds_init

In this case a nested if seems easier to understand to me than another
if-expression duplicating half of a previous one.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agovfs_ceph: Implement SMB_VFS_FSET_DOS_ATTRIBUTES for precise btime
Anoop C S [Fri, 17 May 2024 06:27:26 +0000 (11:57 +0530)] 
vfs_ceph: Implement SMB_VFS_FSET_DOS_ATTRIBUTES for precise btime

Previously we added an implementation for SMB_VFS_FGET_DOS_ATTRIBUTES
so that the btime is always preserved unless explicitly changed using
SMB_VFS_FNTIMES. But there are situations with open file handle where
btime stored on dos attributes as create_time has to be precise for
comparison because a one-to-one conversion between timepsec and nttime
is not always guaranteed.

Accordingly preserve btime via SMB_VFS_FSET_DOS_ATTRIBUTES so that we
always compare the exact btime from fsp stat information while the file
handle is still open.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Jun  3 11:10:11 UTC 2024 on atb-devel-224

14 months agovfs_ceph: Simplify SMB_VFS_FGET_DOS_ATTRIBUTES
Anoop C S [Sat, 18 May 2024 07:07:44 +0000 (12:37 +0530)] 
vfs_ceph: Simplify SMB_VFS_FGET_DOS_ATTRIBUTES

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
14 months agofuzzing: fix fuzz_stable_sort_r_unstable comparison
Douglas Bagnall [Thu, 23 May 2024 04:08:49 +0000 (16:08 +1200)] 
fuzzing: fix fuzz_stable_sort_r_unstable comparison

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69176

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri May 31 05:29:08 UTC 2024 on atb-devel-224

14 months agos3/torture: local_rbtree: avoid birthday collisions
Douglas Bagnall [Wed, 22 May 2024 00:15:37 +0000 (12:15 +1200)] 
s3/torture: local_rbtree: avoid birthday collisions

We insert 999 keys, but if two of them happen to be the same, we
don't find 1000 nodes, and that is upsetting for CI:

[130(1421)/303 at 4m46s] samba3.smbtorture_s3.LOCAL-RBTREE
UNEXPECTED(failure): samba3.smbtorture_s3.LOCAL-RBTREE.smbtorture(none)
REASON: Exception: Exception: using seed 1716333987
host=foo share=bar user= myname=runner-jlguopmm-project-6378020-concurrent-0
Running LOCAL-RBTREE
run_local_rbtree: read1: 999 999, NT_STATUS_OK
run_local_rbtree: delete: 999 999, NT_STATUS_OK
run_local_rbtree: read2: 0 0, NT_STATUS_OK
TEST LOCAL-RBTREE FAILED!
LOCAL-RBTREE took 0.002706 secs

This has been flapping very occasionally for a long time:
https://lists.samba.org/archive/samba-technical/2016-March/112861.html

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
14 months agoexamples:winexe: embed Samba version as exe timestamp
Douglas Bagnall [Wed, 29 May 2024 22:44:24 +0000 (10:44 +1200)] 
examples:winexe: embed Samba version as exe timestamp

It turns out the timestamp doesn't need to be real, and it isn't used,
but it might as well tell you something. So let's make it tell you what
version of Samba it came from, which could be useful for people who have
lots of old winexes lying around, the poor souls.

00000040  0e 1f ba 0e 00 b4 09 cd  21 b8 01 4c cd 21 54 68  |........!..L.!Th|
00000050  69 73 20 70 72 6f 67 72  61 6d 20 63 61 6e 6e 6f  |is program canno|
00000060  74 20 62 65 20 72 75 6e  20 69 6e 20 44 4f 53 20  |t be run in DOS |
00000070  6d 6f 64 65 2e 0d 0d 0a  24 00 00 00 00 00 00 00  |mode....$.......|
00000080  50 45 00 00 64 86 0a 00  00 15 04 00 00 00 00 00  |PE..d...........|
                                    |  |  |
                                    |  |  major  4.
                                    |  minor     21.
                                    release      0

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri May 31 01:28:06 UTC 2024 on atb-devel-224

14 months agoexamples:winexe: reproducible builds with zero timestamp
Douglas Bagnall [Mon, 27 May 2024 23:34:51 +0000 (11:34 +1200)] 
examples:winexe: reproducible builds with zero timestamp

Windows Portable Executable files have a timestamp field and a
checksum field. By default the timestamp field is updated to the
current time, which consequently changes the checksum. This makes the
build nondeterministic. It looks like this:

  --- a/tmp/winexe-1/winexesvc64_exe_binary.c
  +++ b/tmp/winexe-2/winexesvc64_exe_binary.c
  @@ -23,7 +23,7 @@ const DATA_BLOB *winexesvc64_exe_binary(void)
                0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0D, 0x0A,
                0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x50, 0x45, 0x00, 0x00, 0x64, 0x86, 0x0A, 0x00,
  -             0xB2, 0x16, 0x55, 0x66, 0x00, 0x00, 0x00, 0x00,
  +             0xD3, 0x3B, 0x55, 0x66, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x2E, 0x02,
                0x0B, 0x02, 0x02, 0x26, 0x00, 0x86, 0x00, 0x00,
                0x00, 0xBA, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00,
  @@ -33,7 +33,7 @@ const DATA_BLOB *winexesvc64_exe_binary(void)
                0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x40, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00,
  -             0x73, 0xD7, 0x00, 0x00, 0x03, 0x00, 0x60, 0x01,
  +             0x94, 0xFC, 0x00, 0x00, 0x03, 0x00, 0x60, 0x01,
                0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,

https://learn.microsoft.com/en-us/windows/win32/debug/pe-format says
that a timestamp of zero can be used to represent a time that is not
"real or meaningful", so we do that.

As far as I can tell, the timestamp and checksum are only used in
DLLs, not directly executed .exe files.

Thanks to Freexian and the Debian LTS project for sponsoring this work.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoexamples:winexe: more efficient C array generation, no py2
Douglas Bagnall [Mon, 27 May 2024 23:16:23 +0000 (11:16 +1200)] 
examples:winexe: more efficient C array generation, no py2

We don't need to recreate the src array every time, and we don't need
to worry about Python 2 strings.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agobuildtools:pidl: avoid hash randomisation in pidl
Douglas Bagnall [Tue, 28 May 2024 00:17:06 +0000 (12:17 +1200)] 
buildtools:pidl: avoid hash randomisation in pidl

Like many languages, Perl uses has randomisation to prevent nasty
users using crafted values that hash to the same number to effect a
denial of service. This means the traversal order of perl HASH tables
is different every time.

The IDL handed to pidl is trusted, so we don't really need
randomisation, but we do want to be sure the build is the same every
time.

I am not aware of hash randomisation causing problems, but it seems
prudent to avoid it.

We do a similar thing with PYTHONHASHSEED for the entire build.

Thanks to Freexian and the Debian LTS project for sponsoring this work.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopidl:python: Exception if unconvertable in ConvertObjectToPythonLevel
Douglas Bagnall [Wed, 29 May 2024 22:53:24 +0000 (10:53 +1200)] 
pidl:python: Exception if unconvertable in ConvertObjectToPythonLevel

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopidl:python: properly raise exception in ConvertObjectFromPythonData
Douglas Bagnall [Tue, 28 May 2024 04:32:14 +0000 (16:32 +1200)] 
pidl:python: properly raise exception in ConvertObjectFromPythonData

Without the `$self->pidl("$fail");`, the exception is not raised.

We also try to improve the Python message.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopidl:Typelist: resolveType(): don't mistake a reference for a name
Douglas Bagnall [Wed, 29 May 2024 00:14:04 +0000 (12:14 +1200)] 
pidl:Typelist: resolveType(): don't mistake a reference for a name

This function is only used by Python.pm, and was assuming any argument
unrecognised by hasType is a name. It sometimes isn't, resulting in
structures like this:

{
  'DATA' => {
      'TYPE' => 'STRUCT'
    },
  'NAME' => {
      'TYPE' => 'STRUCT',
      'ALIGN' => undef,
      'SURROUNDING_ELEMENT' => undef,
      'ORIGINAL' => {
      'TYPE' => 'STRUCT',
      'FILE' => 'source3/librpc/idl/smbXsrv.idl',
      'LINE' => 101,
      'NAME' => 'tevent_context'
    },
      'ELEMENTS' => undef,
      'NAME' => 'tevent_context',
      'PROPERTIES' => undef
    },
  'TYPE' => 'TYPEDEF'
      };

The problem with that is we end up with the HASH reference as a name
in Python bindings, like this

      PyErr_SetString(PyExc_TypeError, "Can not convert C Type struct HASH(0x5e2dfe5ee278) from Python");

which makes the build nondeterministic (as well as making the message
a little mysterious).

I think all the structures for which this happens are marked
'[ignore]' in IDL, meaning they are not transmitted on the wire. They
should perhaps also not have useless Python getsetters, but let's call
that a different problem.

Thanks to Freexian and the Debian LTS project for sponsoring this work.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoscript/autobuild.py: Add test for --vendor-name and --vendor-patch-revision
Andrew Bartlett [Thu, 30 May 2024 09:13:01 +0000 (21:13 +1200)] 
script/autobuild.py: Add test for --vendor-name and --vendor-patch-revision

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agobuild: Add --vendor-name --vendor-patch-revision options to ./configure
Andrew Bartlett [Wed, 29 May 2024 22:50:12 +0000 (10:50 +1200)] 
build: Add --vendor-name --vendor-patch-revision options to ./configure

These options are for packagers and vendors to set so that when
Samba developers are debugging an issue, we know exactly which
package is in use, and so have an idea if any patches have been
applied.

This is included in the string that a Samba backtrace gives,
as part of the PANIC message.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15654
REF: https://lists.samba.org/archive/samba-technical/2024-May/138992.html

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agopython:smb tests: remove py2 compatibility code
Douglas Bagnall [Tue, 28 May 2024 07:48:04 +0000 (19:48 +1200)] 
python:smb tests: remove py2 compatibility code

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython/common: remove verbiage about old python versions
Douglas Bagnall [Tue, 28 May 2024 07:46:33 +0000 (19:46 +1200)] 
python/common: remove verbiage about old python versions

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agobuildtools: remove Python2 compatibility
Douglas Bagnall [Tue, 28 May 2024 07:45:17 +0000 (19:45 +1200)] 
buildtools: remove Python2 compatibility

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotdb:pytests: remove unused Py2 test branches
Douglas Bagnall [Tue, 28 May 2024 07:43:53 +0000 (19:43 +1200)] 
tdb:pytests: remove unused Py2 test branches

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoldb-samba:pytest: remove unused variable
Douglas Bagnall [Tue, 28 May 2024 07:42:45 +0000 (19:42 +1200)] 
ldb-samba:pytest: remove unused variable

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotalloc:pytest: remove tests that only test Python 2
Douglas Bagnall [Tue, 28 May 2024 07:42:04 +0000 (19:42 +1200)] 
talloc:pytest: remove tests that only test Python 2

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotdb:pytdb:_tdb_text: remove Py2 compatibility code
Douglas Bagnall [Tue, 28 May 2024 07:40:39 +0000 (19:40 +1200)] 
tdb:pytdb:_tdb_text: remove Py2 compatibility code

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoselftest:dnshub: remove py2 compatibility code
Douglas Bagnall [Tue, 28 May 2024 07:39:33 +0000 (19:39 +1200)] 
selftest:dnshub: remove py2 compatibility code

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoctdb-scripts: Protect against races when starting grace period
Martin Schwenke [Fri, 10 May 2024 08:00:18 +0000 (18:00 +1000)] 
ctdb-scripts: Protect against races when starting grace period

While the PID check is worth it in relevant cases, NFS-Ganesha still
might go away after the check.  Unfortunately, neither grace command
fails an indicative exit code, so invent one by checking error
messages.  This can then be converted to success by the caller.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu May 30 12:50:01 UTC 2024 on atb-devel-224

14 months agoctdb-scripts: Check NFS-Ganesha is running before attempting grace
Martin Schwenke [Fri, 10 May 2024 07:51:18 +0000 (17:51 +1000)] 
ctdb-scripts: Check NFS-Ganesha is running before attempting grace

If monitoring has failed because it isn't running, then don't fail
"startipreallocate" or "relaseip" by trying to go into grace.

Don't check this for "takeip".  In that case NFS-Ganesha had better be
running.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
14 months agoctdb-scripts: Improve service PID check
Martin Schwenke [Fri, 10 May 2024 07:46:58 +0000 (17:46 +1000)] 
ctdb-scripts: Improve service PID check

No need to grovel around in /proc.  ps will happily tell us the
command.

Factor out the actual check into a separate function that can be used
elsewhere.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
14 months agoctdb-scripts: Improve NFS-Ganesha export path extraction
Martin Schwenke [Tue, 30 Apr 2024 05:00:34 +0000 (15:00 +1000)] 
ctdb-scripts: Improve NFS-Ganesha export path extraction

Path values do not need to have quotes.  The current code fails if
there aren't any.

Instead, implement a 2 stage parser using 2 sed commands.  See
comments in the code for details.

Regexps are POSIX basic regular expressions, apart from \<WORD\> (used
to ensure WORD is on word boundaries, and the 'i' flag for case
insensitivity.  The latter is supported in FreeBSD sed.

This code successfully parses Path values out of the following
monstrosity:

path = "/foo/bar1;a";
   Path = /foo/bar2;
Something = false;
Pseudo = "/foo/bar3x" ; Path = "/foo/bar3; y" ; Access_type = RO;
Pseudo = "/foo/bar4x" ; path=/foo/bar4; Access_type = RO;
Pseudo = "/foo/barNONONO" ; not_Path=/foo/barNONONO; Access_type = RO;
   Path = /foo/bar5
Pseudo = "/foo/bar6x Path=foo" ; Path=/foo/bar6; Access_type = RO

This is probably the best that can be done within a shell script.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
14 months agoctdb-scripts: Add script option CTDB_NFS_EXPORTS_FILE
Martin Schwenke [Wed, 27 Mar 2024 03:24:09 +0000 (14:24 +1100)] 
ctdb-scripts: Add script option CTDB_NFS_EXPORTS_FILE

Exports may be contained in an include file rather than the top-level
ganesha.conf.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
14 months agoctdb-scripts: Fix usage message
Martin Schwenke [Thu, 6 Jul 2023 03:37:03 +0000 (13:37 +1000)] 
ctdb-scripts: Fix usage message

An IP address is passed to these actions.

Reported-by: Arnab Tah <atah@ddn.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>