amitay/samba.git
4 years agopytests: heed assertEquals deprecation warning en-masse
Douglas Bagnall [Thu, 6 Feb 2020 22:02:38 +0000 (11:02 +1300)]
pytests: heed assertEquals deprecation warning en-masse

TestCase.assertEquals() is an alias for TestCase.assertEqual() and
has been deprecated since Python 2.7.

When we run our tests with in python developer mode (`PYTHONDEVMODE=1
make test`) we get 580 DeprecationWarnings about this.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agonmblib: avoid undefined behaviour in handle_name_ptrs()
Douglas Bagnall [Sun, 19 Jan 2020 02:08:58 +0000 (15:08 +1300)]
nmblib: avoid undefined behaviour in handle_name_ptrs()

If *offset is length - 1, we would read ubuf[(*offset)+1] as the lower
bits of the new *offset. This value is undefined, but because it is
checked against the valid range, there is no way to read further
beyond that one byte.

Credit to oss-fuzz.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14242
OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20193

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Feb  7 10:19:39 UTC 2020 on sn-devel-184

4 years agolibrpc ndr: Change loop index to size_t
Gary Lockyer [Wed, 22 Jan 2020 01:18:00 +0000 (14:18 +1300)]
librpc ndr: Change loop index to size_t

Change the loop index in ndr_check_padding to size_t.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibprc ndr tests: Fix ndrdump test ntlmssp_CHALLENGE_MESSAGE
Gary Lockyer [Thu, 6 Feb 2020 21:50:07 +0000 (10:50 +1300)]
libprc ndr tests: Fix ndrdump test ntlmssp_CHALLENGE_MESSAGE

Fix the expected data in fuzzed_ntlmssp-CHALLENGE_MESSAGE.txt, as it
contained source code line numbers.

Andrew this test needs to be altered to us a regular expression and
remove the dependency on source line numbers.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc ndr: ndr_pull_advance check for unsigned overflow.
Gary Lockyer [Tue, 14 Jan 2020 23:37:06 +0000 (12:37 +1300)]
librpc ndr: ndr_pull_advance check for unsigned overflow.

Handle uint32 overflow in ndr_pull_advance

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc ndr tests: Unsigned overflow in ndr_pull_advance
Gary Lockyer [Sun, 26 Jan 2020 21:06:55 +0000 (10:06 +1300)]
librpc ndr tests: Unsigned overflow in ndr_pull_advance

Check that uint32 overflow is handled correctly by ndr_pull_advance.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc ndr: NDR_PULL_ALIGN check for unsigned overflow
Gary Lockyer [Wed, 22 Jan 2020 01:16:02 +0000 (14:16 +1300)]
librpc ndr: NDR_PULL_ALIGN check for unsigned overflow

Handle uint32 overflow in NDR_PULL_ALIGN

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc ndr tests: uint32 overflow in NDR_PULL_ALIGN
Gary Lockyer [Fri, 24 Jan 2020 02:21:47 +0000 (15:21 +1300)]
librpc ndr tests: uint32 overflow in NDR_PULL_ALIGN

Check that uint32 overflow is handled correctly by NDR_NEED_BYTES.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibrpc ndr: Heap-buffer-overflow in lzxpress_decompress
Gary Lockyer [Thu, 23 Jan 2020 21:41:35 +0000 (10:41 +1300)]
librpc ndr: Heap-buffer-overflow in lzxpress_decompress

Reproducer for oss-fuzz Issue 20083

Project: samba
Fuzzing Engine: libFuzzer
Fuzz Target: fuzz_ndr_drsuapi_TYPE_OUT
Job Type: libfuzzer_asan_samba
Platform Id: linux

Crash Type: Heap-buffer-overflow READ 1
Crash Address: 0x6040000002fd
Crash State:
  lzxpress_decompress
    ndr_pull_compression_xpress_chunk
      ndr_pull_compression_start

Sanitizer: address (ASAN)

Recommended Security Severity: Medium

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: Test behaviour of DNS scavenge with an existing dNSTombstoned value
Andrew Bartlett [Thu, 30 Jan 2020 03:44:05 +0000 (16:44 +1300)]
selftest: Test behaviour of DNS scavenge with an existing dNSTombstoned value

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Feb  6 16:24:25 UTC 2020 on sn-devel-184

4 years agodsdb: Correctly handle memory in objectclass_attrs
Andrew Bartlett [Thu, 30 Jan 2020 03:41:39 +0000 (16:41 +1300)]
dsdb: Correctly handle memory in objectclass_attrs

el->values is caller-provided memory that should be thought of as constant,
it should not be assumed to be a talloc context.

Otherwise, if the caller gives constant memory or a stack
pointer we will get an abort() in talloc when it expects
a talloc magic in the memory preceeding the el->values.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agosource4/scripting/bin: Swap machine account password scripts
Andrew Bartlett [Mon, 3 Feb 2020 03:45:45 +0000 (16:45 +1300)]
source4/scripting/bin: Swap machine account password scripts

I regularly get requests for my simple script to print the
password from the secrets.tdb (or secrets.ldb on the AD DC).

This removes the old script that only reads the secrets.ldb.

Neither new nor old script has tests, however it seems
better to have it in the tree where it can be found rather
that me digging it out of my outbound e-mail.

Originally posted here:
 https://lists.samba.org/archive/samba/2017-November/212362.html

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agosmb2_server: use sendmsg/recvmsg instead of writev/readv
Stefan Metzmacher [Mon, 27 Aug 2018 11:02:50 +0000 (13:02 +0200)]
smb2_server: use sendmsg/recvmsg instead of writev/readv

This avoids a few function calls inside the kernel
in order to reach sock_sendmsg() quicker:

    entry_SYSCALL_64_after_hwframe
       do_syscall_64
          __x64_sys_writev
             do_writev
                vfs_writev
                   do_iter_write
                      do_iter_readv_writev
                         sock_write_iter
                            sock_sendmsg

    entry_SYSCALL_64_after_hwframe
       do_syscall_64
          __x64_sys_sendmsg
             __sys_sendmsg
                ___sys_sendmsg
                   sock_sendmsg

As a side effect it will be useful for SMB-Direct invalidation
messages via msg->msg_control and CMSG_*.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: create a pcap file for the environment setup
Stefan Metzmacher [Thu, 14 Nov 2019 16:36:36 +0000 (17:36 +0100)]
selftest: create a pcap file for the environment setup

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: create pcap files for invidual env services
Stefan Metzmacher [Wed, 30 Oct 2019 20:53:39 +0000 (21:53 +0100)]
selftest: create pcap files for invidual env services

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: move {setup,cleanup}_pcap() to selftest/target/Samba.pm
Stefan Metzmacher [Tue, 4 Feb 2020 16:03:17 +0000 (17:03 +0100)]
selftest: move {setup,cleanup}_pcap() to selftest/target/Samba.pm

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: force LC_ALL=en_US.utf8 LANG=en_US.utf8
Stefan Metzmacher [Mon, 18 Nov 2019 21:02:13 +0000 (22:02 +0100)]
selftest: force LC_ALL=en_US.utf8 LANG=en_US.utf8

That makes sure we have the same as on gitlab runners
(see bootstrap/config.py).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:rpclient: simplify rpc_tstream_next_vector()
Stefan Metzmacher [Wed, 22 Jan 2020 15:14:21 +0000 (15:14 +0000)]
s3:rpclient: simplify rpc_tstream_next_vector()

We always now how many bytes our caller requires,
so there's no need to use tstream_pending_bytes().

This makes it possible to read socket_wrapper generated
captures again, as wireshark requires the fixed (16 bytes) DCERPC
header to be in one TCP packet.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture: make rpc.handles.random-assoc test even more robust
Stefan Metzmacher [Mon, 27 Jan 2020 15:45:44 +0000 (16:45 +0100)]
s4:torture: make rpc.handles.random-assoc test even more robust

This improves commit bebee47e6386476e9948089484f89d213fcc2660 a bit
further.

I just got this:

  connect samr pipe1
  use assoc_group_id[0x00000001] for new connections
  connect lsa pipe2
  got assoc_group_id[0x00000001] for p2
  samr_Connect to open a policy handle on samr p1
  use policy handle on lsa p2 - should fail
  closing policy handle on samr p1
  connect samr pipe3 - should fail
  Failed to bind to uuid 12345778-1234-abcd-ef00-0123456789ac for ncacn_np:localdc[\pipe\samr,validate,assoc_group_id=0x00000001,abstract_syntax=12345778-1234-abcd-ef00-0123456789ac/0x00000001] NT_STATUS_UNSUCCESSFUL
  connect lsa pipe4 - should fail
  Failed to bind to uuid 12345778-1234-abcd-ef00-0123456789ab for ncacn_np:localdc[\pipe\lsarpc,validate,assoc_group_id=0x00000001,abstract_syntax=12345778-1234-abcd-ef00-0123456789ab/0x00000000] NT_STATUS_UNSUCCESSFUL
  connect samr pipe5 with assoc_group_id[0xFFFFFFFF]- should fail
  Failed to bind to uuid 12345778-1234-abcd-ef00-0123456789ac for ncacn_np:localdc[\pipe\samr,validate,assoc_group_id=0xffffffff,abstract_syntax=12345778-1234-abcd-ef00-0123456789ac/0x00000001] NT_STATUS_UNSUCCESSFUL
  connect lsa pipe6 with assoc_group_id[0x00000000]- should fail
  UNEXPECTED(failure): samba4.rpc.handles on ncacn_np with validate.mixed-shared(ad_dc_ntvfs)
  REASON: Exception: Exception: ../../source4/torture/rpc/handles.c:500: status was NT_STATUS_OK, expected NT_STATUS_UNSUCCESSFUL: opening lsa pipe6
  FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites)
  A summary with detailed information can be found in:

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosmbd: avoid double chdir() in chdir_current_service()
Ralph Boehme [Wed, 22 Jan 2020 09:52:39 +0000 (10:52 +0100)]
smbd: avoid double chdir() in chdir_current_service()

Since 8e81090789e4cc3ba9e5aa792d4e52971909c894 we're doing chdir() twice, first
into conn->connectpath, then into conn->origpath.

Before commit 8e81090789e4cc3ba9e5aa792d4e52971909c894 if
chdir(conn->connectpath) succeeded, we wouldn't do the second chdir().

While at it, simplify the logging logic: if chdir() fails in this core function,
just always log is as error including the unix token.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14256
RN: smbd does a chdir() twice per request

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Feb  6 11:44:07 UTC 2020 on sn-devel-184

4 years agos3/lib: RIP smb_user_name
Ralph Boehme [Sat, 18 Jan 2020 07:11:52 +0000 (08:11 +0100)]
s3/lib: RIP smb_user_name

This has been replaced in previous commits by consistently using
current_user_info.smb_name.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/auth: use set_current_user_info() in auth3_check_password_send()
Ralph Boehme [Sat, 18 Jan 2020 07:09:22 +0000 (08:09 +0100)]
s3/auth: use set_current_user_info() in auth3_check_password_send()

This delays reloading config slightly, but I don't see how could affect
observable behaviour other then log messages coming from the functions in
between the different locations for lp_load_with_shares() like
make_user_info_map() are sent to a different logfile if "log file" uses %U.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/auth: use set_current_user_info() in auth3_generate_session_info_pac()
Ralph Boehme [Sat, 18 Jan 2020 07:06:45 +0000 (08:06 +0100)]
s3/auth: use set_current_user_info() in auth3_generate_session_info_pac()

This delays reloading config slightly, but I don't see how could affect
observable behaviour other then log messages coming from the functions in
between the different locations for lp_load_with_shares() like
make_session_info_krb5() are sent to a different logfile if "log file" uses %U.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/rpc_server/netlogon: use set_current_user_info() in _netr_LogonSamLogon_base()
Ralph Boehme [Fri, 17 Jan 2020 20:56:27 +0000 (21:56 +0100)]
s3/rpc_server/netlogon: use set_current_user_info() in _netr_LogonSamLogon_base()

Note that we're now sanitizing the username we got from the client, as we do
everywhere else.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosmbd: remove sub_set_smb_name()/reload_services()
Ralph Boehme [Fri, 17 Jan 2020 20:55:35 +0000 (21:55 +0100)]
smbd: remove sub_set_smb_name()/reload_services()

This means switching auth backend based on %U include, ie

  passdb backend = tdbsam
  include = smb.conf.%U

and smb.conf.SOMEUSER contains

  passdb backend = smbpasswd

won't work anymore.

We're still calling set_current_user_info() and reload_services() later on
in this function, so everything else still works as before.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/auth: use talloc_alpha_strcpy() in auth_session_info_fill_unix()
Ralph Boehme [Fri, 17 Jan 2020 18:31:06 +0000 (19:31 +0100)]
s4/auth: use talloc_alpha_strcpy() in auth_session_info_fill_unix()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/rpc_server: use talloc_alpha_strcpy() in _winreg_InitiateSystemShutdownEx()
Ralph Boehme [Fri, 17 Jan 2020 18:30:36 +0000 (19:30 +0100)]
s3/rpc_server: use talloc_alpha_strcpy() in _winreg_InitiateSystemShutdownEx()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/lib: use talloc_alpha_strcpy() in sub_set_smb_name()
Ralph Boehme [Fri, 17 Jan 2020 18:30:18 +0000 (19:30 +0100)]
s3/lib: use talloc_alpha_strcpy() in sub_set_smb_name()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/lib: use talloc_alpha_strcpy() in set_remote_machine_name()
Ralph Boehme [Fri, 17 Jan 2020 18:30:01 +0000 (19:30 +0100)]
s3/lib: use talloc_alpha_strcpy() in set_remote_machine_name()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/lib: use talloc_alpha_strcpy() in set_local_machine_name()
Ralph Boehme [Fri, 17 Jan 2020 18:28:54 +0000 (19:28 +0100)]
s3/lib: use talloc_alpha_strcpy() in set_local_machine_name()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:auth: use talloc_alpha_strcpy() in auth3_session_info_create()
Ralph Boehme [Fri, 17 Jan 2020 18:28:34 +0000 (19:28 +0100)]
s3:auth: use talloc_alpha_strcpy() in auth3_session_info_create()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/auth: use talloc_alpha_strcpy() in create_local_token()
Ralph Boehme [Fri, 17 Jan 2020 18:28:13 +0000 (19:28 +0100)]
s3/auth: use talloc_alpha_strcpy() in create_local_token()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolib/util: add talloc_alpha_strcpy()
Ralph Boehme [Fri, 17 Jan 2020 18:15:22 +0000 (19:15 +0100)]
lib/util: add talloc_alpha_strcpy()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosmbd: setting current_user stuff here is redundant
Ralph Boehme [Fri, 17 Jan 2020 13:42:22 +0000 (14:42 +0100)]
smbd: setting current_user stuff here is redundant

This is already handled by set_sec_ctx() below, we just have to pass in the
values instead of setting it here in this function before calling set_sec_ctx().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agowafsamba: Do not use 'rU' as the 'U' is deprecated in Python 3.9
Andreas Schneider [Wed, 5 Feb 2020 15:58:26 +0000 (16:58 +0100)]
wafsamba: Do not use 'rU' as the 'U' is deprecated in Python 3.9

See https://docs.python.org/3.9/whatsnew/3.9.html#changes-in-the-python-api

"open(), io.open(), codecs.open() and fileinput.FileInput no longer accept 'U'
(“universal newline”) in the file mode. This flag was deprecated since Python
3.3. In Python 3, the “universal newline” is used by default when a file is
open in text mode. The newline parameter of open() controls how universal
newlines works."

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Feb  6 07:30:13 UTC 2020 on sn-devel-184

4 years agowinbindd: handling missing idmap in getgrgid()
Stefan Metzmacher [Wed, 22 Jan 2020 17:00:07 +0000 (17:00 +0000)]
winbindd: handling missing idmap in getgrgid()

A similar hunk was added via commit
89f753c1fc824fef29aebb7d783ab7e09cd1f04e ("winbind: Use xids2sids in getpwuid"),
but it was missing in commit
e2dda192e7f8b65a5f02120be56cf0f07d03679f ("winbind: Use xids2sids in getgrgid")

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Feb  5 17:56:58 UTC 2020 on sn-devel-184

4 years agos3:auth_sam: map an empty domain or '.' to the local SAM name
Stefan Metzmacher [Thu, 23 Jan 2020 15:21:43 +0000 (16:21 +0100)]
s3:auth_sam: map an empty domain or '.' to the local SAM name

When a domain member gets an empty domain name or '.', it should
not forward the authentication to domain controllers of
the primary domain.

But we need to keep passing UPN account names with
an empty domain to the DCs as a domain member.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:selftest: test authentication with an empty userdomain and upn names
Stefan Metzmacher [Tue, 4 Feb 2020 10:32:05 +0000 (11:32 +0100)]
s3:selftest: test authentication with an empty userdomain and upn names

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:auth_sam: introduce effective_domain helper variables
Stefan Metzmacher [Thu, 23 Jan 2020 15:21:43 +0000 (16:21 +0100)]
s3:auth_sam: introduce effective_domain helper variables

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:auth_sam: make sure we never handle empty usernames
Stefan Metzmacher [Thu, 23 Jan 2020 15:17:30 +0000 (16:17 +0100)]
s3:auth_sam: make sure we never handle empty usernames

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:auth_sam: unify the debug messages of all auth_sam*_auth() functions
Stefan Metzmacher [Thu, 23 Jan 2020 15:13:59 +0000 (16:13 +0100)]
s3:auth_sam: unify the debug messages of all auth_sam*_auth() functions

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:auth_sam: replace confusing FALL_THROUGH; with break;
Stefan Metzmacher [Thu, 23 Jan 2020 14:48:39 +0000 (15:48 +0100)]
s3:auth_sam: replace confusing FALL_THROUGH; with break;

There's no real logic change here, but is makes it easier to
understand.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agobootstrap: Remove un-used dependency python3-crypto
Andrew Bartlett [Fri, 13 Dec 2019 17:59:45 +0000 (06:59 +1300)]
bootstrap: Remove un-used dependency python3-crypto

This became unused in bbeef554f2c15e739f6095fcb57d9ef6646b411c
(except for repl_cleartext_pwd.py, a development script) and we now use
GnuTLS via a Samba wrapper.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:param: make sure secrets_db_connect() no longer creates on empty secrets.ldb
Stefan Metzmacher [Tue, 4 Feb 2020 15:16:48 +0000 (16:16 +0100)]
s4:param: make sure secrets_db_connect() no longer creates on empty secrets.ldb

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Feb  5 10:13:02 UTC 2020 on sn-devel-184

4 years agos4:param: make use of secrets_db_create() in provision_store_self_join()
Stefan Metzmacher [Tue, 4 Feb 2020 15:15:53 +0000 (16:15 +0100)]
s4:param: make use of secrets_db_create() in provision_store_self_join()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:param: add secrets_db_create() helper function
Stefan Metzmacher [Tue, 4 Feb 2020 15:14:55 +0000 (16:14 +0100)]
s4:param: add secrets_db_create() helper function

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolibcli/nbt: avoid talloc_reference() in nbt_name_*_send()
Stefan Metzmacher [Thu, 8 Aug 2013 16:11:23 +0000 (18:11 +0200)]
libcli/nbt: avoid talloc_reference() in nbt_name_*_send()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:rpc_server/lsa: remove some useless talloc_reference() calls
Stefan Metzmacher [Tue, 4 Feb 2020 15:09:46 +0000 (16:09 +0100)]
s4:rpc_server/lsa: remove some useless talloc_reference() calls

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolibcli:smb: Improve check for gnutls_aead_cipher_(en|de)cryptv2
Andreas Schneider [Fri, 24 Jan 2020 15:34:42 +0000 (16:34 +0100)]
libcli:smb: Improve check for gnutls_aead_cipher_(en|de)cryptv2

This is available since version 3.6.10, but 3.6.10 has a bug which got fixed
in 3.6.11, see:

    https://gitlab.com/gnutls/gnutls/-/merge_requests/1085

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

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): Tue Feb  4 06:44:00 UTC 2020 on sn-devel-184

4 years agoselftest: simplify logic in setup_env
Douglas Bagnall [Sat, 7 Dec 2019 10:22:45 +0000 (23:22 +1300)]
selftest: simplify logic in setup_env

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: avoid comparison against undefined value
Douglas Bagnall [Sun, 2 Feb 2020 07:57:17 +0000 (20:57 +1300)]
selftest: avoid comparison against undefined value

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/target/samba: do not look for undef environment
Douglas Bagnall [Sat, 7 Dec 2019 10:20:29 +0000 (23:20 +1300)]
selftest/target/samba: do not look for undef environment

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/target/samba: add missing methods
Douglas Bagnall [Sat, 7 Dec 2019 10:17:26 +0000 (23:17 +1300)]
selftest/target/samba: add missing methods

These methods are being called but have not been provided.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/s3: prefer empty string over undef to add nothing to config
Douglas Bagnall [Sat, 7 Dec 2019 10:08:48 +0000 (23:08 +1300)]
selftest/s3: prefer empty string over undef to add nothing to config

To fix a warning.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/s3: actually close parent copy of smbd's STDIN
Douglas Bagnall [Sat, 7 Dec 2019 10:05:03 +0000 (23:05 +1300)]
selftest/s3: actually close parent copy of smbd's STDIN

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/s4: remove illegal function signature
Douglas Bagnall [Sat, 7 Dec 2019 09:56:00 +0000 (22:56 +1300)]
selftest/s4: remove illegal function signature

The character ':' has no meaning in function signatures. Perhaps ';' was
intended, which would have marked the later arguments as optional --
which is the default with no signature. All callers always provide all
the arguments anyway.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/s4: don't put pcap file in / by default
Douglas Bagnall [Sat, 7 Dec 2019 09:48:42 +0000 (22:48 +1300)]
selftest/s4: don't put pcap file in / by default

If the SOCKET_WRAPPER_PCAP_DIR is not defined, let's assume it wasn't
wanted rather than choosing /.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/s4: properly initialise an empty hash
Douglas Bagnall [Sat, 7 Dec 2019 09:45:47 +0000 (22:45 +1300)]
selftest/s4: properly initialise an empty hash

The '%ret = {}' construction was bad because '{}' is a hash-ref, which
counts as a single scalar value, but a true hash like '%ret' must be
initialised with an even number of scalar values (usually in pairs, like
'($a => $b, $c => $d)').

I think this meant %ret was initialised as something harmless like
'(<HASH(0x55ce39781278)> => undef)'.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: avoid redeclaring perl variables
Douglas Bagnall [Sat, 7 Dec 2019 09:38:30 +0000 (22:38 +1300)]
selftest: avoid redeclaring perl variables

None of these ones are doing any harm, we just want to silence these
warnings.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest/target/samba: avoid overwriting $pkinitdir
Douglas Bagnall [Sat, 7 Dec 2019 10:15:00 +0000 (23:15 +1300)]
selftest/target/samba: avoid overwriting $pkinitdir

We were declaring the same variable twice with two different paths,
"$cadir/Users/$pkinitprincipalname" here and
"$ctx->{prefix_abs}/pkinit" about 5 lines down.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: enable perl warnings
Douglas Bagnall [Sat, 7 Dec 2019 09:37:00 +0000 (22:37 +1300)]
selftest: enable perl warnings

After this we will see more noise with each test run, and these
warnings will be addressed in following commits.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agobuild: Do not check if system perl modules should be bundled
Andrew Bartlett [Sun, 2 Feb 2020 20:51:12 +0000 (09:51 +1300)]
build: Do not check if system perl modules should be bundled

We do not ship any perl modules in third_party at this time, so
this check is pointless and breaks the build for --bundled-libraries=ALL.

As reported by aaptel on https://gitlab.com/samba-team/samba/-/merge_requests/1104#note_281050331

This changes our autobuild script to cover this case in the
samba-static job.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agovfs_gpfs: Remove discard_const_p() from gpfswrap_quotactl() calls
Ralph Wuerthner [Tue, 28 Jan 2020 14:42:03 +0000 (15:42 +0100)]
vfs_gpfs: Remove discard_const_p() from gpfswrap_quotactl() calls

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Mon Feb  3 21:53:05 UTC 2020 on sn-devel-184

4 years agovfs_gpfs: Remove discard_const_p() from gpfs_putacl() calls
Ralph Wuerthner [Tue, 28 Jan 2020 14:40:46 +0000 (15:40 +0100)]
vfs_gpfs: Remove discard_const_p() from gpfs_putacl() calls

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agovfs_gpfs: Remove discard_const_p() from gpfswrap_quotactl() calls
Ralph Wuerthner [Tue, 28 Jan 2020 14:33:47 +0000 (15:33 +0100)]
vfs_gpfs: Remove discard_const_p() from gpfswrap_quotactl() calls

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agogpfswrap: Make pathname "const char *" in gpfswrap_quotactl()
Ralph Wuerthner [Tue, 28 Jan 2020 13:50:19 +0000 (14:50 +0100)]
gpfswrap: Make pathname "const char *" in gpfswrap_quotactl()

Update wrapper function to match the definition in gpfs.h.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agogpfswrap: Make pathname "const char *" in gpfswrap_get_winattrs_path()
Ralph Wuerthner [Tue, 28 Jan 2020 13:46:43 +0000 (14:46 +0100)]
gpfswrap: Make pathname "const char *" in gpfswrap_get_winattrs_path()

Update wrapper function to match the definition in gpfs.h.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agogpfswrap: Make pathname "const char *" in gpfswrap_set_winattrs_path()
Ralph Wuerthner [Tue, 28 Jan 2020 13:44:24 +0000 (14:44 +0100)]
gpfswrap: Make pathname "const char *" in gpfswrap_set_winattrs_path()

Update wrapper function to match the definition in gpfs.h.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agogpfswrap: Make pathname "const char *" in gpfswrap_get_realfilename_path()
Ralph Wuerthner [Tue, 28 Jan 2020 13:42:01 +0000 (14:42 +0100)]
gpfswrap: Make pathname "const char *" in gpfswrap_get_realfilename_path()

Update wrapper function to match the definition in gpfs.h.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agogpfswrap: Make pathname "const char *" in gpfswrap_putacl()
Ralph Wuerthner [Tue, 28 Jan 2020 13:39:51 +0000 (14:39 +0100)]
gpfswrap: Make pathname "const char *" in gpfswrap_putacl()

Update wrapper function to match the definition in gpfs.h.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agogpfswrap: Make pathname "const char *" in gpfswrap_getacl()
Ralph Wuerthner [Tue, 28 Jan 2020 13:34:55 +0000 (14:34 +0100)]
gpfswrap: Make pathname "const char *" in gpfswrap_getacl()

Update wrapper function to match the definition in gpfs.h.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agogpfswrap: Remove unused wrapper gpfswrap_getfilesetid()
Ralph Wuerthner [Fri, 31 Jan 2020 08:51:27 +0000 (09:51 +0100)]
gpfswrap: Remove unused wrapper gpfswrap_getfilesetid()

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoscript/release.sh: Don't use quotations any longer.
Karolin Seeger [Tue, 28 Jan 2020 10:48:53 +0000 (11:48 +0100)]
script/release.sh: Don't use quotations any longer.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Mon Feb  3 12:45:39 UTC 2020 on sn-devel-184

4 years agopidl/wscript: configure should insist on Parse::Yapp::Driver
Douglas Bagnall [Sun, 2 Feb 2020 03:05:38 +0000 (16:05 +1300)]
pidl/wscript: configure should insist on Parse::Yapp::Driver

following 83ffe6752d589180eac96d7b8e7d1a54e3476bfd, you get a build
error if you lack a system perl Parse::Yapp. Let's make it a configure
failure instead.

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): Sun Feb  2 10:09:11 UTC 2020 on sn-devel-184

4 years agos3: VFS: Implement create_dfs_pathat() in catia.
Jeremy Allison [Tue, 28 Jan 2020 22:59:46 +0000 (14:59 -0800)]
s3: VFS: Implement create_dfs_pathat() in catia.

Now we use this instead of symlinks to create
DFS links, it's needed in cap.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Jan 30 18:21:47 UTC 2020 on sn-devel-184

4 years agos3: VFS: Implement create_dfs_pathat() in catia.
Jeremy Allison [Tue, 28 Jan 2020 22:42:49 +0000 (14:42 -0800)]
s3: VFS: Implement create_dfs_pathat() in catia.

Now we use this instead of symlinks to create
DFS links, it's needed in catia.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos4:torture: Skip the deltest20 as user root
Andreas Schneider [Thu, 30 Jan 2020 15:18:25 +0000 (16:18 +0100)]
s4:torture: Skip the deltest20 as user root

The test is meant to be run as a user and not root.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 30 16:54:33 UTC 2020 on sn-devel-184

4 years agoctdb-test: Fix a typo
Volker Lendecke [Tue, 28 Jan 2020 16:42:13 +0000 (17:42 +0100)]
ctdb-test: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 30 13:53:22 UTC 2020 on sn-devel-184

4 years agolibsmb: Fix a typo
Volker Lendecke [Thu, 23 Jan 2020 20:23:03 +0000 (21:23 +0100)]
libsmb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoauth3: Fix a typo
Volker Lendecke [Mon, 27 Jan 2020 15:43:24 +0000 (16:43 +0100)]
auth3: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolib: Align integer types
Volker Lendecke [Fri, 24 Jan 2020 10:49:58 +0000 (11:49 +0100)]
lib: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolibcli: Align integer types
Volker Lendecke [Tue, 28 Jan 2020 14:39:29 +0000 (15:39 +0100)]
libcli: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agopassdb: Use struct allocation
Volker Lendecke [Mon, 27 Jan 2020 16:00:59 +0000 (17:00 +0100)]
passdb: Use struct allocation

Give the compiler more info

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:torture: Convert samba4.base.charset test to smb2
David Mulder [Tue, 10 Dec 2019 19:06:13 +0000 (12:06 -0700)]
s4:torture: Convert samba4.base.charset test to smb2

The partial surrogate test is known to fail (in
both smb1 and smb2).

Signed-off-by: David Mulder <dmulder@suse.com>
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Jan 30 12:05:13 UTC 2020 on sn-devel-184

4 years agoselftest: Exit skipped daemons on close(STDIN)
Volker Lendecke [Tue, 28 Jan 2020 13:46:09 +0000 (14:46 +0100)]
selftest: Exit skipped daemons on close(STDIN)

Without this, teardown_env() will take ages for environments with
skipped daemons

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jan 29 11:06:53 UTC 2020 on sn-devel-184

4 years agoselftest: Close STDIN_PIPE's write end for skipped daemons
Volker Lendecke [Tue, 28 Jan 2020 13:41:11 +0000 (14:41 +0100)]
selftest: Close STDIN_PIPE's write end for skipped daemons

Without this, any environment that skips any daemon will not shut down
properly. If a copy of a pipe's write end remains, closing one of them
won't cause the read end to be readable, i.e. the daemons waiting for
that won't exit properly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib: asn1.c: Prevent ASN1_ENUMERATED from wrapping.
Jeremy Allison [Thu, 23 Jan 2020 21:59:18 +0000 (13:59 -0800)]
lib: asn1.c: Prevent ASN1_ENUMERATED from wrapping.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <dbagnall@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 29 01:02:04 UTC 2020 on sn-devel-184

4 years agolib/util: use better linux os detection in gpfs configure
Günther Deschner [Mon, 27 Jan 2020 20:39:20 +0000 (21:39 +0100)]
lib/util: use better linux os detection in gpfs configure

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Christof Schmitt cs@samba.org
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Jan 28 18:05:34 UTC 2020 on sn-devel-184

4 years agoctdb-tests: Enable job control when keeping stdin open
Martin Schwenke [Mon, 13 Jan 2020 23:58:15 +0000 (10:58 +1100)]
ctdb-tests: Enable job control when keeping stdin open

POSIX says:

  If job control is disabled (see set, -m), the standard input for an
  asynchronous list, before any explicit redirections are performed,
  shall be considered to be assigned to a file that has the same
  properties as /dev/null. This shall not happen if job control is
  enabled. In all cases, explicit redirection of standard input shall
  override this activity.

ctdbd is backgrounded at startup, so the above causes stdin to be
redirected from /dev/null.  Enable job control to work around this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Jan 28 11:24:35 UTC 2020 on sn-devel-184

4 years agoctdb-tests: Don't close stdin when starting local daemons
Martin Schwenke [Mon, 13 Jan 2020 10:04:24 +0000 (21:04 +1100)]
ctdb-tests: Don't close stdin when starting local daemons

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Shut down if interactive and stdin is closed
Martin Schwenke [Mon, 13 Jan 2020 10:04:54 +0000 (21:04 +1100)]
ctdb-daemon: Shut down if interactive and stdin is closed

This allows a test environment to simply close its end of a pipe to
cleanly shutdown ctdbd.  Like in smbd, this is only done if stdin is a
pipe or a socket.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Only stop monitoring if it has been initialised
Martin Schwenke [Mon, 13 Jan 2020 10:13:32 +0000 (21:13 +1100)]
ctdb-daemon: Only stop monitoring if it has been initialised

This avoids a crash if ctdb_shutdown_sequence() is called before
monitoring is initialised.

Switch to using TALLOC_FREE() while touching this function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agolib:util: Log mkdir error on correct debug levels
Andreas Schneider [Mon, 27 Jan 2020 13:58:10 +0000 (14:58 +0100)]
lib:util: Log mkdir error on correct debug levels

For smbd we want an error and for smbclient we only want it in NOTICE
debug level.
The default log level of smbclient is log level 1 so we need notice to
not spam the user.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Jan 27 15:55:24 UTC 2020 on sn-devel-184

4 years agoselftest: Convert Samba3::provision() to named parameters
Volker Lendecke [Fri, 24 Jan 2020 09:45:52 +0000 (10:45 +0100)]
selftest: Convert Samba3::provision() to named parameters

9 positional parameters is a bit too much for easy overview

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 years agoselftest: Factor out create_file_chmod()
Volker Lendecke [Thu, 23 Jan 2020 15:07:59 +0000 (16:07 +0100)]
selftest: Factor out create_file_chmod()

24 lines less perl :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 years agokrb5-wrap: deal with different krb5_trace_info struct flavors (earlier MIT krb5 releases)
Günther Deschner [Thu, 23 Jan 2020 14:31:27 +0000 (15:31 +0100)]
krb5-wrap: deal with different krb5_trace_info struct flavors (earlier MIT krb5 releases)

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jan 24 20:38:53 UTC 2020 on sn-devel-184

4 years agonsswitch:tests: Add test to check correct group lookup with samlogon cache
Andreas Schneider [Wed, 15 Jan 2020 15:29:24 +0000 (16:29 +0100)]
nsswitch:tests: Add test to check correct group lookup with samlogon cache

TEST FOR: https://bugzilla.samba.org/show_bug.cgi?id=14124

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jan 24 17:18:38 UTC 2020 on sn-devel-184

4 years agoselftest: Make 'Samba Users' the primary group of joe
Andreas Schneider [Wed, 15 Jan 2020 13:41:37 +0000 (14:41 +0100)]
selftest: Make 'Samba Users' the primary group of joe

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
4 years agoselftest: Add a group 'Samba Users'
Andreas Schneider [Wed, 15 Jan 2020 13:41:13 +0000 (14:41 +0100)]
selftest: Add a group 'Samba Users'

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
4 years agoselftest: Add user joe
Andreas Schneider [Wed, 15 Jan 2020 13:39:56 +0000 (14:39 +0100)]
selftest: Add user joe

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>