[Pkg-samba-maint] [Git][samba-team/samba][experimental] 3015 commits: VERSION: Bump version up to 4.11.0pre1

Mathieu Parent gitlab at salsa.debian.org
Wed Sep 25 06:41:24 BST 2019



Mathieu Parent pushed to branch experimental at Debian Samba Team / samba


Commits:
de516b95 by Karolin Seeger at 2019-01-15T10:37:30Z
VERSION: Bump version up to 4.11.0pre1

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
d40ad902 by Karolin Seeger at 2019-01-15T10:40:06Z
WHATSNEW: Start release notes for Samba 4.11.0pre1.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
09effcb5 by Günther Deschner at 2019-01-15T20:27:20Z
s3-smbd: use fruit:model string for mDNS registration

With this change we now allow to modify the icon to represent Samba in
Finder. Possible values are at least:

fruit:model = iMac
fruit:model = MacBook
fruit:model = MacPro
fruit:model = Xserve
fruit:model = RackMac

Prior to this change we only displayed the correct icon when a mac
client negotiated the apple create context over SMB.

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

Based on proposed patch from Rouven WEILER <Rouven_Weiler at gmx.net>

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Tue Jan 15 21:27:20 CET 2019 on sn-devel-144

- - - - -
dd231a16 by Jeremy Allison at 2019-01-15T21:27:09Z
python: dns_hub: Fix indentation of 'raise' on error.

Remove second socket.sendto().

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
0b996afe by Dylan Stephano-Shachter at 2019-01-16T01:01:55Z
profiling: stop smbprofile from growing unnecessarily

Signed-off-by: Dylan Stephano-Shachter <dshachter at nasuni.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jan 16 02:01:55 CET 2019 on sn-devel-144

- - - - -
193a0d6f by Volker Lendecke at 2019-01-16T04:34:17Z
ctdb: Print locks latency in machinereadable stats

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13742
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Wed Jan 16 05:34:17 CET 2019 on sn-devel-144

- - - - -
c324f84a by Justin Stephenson at 2019-01-16T07:54:23Z
s3:libsmb: Honor disable_netbios option in smbsock_connect_send

If disable_netbios is set, return before the tevent timer is triggered
to prevent outgoing netbios connections.

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

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jan 16 08:54:23 CET 2019 on sn-devel-144

- - - - -
e68dd420 by Philipp Gesang at 2019-01-16T17:51:27Z
libcli: remove declaration of nt_errstr_const

nt_errstr_const was renamed nt_errstr in 2011, rendering the
declaration useless.

Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3bb78089 by Tim Beale at 2019-01-16T17:51:27Z
join: Fix TypeError when handling exception

When we can't resolve a domain name, we were inadvertently throwing a
TypeError whilst trying to output a helpful message. E.g.

ERROR(<class 'TypeError'>): uncaught exception - 'NTSTATUSError' object
does not support indexing

Instead of indexing the object, we want to index the Exception.args so
that we just display the string portion of the exception error.

The same problem is also present for the domain trust commands.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny at samba.org>
Reviewed-by: Jeremy Allison <rpenny at samba.org>

- - - - -
9e4b08f4 by Tim Beale at 2019-01-16T21:11:04Z
join: Throw CommandError instead of Exception for simple errors

Throwing an exception here still dumps out the Python stack trace, which
can be a little disconcerting for users.

In this case, the stack trace isn't going to really help at all (the
problem is pretty obvious), and it obscures the useful message
explaining what went wrong.

Throw a CommandError instead, which samba-tool will catch and display
more nicely.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny at samba.org>
Reviewed-by: Jeremy Allison <rpenny at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jan 16 22:11:04 CET 2019 on sn-devel-144

- - - - -
2723d900 by Ralph Wuerthner at 2019-01-17T00:36:54Z
vfs_fileid: fix fsname_norootdir algorithm

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13744

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Thu Jan 17 01:36:54 CET 2019 on sn-devel-144

- - - - -
3b2e86bb by Tim Beale at 2019-01-17T00:40:29Z
python/gpclass: Convert gpclass to use s3 SMB Python bindings

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
b982811b by Tim Beale at 2019-01-17T00:40:30Z
s3:pylibsmb: Add .set_acl API to SMB py bindings

This is pretty similar code to py_smb_getacl(), except it's calling
cli_set_security_descriptor() instead of cli_query_security_descriptor()

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
345746ea by Tim Beale at 2019-01-17T00:40:30Z
netcmd: Change SMB flags from s4 Py bindings to s3

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0304b08d by Tim Beale at 2019-01-17T00:40:30Z
s3:pylibsmb: Add FILE_READ_ATTRIBUTES access to .loadfile() API

Add FILE_READ_ATTRIBUTES when opening the file handle, as we need to
read the file's size.

The .loadfile() API can end up calling cli_qfileinfo_basic() to get the
file size. This can end up doing a 'FILE_ALL_INFORMATION' SMBv2 request
underneath, which the MS-SMB2 spec (section 3.3.5.20.1 Handling
SMB2_0_INFO_FILE) says the file handle must have FILE_READ_ATTRIBUTES
access granted.

I noticed this problem when running .loadfile() against the NTVFS
server.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
08f1627c by Tim Beale at 2019-01-17T00:40:30Z
netcmd: Change GPO commands to use s3 SMB Py bindings

This means we can now use GPO commands on a DC that has SMBv1 disabled.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
6a29e63f by Tim Beale at 2019-01-17T00:40:30Z
s4:pysmb: Add error log that the s4 bindings are deprecated

We plan to delete the s4 SMB Python bindings in the next Samba release
after v4.10, but first give external consumers a heads-up, just in case
they are currently using the s4 bindings.

Note the auth_log tests still use the s4 bindings, but all user-facing
tools should now be updated to use the s3 bindings.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2a7372da by Tim Beale at 2019-01-17T00:40:30Z
tests: Run samba_tool.gpo tests against backup testenvs

Run the GPO tests against the backup/restore testenvs.

Because the backup/restore preserves the NTACLs of the sysvol files,
running the GPO tests against the backup testenvs is a good sanity-
check. If fact it highlights that there is currently a problem with
restoring the GPO files - this shows up in 'samba-tool gpo aclcheck',
but we never noticed it until now.

NTACL backup works slightly different for offline backups, and rename
backups end up with more sysvol files, so run the tests against both
these envs.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
f3fe96fc by Tim Beale at 2019-01-17T00:40:30Z
ntacls: Pass correct use_ntvfs through to setntacl()

We were already checking the smb.conf to see if it uses the NTVFS file
server or the default smbd server. However, we weren't passing this
through to the setntacl() call.

This fixes the problem we noticed with 'samba-tool gpo aclcheck' failing
after a restore.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
da33c2c4 by Tim Beale at 2019-01-17T00:40:30Z
tests: Run GPO commands against testenv with SMBv1 disabled

Just to prove that they work across SMBv2.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a310de2d by Tim Beale at 2019-01-17T00:40:31Z
selftest: Give the backup testenvs a 'test1' share

The ntacls_backup tests use the test1 share, and we want to run them
against the restoredc (which has SMBv1 disabled).

The xattr.tdb file is needed for the backend_obj.wrap_getxattr() call
(in ntacls.py) to work.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
7fb93eac by Tim Beale at 2019-01-17T00:40:31Z
tests: Run ntacls_backup tests against testenv with SMBv1 disabled

Just to prove that the NTACL backup works over SMBv2.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
065faa6a by Tim Beale at 2019-01-17T00:40:31Z
tests: Relax auth_log SMB assertions to cover v1 *or* v2

The s4 Python bindings currently only support SMBv1 connections.
If we change the bindings to support *either* v1 or v2, they'll
end up negotiating v2. In which case the server is "SMB2", not "SMB",
and these assertions fail.

Long-term we want to get rid of SMBv1, so it makes sense to write the
tests so that they pass against either v1 or v2.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e82e1b31 by Tim Beale at 2019-01-17T00:40:31Z
tests: Use MUST_USE_KERBEROS over AUTO_USE_KERBEROS in auth_log tests

The s3 SMB client bindings seem slightly different to s4, in that they
default to setting the CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS flag.
This seems to fallback to finding a valid KRB TGT (from a previous
successful test), which results in the connection succeeding rather than
failing.

Setting MUST_USE_KERBEROS explicitly avoids this behaviour.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
914e9d35 by Tim Beale at 2019-01-17T00:40:31Z
tests: Refactor auth_log SMB connection to be in a single place

This should not alter the behaviour of the tests at all. It just makes
it easier to switch over the underlying SMB client bindings.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a67b711e by Tim Beale at 2019-01-17T03:47:56Z
tests: Switchover auth_log from s4 SMB client bindings to s4

The main changes required are:
- we need to use an s3 loadparm instead of the standard s4 lp.
- the s3 SMB bindings don't support the use_spnego/ntlmv2_auth params,
  however, we can set these in the loadparm instead, which will get the
  SMB client code to do what we want. Instead of passing in boolean
  parameters, we need to use yes/no strings that the lp will accept.
  (We always set these values because the underlying lp context is
  actually global, and setting a value is 'sticky' and will persist
  across test cases. These conf settings are only used by the SMB client
  code, and so will only affect the SMB test cases).
- For the no_spnego_no_ntlmv2 test cases, we now explicitly force it to
  an SMBv1 connection. The s4 bindings only ever supported SMBv1
  connections, so this is the same behaviour. The other test cases will
  now try to negotiate SMBv2 connections, however, the no_ntlmv2 test
  cases are explicitly checking for bare-NTLM (with the s3 bindings, it
  now ends up as NTLMSSP by default).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Jan 17 04:47:56 CET 2019 on sn-devel-144

- - - - -
1937b0cb by Andreas Schneider at 2019-01-17T10:35:12Z
generate_param.py: Use C99 initializer for last element in param table

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
48285a9c by Andreas Schneider at 2019-01-17T10:35:12Z
s4:librpc: Use C99 initializer for PyGetSetDef in py_auth

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
b8c248e4 by Tim Beale at 2019-01-17T14:23:23Z
dns_hub: Rename variable to avoid naming collision in exception handler

In dns_hup.py, we are both importing the socket module and declaring a
variable called socket. When we try to catch a socket.error exception
(defined by the module), Python thinks we're referring to the variable.
As the variable has no attribute called 'error', Python throws an
exception, e.g.:

  File "./bin/python/samba/tests/dns_forwarder_helpers/dns_hub.py", line
123, in handle
    except socket.error as err:
AttributeError: 'socket' object has no attribute 'error'

We can avoid this problem by calling the variable 'sock' instead.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Jan 17 15:23:23 CET 2019 on sn-devel-144

- - - - -
528d3396 by Christof Schmitt at 2019-01-18T11:58:16Z
wscript: Make non_posix_acls a subsystem

This fixes build error when building vfs_gpfs as static module:

ERROR: circular library dependency between smbd_base and non_posix_acls

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
fd789b2c by Christof Schmitt at 2019-01-18T11:58:16Z
third_party: Add gpfs.h header file

This is the only requirement for building the vfs_gpfs module; the
corresponding library is opened through dlopen at runtime. The intent
here is to always build the vfs_gpfs module to easily detect breakage
e.g. due to vfs interface changes.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
c41ec2a9 by Christof Schmitt at 2019-01-18T16:21:02Z
lib: Use gpfs.h from third_party on Linux

Update the logic for finding the gpfs.h header file: Look for the header
file in the default location under /usr/lpp/mmfs/include. If it is not
available there, default to the file in third_party/gpfs/ on Linux (AIX
could be added if there is demand).

The configure option --with-gpfs=GPFS_HEADERS_DIR can always be used to
overwrite the default behavior with a specific location.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Fri Jan 18 17:21:02 CET 2019 on sn-devel-144

- - - - -
c5a69c9f by Puran Chand at 2019-01-18T19:11:22Z
s3:libsmb: parse_finfo_id_both_directory_info capture FileID in SMB2_FIND_ID_BOTH_DIRECTORY_INFO response

This captures the FileID in struct file_info while parsing SMB2_FIND_ID_BOTH_DIRECTORY_INFO
response

Refered MS doc for spec:- https://msdn.microsoft.com/en-us/library/cc246290.aspx

Signed-off-by: Puran Chand <pchand at vmware.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2c113522 by Jeremy Allison at 2019-01-18T19:11:22Z
s3:libsmb: Store file allocation size in struct file_info.

We get this already, from SMB2_FIND_ID_BOTH_DIRECTORY_INFO
so return it.

For SMB1 leave this as zero so callers know it hasn't
been initialized.

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
4b26ccff by Martin Krämer at 2019-01-18T22:19:13Z
python: dsal: Fix possibility of identical ACE's being added.

Currently it is possible to add the same ace multiple times if
the case sensitivity does not match the existing one using "--sddl" parameter.
As an example while an ace

"OA;CIIO;RPWP;3e978925-8c01-11d0-afda-00c04fd930c9;bf967a86-0de6-11d0-a285-00aa003049e2;PS"

already exists a sddl

"OA;CIIO;RPWP;3E978925-8C01-11D0-AFDA-00C04FD930C9;BF967A86-0DE6-11D0-A285-00AA003049E2;PS"

can be added without detection (and can be added multiple times). As an end result
after a high number of addings (in my tests it was about 1600-1800 aces for one
object) no further changes on that object are possible.

Signed-off-by: Martin Krämer <mk.maddin at gmail.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Rowland Penny <rpenny at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Jan 18 23:19:13 CET 2019 on sn-devel-144

- - - - -
5822449a by Andreas Schneider at 2019-01-19T11:24:18Z
s3:lib: Fix the debug message for adding cache entries.

To get correct values, we need to cast 'timeout' to 'long int' first in
order to do calculation in that integer space! Calculations are don in
the space of the lvalue!

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
f3c30b2f by Andreas Schneider at 2019-01-19T11:24:18Z
lib:mscat: Fix may be used uninitialized warnings

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
56bbfd90 by Andreas Schneider at 2019-01-19T11:24:18Z
lib:mscat: Use size_t for len value to fix build issue

asn1_read_value_type() only uses it as an unsigned it, a negative value
isn't assinged.

Signed-off-by: Andreas Schneider <asn at samba.org>

- - - - -
9ac30e77 by Andreas Schneider at 2019-01-19T11:24:18Z
s4:dsdb: Fix size types in audit_log

audit_log.c:878:7: error: assuming signed overflow does not occur when
simplifying conditional to constant [-Werror=strict-overflow]

Signed-off-by: Andreas Schneider <asn at samba.org>

- - - - -
c195134e by Andreas Schneider at 2019-01-19T11:24:18Z
s4:dsdb: Fix size type for num_of_attrs in acl_read

This fixes a compile error on sn-devel184.

Signed-off-by: Andreas Schneider <asn at samba.org>

- - - - -
448d67ba by Andreas Schneider at 2019-01-19T14:36:51Z
s4:kdc: Fix size type for num_bind in kdc-heimdal

This fixes a compile error on sn-devel184.

Signed-off-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Sat Jan 19 15:36:51 CET 2019 on sn-devel-144

- - - - -
fb049827 by Douglas Bagnall at 2019-01-19T18:21:19Z
python: dns_hub: do not crash if a socket fails

We print the error and keep going.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
011ee271 by Douglas Bagnall at 2019-01-19T18:21:19Z
python/uptodateness: cope with unknown invocation ID

This can happen if a server has been replaced

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7fc60ea5 by Douglas Bagnall at 2019-01-19T18:21:20Z
python/kcc lib: cope with differently formed repsToFrom

samba-tool visualise reuses these libraries to parse reps from other DCs, and Windows sometimes sends
more data than we are expecting

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f4b3229f by Douglas Bagnall at 2019-01-19T18:21:20Z
s4/py_dsdb: catch/handle alloc failures in py_dsdb_normalise_attributes()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
942567af by Gary Lockyer at 2019-01-19T18:21:20Z
group_audit: Tests for error handling in group change

Add tests to exercise the error handling in
log_group_membership_changes.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
60aa7b36 by Gary Lockyer at 2019-01-19T21:32:05Z
group_audit: error handling in group change

Generate an appropriate log message in the event of an error
log_group_membership_changes.  As the changes have not been applied to
the database, there is no easy way to determine the intended changes.
This information is available in the "dsdbChange" audit messages, to
avoid replicating this logic for what should be a very rare occurrence
we simply log it as a "Failure"

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Sat Jan 19 22:32:05 CET 2019 on sn-devel-144

- - - - -
08ba013a by Anoop C S at 2019-01-19T23:31:25Z
s4/messaging: Fix undefined reference in linking libMESSAGING-samba4.so

Early check for DEVELOPER or ENABLE_SELFTEST configure options inside
messaging_handlers.c leaves us with the following undefined reference
linkage error:

[1315/3712] Linking bin/default/source4/lib/messaging/libMESSAGING-samba4.so
/usr/bin/ld: source4/lib/messaging/messaging.c.4.o: in function
						`imessaging_init_internal':
/root/samba.git/bin/default/../../source4/lib/messaging/messaging.c:472:
		undefined reference to `imessaging_register_extra_handlers'
collect2: error: ld returned 1 exit status

This happened due to failure in including "includes.h" before checking
the above mentioned configure options.

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0628ca2a by Lukas Slebodnik at 2019-01-20T02:49:59Z
tdb: Fix compatibility of wscript with older python

Traceback (most recent call last):
  File "tdb-1.3.17/third_party/waf/waflib/Scripting.py", line 158, in waf_entry_point
    run_commands()
  File "tdb-1.3.17/third_party/waf/waflib/Scripting.py", line 251, in run_commands
    ctx = run_command(cmd_name)
  File "tdb-1.3.17/third_party/waf/waflib/Scripting.py", line 235, in run_command
    ctx.execute()
  File "tdb-1.3.17/third_party/waf/waflib/Context.py", line 204, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "tdb-1.3.17/third_party/waf/waflib/Context.py", line 286, in recurse
    user_function(self)
  File "tdb-1.3.17/wscript", line 225, in testonly
    cmd = "BINDIR={} {}".format(blddir, sh_test)
ValueError: zero length field name in format

Signed-off-by: Lukas Slebodnik <lslebodn at fedoraproject.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Sun Jan 20 03:49:59 CET 2019 on sn-devel-144

- - - - -
10e54a09 by Tim Beale at 2019-01-21T15:34:06Z
netcmd: Try to improve domain backup error message

I ran this command as non-root by mistake and didn't find the error
message particularly helpful. Tweak the error message so it reminds the
user that they should be root. Also display the path we're looking for
the sam.ldb file in, to give them more clues.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Mon Jan 21 16:34:06 CET 2019 on sn-devel-144

- - - - -
adffe0dc by Günther Deschner at 2019-01-22T17:37:56Z
s3-vfs: add glusterfs_fuse vfs module.

This module only implements the get_real_filename function by accessing
a distinct extended attribute that is available over a glusterfs fuse
mount.

By implementing this vfs function users of a glusterfs fuse mount
achieve a much better performance in create based workloads where samba
then can avoid trying multiple case folding options to detect the real
filename.

Patch is based on an initial patch provided by
Poornima G <pgurusid at redhat.com>

Guenther

Signed-off-by: Günther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Tue Jan 22 18:37:56 CET 2019 on sn-devel-144

- - - - -
36c42e6d by Jeremy Allison at 2019-01-22T22:37:16Z
libcli: dns: Change internal DNS_REQUEST_TIMEOUT from 2 to 10 seconds.

Should make us more robust when dealing with slow DNS servers.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Jan 22 23:37:16 CET 2019 on sn-devel-144

- - - - -
4729c90f by Joe Guo at 2019-01-23T02:09:41Z
traffic: rm --scale-traffic default value

-S, --scale--traffic defaults to 1.0
when we switch to new option -T, both -T and -S are set, which raise an error:

script/traffic_replay #234: --scale-traffic and --packets-per-second are incompatible. Use one or the other.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

Autobuild-User(master): Tim Beale <timbeale at samba.org>
Autobuild-Date(master): Wed Jan 23 03:09:41 CET 2019 on sn-devel-144

- - - - -
574fdfae by Ralph Boehme at 2019-01-23T11:41:32Z
CI: run "samba-nt4" as part of the free runners

Looks like this got lost in the py2/py3 reshuffling around
d01d85ccb255cbdfd3d379dfe0cd7ac58af7f284.

Signed-off-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Jan 23 12:41:32 CET 2019 on sn-devel-144

- - - - -
9f666969 by SATOH Fumiyasu at 2019-01-23T17:49:17Z
docs-xml: Fix a typo in manpage for idmap_ad

Signed-off-by: SATOH Fumiyasu <fumiyas at osstech.co.jp>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
c9940272 by Anoop C S at 2019-01-23T20:59:10Z
s3-vfs: Use ENOATTR in errno comparison for getxattr

* ENODATA is not defined in FreeBSD
* ENOATTR is defined to be a synonym for ENODATA in Linux
* In its absence Samba already defines ENOATTR to either
  ENODATA or ENOENT

Thus it is safe and correct to compare with ENOATTR rather
than ENODATA.

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Uri Simchoni <uri at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jan 23 21:59:10 CET 2019 on sn-devel-144

- - - - -
67fc683a by Ralph Boehme at 2019-01-24T01:45:09Z
CI: move target "build_nt4" to private gitlab runners

Fixes the mistake of 574fdfae59c6d7c97be48ca52ac9aefac82feccd that added
"build_nt4" to the public runners.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

Autobuild-User(master): Tim Beale <timbeale at samba.org>
Autobuild-Date(master): Thu Jan 24 02:45:09 CET 2019 on sn-devel-144

- - - - -
e903d37e by Tim Beale at 2019-01-25T12:20:23Z
s3:rpclient: rpclient help is not very helpful

The help was not telling me that there was a mandatory 'server' argument
that I needed to specify. After trying several different combinations
of parameters, I eventually had to run the tool in gdb to work out why
it was complaining.

This is the output I was getting:

bin/rpcclient -U$USERNAME%$PASSWORD -I $SERVER_IP
Usage: rpcclient [OPTION...]
  -c, --command=COMMANDS                 Execute semicolon separated
cmds
  -I, --dest-ip=IP                       Specify destination IP address
  -p, --port=PORT                        Specify port number
...

New help output is:

Usage: rpcclient [OPTION...] <server>
Options:
  -c, --command=COMMANDS                 Execute semicolon separated
cmds
...

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
7b21b4c1 by Jeremy Allison at 2019-01-25T12:20:23Z
s3: tests: Add regression test for smbd crash on share force group change with existing connection.

Mark as known fail for now.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
e37f9956 by Jeremy Allison at 2019-01-25T15:31:27Z
smbd: uid: Don't crash if 'force group' is added to an existing share connection.

smbd could crash if "force group" is added to a
share definition whilst an existing connection
to that share exists. In that case, don't change
the existing credentials for force group, only
do so for new connections.

Remove knownfail from regression test.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Fri Jan 25 16:31:27 CET 2019 on sn-devel-144

- - - - -
d93f901e by Isaac Boukris at 2019-01-25T20:57:57Z
Fix tests when building with selftest but without developer

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Fri Jan 25 21:57:57 CET 2019 on sn-devel-144

- - - - -
8c097b4a by Tim Beale at 2019-01-25T23:53:10Z
s3:pylibsmb: Initialize pointers to NULL in new API code

Fix a few uninitialized pointers that managed to sneak through review.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
80685fd8 by Tim Beale at 2019-01-26T03:05:25Z
s4:libcli: Remove (now unused) pysmb.c bindings

The s4 SMB client bindings don't support SMBv2, so we've made the
decision to use the s3 SMB client bindings/library code instead.
Everything in the Samba codebase now uses the s3 bindings, and we'll
add a warning message to Samba v4.10 that the s4 bindings are
deprecated. This patch removes the unused s4 bindings completely for
the next (i.e. v4.11) release.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Jan 26 04:05:25 CET 2019 on sn-devel-144

- - - - -
8989916b by Andreas Schneider at 2019-01-26T18:08:12Z
gitlab-ci: Move the image definition to the template

And in addition use variables for defining project and build env.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5aee11c2 by Andreas Schneider at 2019-01-26T18:08:12Z
gitlab-ci: Move before and after script to shared template

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b9924839 by Andreas Schneider at 2019-01-26T21:16:38Z
gitlab-ci: Use artifacts instead of after_script

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Sat Jan 26 22:16:38 CET 2019 on sn-devel-144

- - - - -
db6992c2 by Andreas Schneider at 2019-01-28T09:29:12Z
ctdb: Use C99 initializer for poptOption in ctdb tool

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
23709cc3 by Andreas Schneider at 2019-01-28T09:29:12Z
ctdb: Use C99 initializer for poptOption in test_options

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
d304d3c6 by Andreas Schneider at 2019-01-28T09:29:12Z
examples: Reformat testacl libsmbclient example

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
007898bf by Andreas Schneider at 2019-01-28T09:29:12Z
examples: Use C99 initializer for poptOption in testacl

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
cbf8917b by Andreas Schneider at 2019-01-28T09:29:12Z
lib:texpect: Use C99 initializer for poptOption in texpect

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
cdf03f92 by Andreas Schneider at 2019-01-28T09:29:12Z
libcli:nbt: Use C99 initializer for poptOption in nmblookup

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
53e2e8c3 by Andreas Schneider at 2019-01-28T09:29:12Z
nsswitch: Use C99 initializer for poptOption in wbinfo

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
b0dbc7d1 by Andreas Schneider at 2019-01-28T09:29:13Z
s3:client: Use C99 initializer for poptOption in smbclient

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
3834ea86 by Andreas Schneider at 2019-01-28T09:29:13Z
s3:rpcclient: Use C99 initializer for poptOption in cmd_witness

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
9a15d458 by Andreas Schneider at 2019-01-28T09:29:13Z
s3:smbd: Use C99 initializer for poptOption in smbd server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a3aca2f7 by Andreas Schneider at 2019-01-28T09:29:13Z
s3:torture: Use C99 initializer for poptOption in vfstest

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
83d25ca9 by Andreas Schneider at 2019-01-28T09:29:13Z
s3:utils: Use C99 initializer for poptOption in smbstatus

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5990980c by Andreas Schneider at 2019-01-28T09:29:13Z
s3:utils: Use C99 initializer for poptOption in smbcacls

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
19d44958 by Andreas Schneider at 2019-01-28T09:29:13Z
s3:utils: Use C99 initializer for poptOption in nmblookup

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
aa944d50 by Andreas Schneider at 2019-01-28T09:29:13Z
s3:utils: Use C99 initializer for poptOption in profiles

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0fde49ac by Andreas Schneider at 2019-01-28T09:29:14Z
s3:utils: Use C99 initializer for poptOption in sharesec

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a2bb5654 by Andreas Schneider at 2019-01-28T09:29:14Z
s3:utils: Use C99 initializer for poptOption in ntlm_auth

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f5f084e9 by Andreas Schneider at 2019-01-28T09:29:14Z
s3:utils: Use C99 initializer for poptOption in smbcquotas

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
7c8d4f21 by Andreas Schneider at 2019-01-28T09:29:14Z
s3:utils: Use C99 initializer for poptOption in testparm

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5961286f by Andreas Schneider at 2019-01-28T09:29:14Z
s3:utils: Use C99 initializer for poptOption in log2pcaphex

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
90103d1d by Andreas Schneider at 2019-01-28T09:29:14Z
s3:utils: Use C99 initializer for poptOption in net

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0de35fd3 by Andreas Schneider at 2019-01-28T09:29:14Z
s3:utils: Use C99 initializer for poptOption in smbtree

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f699cec7 by Andreas Schneider at 2019-01-28T09:29:15Z
s3:utils: Use C99 initializer for poptOption in smbget

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
4c3ada25 by Andreas Schneider at 2019-01-28T09:29:15Z
s3:param: Use C99 initializer for poptOption in test_lp_load

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
650af8bf by Andreas Schneider at 2019-01-28T09:29:15Z
s3:winbind: Use C99 initializer for poptOption in winbindd

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
54c1ab6d by Andreas Schneider at 2019-01-28T09:29:15Z
s3:lib: Use POPT_TABLEEND for last element of poptOption

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
d34edc6b by Andreas Schneider at 2019-01-28T09:29:15Z
s3:lib: Use C99 initializer for poptOption in netapi common test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f68d6aa3 by Andreas Schneider at 2019-01-28T09:29:15Z
s3:lib: Use C99 initializer for poptOption in netapi nltest

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
fd499b7f by Andreas Schneider at 2019-01-28T09:29:15Z
s3:lib: Use C99 initializer for poptOption in popt_common

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
1cde483c by Andreas Schneider at 2019-01-28T09:29:16Z
s3:lib: Use C99 initializer for poptOption in popt_common_cmdline

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
025b32e5 by Andreas Schneider at 2019-01-28T09:29:16Z
s3:netapi: Use C99 initializer for poptOption in netapi example

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
e9ef830f by Andreas Schneider at 2019-01-28T09:29:16Z
s3:nmbd: Use C99 initializer for poptOption in nmbd

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
3a5cd0a3 by Andreas Schneider at 2019-01-28T09:29:16Z
s3:utils: Use C99 initializer for poptOption in mvxattr

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
ee8f0986 by Andreas Schneider at 2019-01-28T09:29:16Z
s4:smbd: Use C99 initializer for poptOption in server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
ad13bd56 by Andreas Schneider at 2019-01-28T09:29:16Z
s4:client: Use C99 initializer for poptOption in client

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f66ead39 by Andreas Schneider at 2019-01-28T09:29:16Z
s4:client: Use C99 initializer for poptOption in cifsdd

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
ded66cf3 by Andreas Schneider at 2019-01-28T09:29:16Z
s4:lib: Use C99 initializer for poptOption in popt_common

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2b6706fb by Andreas Schneider at 2019-01-28T09:29:17Z
s4:lib: Use C99 initializer for poptOption in popt_credentials

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
34ae8dc3 by Andreas Schneider at 2019-01-28T09:29:17Z
s3:torture: Use C99 initializer for cmd_set in cmd_vfs

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
78b45a47 by Andreas Schneider at 2019-01-28T09:29:17Z
s3:torture: Use C99 initializer for cmd_set in vfstest

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
65729e37 by Andreas Schneider at 2019-01-28T09:29:17Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_spoolss

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5b298d30 by Andreas Schneider at 2019-01-28T09:29:17Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_dfs

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
281c5107 by Andreas Schneider at 2019-01-28T09:29:17Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_netlogon

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6087decf by Andreas Schneider at 2019-01-28T09:29:17Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_srvsvc

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
d1695761 by Andreas Schneider at 2019-01-28T09:29:18Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_echo

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
17d166e6 by Andreas Schneider at 2019-01-28T09:29:18Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_drsuapi

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
8cb851ff by Andreas Schneider at 2019-01-28T09:29:18Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_dssetup

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2bec9593 by Andreas Schneider at 2019-01-28T09:29:18Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_wkssvc

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
711cb035 by Andreas Schneider at 2019-01-28T09:29:18Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_fss

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a1765267 by Andreas Schneider at 2019-01-28T09:29:18Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_winreg

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2069372e by Andreas Schneider at 2019-01-28T09:29:18Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_iremotewinspool

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
b7b78134 by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_ntsvcvs

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
d69fbf41 by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_clusapi

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
90b338e8 by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_samr

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
bbc4d8c5 by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_lsarpc

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
05afe962 by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in rpcclient

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f70dbe9f by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_witness

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
eee66741 by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_eventlog

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
328cb7aa by Andreas Schneider at 2019-01-28T09:29:19Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5701586d by Andreas Schneider at 2019-01-28T09:29:20Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_epmapper

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0a6f78d7 by Andreas Schneider at 2019-01-28T09:29:20Z
s3:rpcclient: Use C99 initializer for cmd_set in cmd_shutdown

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
651ee7f2 by Andreas Schneider at 2019-01-28T09:29:20Z
lib:tdb: Use C99 initializer for PyGetSetDef in pytdb

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
85a5dc56 by Andreas Schneider at 2019-01-28T09:29:20Z
lib:ldb: Use C99 initializer for PyGetSetDef in pyldb

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2baa2c0f by Andreas Schneider at 2019-01-28T09:29:20Z
s3:passdb: Use C99 initializer for PyGetSetDef in py_passdb

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
7017f245 by Andreas Schneider at 2019-01-28T09:29:20Z
s4:librpc: Use C99 initializer for PyGetSetDef in pyrpc

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
ee4795b9 by Andreas Schneider at 2019-01-28T09:29:20Z
s4:lib: Use C99 initializer for PyGetSetDef in pymessaging

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
d538319e by Andreas Schneider at 2019-01-28T09:29:21Z
s4:pyparam: Use C99 initializer for PyGetSetDef

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
246f7dd7 by Andreas Schneider at 2019-01-28T09:29:21Z
auth:creds: Use C99 initializer for PyMethodDef

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
14c7d19b by Andreas Schneider at 2019-01-28T09:29:21Z
auth:gensec: Use C99 initializer in schannel

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
611b6c7e by Andreas Schneider at 2019-01-28T09:29:21Z
ctdb: Use C99 initializer for last element of tunables

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6c520978 by Andreas Schneider at 2019-01-28T09:29:21Z
ctdb:common: Use C99 initializer for 'struct ifreq'

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
fb57c97c by Andreas Schneider at 2019-01-28T09:29:21Z
ctdb:tools: Use correct C99 initializer for ltdb_header

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
3cd5d4b3 by Andreas Schneider at 2019-01-28T09:29:21Z
lib:ldb: Use C99 initializer for tdb_logging_context

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
146ed089 by Andreas Schneider at 2019-01-28T09:29:21Z
lib:ldb: Use correct C99 initializer for 'struct tm'

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a1ce666d by Andreas Schneider at 2019-01-28T09:29:22Z
lib:tdb: Use C99 initializer for tdb_header

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
47b57a2f by Andreas Schneider at 2019-01-28T09:29:22Z
lib:tdb: Use C99 initializer for tdb_logging_context

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0da2e9c2 by Andreas Schneider at 2019-01-28T09:29:22Z
lib:tevent: Use correct C99 initializer for tevent_req

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
014a72c7 by Andreas Schneider at 2019-01-28T09:29:22Z
lib:util: Use C99 initializer for builtin_functions in iconv

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
fe78ebcb by Andreas Schneider at 2019-01-28T09:29:22Z
lib:util: Use C99 initializer for weird_table in charset

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
7983b03a by Andreas Schneider at 2019-01-28T09:29:22Z
lib:util: Use C99 initializer in tfork test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
bbc4d728 by Andreas Schneider at 2019-01-28T09:29:22Z
libgpo: Use C99 initializer for gp_extension_reg_table

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
292dbbf1 by Andreas Schneider at 2019-01-28T09:29:23Z
librpc:rpc: Use C99 initializer for last element in dcerpc_faults

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
99c2a24e by Andreas Schneider at 2019-01-28T09:29:23Z
sddl: Use C99 initializer for sid_codes

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5e0923d8 by Andreas Schneider at 2019-01-28T09:29:23Z
s3:registry: Use C99 initializer for BOM

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
58b4f48c by Andreas Schneider at 2019-01-28T09:29:23Z
s3:lib: Use C99 initializer for audit_category_tab

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
4bb10422 by Andreas Schneider at 2019-01-28T09:29:23Z
s3:smbd: Use C99 initializer for RAP api_commands

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
e73ff643 by Andreas Schneider at 2019-01-28T09:29:23Z
s3:torture: Use C99 initializer for torture_ops

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
4ad94b60 by Andreas Schneider at 2019-01-28T09:29:23Z
s3:utils: Use C99 initializer for msg_types in smbcontrol

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2eab064a by Andreas Schneider at 2019-01-28T09:29:23Z
s3:utils: Use C99 initializer in functable in net_lookup

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0e28116e by Andreas Schneider at 2019-01-28T09:29:24Z
s3:utils: Use C99 initializer in functable in net

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
8e1f9675 by Andreas Schneider at 2019-01-28T09:29:24Z
s4:dsdb: Use C99 initializer in util

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
4d1ae190 by Andreas Schneider at 2019-01-28T09:29:24Z
s4:samdb: Use C99 initializer for last element of ldb_map_objectclass

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6395a9a8 by Andreas Schneider at 2019-01-28T09:29:24Z
s4:torture: Use C99 initializers for dirs in oplock test

Yes, this was already valid C99 but the compiler on Ubuntu 14.04 simply
sucks. This doesn't happen with this gcc version on other Linux systems.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
8647ae63 by Andreas Schneider at 2019-01-28T09:29:24Z
s4:torture: Use C99 initializers for levels in qfsinfo test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2df8e808 by Andreas Schneider at 2019-01-28T09:29:24Z
s4:torture: Use C99 initializers for dirs in smb2 notify test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
1474de31 by Andreas Schneider at 2019-01-28T09:29:24Z
s4:torture: Use C99 initializers for levels in raw search test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
d731ddf8 by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Use C99 initializers for levels in raw notify test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
7ceffb31 by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Use C99 initializers for dirs in smb2 oplock test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a5362457 by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Use C99 initializers for hold_sharemode_table in smb2 sharemode test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
660428a2 by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Use C99 initializers for level in smb2 dir test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0bcbec40 by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Use C99 initializers for file_levels in smb2 getinfo test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6b0963f6 by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Complete C99 initializers for levels in raw qfileinfo test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
7c9abe78 by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Use C99 initializer for last element in get_and_set_info

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
c0a6f69e by Andreas Schneider at 2019-01-28T09:29:25Z
s4:torture: Use C99 initializer in test_SecurityDescriptorsSecInfo

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
3e3e3a92 by Andreas Schneider at 2019-01-28T09:29:26Z
s4:torture: Add missing C99 initializer for torture_rpc_samlogon

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
bb5b1c80 by Andreas Schneider at 2019-01-28T09:29:26Z
s4:torture: Use C99 initializers in gentest

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
4609e6fb by Andreas Schneider at 2019-01-28T09:29:26Z
s4:torture: Fix C99 initializers for vfs fruit tests

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
8c774f5a by Andreas Schneider at 2019-01-28T09:29:26Z
s4:cifsdd: Use C99 initializers for cifsdd argdef

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6a332618 by Andreas Schneider at 2019-01-28T09:29:26Z
libcli:smb: Use C99 initializer for derivation in smbXcli_base

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
1c4ba8e9 by Douglas Bagnall at 2019-01-28T09:29:26Z
pyrpc: typo in transfer syntax docstring

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
1f37ac3b by Douglas Bagnall at 2019-01-28T09:29:26Z
libgpo: remove duplicate entry in value table

previously added a few lines up.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
9e4ddff2 by Douglas Bagnall at 2019-01-28T09:29:26Z
libgpo: remove 404 link in comment

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
ed209cfe by Douglas Bagnall at 2019-01-28T13:28:29Z
s3:nmbd: small improvements in --help strings

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Jan 28 14:28:29 CET 2019 on sn-devel-144

- - - - -
e2eadf9a by Justin Stephenson at 2019-01-28T14:44:18Z
s4:torture: Share test iremotewinspool functions

Create iremotewinspool_common.c and iremotewinspool_common.h to make
test functions available for additional tests

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
8f240b12 by Justin Stephenson at 2019-01-28T14:44:18Z
s4:torture: Seperate out function calls inside params

Minor change to allow for easier debugging

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
5c1514e6 by Justin Stephenson at 2019-01-28T14:44:18Z
librpc:idl: Fix pszDestInfPath winspool parameter type

The in/out type of pszDestInfPath needs to be a string type for
RPC call UploadPrinterDriverPackage.

Per the Spec:

[in, out, unique, size_is(*pcchDestInfPath)] wchar_t* pszDestInfPath,

 pszDestInfPath: A pointer to a buffer that receives a string that
 specifies the full path of the directory to which the driver
 installation control file was copied.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
a9c50a71 by Justin Stephenson at 2019-01-28T14:44:18Z
s4:torture: Add iremotewinspool driver torture template

Add the template with setup and teardown functions
for the iremotewinspool_driver torture suite, and
add this to the list of torture tests

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
5e97d3cd by Justin Stephenson at 2019-01-28T14:44:18Z
s4:torture: Use test client user and machine name defaults

Use "testclient_machine" and "testclient_user" in open printer calls.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
7abf1d03 by Andreas Schneider at 2019-01-28T14:44:18Z
util: Add file tree walk interface

Add tftw() utility to emulate nftw() behavior with a userdata pointer.
This is repurposed from the csync project custom file tree walker.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
7d42029f by Günther Deschner at 2019-01-28T14:44:18Z
utils:libgpo: re-add libgpo as library, it should not be part of gpext

It was initially removed in 78fd02cf31dfe72d596030f342aebefba1e72263 but
is needed by the inf file parsing.

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
b6712ab9 by Guenther Deschner at 2019-01-28T14:44:18Z
lib:printer_driver: Add printer_driver library to parse printer driver inf files

Pair-Programmed-With: Justin Stephenson <jstephen at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
04d92b00 by Justin Stephenson at 2019-01-28T14:44:18Z
lib:printer_driver: Handle PrintProcessor string

This fixes an issue parsing the section of a certain HP
driver inf file:

PrintProcessor=%PRINT_PROCESSOR%

where %PRINT_PROCESSOR% is a [Strings] substituted value,
gp_inifile_getstring_ext() performs the substitution correctly.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
16638011 by Justin Stephenson at 2019-01-28T14:44:18Z
lib:printer_driver: Parse SourceDisksNames section

This allows a driver inf with a [SourceDisksNames] section
excluding the system architecture to be parsed.

https://docs.microsoft.com/en-us/windows-hardware/drivers/install/inf-sourcedisksnames-section?f=255&MSPPError=-2147217396

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
5442355c by Justin Stephenson at 2019-01-28T14:44:18Z
lib:printer_driver: Don't overwrite printprocessor

If the printprocessor is parsed from the inf file in the codepath:

setup_driver_name
  find_driver_files
    process_driver_section_printprocessor

Don't overwrite the value later on in setup_driver_name with the default "winprint"

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
7783c62b by Justin Stephenson at 2019-01-28T14:44:18Z
lib:printer_driver: Retrieve Class value

Retrieve the Class value from the inf file [Version] section.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
1ac1b3e1 by Justin Stephenson at 2019-01-28T14:44:19Z
s4:torture: Add driver parsing wrapper

Add wrapper function to parse inf driver file and get
validated driver information.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
01f1bd3f by Justin Stephenson at 2019-01-28T14:44:19Z
s4:torture: Add test_init_driver_info function

Validate torture options, obtain and retrieve driver information, and
call driver parsing function to retrieve driver info needed for
performing the test.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
a9619abb by Justin Stephenson at 2019-01-28T14:44:19Z
s4:torture: Add test_CopyDriverFiles

Add test to copy driver files from a torture option provided local driver_path
to the print$ share of //server/.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
a9f283c8 by Justin Stephenson at 2019-01-28T14:44:19Z
s4:torture: Add test_UploadPrinterDriverPackage

Add test to Upload Print Driver, a prerequisite RPC call before
installing the print driver. The inf driver file to use in this test
will be provided using torture option:inf_file

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
c627b4e3 by Justin Stephenson at 2019-01-28T14:44:19Z
s4:torture: Add test_InstallPrinterDriverFromPackage

Install a previous uploaded driver package.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
38967fd9 by Justin Stephenson at 2019-01-28T14:44:19Z
s4:torture: Add test_ValidatePrinterDriverInstalled

Perform checks against the print driver registry information
to ensure the driver was installed as expected.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
669b135b by Justin Stephenson at 2019-01-28T14:44:19Z
s4:torture: Uninstall driver and cleanup

Uninstall and remove the print driver packages to cleanup
after the install. Cleanup and remove smb directory created
inside print$.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
232273bf by Justin Stephenson at 2019-01-28T18:34:41Z
s4:torture: Enforce Printer Class

Ensure that the provided inf defines Class=Printer for driver installation
to succeed.

Some driver packages(HP Universal Print Driver) include inf files with
other device types such as Class=USB. Attempting to install these will fail
when tested against Windows Server 2016 Print server using
iremotewinspool RPC calls.

Signed-off-by: Justin Stephenson <jstephen at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

Autobuild-User(master): Björn Jacke <bjacke at samba.org>
Autobuild-Date(master): Mon Jan 28 19:34:41 CET 2019 on sn-devel-144

- - - - -
45a202a1 by David Disseldorp at 2019-01-28T23:29:17Z
s3/lib: don't rely on implicit int return type

C99 removed this behaviour.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f1b43dfe by David Disseldorp at 2019-01-28T23:29:17Z
s3/lib: clean up have_syscall() formatting

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e1324580 by David Disseldorp at 2019-01-29T02:47:27Z
tests: don't rely on implicit int return type

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Tue Jan 29 03:47:27 CET 2019 on sn-devel-144

- - - - -
1f07c478 by Douglas Bagnall at 2019-01-29T12:45:32Z
python/modules: maintain correct refcount for path items

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
3584fe46 by Douglas Bagnall at 2019-01-29T12:45:32Z
s3/py_passdb: maintain correct refcount on allocation failure

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
e23b9f88 by Douglas Bagnall at 2019-01-29T12:45:32Z
s4/pyrpc_util: appropriately decrement refcounts on failure

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
a3aa5af3 by Douglas Bagnall at 2019-01-29T12:45:32Z
s4/pyrpc_util: catch alloc failure in py_dcerpc_interface_init_helper()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
ca93b1e1 by Douglas Bagnall at 2019-01-29T15:54:48Z
s4/param/provision py_dom_sid_FromSid: avoid python memleak

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Tue Jan 29 16:54:48 CET 2019 on sn-devel-144

- - - - -
60b062d6 by Volker Lendecke at 2019-01-29T21:06:59Z
vfs_gpfs: Fix the 32-bit build

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Tue Jan 29 22:06:59 CET 2019 on sn-devel-144

- - - - -
8061983d by Stefan Metzmacher at 2019-01-29T21:09:07Z
wscript: separate embedded_heimdal from system_heimdal

This allows to default (embedded_heimdal) to build even with a
broken krb5-config file from Heimdal.

In the system_heimdal case we parse the content of krb5-config
instead of just executing it. This fails on FreeBSD 12 as
krb5-config contains iso-8859-1 characters, which can't be parsed
as unicode python buffers when using python3.

Fixing the system_heimdal case is a task for another day,
I guess it will only work once we imported a current heimdal version
and actually tested the system_heimdal case.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e49df24e by Stefan Metzmacher at 2019-01-29T21:09:07Z
replace: only include <sys/capability.h> with HAVE_POSIX_CAPABILITIES

On FreeBSD <sys/capability.h> is a legacy wrapper to <sys/capsicum.h>,
which implements something different. With FreeBSD 12 including
<sys/capability.h> generates a compiler warning/error.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
b2050db6 by Stefan Metzmacher at 2019-01-29T21:09:07Z
wafsamba/replace: move __STDC_WANT_LIB_EXT1__ to CFLAGS

This fixes the build of python bindings, which use memset_s()
(via ZERO_STRUCT).

In python bindings Python.h needs to be the first header, which means
is already includes string.h. Defining __STDC_WANT_LIB_EXT1__ in
replace.h is too late in that case.

This fixes the --check-c-compiler=gcc --picky-developer on FreeBSD 12.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c0ed5bd0 by Stefan Metzmacher at 2019-01-29T21:09:07Z
third_party/resolv_wrapper: fix HAVE_RESOLV_IPV6_NSADDRS for struct __res_state

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
8e7b63a1 by David Mulder at 2019-01-29T21:09:07Z
'articles' variable causes a dependency loop

This 'articles' variable contains
'smbdotconf/parameters.all.xml' and causes a
dependency loop when creating parameters.all.xml

Signed-off-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
0b66cf93 by Stefan Metzmacher at 2019-01-29T21:09:07Z
python/tests/dns*: make use of dns.DNS_RCODE/dns.DNS_OPCODE

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
29f9618e by Stefan Metzmacher at 2019-01-29T21:09:07Z
dns.idl: fix DNS_RCODE from 0xF to 0x1F

commit 74206984daa9c707a38675df88d6bbe660d876bc introduced
TSIG related error codes up to DNS_RCODE_BADALG   = 0x15

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
7a7a5ccf by Lukas Slebodnik at 2019-01-29T21:09:07Z
ldb: The test api.py should not rely on order of entries in dict

Test failed on s390x but there is a simple reproducer for any
architecture.

The built-in function repr returns the canonical string representation
of the object. We needn't care about order attributes in string
representation. Therefore test should pass for any order.

    for i in {1..30}; do
        PYTHONHASHSEED=random \
        python2 -c 'import ldb; msg = ldb.Message(); msg.dn = ldb.Dn(ldb.Ldb(), "dc=foo29"); msg["dc"] = b"foo"; print(repr(msg)) '
    done

  ======================================================================
  FAIL: test_repr (__main__.LdbMsgTests)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/python/api.py", line 2322, in test_repr
      "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])})")
  AssertionError: "Message({'dc': MessageElement(['foo']), 'dn': Dn('dc=foo29')})" != "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])})"
  ----------------------------------------------------------------------
  Ran 1025 tests in 29.146s
  FAILED (failures=1)

Signed-off-by: Lukas Slebodnik <lslebodn at fedoraproject.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
12b9adec by Stefan Metzmacher at 2019-01-29T21:09:07Z
manpages/samba.7.xml: smbcontrol can also work with 'samba'

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Björn Baumbach <bbaumbach at samba.org>

- - - - -
3a0c1da4 by Stefan Metzmacher at 2019-01-29T21:09:08Z
s4:messaging: add support 'smbcontrol <pid> debug/debuglevel'

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Björn Baumbach <bbaumbach at samba.org>

- - - - -
5bd7a8e5 by Stefan Metzmacher at 2019-01-29T21:09:08Z
s4:server: avoid using pid=0 for the parent 'samba' process

It confuses the 'samba-tool processes' output and log messages.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Björn Baumbach <bbaumbach at samba.org>

- - - - -
832776c0 by Stefan Metzmacher at 2019-01-29T21:09:08Z
s4:server: add support for 'smbcontrol samba shutdown'

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Björn Baumbach <bbaumbach at samba.org>

- - - - -
d03991f5 by Stefan Metzmacher at 2019-01-30T00:51:48Z
selftest:Samba4: use 'smbcontrol samba shutdown'

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Björn Baumbach <bbaumbach at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Jan 30 01:51:48 CET 2019 on sn-devel-144

- - - - -
dc9a2c05 by Jeremy Allison at 2019-01-30T20:21:10Z
s3: smbd: smb2-posix: Add IO_REPARSE_TAG_NFS.

https://msdn.microsoft.com/en-us/library/dn617178.aspx

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

- - - - -
abbaa629 by Jeremy Allison at 2019-01-30T23:50:10Z
s3: smbd: smb2-posix: Add NFS_SPECFILE_XXX defines.

Sub-types for NFS reparse point.

https://msdn.microsoft.com/en-us/library/dn617178.aspx

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

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Thu Jan 31 00:50:10 CET 2019 on sn-devel-144

- - - - -
4ecdcc4b by Gary Lockyer at 2019-01-31T03:25:13Z
man pages: document prefork process model

Document the process model options -M

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Tim Beale <timbeale at samba.org>
Autobuild-Date(master): Thu Jan 31 04:25:14 CET 2019 on sn-devel-144

- - - - -
5d5a790b by Tim Beale at 2019-02-01T02:36:15Z
dns_hub: Fix flake8 warnings

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a094e16f by Tim Beale at 2019-02-01T02:36:15Z
selftest: Move dns_hub.py into selftest directory

As dns_hub.py is now integral to the selftest environments, it seems to
make sense for it to live under the selftest/ directory.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b4211f69 by Tim Beale at 2019-02-01T02:36:15Z
selftest: Add dns_hub to selftest/target/README

Add a description explaining what dns_hub does and why we need it.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9a893f96 by Tim Beale at 2019-02-01T02:36:15Z
ldb: Avoid inefficient one-level searches

Commit 88ae60ed186c9 introduced a problem that made one-level
searches inefficient if there were a lot of child objects in the same
level, and the requested object didn't exist. Basically, it ignored the
case where ldb_kv_index_dn() returned LDB_ERR_NO_SUCH_OBJECT, i.e. the
indexed lookup was successful, but didn't find a match. At which point,
there was no more processing we needed to do.

The behaviour after 88ae60ed186c9 was to fall-through and run the
ldb_kv_index_filter() function over *all* the children. This still
returned the correct result, but could be costly if there were a lot of
children.

The case 88ae60ed186c9 was trying to fix was where we could not do
an indexed search (e.g. trying to match on a 'attribute=*' filter). In
which case we want to ignore the LDB_ERR_OPERATIONS_ERROR and just run
ldb_kv_index_filter() over all the children. This is still more
efficient than the fallback of doing a full database scan.

This patch adds in a short-circuit for the NO_SUCH_OBJECT case, so we
can skip the unnecessary ldb_kv_index_filter() work.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
72928444 by Tim Beale at 2019-02-01T02:36:15Z
ldb: Remove comment that no longer makes sense

This comment was written before the GUID_index_attribute block of code
existed. So we now *do* load the index values and *do* check for a
strict intersect, so the comment is redundant.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
13260068 by Tim Beale at 2019-02-01T02:36:15Z
ldb: Elaborate on ldb_kv_search_indexed() comments

Disclaimer: this is based on my limited understanding of what the code
is doing.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
57a565b2 by Tim Beale at 2019-02-01T02:36:15Z
ldb: Rename variable

The old name confused me because it's not really related to the
one-level index at all. It's the result from evaluating the indexed
search specified in the ac->tree.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e7f524fd by Andrew Bartlett at 2019-02-01T02:36:15Z
ldb: Add even more comments on what strict does to the list intersections

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
5e716c02 by Andrew Bartlett at 2019-02-01T02:36:15Z
ldb: Release ldb 1.5.3

* Avoid inefficient one-level searches (bug 13762)
* The test api.py should not rely on order of entries in dict (bug 13772)

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
3f8d83b7 by Tim Beale at 2019-02-01T02:36:16Z
samba: Change default process model to prefork

Prefork is the more sensible default option now, as it better
handles a large number of client connections.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
46033515 by Tim Beale at 2019-02-01T02:36:16Z
selftest: Make process_model argument optional in check_or_start()

It's more realistic to *not* always specify a process-model, and rely on
the samba code to use the correct default. This patch changes selftest
so we only use the -M process-model option if a particular process_model
was specified. Otherwise the testenv will use whatever the default is.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d29853ab by Tim Beale at 2019-02-01T02:36:16Z
selftest: Convert backup/restore testenvs to use default

These testenvs shouldn't be dependent on the process model at all, so we
should be able to convert them to the new default without any
repercussions.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c649aece by Tim Beale at 2019-02-01T02:36:16Z
man pages: Add note about standard process model

Calling this model the 'standard' model made a lot more sense when it
was the default. Add a small note explaining that it has this name for
historical reasons.

(The term 'standard' may have originally been chosen for some other
reason. However, it's hard to find the rationale behind the term from
back in 2005)

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
40271520 by Tim Beale at 2019-02-01T02:36:16Z
selftest: Fix running proclimit tests locally

The dns_hub changes missed a dependency. Fortunately, during an
autobuild, the dns_hub is always up and running by the time the
proclimitdc tests are run. However, the tests were failing if run
locally just on their own.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6cee31b0 by Tim Beale at 2019-02-01T02:36:16Z
selftest: Reorder ENV_DEPS so similar testenvs are together

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b2126cd6 by Tim Beale at 2019-02-01T02:36:16Z
selftest: Add comment elaborating on what ENV_DEPS actually does

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1e0db972 by Tim Beale at 2019-02-01T02:36:17Z
selftest: Remove unnecessary tests.py options from proclimit tests

It seems like these extra options were just copy-n-pasted from another
test. The process_limits test doesn't actually try to use these env
variables at all. All the test is doing is creating LDAP connections to
the DC. The SOCKET_WRAPPER_DEFAULT_IFACE may have perhaps been needed,
but we can avoid this by dropping ':local' from the testenv and running
the test as a "client" instead.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5bfad1b2 by Tim Beale at 2019-02-01T02:36:17Z
netcmd: Improve error handling of gpo aclcheck as non-admin

Reading the nTSecurityDescriptor attribute over LDAP requires admin
creds. However, if you don't specify admin creds, then you get an error
like this:

bin/samba-tool gpo aclcheck
ERROR(<class 'KeyError'>): uncaught exception - 'No such element'
  File "bin/python/samba/netcmd/__init__.py", line 184, in _run
    return self.run(*args, **kwargs)
  File "bin/python/samba/netcmd/gpo.py", line 1536, in run
    ds_sd_ndr = m['nTSecurityDescriptor'][0]

This patch adds an explicit check/error message to make the problem
clearer.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f00362fb by Garming Sam at 2019-02-01T02:36:17Z
cracknames: Change search filter to use the smaller index

In large domains with many users, '(objectClass=User)' may as well not
be specified because it's iterating over the entire database.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e0c05383 by Douglas Bagnall at 2019-02-01T02:36:17Z
Tests for segfaults in python bindings

These tests run in a child process and are regarded as succeeding if they
don't die by signal.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bdb41326 by Douglas Bagnall at 2019-02-01T02:36:17Z
pynbt: catch type errors in PyObject_AsNBTName()

This fixes some known segfaults.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ec1e5698 by Douglas Bagnall at 2019-02-01T02:36:17Z
pygensec: insist on proper AuthContext in start_server

Fixes another segfault.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a7e07413 by Douglas Bagnall at 2019-02-01T02:36:17Z
s4/pyauth: check ldb argument in py_user_session()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f17e36c3 by Douglas Bagnall at 2019-02-01T02:36:17Z
s4/pyauth: insist on proper ldb in context_new()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1f9ac913 by Douglas Bagnall at 2019-02-01T02:36:17Z
s4/pyauth: fix memory leak when context_new() has bad arguments

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b313a6aa by Douglas Bagnall at 2019-02-01T02:36:17Z
s4/param/provision: check samdb argument in provision_bare()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3da801ae by Douglas Bagnall at 2019-02-01T02:36:17Z
py_net: fix != None check

Py_None is not false in C, so this branch was always taken.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0e419a21 by Douglas Bagnall at 2019-02-01T02:36:18Z
pyldb: make ldb.connect() url mandatory

The call fails without it, so we might as well fail sooner

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
545c3e6b by Andrew Bartlett at 2019-02-01T06:02:56Z
ldb: Release ldb 1.6.0

* pyldb: make ldb.connect() url mandatory
* New version number for master (Samba 4.11 eventually)

The 1.5.x series will be maintained in the v4-10-test branch

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Feb  1 07:02:56 CET 2019 on sn-devel-144

- - - - -
bdb90ec9 by David Disseldorp via samba-technical at 2019-02-01T15:08:25Z
build: replace SAMBA3_ADD_OPTION with samba_add_onoff_option

The former is just an alias for the latter. samba_add_onoff_option()
better describes what the function actually does, so use that and
remove the alias.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
0ae7c314 by David Disseldorp at 2019-02-01T15:08:25Z
printing: drop pcap_cache_loaded() guard around load_printers()

Add the pcap_cache_loaded() check to load_printers() and return early
if it returns false. This simplifies callers in preparation for checking
lp_load_printers() in the printcap cache update code-path.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13766

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
6a77237c by David Disseldorp at 2019-02-01T18:25:03Z
printing: check lp_load_printers() prior to pcap cache update

Avoid explicit and housekeeping timer triggered printcap cache updates
if lp_load_printers() is disabled.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13766

Signed-off-by: David Disseldorp <ddiss at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Fri Feb  1 19:25:03 CET 2019 on sn-devel-144

- - - - -
63f4fb61 by Douglas Bagnall at 2019-02-02T19:19:05Z
abi_gen.sh: ignore gdb customisations when comparing signatures

If a .gdbinit file says "set print pretty on", the signatures are printed over
several lines, and the abi_check fails. So let's ignore .gdbinit files.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Sat Feb  2 20:19:05 CET 2019 on sn-devel-144

- - - - -
9df23fe4 by Björn Jacke at 2019-02-03T08:54:56Z
sysquota_linux: fix querying of group quotas

for gids we need to get/set the effective gids, same like for the uids already

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

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

Autobuild-User(master): Uri Simchoni <uri at samba.org>
Autobuild-Date(master): Sun Feb  3 09:54:56 CET 2019 on sn-devel-144

- - - - -
64e05bc8 by Volker Lendecke at 2019-02-03T12:52:29Z
librpc: Solaris cc does not like unnamed struct members

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

- - - - -
858a25ab by Volker Lendecke at 2019-02-03T12:52:29Z
libcli: Solaris cc can't return void values

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

- - - - -
0e3eda5b by Anoop C S at 2019-02-03T16:00:33Z
vfs_glusterfs: Adapt to changes in libgfapi signatures

VFS module for GlusterFS fails to compile due to recent changes done to
some API signatures. Therefore adding missing arguments to those APIs
adapting to new signatures.

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

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sun Feb  3 17:00:33 CET 2019 on sn-devel-144

- - - - -
cca48c1a by Andreas Schneider at 2019-02-04T01:03:56Z
docs: Document DCEPRC binding string for rpcclient

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Feb  4 02:03:56 CET 2019 on sn-devel-144

- - - - -
95b2c9d7 by Tim Beale at 2019-02-05T11:23:31Z
autobuild: Split backup/restore testenvs out into separate job

The samba-ad-dc-2 job was reaching its limits with the number of
testenvs and what the resource-limited CI machines can handle.
Samba processes were getting swapped out of memory, causing CI runs
to fail.

This patch splits the backup/restore testenv targets into a separate
autobuild job: samba-ad-dc-backup.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue Feb  5 12:23:31 CET 2019 on sn-devel-144

- - - - -
9465292d by Ralph Boehme at 2019-02-06T06:11:30Z
tldap: avoid a use after free crash

I saw the following crash in tldap in the winbindd idmap child on a
member server after messing with the LDAP server on the DC:

0  0x00007f77ea9a307a in __GI___waitpid (pid=9815, stat_loc=stat_loc at entry=0x7ffe77569eb0, options=options at entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
1  0x00007f77ea91bfbb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
2  0x00007f77edd8c24b in smb_panic_s3 (why=0x7f77f08e6e88 "Bad talloc magic value - access after free") at ../source3/lib/util.c:828
3  0x00007f77f15afe85 in smb_panic (why=0x7f77f08e6e88 "Bad talloc magic value - access after free") at ../lib/util/fault.c:170
4  0x00007f77f08e2678 in talloc_abort (reason=0x7f77f08e6e88 "Bad talloc magic value - access after free") at ../lib/talloc/talloc.c:472
5  0x00007f77f08e268b in talloc_abort_access_after_free () at ../lib/talloc/talloc.c:477
6  0x00007f77f08e2710 in talloc_chunk_from_ptr (ptr=0x55da7605a020) at ../lib/talloc/talloc.c:494
7  0x00007f77f08e4a19 in _talloc_free (ptr=0x55da7605a020, location=0x7f77e181474d "../source3/lib/tldap.c:1918") at ../lib/talloc/talloc.c:1716
8  0x00007f77e180b65c in tldap_search_all_done (subreq=0x55da7605a020) at ../source3/lib/tldap.c:1918
9  0x00007f77f0af0fd0 in _tevent_req_notify_callback (req=0x55da7605a020, location=0x7f77e1813e50 "../source3/lib/tldap.c:47") at ../lib/tevent/tevent_req.c:125
10 0x00007f77f0af10a5 in tevent_req_finish (req=0x55da7605a020, state=TEVENT_REQ_USER_ERROR, location=0x7f77e1813e50 "../source3/lib/tldap.c:47") at ../lib/tevent/tevent_req.c:162
11 0x00007f77f0af1113 in _tevent_req_error (req=0x55da7605a020, error=9780923860630110289, location=0x7f77e1813e50 "../source3/lib/tldap.c:47") at ../lib/tevent/tevent_req.c:180
12 0x00007f77e180781a in tevent_req_ldap_error (req=0x55da7605a020, rc=...) at ../source3/lib/tldap.c:47
13 0x00007f77e180b2c4 in tldap_search_done (subreq=0x55da76058280) at ../source3/lib/tldap.c:1813
14 0x00007f77f0af0fd0 in _tevent_req_notify_callback (req=0x55da76058280, location=0x7f77e1813e50 "../source3/lib/tldap.c:47") at ../lib/tevent/tevent_req.c:125
15 0x00007f77f0af10a5 in tevent_req_finish (req=0x55da76058280, state=TEVENT_REQ_USER_ERROR, location=0x7f77e1813e50 "../source3/lib/tldap.c:47") at ../lib/tevent/tevent_req.c:162
16 0x00007f77f0af11cd in tevent_req_trigger (ev=0x55da760526c0, im=0x55da76058360, private_data=0x55da76058280) at ../lib/tevent/tevent_req.c:219
17 0x00007f77f0af0378 in tevent_common_loop_immediate (ev=0x55da760526c0) at ../lib/tevent/tevent_immediate.c:135
18 0x00007f77f0af8b8f in epoll_event_loop_once (ev=0x55da760526c0, location=0x7f77f0af92b0 "../lib/tevent/tevent_req.c:269") at ../lib/tevent/tevent_epoll.c:911
19 0x00007f77f0af5925 in std_event_loop_once (ev=0x55da760526c0, location=0x7f77f0af92b0 "../lib/tevent/tevent_req.c:269") at ../lib/tevent/tevent_standard.c:114
20 0x00007f77f0aef201 in _tevent_loop_once (ev=0x55da760526c0, location=0x7f77f0af92b0 "../lib/tevent/tevent_req.c:269") at ../lib/tevent/tevent.c:725
21 0x00007f77f0af1361 in tevent_req_poll (req=0x55da7605eed0, ev=0x55da760526c0) at ../lib/tevent/tevent_req.c:269
22 0x00007f77e180fec9 in tldap_gensec_bind (ctx=0x55da76051ec0, creds=0x55da76052250, target_service=0x7f77e18164b3 "ldap", target_hostname=0x55da7605d182 "dc1.sdom1.site", target_principal=0x0, lp_ctx=0x55da76052180, gensec_features=6) at ../source3/lib/tldap_gensec_bind.c:358
23 0x00007f77e1810d21 in idmap_ad_get_tldap_ctx (mem_ctx=0x55da76050510, domname=0x55da76051d50 "sdom1", pld=0x55da76050518) at ../source3/winbindd/idmap_ad.c:326
24 0x00007f77e1811056 in idmap_ad_context_create (mem_ctx=0x55da76059c00, dom=0x55da76059c00, domname=0x55da76051d50 "sdom1", pctx=0x7ffe7756a5f8) at ../source3/winbindd/idmap_ad.c:374
25 0x00007f77e18119c0 in idmap_ad_get_context (dom=0x55da76059c00, pctx=0x7ffe7756a640) at ../source3/winbindd/idmap_ad.c:554
26 0x00007f77e181275b in idmap_ad_sids_to_unixids (dom=0x55da76059c00, ids=0x55da760518a0) at ../source3/winbindd/idmap_ad.c:784
27 0x00007f77e1813217 in idmap_ad_sids_to_unixids_retry (dom=0x55da76059c00, ids=0x55da760518a0) at ../source3/winbindd/idmap_ad.c:947
28 0x000055da7459ce05 in _wbint_Sids2UnixIDs (p=0x7ffe7756a870, r=0x55da76050860) at ../source3/winbindd/winbindd_dual_srv.c:202
29 0x000055da7460aa5e in api_wbint_Sids2UnixIDs (p=0x7ffe7756a870) at default/librpc/gen_ndr/srv_winbind.c:391
30 0x000055da7459c7f4 in winbindd_dual_ndrcmd (domain=0x0, state=0x7ffe7756abb8) at ../source3/winbindd/winbindd_dual_ndr.c:369
31 0x000055da7459828c in child_process_request (child=0x55da74874bc0 <static_idmap_child>, state=0x7ffe7756abb8) at ../source3/winbindd/winbindd_dual.c:666
32 0x000055da7459ae58 in child_handler (ev=0x55da7602c2b0, fde=0x55da7603f8a0, flags=1, private_data=0x7ffe7756abb0) at ../source3/winbindd/winbindd_dual.c:1567
33 0x00007f77f0af85f1 in epoll_event_loop (epoll_ev=0x55da76048b00, tvalp=0x7ffe7756aab0) at ../lib/tevent/tevent_epoll.c:728
34 0x00007f77f0af8c29 in epoll_event_loop_once (ev=0x55da7602c2b0, location=0x55da74628b08 "../source3/winbindd/winbindd_dual.c:1766") at ../lib/tevent/tevent_epoll.c:930
35 0x00007f77f0af5925 in std_event_loop_once (ev=0x55da7602c2b0, location=0x55da74628b08 "../source3/winbindd/winbindd_dual.c:1766") at ../lib/tevent/tevent_standard.c:114
36 0x00007f77f0aef201 in _tevent_loop_once (ev=0x55da7602c2b0, location=0x55da74628b08 "../source3/winbindd/winbindd_dual.c:1766") at ../lib/tevent/tevent.c:725
37 0x000055da7459b9e9 in fork_domain_child (child=0x55da74874bc0 <static_idmap_child>) at ../source3/winbindd/winbindd_dual.c:1766
38 0x000055da74596e96 in wb_child_request_waited (subreq=0x0) at ../source3/winbindd/winbindd_dual.c:188
39 0x00007f77f0af0fd0 in _tevent_req_notify_callback (req=0x55da7604f820, location=0x7f77f0af90f8 "../lib/tevent/tevent_queue.c:355") at ../lib/tevent/tevent_req.c:125
40 0x00007f77f0af10a5 in tevent_req_finish (req=0x55da7604f820, state=TEVENT_REQ_DONE, location=0x7f77f0af90f8 "../lib/tevent/tevent_queue.c:355") at ../lib/tevent/tevent_req.c:162
41 0x00007f77f0af10cd in _tevent_req_done (req=0x55da7604f820, location=0x7f77f0af90f8 "../lib/tevent/tevent_queue.c:355") at ../lib/tevent/tevent_req.c:168
42 0x00007f77f0af0cc1 in tevent_queue_wait_trigger (req=0x55da7604f820, private_data=0x0) at ../lib/tevent/tevent_queue.c:355
43 0x00007f77f0af06f2 in tevent_queue_immediate_trigger (ev=0x55da7602c2b0, im=0x55da760466a0, private_data=0x55da76046580) at ../lib/tevent/tevent_queue.c:149
44 0x00007f77f0af0378 in tevent_common_loop_immediate (ev=0x55da7602c2b0) at ../lib/tevent/tevent_immediate.c:135
45 0x00007f77f0af8b8f in epoll_event_loop_once (ev=0x55da7602c2b0, location=0x55da74612630 "../source3/winbindd/winbindd.c:1803") at ../lib/tevent/tevent_epoll.c:911
46 0x00007f77f0af5925 in std_event_loop_once (ev=0x55da7602c2b0, location=0x55da74612630 "../source3/winbindd/winbindd.c:1803") at ../lib/tevent/tevent_standard.c:114
47 0x00007f77f0aef201 in _tevent_loop_once (ev=0x55da7602c2b0, location=0x55da74612630 "../source3/winbindd/winbindd.c:1803") at ../lib/tevent/tevent.c:725
48 0x000055da74561431 in main (argc=2, argv=0x7ffe7756c968) at ../source3/winbindd/winbindd.c:1803

subreq is a child of the state of req which will already be free by the
callback of req.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13776

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
bf91ee0a by Ralph Boehme at 2019-02-06T09:19:12Z
tldap: avoid more use after free errors

See the previous commit for an explanation. :)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13776

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Feb  6 10:19:12 CET 2019 on sn-devel-144

- - - - -
a8e10a12 by Noel Power at 2019-02-07T12:44:30Z
Decrement references to python objects passed to Py_BuildValue

Py_BuildValue when processing format 'O' will
  'Pass a Python object untouched (except for its reference count,
   which is incremented by one'

Basically this means if you are using a new reference to a PyObject
to pass to BuildValue (to be used with the 'O' format) the reference
*isn't* stolen so you really do need to DECREF it in order to ensure
it gets cleaned up.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
1be9b0cf by Noel Power at 2019-02-07T12:44:30Z
Examine result of SetList (and prevent sending NULL to PyList_SetItem)

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
53d973f5 by Noel Power at 2019-02-07T12:44:30Z
Cleanup references to module objects returned from PyImport_ImportModule

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
85b7574b by Noel Power at 2019-02-07T12:44:30Z
pidl: Fix Generated ndr python code to DECREF imported modules

Generated code calls Py_ImportModule but in all error returns
and also successful exit the code fails to decrement reference to
loaded modules in MODULE_INIT_FUNC function.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
e29c3494 by Noel Power at 2019-02-07T12:44:30Z
decref results of PyStr_FromString

Where we create temporary objects (which are added to containers)
these objects already get there ref count incremented. In this case
we need to decref those objects to ensure they are released.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2814690d by Noel Power at 2019-02-07T12:44:30Z
Cleanup (decref) some objects added to list.

PyList_Append doesn't steal references, so if the item created is
a temp object, created just to be added to the list we need to
 decref the item appended in order for it to be released.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
61670169 by Noel Power at 2019-02-07T16:17:46Z
Clean up reference used with PyDict_Setxxx

PyDictSetxxx methods don't steal reference so if the items added
to the dictionary were created just for the purpose of inserting
into the dict then we need to decref them.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Thu Feb  7 17:17:46 CET 2019 on sn-devel-144

- - - - -
c824240c by David Disseldorp at 2019-02-07T16:23:18Z
lib/debug: retain full string in state.prog_name global

setup_logging() retains a global pointer to the provided const string in
state.prog_name, which is later used in the debug_backend->reload()
callback.
Some setup_logging() callers, such as popt_common_callback(),
incorrectly assume that a dynamic buffer is safe to provide as a
prog_name parameter. Fix this by copying the entire string in
setup_logging().

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
901ca24e by David Disseldorp at 2019-02-07T16:23:18Z
s3/lib/popt_common: don't assume stackframe presence

popt_common_callback() should be leak-safe if a talloc stackframe isn't
available, as it's invoked early on.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f132c376 by David Disseldorp at 2019-02-07T16:23:18Z
s3/lib/popt_common: use stack buffer in set_logfile()

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3e25d4d5 by Andreas Schneider at 2019-02-07T16:23:18Z
docs-xml: Update documentation for 'restrict anonymous' option

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Rowland Penny <rpenny at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

- - - - -
eaf63f0b by David Disseldorp at 2019-02-07T20:33:15Z
docs-xml: "cluster addresses" dns registration

Bug 7871 added functionality to register smb.conf "cluster addresses"
when net ads dns register is called with clustering=yes, but the man
page was not updated. Add documentation for this behaviour.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Thu Feb  7 21:33:15 CET 2019 on sn-devel-144

- - - - -
10114238 by Stefan Metzmacher at 2019-02-07T21:47:22Z
lib/util: add samba_runcmd_export_stdin() helper function

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
65e52c24 by Stefan Metzmacher at 2019-02-07T21:47:22Z
s4:dsdb:util: make use of samba_runcmd_export_stdin()

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
531b713c by Stefan Metzmacher at 2019-02-08T01:54:20Z
lib/util: inline lib/util/util_runcmd.h again

samba_runcmd_state should not be exposed!

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Fri Feb  8 02:54:20 CET 2019 on sn-devel-144

- - - - -
87149445 by Joe Guo at 2019-02-08T05:34:47Z
s4/scripting/bin: open unicode files with utf8 encoding and write unicode string

In files like `libcli/util/werror_err_table.txt` and `libcli/util/ntstatus_err_table.txt`,
there were unicode quote symbols at line 6:

    ...(“this documentation”)...

In `libcli/util/wscript_build`, it will run `gen_werror.py` and `gen_ntstatus.py`
to `open` above files, read content from them and write to other files.

When encoding not specified, `open` in both python 2/3 will guess encoding from locale.

When locale is not set, it defaults to POSIX or C, and then python will use
encoding `ANSI_X3.4-1968`.

So, on a system locale is not set, `make` will fail with encoding error
for both python 2 and 3:

    File "/home/ubuntu/samba/source4/scripting/bin/gen_werror.py", line 139, in main
        errors = parseErrorDescriptions(input_file, True, transformErrorName)
      File "/home/ubuntu/samba/source4/scripting/bin/gen_error_common.py", line 52, in parseErrorDescriptions
        for line in file_contents:
      File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 318: ordinal not in range(128)

In this case, we have to use `io.open` with `encoding='utf8'`.
However, then we got unicode strs and try to write them with other strs
into new file, which means the new file must also open with utf-8 and
all other strs have to be unicode, too.

Instead of prefix `u` to all strs, a more easier/elegant way is to enable
unicode literals for the python scripts, which we normally didn't do in samba.

Since both `gen_werror.py` and `gen_ntstatus.py` are bin scripts and no
other modules import them, it should be ok for this case.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>

Autobuild-User(master): Douglas Bagnall <dbagnall at samba.org>
Autobuild-Date(master): Fri Feb  8 06:34:47 CET 2019 on sn-devel-144

- - - - -
51bc92d8 by Aliaksei Karaliou at 2019-02-08T07:51:19Z
build: Get rid of hardcoded 'bin/default' in includes

Removed occurrences of bin/default used in #include directive for
auto-generated headers residing in build directory.
Build system is capable of resolving path to such headers by itself
without extra hardcoded path to build directory.

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
74cf2a1b by Aliaksei Karaliou at 2019-02-08T07:51:19Z
build:docs: Get rid of hardcoded 'bin/default'

Build scripts for documentation still contain hardcoded path to build
destination rather than use proper final build path variables.

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e4ae59bb by Volker Lendecke at 2019-02-08T07:51:19Z
torture4: Solaris cc can't deal with empty initializers

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
65c05357 by Volker Lendecke at 2019-02-08T07:51:19Z
winbind: Enhance xids2sids debugging

Print what was requested and returned

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c516394e by Volker Lendecke at 2019-02-08T07:51:19Z
smbd: Avoid sending S-1-22- to winbind

Sending S-1-22-x to a typeless sids2xids call will make winbind prime
the reverse xids2sids cache, which is very likely the wrong mapping. Add
a check that avoids bothering the winbind pipe when it's clear this
can't work anyway.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
076f30b0 by Volker Lendecke at 2019-02-08T12:30:32Z
winbindd: Enhance xids2sids debugging

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Fri Feb  8 13:30:32 CET 2019 on sn-devel-144

- - - - -
8294e68a by Douglas Bagnall at 2019-02-08T12:31:38Z
py_tevent: add_timer takes float argument

We were already using it that way.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
96cdacae by Douglas Bagnall at 2019-02-08T12:31:38Z
s3/libsmb/py: match input argument types with C types

If PyArg_ParseTupleAndKeywords() is given, say, an "H" format (meaning
unsigned short int) but the referenced variable is a plain unsigned
int, the top 16 bits of the variable will be left undefined. In that
case we should use an "I" format (and/or initialize the variable).

In many cases the change is fairly innocuous, such as when "i" and "I"
are mixed (for signed and unsigned ints respectively), but the
resulting write is the same size and probably gives the same result in
practice.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
1e8d0d80 by Douglas Bagnall at 2019-02-08T12:31:39Z
s4/librpc/py_misc: ParseTuple format should match actual types

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
7b9d4580 by Douglas Bagnall at 2019-02-08T12:31:39Z
s4/messaging/py: use better format strings for variable types

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
8a828684 by Douglas Bagnall at 2019-02-08T16:09:51Z
s4/registry/py: use unsigned ParseTuple format for unsigned value

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Fri Feb  8 17:09:51 CET 2019 on sn-devel-144

- - - - -
3204dc66 by Jeremy Allison at 2019-02-08T18:54:17Z
s3: VFS: vfs_fruit. Fix the NetAtalk deny mode compatibility code.

This exhibited itself as a problem with OFD locks reported
as:

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

However, due to underlying bugs in the vfs_fruit
code the file locks were not being properly applied.

There are two problems in fruit_check_access().

Problem #1:

Inside fruit_check_access() we have:

flags = fcntl(fsp->fh->fd, F_GETFL);
..
if (flags & (O_RDONLY|O_RDWR)) {

We shouldn't be calling fcntl(fsp->fh->fd, ..) directly.
fsp->fh->fd may be a made up number from an underlying
VFS module that has no meaning to a system call.

Secondly, in all POSIX systems - O_RDONLY is defined as
*zero*. O_RDWR = 2.

Which means flags & (O_RDONLY|O_RDWR) becomes (flags & 2),
not what we actually thought.

Problem #2:

deny_mode is *not* a bitmask, it's a set of discrete values.

Inside fruit_check_access() we have:

if (deny_mode & DENY_READ) and also (deny_mode & DENY_WRITE)

However, deny modes are defined as:

/* deny modes */
define DENY_DOS 0
define DENY_ALL 1
define DENY_WRITE 2
define DENY_READ 3
define DENY_NONE 4
define DENY_FCB 7

so if deny_mode = DENY_WRITE, or if deny_mode = DENY_READ
then it's going to trigger both the if (deny_mode & DENY_READ)
*and* the (deny_mode & DENY_WRITE) conditions.

These problems allowed the original test test_netatalk_lock code to
pass (which was added for BUG: https://bugzilla.samba.org/show_bug.cgi?id=13584
to demonstrate the lock order violation).

This patch refactors the fruit_check_access()
code to be much simpler (IMHO) to understand.

Firstly, pass in the SMB1/2 share mode, not old
DOS deny modes.

Secondly, read all the possible NetAtalk locks
into local variables:

netatalk_already_open_for_reading
netatalk_already_open_with_deny_read
netatalk_already_open_for_writing
netatalk_already_open_with_deny_write

Then do the share mode/access mode checks
with the requested values against any stored
netatalk modes/access modes.

Finally add in NetATalk compatible locks
that represent our share modes/access modes
into the file, with an early return if we don't
have FILE_READ_DATA (in which case we can't
write locks anyway).

The patch is easier to understand by looking
at the completed patched fruit_check_access()
function, rather than trying to look at the
diff.

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>

- - - - -
28990e4b by Jeremy Allison at 2019-02-08T22:26:46Z
s4: torture: vfs_fruit. Change test_fruit_locking_conflict() to match the vfs_fruit working server code.

Originally added for BUG: https://bugzilla.samba.org/show_bug.cgi?id=13584
to demonstrate a lock order violation, this test
exposed problems in the mapping of SMB1/2 share modes
and open modes to NetATalk modes once we moved to OFD locks.

Change the test slightly (and add comments)
so it demonstrates working NetATalk share modes
on an open file.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Feb  8 23:26:46 CET 2019 on sn-devel-144

- - - - -
2ff2594b by Andreas Schneider at 2019-02-08T22:32:10Z
s3:vfs: Initialize pid to 0 in test_netatalk_lock()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
7ff94b18 by Andreas Schneider at 2019-02-09T02:43:50Z
s3:vfs: Correctly check if OFD locks should be enabled or not

Also the smb.conf options should only be checked once and a reload of
the config should not switch to a different locking mode.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Feb  9 03:43:50 CET 2019 on sn-devel-144

- - - - -
67825c96 by Aurelien Aptel at 2019-02-09T17:30:14Z
libcli: add getters for smb2 {signing,encryption,decryption} keys

Adds:
- smb2cli_session_signing_key()
- smb2cli_session_encryption_key()
- smb2cli_session_decryption_key()

Signed-off-by: Aurelien Aptel <aaptel at suse.com>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

- - - - -
0732499f by Aurelien Aptel at 2019-02-09T17:30:14Z
docs-xml: add "debug encryption" global parm

Add debug option to dump in the log the session id & keys in smbd and
libsmb-based code for offline decryption.

Wireshark can make use of this to decrypt encrypted traffic.

Signed-off-by: Aurelien Aptel <aaptel at suse.com>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

- - - - -
584dfc15 by Aurelien Aptel at 2019-02-09T20:43:25Z
libsmb,s3/smbd: dump SMB3+ session keys if debug parm is set

Use of previously added smb.conf global param.

Sample usage:

$ smbclient //localhost/scratch --option='debugencryption=yes' \
                                 -e -mSMB3 -U aaptel%aaptel -c quit
debug encryption: dumping generated session keys
Session Id    [0000] 26 48 BF FD 00 00 00 00                             &H......
Session Key   [0000] 63 D6 CA BC 08 C8 4A D2   45 F6 AE 35 AB 4A B3 3B   c.....J. E..5.J.;
Signing Key   [0000] 4E FE 35 92 AC 13 14 FC   C9 17 62 B1 82 20 A4 12   N.5..... ..b.. ..
App Key       [0000] A5 0F F4 8B 2F FB 0D FF   F2 BF EE 39 E6 6D F5 0A   ..../... ...9.m..
ServerIn Key  [0000] 2A 02 7E E1 D3 58 D8 12   4C 63 76 AE 59 17 5A E4   *.~..X.. Lcv.Y.Z.
ServerOut Key [0000] 59 F2 5B 7F 66 8F 31 A0   A5 E4 A8 D8 2F BA 00 38   Y.[.f.1. ..../..8

We can now simply pass -ouat:smb2_seskey_list:<sesid>,<seskey> to
wireshark or tshark:

$ tshark -ouat:smb2_seskey_list:2648BFFD00000000,63D6CABC08C84AD245F6AE35AB4AB33B \
          -Y smb2 -r capture.pcap -Tfields -e _ws.col.Info
Negotiate Protocol Response
Negotiate Protocol Request
Negotiate Protocol Response
Session Setup Request, NTLMSSP_NEGOTIATE
Session Setup Response, Error: STATUS_MORE_PROCESSING_REQUIRED, NTLMSSP_CHALLENGE
Session Setup Request, NTLMSSP_AUTH, User: WORKGROUP\aaptel
Session Setup Response
Tree Connect Request Tree: \\localhost\IPC$
Tree Connect Response
Decrypted SMB3;Ioctl Request FSCTL_DFS_GET_REFERRALS, File: \localhost\scratch
Decrypted SMB3;Ioctl Response, Error: STATUS_NOT_FOUND
Decrypted SMB3;Tree Disconnect Request
Decrypted SMB3;Tree Disconnect Response
Decrypted SMB3;Tree Connect Request Tree: \\localhost\scratch
Decrypted SMB3;Tree Connect Response
Decrypted SMB3;Tree Disconnect Request
Decrypted SMB3;Tree Disconnect Response

For more info on Wireshark decryption support see
https://wiki.samba.org/index.php/Wireshark_Decryption

Signed-off-by: Aurelien Aptel <aaptel at suse.com>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Sat Feb  9 21:43:25 CET 2019 on sn-devel-144

- - - - -
244e2a02 by Noel Power at 2019-02-11T06:43:31Z
buildtools/wafsamba: Avoid decode when using python2

To avoid problematic type checking for 'str' types which fail
when result from str.decode is used.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13777

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
835e1564 by Garming Sam at 2019-02-11T06:43:31Z
dnsserver: Return access denied to the caller if the user was not a DNS admin

This is not a proper fix to match Windows, but at the very least, it
should be more obvious to users (using samba-tool for instance), that
the user needs to be given more access or that they should use the
administrator.

Windows seems to deny access altogether by returning a fault after they
have bound to the pipe and actually sent an operation.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b50f8390 by Aliaksei Karaliou at 2019-02-11T06:43:31Z
build: Fixed usage of non-default path to WAFLOCK

If WAFLOCK environment variable is set, use it to override path
to WAF lock file in Samba build scripts.

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
724c07fe by Aliaksei Karaliou at 2019-02-11T06:43:31Z
build: Don't generate kerberos_implementation.py if building without python

It is unnecessary to generate kerberos_implementation.py when python is
disabled.

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
65ea3f2a by Aliaksei Karaliou at 2019-02-11T06:43:31Z
s3:util: Move popen wrappers to lib/util

When linked into Samba3 libraries, sys_popen()/sys_pclose()
cannot be used in lower level libraries because of circular
dependencies.

This patch moves them into common samba-util library.

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d21fc7d8 by Aliaksei Karaliou at 2019-02-11T06:43:31Z
s3:util: Move static file_pload() function to lib/util

file_pload() is static private function in Samba3 library, however it
does not have any special dependencies and might be widely used as
common function, so moving it into common samba-util library.

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
193bb824 by Aliaksei Karaliou at 2019-02-11T06:43:31Z
s3:modules: Fix compilation of nfs41acl_xdr.c when building outside src

If the Samba build directory is outside its source directory, generation
of nfs41acl_xdr.c by rpcgen leads to improper include paths to nfs41acl.h.

This happens because rpcgen is designed to produce its generated file in the
same directory as the input template. If the build directory is not located
under the source directory, this relative path will be invalid and the header
will not be found.

Example:
 src dir is ~/samba-src
 bld dir is ~/samba-bld

rpcgen will use path ../../samba-src/source3/modules/nfs41acl.x
running from ~/samba-bld/default and nfs41acl_xdr.c will contain:
 #include "../../samba-src/source3/modules/nfs41acl.h"

This behaviour is fixed through an intermediate copy of the input file to
the build directory so that rpcgen receives the path as if located in src.

Also now we avoid generation of nfs41acl_xdr.c when HAVE_RPC_XDR_H is
not defined because it will not be used as part of the vfs_nfs4acl_xattr
module.

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
39c1aa28 by Stefan Metzmacher at 2019-02-11T06:43:31Z
selftest: make check password script more portable

We should not rely on Linux specific sed options.

grep -q also works on FreeBSD (tested on FreeBSD 12).

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
77bddbb7 by Stefan Metzmacher at 2019-02-11T06:43:32Z
tests/user_check_password_script: add a test do disallow the username as password

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9f6ade21 by Stefan Metzmacher at 2019-02-11T06:43:32Z
s4:dsdb:util: export SAMBA_CPS_{ACCOUNT,USER_PRINCIPAL,FULL}_NAME for check password script

This allows the check password script to reject the username and other
things.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c4131b61 by Stefan Metzmacher at 2019-02-11T06:43:32Z
selftest: require SAMBA_CPS_ACCOUNT_NAME in checkpassword_arg1.sh

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cef1d2ab by Stefan Metzmacher at 2019-02-11T06:43:32Z
s3:srv_samr_chgpasswd: export SAMBA_CPS_{ACCOUNT,USER_PRINCIPAL,FULL}_NAME for check password script

This is keep compatibility with the AD DC usage.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2e8daeb2 by Stefan Metzmacher at 2019-02-11T10:03:58Z
docs-xml/smbdotconf: document export of SAMBA_CPS_{ACCOUNT,USER_PRINCIPAL,FULL}_NAME for check password script

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Feb 11 11:03:58 CET 2019 on sn-devel-144

- - - - -
55cce815 by Tim Beale at 2019-02-11T10:41:21Z
selftest: Make dns_hub socket timeout match DNS_REQUEST_TIMEOUT

I was hitting the recv_packet = s.recv(2048, 0) exception because
the socket timeout was reached. We've seen it before, but it seemed more
common after changing the default process-model to prefork. This patch
makes the socket timeout used by the python code consistent with the C
code.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
80d293ca by Stefan Metzmacher at 2019-02-11T10:41:21Z
selftest: improve debugging in dns_hub.py

We only print debug messages when the response is delayed by more than 2
seconds.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
162219de by Stefan Metzmacher at 2019-02-11T10:41:21Z
blackbox/dbcheck.sh: fix dbcheck_fix_one_way_links cleanup

Commit 35bfc62a31c9ad73449594ddd48f76f50e0abade changed
dbcheck to not regard old one-way-links as errors.

At that time the relavant trigger changed from
fix_all_string_dn_component_mismatch to
fix_all_old_dn_string_component_mismatch.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
09c4e78f by Stefan Metzmacher at 2019-02-11T10:41:21Z
dsdb/tests/vlv: use only one toplevel dn that is correctly cleaned up

Before "OU=vlvtestou2,%s" % (self.base_dn) was left behind after the
test.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b1740f3b by Ralph Boehme at 2019-02-11T13:10:12Z
CI: split out "samba-ad-dc-ntvfs[-py2]" test targets

Many AD tests currently use the "samba" target. Split out a new target
"samba-ad-dc-ntvfs" and have all tests that use the "ad_dc_ntvfs" env
use the new target. This should greatly speed up the runtime for the "samba"
target and avoid swapping.

This reduces the total CI time by ~ 55%, I got an autobuild and a gitlab
pipeline finished in just ~ 100 mins!

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Mon Feb 11 14:10:12 CET 2019 on sn-devel-144

- - - - -
77dbe6b9 by Andreas Schneider at 2019-02-12T22:02:07Z
s3:locking: Add missing NULL check

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
f8a85ed5 by Andreas Schneider at 2019-02-12T23:52:25Z
s3:utils: Add missing NULL check in rpc_fetch_domain_aliases()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Feb 13 00:52:25 CET 2019 on sn-devel-144

- - - - -
d0e26ea6 by Douglas Bagnall at 2019-02-13T03:15:14Z
spelling of associated

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5b0a9818 by Douglas Bagnall at 2019-02-13T03:15:14Z
dsdb: make get_parsed_dns_trusted() a common helper function

We are already using it in two places, and are about to add a third.

The version in repl_meta_data.c did more work in the case that the
parsed_dns can't really be trusted to conform to the expected format;
this is now a wrapper called get_parsed_dns_trusted_fallback().

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a086a645 by Douglas Bagnall at 2019-02-13T03:15:14Z
dsdb: linked attrs: check a talloc_new()

Also we can defer it past a thing that doesn't need or check for it.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c874b625 by Douglas Bagnall at 2019-02-13T03:15:14Z
dsdb: check NULL guid strings in la_fix_links

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cb502997 by Douglas Bagnall at 2019-02-13T03:15:14Z
replmd: move a if (ret) closer to ret source

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d4ebe006 by Douglas Bagnall at 2019-02-13T03:15:14Z
ldb_dn: remove unreachable code in dn_explode

Every time I look at this file, I spend a few minutes wondering how
these bits of code are ever run. Never again.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d21801b8 by Douglas Bagnall at 2019-02-13T03:15:15Z
ldb_dn: don't free a known NULL pointer

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
85a7b4bf by Tim Beale at 2019-02-13T03:15:15Z
selftest: Use default 'prefork children' smb.conf setting

The default setting should be 4, so there should be no need to specify
this in the testenv smb.conf.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
22c016b1 by Tim Beale at 2019-02-13T03:15:15Z
selftest: Change backup/restore testenvs to use 1 prefork child

Recently the gitlab CI jobs were hitting memory resource limits and
using swap, which then caused test failures. The process model used in
the testenvs seemed to be contributing to this problem.

We can reduce the memory overhead of the restore/backup testenvs by
using 1 prefork child process instead of the default of 4 (kudos to
Garming for the idea). The tests run against these testenvs are basic
sanity-checks, rather than heavy-duty stress tests, so the number of
prefork workers shouldn't matter.

This is a bit of a tradeoff between testing the defaults that will
actually be used in production vs using limited resources efficiently on
shared CI runner machines.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c9fa0a05 by Joe Guo at 2019-02-13T03:15:15Z
wafsamba/samba_utils.py: override symlink to allow force link

if bin is not empty and I have been sharing the samba tree into
a Vagrant environment and we run make, we get annoying linking error like this:

     File "~/samba/lib/tevent/wscript", line 130, in build
        installdir='python')
      File "./buildtools/wafsamba/wafsamba.py", line 745, in SAMBA_SCRIPT
        os.symlink(link_src, link_dst)
    FileExistsError: [Errno 17] File exists: '~/samba/lib/tevent/tevent.py' -> '~/samba/bin/default/../python/tevent.py'
    Makefile:7: recipe for target 'all' failed

Override the symlink method to allow force linking.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
30d505e9 by Andrew Bartlett at 2019-02-13T04:49:43Z
selftest: Only set clockskew to 5 seconds for MIT Kerberos

This was added in ac5427c6eba09134411f76a5e6f7e2643fa74eed as part of the MIT KDC
effort, but makes some tests much less reliable under high load.

As the Heimdal build does not need this, only specify for the MIT build.

Tested with an MIT AD DC build with:
 make test TESTS="samba3.raw.session samba3.smb2.session"

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Feb 13 05:49:43 CET 2019 on sn-devel-144

- - - - -
5dad03b8 by Noel Power at 2019-02-13T10:42:08Z
Fix mem leak with PyBytes_FromStringAndSize
Reviewed-by: Andrew Bartlett abartlet at samba.org

- - - - -
8d3f736b by Noel Power at 2019-02-13T10:42:09Z
Fix instances of PyDict_SetItem to decref the value

Although it would be better to use the BuildValue approach to
create the dictionares here, unfortunately the dictionaries created
here have key/values that are created dynamically (based on input params).

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett abartlet at samba.org

- - - - -
0c15c4b1 by Noel Power at 2019-02-13T13:51:12Z
Make sure results from GetAttrString are decref'ed where needed

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett abartlet at samba.org

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Wed Feb 13 14:51:12 CET 2019 on sn-devel-144

- - - - -
3a793497 by Christof Schmitt at 2019-02-13T16:58:33Z
waf: Check for libnscd

The check was in the old autoconf, but not in waf. As the code is still
in source3/lib/util_nscd.c, add the check for libnscd to allow building
and using the code.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Wed Feb 13 17:58:33 CET 2019 on sn-devel-144

- - - - -
c27afc09 by Volker Lendecke at 2019-02-14T01:18:28Z
messages_dgm: Use saved errno value

In this case this is just a cleanup, the value has just been set by
messaging_dgm_sendmsg. But as that already saves errno into a local
variable, use that.

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8d8f62c4 by Volker Lendecke at 2019-02-14T01:18:28Z
torture3: Extend read3 for the "messaging target re-inits" failure

Do ping_pong a hundred times, re-initializing the msg_ctx every time.

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2543bba0 by Volker Lendecke at 2019-02-14T01:18:28Z
messages_dgm: Properly handle receiver re-initialization

This only properly covers the small-message nonblocking case. Covering
the large-message and the blocking case is a much larger effort assuming
we want to re-send the failed message if parts of the message has gone
through properly. Don't do that for now.

This was found by sanba_dnsupdate constantly recreating its irpc handle to
winbindd in the RODC case.

The messaging_dgm code cached connected datagram sockets based on the
destination pid for 1 second. Which means the IRPC responses from
winbindd are never delivered to samba_dnsupdate,
which will then hit a timeout.

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
dd3a536b by Stefan Metzmacher at 2019-02-14T01:18:28Z
s4:setup: register ${NTDSGUID}._msdcs.${DNSFOREST} first in dns_update_list

After the A and AAAA records for the ${HOSTNAME} this is the most
important name.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2f2da096 by Stefan Metzmacher at 2019-02-14T01:18:28Z
winbindd_irpc: remove unused winbind_DsrUpdateReadOnlyServerDnsRecords from wb_irpc_forward_state

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
767e60d9 by Stefan Metzmacher at 2019-02-14T01:18:28Z
samba_dnsupdate: make it clear that opts.use_file is active and we're not using nsupdate

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
19f34b21 by Stefan Metzmacher at 2019-02-14T01:18:29Z
samba_dnsupdate: make rodc_dns_update() more robust against timing problems

Without this we had an interesting race!

The messaging_dgm code caches connected datagram sockets based on the
destination pid for 1 second.

The fact that samba_dnsupdate constantly recreates its messaging
context (and the underlying datagram socket) means that we the winbindd
messaging context may get a stale connection. As a result sending any
message from winbindd back to samba_dnsupdate will result in
ECONNREFUSED.

That means the IRPC response from winbindd never reaches
samba_dnsupdate, which will then hit a timeout.

In turn samba_dnsupdate on the RODC times out.

This was a workaround for the problem, by having just one global
IRPC handle and thus just one messaging_dgm context.
The actual problem is solved a few commits before
("messages_dgm: Properly handle receiver re-initialization").
But we keep this as an performance optimization, which hopefully
means that the overall samba_dnsupdate is less likely to
timeout after the hardcoded 20 seconds.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b988695e by Stefan Metzmacher at 2019-02-14T01:18:29Z
selftest:Samba4: report when samba is started and ready

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8c0853b8 by Stefan Metzmacher at 2019-02-14T01:18:29Z
selftest:Samba4: wait for DNS names being registered

We can't reliable start tests without registered dns names.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
35d66610 by Stefan Metzmacher at 2019-02-14T01:18:29Z
script/autobuild.py: add 'lsb_release -a' and 'mount' to system-info.txt

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
670413f0 by Stefan Metzmacher at 2019-02-14T01:18:29Z
.gitlab-ci.yml: print out more information in the before_script section

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
305db94c by Stefan Metzmacher at 2019-02-14T01:18:29Z
.gitlab-ci*.yml: remove build_ prefixes

It's useless to see 'builf_samba_ad...' 7 times in the gitlab pipeline summary.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a61e121e by Stefan Metzmacher at 2019-02-14T01:18:29Z
.gitlab-ci*.yml: use 'extends: ' instead of YAML Anchors

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7dcf5128 by Stefan Metzmacher at 2019-02-14T01:18:30Z
.gitlab-ci.yml: add retries on runner_system_failure/stuck_or_timeout_failure

This hopefully avoids pipeline failures due too docker/runner
errors.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
da566447 by Andrew Bartlett at 2019-02-14T01:18:30Z
.gitlab-ci.yml: Fix the registry as "registry.gitlab.com"

This is important as our team docker images are only in this registry, but
the .gitlab-ci.yml file is also run on other private GitLab hosts.

This partially undoes 8989916b5af6fed9c4c63035d4488583396b8c5a

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
20017b57 by Andrew Bartlett at 2019-02-14T01:18:30Z
.gitlab-ci.yml: Use .extends to avoid duplication of autobuild command

This should make our .gitlab-ci.yml file much less overwealming.

The downside is that $CI_JOB_NAME is printed rather than the job name
in the log, but the upside is that the names must now strictly match.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
2381febc by Andrew Bartlett at 2019-02-14T01:18:30Z
.gitlab-ci.yml: Re-indent comments on test times

(some of these need to be updated, but for now improve the formatting)

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
7c1ae35b by Tim Beale at 2019-02-14T01:18:30Z
.gitlab-ci.yml: Include the actual command used by gitlab

Someone who finds gitlab mysterious will have no idea what $CI_JOB_NAME
should be, if they wanted to reproduce the autobuild job manually. It
should be trivial to include the actual command being run in the logs.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2346cef9 by Tim Beale at 2019-02-14T02:51:21Z
.gitlab-ci.yml: Make docker image name more explicit

The 'image' YAML tag implies a docker image, but for people who find
gitlab mysterious, let's make it blatantly obvious what we're doing
here.

+ added a comment
+ added 'DOCKER' to the variable names
+ removed 'BUILD', as we've now dropped this from all the job-names
+ tried to make the variable names consistent, both within the file and
WRT docker terminology

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Feb 14 03:51:21 CET 2019 on sn-devel-144

- - - - -
f3fd2d94 by Gary Lockyer at 2019-02-14T04:03:23Z
s2 decrpc samr: Add tests for QueryDomainInfo

Add tests for the number of domain users, groups and aliases returned by
QueryDomainInfo.

These tests revealed that the existing code was not checking the
returned elements to ensure they were part of the domain.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
12fcab11 by Gary Lockyer at 2019-02-14T04:03:23Z
s4 dsdb util: add dsdb_domain_count

This counts the number of objects that are in the domain,
provided a domain SID was supplied (otherwise it just
counts all the objects).

This routine avoids allocating memory for the full
result set by using a callback.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7fc379ce by Gary Lockyer at 2019-02-14T04:03:23Z
s4 rpc_server_samr: DomGeneralInformation use dsdb_domain_count

Use dsdb_domain_count instead of samdb_search_count to determine the
number of users, groups and aliases.  This gives a performance gain of
around 10%, reduces the total memory allocated and fixes the incorrect
count returned for aliases.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2546f260 by Gary Lockyer at 2019-02-14T04:03:24Z
s4 dsdb util: samdb_client_site_name use dsdb_domain_count

Replace the call to samdb_search_count with dsdb_domain_count. As this
is the only remaining caller of samdb_search_count, replacing it will
allow the removal of samdb_search_count.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f0e96d21 by Gary Lockyer at 2019-02-14T04:03:24Z
s4 dsdb util: remove samdb_search_count

All the uses have been replaced with calls to dsdb_domain_count, so it
is no longer needed.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ea2de21d by Gary Lockyer at 2019-02-14T05:53:14Z
s4 dsdb util: samdb_client_site_name clean up

* Initialise pointers to NULL
* replace talloc_free with TALLOC_FREE
* add goto exit to ensure memory deallocated correctly

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Feb 14 06:53:14 CET 2019 on sn-devel-144

- - - - -
4985d73c by Andreas Schneider at 2019-02-14T14:59:25Z
lib:util: Add missing "replace.h" header in tftw

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
eeabe171 by Andreas Schneider at 2019-02-14T14:59:25Z
lib:util: Add GPL header to tftw.c

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
2a7086f1 by Andreas Schneider at 2019-02-14T14:59:25Z
librpc:ndr: Implement ndr_zero_memory()

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
666802a3 by Andreas Schneider at 2019-02-14T14:59:26Z
librpc:ndr: Add NDR_ZERO_STRUCT(P) macros

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
532ce0d2 by Andreas Schneider at 2019-02-14T14:59:26Z
pidl: Use NDR_ZERO_STRUCT(P) macros

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
96df6878 by Andreas Schneider at 2019-02-14T14:59:26Z
lib:util: Move discard_const(_p) to own header for libndr.h

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
6d232f3f by Andreas Schneider at 2019-02-14T14:59:26Z
waf: Do not install internal header

We should not install header files without an public API:

- memory.h
- safe_strings.h
- talloc_stack.h

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
08b91f5e by Andreas Schneider at 2019-02-14T16:32:38Z
gitlab-ci: Rename DOCKER to CONTAINER

This is just a runc container, not tied to docker. See podman.io

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Björn Jacke <bj at sernet.de>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Feb 14 17:32:38 CET 2019 on sn-devel-144

- - - - -
5f3beb6e by Tim Beale at 2019-02-15T03:35:22Z
autobuild: Drop py2 autobuild jobs

Samba v4.11 will no longer support python2, so let's drop the autobuild
jobs. This will save some gitlab/sn-devel time and money, as it's less
work for CI to do.

Note that this highlights some previous inconsistencies:
- samba-none-env-py2 was being built for gitlab but not sn-devel.
- samba-nt4-py2 was being built for sn-devel but not gitlab

I've left samba-buildpy2-only for now, which will be addressed in a
subsequent patch.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6ba99c36 by Tim Beale at 2019-02-15T03:35:22Z
autobuild: Update variable name to make more sense

When we switched from python2 being the default to python3, we didn't
update this variable name. It's now handling the python2 case, but it's
a boolean flag named 'py3', which is rather confusing.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8c5a5a58 by Tim Beale at 2019-02-15T03:35:22Z
autobuild: Remove the PY3_ONLY variable

This variable is no longer needed as all the tests run using python3
now.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9124e44d by Tim Beale at 2019-02-15T03:35:23Z
autobuild: Tidy up unnecessary line-breaks in 'TESTS='

Now that we've dropped the {PY3_ONLY} variable, there's no need for
line-breaks in some of the 'TESTS=' values. We can tidy this up a bit.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e11969de by Tim Beale at 2019-02-15T03:35:23Z
autobuild: Remove ${EXTRA_PYTHON} variable

We no longer build the python2 bindings, only python3. So we can get rid
of this variable now.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
689a1ee7 by Tim Beale at 2019-02-15T03:35:23Z
autobuild: Replace samba-buildpy2-only with samba-nopython-py2

For Samba 4.11, the minimum python2 functionality we will support (for
now, at least - we may change our minds) is for the --disable-python
target, i.e. if you're excluding all the python functionality from
samba, then WAF should still support being built with python2.

The use case here is old unix platforms that want to use smbd, but don't
have python3 support.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
63ea8680 by Tim Beale at 2019-02-15T03:35:23Z
autobuild: Drop 'py2' flag

This isn't used any more. It was only being set, never referenced.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8eac5a6b by Joe Guo at 2019-02-15T05:07:07Z
.gitignore: add ignore rules for a few dev tools

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Feb 15 06:07:07 CET 2019 on sn-devel-144

- - - - -
cd1ac366 by Björn Jacke at 2019-02-17T12:33:12Z
sambaundoguididx: use the right escaped oder unescaped sam ldb files

the correct filename is taken from the partition database before, we should not
unescape that because this can result in a new unescaped ldb file being created
and the script not to work at all.

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

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2888bee4 by Björn Jacke at 2019-02-17T12:33:12Z
replace: remove needless vxfs header file check

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
bc2cc687 by Björn Jacke at 2019-02-17T12:33:12Z
ntquotas: do not set inode limits when setting space quota

we are supposed to set a space quota limit, we should not calculate an
additional artifical inode limit out of that.

Signed-off-by: Bjoern Jacke <bjacke at samba.org>

- - - - -
99742c86 by Björn Jacke at 2019-02-17T12:33:12Z
sysquotas_linux: fix inode limit setting, which is not depeding on blocksize

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
28da0723 by Björn Jacke at 2019-02-17T12:33:12Z
sysquotas_xfs: fix inode limit setting, which is not depeding on blocksize

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
e4abe870 by Björn Jacke at 2019-02-17T12:33:13Z
sysquotas_nfs: also honor reported inode/file limits

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
56c198c0 by Bjoern Jacke at 2019-02-17T12:33:13Z
tests/quota: tidy up includes of sysquotas 4B

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
2eca1a66 by Bjoern Jacke at 2019-02-17T12:33:13Z
sysquotas.h: collect more platform quotablock sizes

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
21e930ad by Bjoern Jacke at 2019-02-17T12:33:13Z
waf: check for jfs/quota.h

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
0d815dbb by Bjoern Jacke at 2019-02-17T12:33:13Z
sysquotas_4B: make quota block calculation adopt to platform quota block size

the correct QUOTABLOCK_SIZE for platform is taken from sysquotas.h

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
c143de9a by Bjoern Jacke at 2019-02-17T12:33:13Z
sysquotas_4B: enable for jfs/quota.h on AIX

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
204a03e0 by Bjoern Jacke at 2019-02-17T12:33:13Z
add sysquotas_jfs2.c

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
0c9c51fa by Bjoern Jacke at 2019-02-17T12:33:13Z
tests/sysquotas.c: include jfs/quota.h for 4B test on AIX

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
7859ebc5 by Bjoern Jacke at 2019-02-17T12:33:14Z
quotas: remove legacy AIX quota code that is covered by sysquotas now

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
e2cc29da by Björn Jacke at 2019-02-17T12:33:14Z
waf/quotas: fail configure when quotas were requested but not found

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
e8d1e04b by Björn Jacke at 2019-02-17T12:33:14Z
sysquotas_4B: raise log level of a sometimes too noisy message

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>

- - - - -
6e72fe84 by Björn Jacke at 2019-02-17T12:33:14Z
waf: fix some missing newline compiler warnings

without a trailing newline the studio compiler issues:

warning: newline not last character in file

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
decba07b by Björn Jacke at 2019-02-17T12:33:14Z
waf: fix WERROR_CFLAGS check

if we found the right WERROR flags of the compiler then the compiler is right
to fail because we explicitly give it an empty file to compile. We
should not do that because that makes the almost successful test fail.
This fixed the studio compiler test.

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2ba972e9 by Björn Jacke at 2019-02-17T12:33:14Z
waf: fix compiler warnings in configure checks

the studio compiler issued here:

warning: statement not reached

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c1715406 by Björn Jacke at 2019-02-17T12:33:14Z
waf: remove duplicate WERROR cflags

WERROR flags are already added by the strict=True switch.

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
99dd2ae8 by Björn Jacke at 2019-02-17T12:33:14Z
waf: remove redundant WERROR flag

CHECK_CFLAGS always uses WERROR flags

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
918bf89d by Björn Jacke at 2019-02-17T12:33:15Z
waf: use the correct WERROR_CFLAGS in CHECK_CODE

all the non gcc version were incorrectly set here till now

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
7058a88c by Björn Jacke at 2019-02-17T12:33:15Z
waf: print the library name in which we search for a function

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f2c3d2b2 by Björn Jacke at 2019-02-17T12:33:15Z
wafsamba: we should also remove stale symlinks here

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c9bcde01 by Björn Jacke at 2019-02-17T12:33:15Z
waf: fix setting of RPATH_ST variable

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
44ccba40 by Björn Jacke at 2019-02-17T12:33:15Z
third_party/nss_wrapper/wscript: fix check for gethostbyname

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
b8bf7ef8 by Björn Jacke at 2019-02-17T12:33:15Z
waf: add library dependency for sendfile on Solaris

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
a87660b3 by Björn Jacke at 2019-02-17T14:05:20Z
third_party/nss_wrapper/wscript: check for libnsl and libsocket

this is needed as there are HAVE_LIBNSL and HAVE_LIBSOCKET in the code and
Samba fails to build in a terrible obscure way on Solaris if this is not
working inside nss_wrapper here.

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Björn Jacke <bjacke at samba.org>
Autobuild-Date(master): Sun Feb 17 15:05:20 CET 2019 on sn-devel-144

- - - - -
8f9bb790 by Tim Beale at 2019-02-18T04:42:09Z
selftest: Add common function to return cmd environment variables

We prefix samba-tool commands with a bunch of WRAPPER/CONF environment
variables, in order for the command to work properly. These variables
are duplicated all over the place in the selftest code. This patch adds
a helper function to return the variables, so we can reduce the required
code down to a single line in a lot of places.

A couple of exceptions I've left alone:
- drs replicate, which omits the RESOLV_WRAPPER_CONF/_HOSTS variables
  (I'm not sure whether that's deliberate or not).
- create_backup(), which uses the backupfromdc's krb5.conf rather than
  the new testenv.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
aeadf75c by Tim Beale at 2019-02-18T04:42:09Z
selftest: Export DC conf path for special cases

In a few rare cases, a test needs to assert aspects both client-side and
server-side aspects. A typical example would be the audit logging, which
is exercising client-side behaviour, but also asserting the server-side
logging.

Usually this has involved a kludge in tests.py to either use
socket-wrapper explicitly, or hardcode in the server smb.conf path.

This patch exposes the existing SERVERCONFFILE env variable to the
tests. DC_SERVERCONFFILE has been added for 2 DC testenvs, where we need
the PDC's smb.conf.

The benefit of doing this way is the filepath/testenv-dependency logic
is all self-contained with the Perl code, and it doesn't bleed out into
tests.py as well.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ab374462 by Tim Beale at 2019-02-18T04:42:09Z
tests: Tweak DRS tests to avoid unnecessary env variables

Each DC used in a DRS test has its own '<testenv>_SERVER' environment
variable, e.g. VAMPIRE_DC_SERVER. These variables are only used by
test.py for DRS, but they're not actually needed.

The $SERVER environment variable holds the same information, so we can
just use this in test.py instead.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b3480459 by Tim Beale at 2019-02-18T04:42:09Z
selftest: Remove unused environment variables

We only really want generic environment variables. For 2+ DC
environments, we have the $SERVER and $DC_SERVER (aka PDC) variables.
However, lots of testenvs also export really specific environment
variables, e.g. VAMPIRE_2000_DC_SERVER_IP (despite that testenv being
only used for a single test case).

Previously the <testenv>_SERVER variable was used for DRS tests, but we
can avoid the need to do this now. The other variables are not used at
all.

The RODC and TRUST environment variables are still used by a few tests.
SUBDOM_DC_SERVER is only used within Samba4.pm and not exported.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bc4c0438 by Tim Beale at 2019-02-18T04:42:09Z
selftest: Remove need for $RODC_DC_SERVER env variable

Same deal as earlier patch - we can use the $SERVER env variable instead
and avoid the need for this extra variable.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
31c5d4c9 by Tim Beale at 2019-02-18T04:42:10Z
selftest: Add helper function to avoid repeated {DC_SERVER}=x

For every 2-DC testenv we setup, we copy the $DC_SERVER value of the
dependent testenv (i.e. the PDC) into the env variables for the new
testenv. This means DC_SERVER always points to the PDC (or first DC).

This adds a helper function to avoid repeating this code for every 2-DC
environment we setup.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8fc04d2c by Tim Beale at 2019-02-18T06:24:05Z
selftest: Initialize DC_SERVER/etc variables in one place

It's simpler to do setup DC_SERVER/etc in the same place we set
SERVER/etc. (Rather than initializing them for every single testenv,
like we were doing).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Feb 18 07:24:05 CET 2019 on sn-devel-144

- - - - -
4843a27b by Joe Guo at 2019-02-18T08:25:21Z
wafsamba/symbols: always split Popen output by bytes

In py3, `wafsamba.duplicate_symbols` test may fail:

    ...
    elfpipe = subprocess.Popen(['readelf', '--dynamic', binname], stdout=subprocess.PIPE).stdout
    ...

    File "./buildtools/wafsamba/symbols.py", line 153, in get_libs
        rpath.extend(m.group(1).split(":"))
    TypeError: a bytes-like object is required, not 'str'

Because Popen will always return bytestr even in py3, and ":" is a
unicode str in py3.  Change ":" to b":" to fix.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9fa698b0 by Joe Guo at 2019-02-18T08:25:21Z
wafsamba/symbols: change regex to match both rpath and runpath for different readelf output

In `wafsamba.dumplicate_symbols` test, it will use Popen to call:

    readelf --dynamic bin/default/source3/lib/netapi/examples/netlogon/netlogon_control2

then try to find rpath lib lines from output with regex:

    re_rpath     = re.compile(b'Library rpath: \[(.*)\]')

In ubuntu 14.04 docker image, which current CI is using, the actual output
from `readelf` is `runpath` instead of 'rpath':

    ...
    Library runpath: [/home/gitlab-runner/samba/bin/shared:/home/gitlab-runner/samba/bin/shared/private]\n'
    ...

So the regex never matched, and hide a bug.

In Ubuntu 1604 docker image, the output changes to `rpath` and matched the
regex, which expose the error in previous commit.

Improve the regex to match both `rpath` and `runpath`.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6b4ae52f by Joe Guo at 2019-02-18T09:54:19Z
.gitlab-ci.yml: merge .gitlab-ci-private.yml

`.gitlab-ci.yml` support conditional jobs with `only` and `except`.
And variables can be read from repo CI/CD settings as condition:

    build_samba:
      script: ...
      only:
        variables:
          - $SUPPORT_PRIVATE_TEST == 'yes'

Instead of having 2 copies of yml file, we can use this feature to
trigger private jobs only when a var like `SUPPORT_PRIVATE_TEST` is defined.

I've already added above var to our repos.
Once merged, we can remove custom CI config file in
gitlab repo settings, and remove .gitlab-ci-private.yml file from code.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Feb 18 10:54:19 CET 2019 on sn-devel-144

- - - - -
03357bc8 by Andreas Schneider at 2019-02-18T12:01:12Z
nssswitch: Log user access to kerberos

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Feb 18 13:01:12 CET 2019 on sn-devel-144

- - - - -
ec51bfca by Tim Beale at 2019-02-19T23:37:14Z
s3:tests: Set/return $failed in test_smbclient_auth.sh

Update the test so the shell script returns pass/fail as the exit code.

Note that subunit is just looking for 'failure:' in the test output for
whether the test passed or failed, so setting $failed isn't strictly
required.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bcd00753 by Tim Beale at 2019-02-19T23:37:14Z
selftest: Abort if we fail to startup testenv with '--one' option

The --one selftest.pl option means abort when the first test fails.
However, when 'make test' fails to startup a testenv, it'll try to
continue and run other tests by default. When '--one' is used,
selftest.pl can just die() at that point.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
96472306 by Tim Beale at 2019-02-20T01:10:00Z
selftest: Add basic sanity-check tests for nopython target

Previously we were only checking samba compiled OK with
--disable-python, not that it actually ran.

The main problem is all the make test framework is based around
subunit/smbtorture, neither of which we seem to build with
disable-python. However, for just a simple sanity-check, we can just
bypass all the subunit-filter work and just call the Perl code directly.
This works OK as long as it's just simple shell script tests that we're
running, as we can check the script's exit code directly.

The main thing that we really want to test is that we can start up the
smbd testenv and connect to it (i.e. a simple smbclient test).

This patch adds a new 'make test-nopython' target. This disables the
subunit filtering, and runs a small test-list that was generated manually.

Note that currently this has the limitation that it doesn't support known
failures or flapping tests. However, just checking that smd starts up OK
is probably OK for now.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Feb 20 02:10:00 CET 2019 on sn-devel-144

- - - - -
853ad870 by Gary Lockyer at 2019-02-20T05:03:08Z
auth_log tests: Allow the remote address to be None

Allow self.remoteAddress to be None, remote address filtering is not
required for the winbind auth logging tests.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e3693bc2 by Gary Lockyer at 2019-02-20T05:03:08Z
wbinfo: fix --ntlmv1 option

Currently using the --ntlmv1 option fails with an unknown option error.
This patch ensures that the option is correctly supported.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
47cebbe2 by Gary Lockyer at 2019-02-20T05:03:08Z
s3 winbind auth_log: Tests for logon id logging.

Tests to validate that winbind generates a random logon_id and passes it
in the netlogon call.

This will allow the linking of the windbind authentication requests and
the SamLogon request on the DC.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
826d930a by Gary Lockyer at 2019-02-20T05:03:08Z
s3 auth: Create messaging and lp contexts.

If 'auth event notifications' are enabled create an imessaging_context
and a loadparm_context that can be passed to log_authentication_event.

This will allow the generated authentication messages to be tested.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
87e63a86 by Gary Lockyer at 2019-02-20T05:03:08Z
lib util: Add function to generate random uint64_t

Generate a random uint64_t , which will be used for the netlogon
logon_id.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
96e6aded by Gary Lockyer at 2019-02-20T05:03:09Z
librpc idl: netlogon netr_identity_info logon_id to 64 bit

Fold the two 32 bit values logon_id_high and logon_id_low into a single
64 bit logon_id in netr_identity_info.  This will be used to tie
together winbind and SamLogon requests in audit logging.

Summary of the of the Query and Response from Microsoft on it's usage.

[REG:119013019612095] [MS-NRPC]: NETLOGON_LOGON_IDENTITY_INFO: Does
the Reserved field have LogonId meaning?

Questions:
  In NetrLogonSamLogonEx does the Reserved field
  (of NETLOGON_LOGON_IDENTITY_INFO) have LogonId meaning?

  What is a valid LogonID, and does have any audit usage?

  Samba is sending a constant "deadbeef" in hex and would like to
  understand any usage of this field.

Response:
  The NRPC spec is accurate in defining the field as Reserved, and without
  protocol significance. In the header file in our source code, it is
  defined as LogonId and commented as such, but it’s effectively not used.
  This is probably why the API structure has that field name. It may have
  been intended as such but it’s not used.

Samba will send a random value in this field.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d486a199 by Gary Lockyer at 2019-02-20T05:03:09Z
auth log: Log the netlogon logon id.

Add code to log the logonId in the JSON Authentication messages.

The version number for Authentication messages changes from 1.1 to 1.2
to reflect this.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
62e4f8f3 by Gary Lockyer at 2019-02-20T05:03:09Z
s4 rpc netlogon: Pass logon_id to auth logging

Pass the logon_id passed in the netlogon identity information to
auth_logging.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e8e4f35b by Gary Lockyer at 2019-02-20T05:03:09Z
kdc hdb: Generate and pass logon ID

Generate and pass the logon_id in SamLogon calls

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0e2acf6c by Gary Lockyer at 2019-02-20T05:03:09Z
winbind: Generate and pass logon ID

Generate a random logon_id and pass it in the SamLogon calls.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c8b7b791 by Gary Lockyer at 2019-02-20T05:03:09Z
winbind: Log PAM and NTLM authentications.

Generate JSON authentication messages for winbind PAM_AUTH and
PAM_AUTH_CRAP requests.  The logon_id in these messages can be used to
link them to the SamLogon messages.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d4baed45 by Gary Lockyer at 2019-02-20T06:43:10Z
WHATSNEW: winbind authentication logging

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Feb 20 07:43:10 CET 2019 on sn-devel-144

- - - - -
9c2d15c2 by David Disseldorp at 2019-02-20T11:11:20Z
vfs_glusterfs: check for VFS_ADD_FSP_EXTENSION() failure

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
8c92702d by David Disseldorp at 2019-02-20T12:56:09Z
vfs_ceph: refactor if-error-return-else logic

vfs_ceph has quite a few occurrences of:
	if (result < 0) {
		WRAP_RETURN(result);	/* calls return */
	} else {
		...
	}

This change drops the superfluous else {} encapsulation and also removes
duplication of ceph statx debug messages.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Wed Feb 20 13:56:09 CET 2019 on sn-devel-144

- - - - -
5f9a5ef2 by Noel Power at 2019-02-21T03:09:19Z
s4/param: Fix provision_get_schema leaking python object

provision_get_schema returns a ldb_context object which is stored
in a python object. As a result the parent python object is never
decrefed and probably not released ever.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
fa8a8483 by Joe Guo at 2019-02-21T03:09:19Z
dbcheck: skip reverse member link checks when cli option specified

currently dbcheck cmd tooks about 1 day to finish on a 100k user database.
We can skip member reverse link checks to speed it up dramatically.
A new cli option is added to enable the skipping.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e051d787 by Joe Guo at 2019-02-21T03:09:19Z
selftest/tests: add helper method to simplify plantestsuite

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8216a619 by Joe Guo at 2019-02-21T03:09:19Z
selftest/tests: add smoketests for dbcheck --quick-membership-checks

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3803f87f by Joe Guo at 2019-02-21T03:09:20Z
bootstrap/config.py: define package lists and templates

Define default pkg list, and allow to override for each dist.
Also define bootstrap/Dockerfile/Vagrantfile templates.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3737518a by Joe Guo at 2019-02-21T03:09:20Z
bootstrap/template.py: add cli to render templates

- bootstrap for each dist
- Dockerfile for each dist
- Vagrantfile all in one

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
26d2f74c by Joe Guo at 2019-02-21T03:09:20Z
bootstrap/docker.py: add cli to build/tag/push docker images

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
50a1109c by Joe Guo at 2019-02-21T03:09:20Z
bootstrap/dists: add rendered files for dists

Add these into repo, then we can link it to samba wiki,
for people to get a latest and precise pkg list

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d6f6eb4f by Joe Guo at 2019-02-21T03:09:20Z
bootstrap/README.md: add README.md

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cf8ff6b8 by Martin Krämer at 2019-02-21T03:09:20Z
Update dsacl.py - add_ace to handle/verify sddl parameter correct

Test for samba-tool dsacl set --sddl parmeter

Update tests.py - add dsacl (dsacl.py / samba-tool dsacl set) test

Signed-off-by: <Martin Krämer mk.maddin at gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
fb7a8064 by Martin Krämer at 2019-02-21T03:09:20Z
Add command "samba-tool dsacl get" This code is very equal to "samba-tool dsacl set", except it only prints out the current sddl of an object.

Signed-off-by: Martin Krämer <mk.maddin at gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8431cd40 by Andrew Bartlett at 2019-02-21T03:09:20Z
samba-tool dsacl: Mark old and new descriptor output correctly

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
8e201529 by Andrew Bartlett at 2019-02-21T03:09:21Z
selftest: Add test for samba-tool dsacl get, cross-checked with samba-tool dsacl set

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
cbf23f2b by Andrew Bartlett at 2019-02-21T04:37:31Z
selftest: Confirm new and old SDDL strings differ after a samba-tool dsacl set

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Feb 21 05:37:31 CET 2019 on sn-devel-144

- - - - -
fa8e69ac by Swen Schillig at 2019-02-22T01:08:07Z
ctdb: buffer write beyond limits

In order to calculate the number of bytes correctly which
are to be read into the buffer, the buffer.offset must be taken
into account.

This patch fixes a regression introduced by 382705f495dd.

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

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
92a90524 by Christof Schmitt at 2019-02-22T02:51:37Z
ctdb-tests: Add test for ctdb_io.c

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Fri Feb 22 03:51:37 CET 2019 on sn-devel-144

- - - - -
b33fad77 by Jiří Šašek at 2019-02-22T11:30:10Z
notifyd: Fix SIGBUS on sparc

Problem is the structure "struct notify_instance" can lay in message buffer on
address not dividable by 8 but this structure begins by uint_64 (secs in
time-stamp). Structure should be re-packed to standalone buffer before the use.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13704
Signed-off-by: jiri.sasek at oracle.com
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Björn Jacke <bjacke at samba.org>
Autobuild-Date(master): Fri Feb 22 12:30:11 CET 2019 on sn-devel-144

- - - - -
02c9bee8 by Mark Niggemann at 2019-02-22T14:04:54Z
set caller allocation units in statvfs f_bavail

Signed-off-by: Mark Niggemann <mark.niggemann at ge.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bjoern Jacke <bjacke at samba.org>

Autobuild-User(master): Björn Jacke <bjacke at samba.org>
Autobuild-Date(master): Fri Feb 22 15:04:55 CET 2019 on sn-devel-144

- - - - -
64176f00 by Volker Lendecke at 2019-02-22T20:48:11Z
libsmb: Convert cli_posix_open to normal tevent_req pattern

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

- - - - -
529c61d0 by Volker Lendecke at 2019-02-22T20:48:11Z
libsmb: Pull up wire_flags calculation from open_internal

This avoids passing down a boolean

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

- - - - -
5dd67797 by Volker Lendecke at 2019-02-22T20:48:11Z
libsmb: Fix a resource leak in cli_posix_mkdir

smbd does posix_mkdir if the wire flags are exactly

	if (wire_open_mode == (SMB_O_CREAT|SMB_O_DIRECTORY))

open_flags_to_wire however adds a SMB_O_RDONLY, so that we enter the
normal open routine which happens to create a directory as well. The
main difference is that posix_mkdir does *NOT* return an open
handle. As we did not enter this code path due to the SMB_O_RDONLY we
leak a SMB1 fd per cli_posix_mkdir call.

Pretty hard to test automatically, this would be an interaction with
smbstatus.

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

- - - - -
121af4c3 by Andreas Schneider at 2019-02-22T20:48:11Z
s4:dns_crypto: Remove unused include of hmac_md5.h

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3d95c1f6 by Andreas Schneider at 2019-02-22T20:48:11Z
s3:auth: Remove unused arcfour.h header from server_info.c

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
6b4bb232 by Andreas Schneider at 2019-02-22T20:48:11Z
s3:auth: Remove unused arcfour.h from auth_util.c

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e5031537 by Andreas Schneider at 2019-02-22T20:48:11Z
s3:rpc_server: Remove unused arcfour.h from netlogon

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0a1d1a57 by Andreas Schneider at 2019-02-22T22:16:40Z
s3:winbindd: Remove unused arcfour.h from PAM handling

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Feb 22 23:16:40 CET 2019 on sn-devel-144

- - - - -
f5a8bc2f by Ralph Boehme at 2019-02-23T06:54:09Z
winbindd: make a copy of xid's in wb_xids2sids_send()

This is in preparation of setting the result of the mapping in the top-
level callback wb_xids2sids_done(), not in the per-idmap-domain callback
wb_xids2sids_dom_done().

When caching the mapping we need the id-type from the backend, so we
need a way to pass up that information from wb_xids2sids_dom_done() up
to wb_xids2sids_done()

The xids array copy gets passed from wb_xids2sids_send() to
wb_xids2sids_dom_send(), so wb_xids2sids_dom_done() can then directly
update the top-level copy.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
5d277ea7 by Ralph Boehme at 2019-02-23T06:54:09Z
winbindd: make xids a const argument to wb_xids2sids_send()

The previous commit made an internal copy of xids, this commit makes it
more obvious that we must not mess with the xids argument but treat it as
an in-parameter and don't write to it.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
f8bf4fc6 by Ralph Boehme at 2019-02-23T06:54:09Z
winbindd: convert id to a pointer in wb_xids2sids_dom_done()

No change in behaviour.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
7f23ef7b by Ralph Boehme at 2019-02-23T06:54:09Z
winbindd: update xid in wb_xids2sids_state->xids with what we got

In preparation of priming the idmap cache in the top-level
wb_xids2sids_done(), not in the per-idmap-domain callback
wb_xids2sids_dom_done().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
8e9c2a1f by Ralph Boehme at 2019-02-23T06:54:09Z
winbindd: switch send-next/done order

In preparation of adding more logic to the done step. No change in
behaviour.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
62f54229 by Ralph Boehme at 2019-02-23T06:54:10Z
winbindd: track whether a result from xid2sid was coming from the cache

This is needed in preparation of moving the step to update the idmap
cache from the per-idmap-domain callback wb_xids2sids_dom_done() to the
top-level callback wb_xids2sids_done().

Currently the sequence of action is:

* check cache, if not found:
  * ask backends
  * cache result from backend
* return results

Iow, if we got something from the cache, we don't write the cache.

The next commit defers updating the cache to the top-level callback, so
the sequence becomes

* check cache, if not found:
  * ask backends
* cache results
* return results

This has two problems:

* it needlessly writes to the cache what we just got from it

* it possibly overwrites the ID_TYPE_BOTH for a SID-to-xid mapping in
  the following case:

  - existing ID_TYPE_BOTH mapping in the cache, eg:

    IDMAP/SID2XID/S-1-5-21-2180672342-2513613279-2566592647-512 -> Value: 3000000:B

  - someone calls wb_xids2sids_send() with xid.id=3000000,xid.type=ID_TYPE_GID

  - cache lookup with idmap_cache_find_gid2sid() succeeds

  - when caching results we'd call idmap_cache_set_sid2unixid() with the
    callers xid.type=ID_TYPE_GID, so idmap_cache_set_sid2unixid() will
    overwrite the SID-to-xid mapping with ID_TYPE_GID

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
9b9565c3 by Ralph Boehme at 2019-02-23T08:23:21Z
winbindd: set idmap cache entries as the last step in async wb_xids2sids

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13802

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Sat Feb 23 09:23:22 CET 2019 on sn-devel-144

- - - - -
f0decb31 by Jeremy Allison at 2019-02-24T11:21:10Z
s3: smbtorture3: Add POSIX-MKDIR test for posix_mkdir case sensitive bug.

Test does:

mkdir POSIX_foo
mkdir POSIX_Foo
mkdir POSIX_foo/Foo
mkdir POSIX_foo/foo
mkdir POSIX_Foo/Foo
mkdir POSIX_Foo/foo

Which should pass a SMB1 POSIX extensions server
as posix mkdir should always be case sensitive
no matter what the share is set to.

Mark as knownfail for now.

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

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

- - - - -
980db8de by Jeremy Allison at 2019-02-24T11:21:10Z
smbd: SMB1-POSIX: Add missing info-level SMB_POSIX_PATH_OPEN for UCF_UNIX_NAME_LOOKUP flag.

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

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

- - - - -
12da33e2 by Jeremy Allison at 2019-02-24T13:04:14Z
smbd: unix_convert: Ensure we don't call get_real_filename on POSIX paths.

For posix_pathnames don't blunder into the name_has_wildcard OR
get_real_filename() codepaths as they may be doing case insensitive lookups.
So when creating a new POSIX directory 'Foo' they might
match on name 'foo'.

Remove POSIX-MKDIR from knownfail.

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

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

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Sun Feb 24 14:04:14 CET 2019 on sn-devel-144

- - - - -
82e7f382 by Martin Schwenke at 2019-02-25T01:12:16Z
ctdb-config: Change example recovery lock setting to one that fails

ctdbd will start without a recovery lock configured.  It will log a
message saying that this is not optimal.  However, a careless user may
overlook both this message and the importance of setting a recovery
lock.  If the existing example configuration is uncommented then the
directory containing it will be created (by 01.reclock.script) and the
failure (i.e. multiple nodes able to take the lock) will be confusing.

Instead, change the example setting to one that will result in banned
nodes, encouraging users to consciously configure (or deconfigure) the
recovery lock.  Tweak the corresponding comment.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
621658cb by Martin Schwenke at 2019-02-25T01:12:16Z
ctdb-recoverd: Free cluster mutex handler on failure to take lock

If nested events occur while the file descriptor handler is still
active then chaos can ensue.  For example, if a node is banned and the
lock is explicitly cancelled (e.g. due to election loss) then
double-talloc-free()s abound.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
7e4aae69 by Martin Schwenke at 2019-02-25T01:12:16Z
ctdb-recoverd: Clean up logging on failure to take recovery lock

Add an explicit case for a timeout and clean up the other messages.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
c0fb62ed by Martin Schwenke at 2019-02-25T01:12:16Z
ctdb-recoverd: Make recoverd context available in recovery lock handle

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
45a77d65 by Martin Schwenke at 2019-02-25T01:12:17Z
ctdb-recoverd: Ban node on unknown error when taking recovery lock

We really shouldn't see unknown errors.  They probably represent a
misconfigured recovery lock or similar.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
13a1a480 by Martin Schwenke at 2019-02-25T01:12:17Z
ctdb-recoverd: Time out attempt to take recovery lock after 120s

Currently this will wait forever.  It really needs a timeout in case
the cluster filesystem (or other lock mechanism) is completely wedged.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
ce09d9c3 by Martin Schwenke at 2019-02-25T01:12:17Z
ctdb-tests: Force test failure if local daemon setup fails

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
e74f5243 by Martin Schwenke at 2019-02-25T01:12:17Z
ctdb-tests: Add -R option for local daemons to use recovery lock command

Under the covers, a command is always used.  However, there is no way
of testing of the code path where a command is explicitly configured.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
ebc08212 by Martin Schwenke at 2019-02-25T01:12:17Z
ctdb-tests: Add a test for configuring the recovery lock as a command

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
c93430fe by Martin Schwenke at 2019-02-25T02:40:16Z
ctdb-cluster-mutex: Separate out command and file handling

This code is difficult to read and there really is no common code
between the 2 cases.  For example, there is no need to split a
filename into words.  Separating each of the 2 cases into its own
function makes the logic much easier to understand.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Mon Feb 25 03:40:16 CET 2019 on sn-devel-144

- - - - -
632d0db8 by Jeremy Allison at 2019-02-25T07:05:16Z
s3: torture: Add additional POSIX mkdir tests.

Ensure that if POSIX_foo exists as a file
we return the correct error code NT_STATUS_OBJECT_PATH_NOT_FOUND
if we try and traverse it as a directory.

Also ensure creation/deletion of POSIX_foo/foo fails
for directories and files with NT_STATUS_OBJECT_PATH_NOT_FOUND
if the directory POSIX_foo/ doesn't exist.

knownfail is back :-).

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

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

- - - - -
3f1a13a9 by Jeremy Allison at 2019-02-25T08:33:27Z
s3: smbd: filenames - ensure we replace the missing '/' if we error in an intermediate POSIX path.

Previous regression test ensures we still return the correct
error code for POSIX pathname operations.

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

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

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Mon Feb 25 09:33:27 CET 2019 on sn-devel-144

- - - - -
d9f9a73d by Volker Lendecke at 2019-02-25T18:36:19Z
torture: Use GUID_zero()

10 lines less...

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2bd6f57c by Volker Lendecke at 2019-02-25T18:36:19Z
smbd: Align integer types

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
26f18b9b by Volker Lendecke at 2019-02-25T18:36:20Z
libsmb: Resolve special _recv handling in cli_ntcreate

cli_smb2_create_fnum_recv will gain output create blobs soon and thus
differ from the NT1 function.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e8e96771 by Volker Lendecke at 2019-02-25T20:07:22Z
libcli: Pass buf/len to smb2_negotiate_context_add

Every caller did a data_blob_const() right before calling
smb2_negotiate_context_add(). Avoid that.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Feb 25 21:07:22 CET 2019 on sn-devel-144

- - - - -
3674b089 by Lukas Slebodnik at 2019-02-25T20:26:11Z
CVE-2019-3824 ldb: Out of bound read in ldb_wildcard_compare

There is valgrind error in few tests tests/test-generic.sh
 91 echo "Test wildcard match"
 92 $VALGRIND ldbadd $LDBDIR/tests/test-wildcard.ldif  || exit 1
 93 $VALGRIND ldbsearch '(cn=test*multi)'  || exit 1
 95 $VALGRIND ldbsearch '(cn=*test_multi)'  || exit 1
 97 $VALGRIND ldbsearch '(cn=test*multi*test*multi)'  || exit 1

e.g.
  ==3098== Memcheck, a memory error detector
  ==3098== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  ==3098== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
  ==3098== Command: ./bin/ldbsearch (cn=test*multi)
  ==3098==
  ==3098== Invalid read of size 1
  ==3098==    at 0x483CEE7: memchr (vg_replace_strmem.c:890)
  ==3098==    by 0x49A9073: memmem (in /usr/lib64/libc-2.28.9000.so)
  ==3098==    by 0x485DFE9: ldb_wildcard_compare (ldb_match.c:313)
  ==3098==    by 0x485DFE9: ldb_match_substring (ldb_match.c:360)
  ==3098==    by 0x485DFE9: ldb_match_message (ldb_match.c:572)
  ==3098==    by 0x558F8FA: search_func (ldb_kv_search.c:549)
  ==3098==    by 0x48C78CA: ??? (in /usr/lib64/libtdb.so.1.3.17)
  ==3098==    by 0x48C7A60: tdb_traverse_read (in /usr/lib64/libtdb.so.1.3.17)
  ==3098==    by 0x557B7C4: ltdb_traverse_fn (ldb_tdb.c:274)
  ==3098==    by 0x558FBFA: ldb_kv_search_full (ldb_kv_search.c:594)
  ==3098==    by 0x558FBFA: ldb_kv_search (ldb_kv_search.c:854)
  ==3098==    by 0x558E497: ldb_kv_callback (ldb_kv.c:1713)
  ==3098==    by 0x48FCD58: tevent_common_invoke_timer_handler (in /usr/lib64/libtevent.so.0.9.38)
  ==3098==    by 0x48FCEFD: tevent_common_loop_timer_delay (in /usr/lib64/libtevent.so.0.9.38)
  ==3098==    by 0x48FE14A: ??? (in /usr/lib64/libtevent.so.0.9.38)
  ==3098==  Address 0x4b4ab81 is 0 bytes after a block of size 129 alloc'd
  ==3098==    at 0x483880B: malloc (vg_replace_malloc.c:309)
  ==3098==    by 0x491048B: talloc_strndup (in /usr/lib64/libtalloc.so.2.1.15)
  ==3098==    by 0x48593CA: ldb_casefold_default (ldb_utf8.c:59)
  ==3098==    by 0x485F68D: ldb_handler_fold (attrib_handlers.c:64)
  ==3098==    by 0x485DB88: ldb_wildcard_compare (ldb_match.c:257)
  ==3098==    by 0x485DB88: ldb_match_substring (ldb_match.c:360)
  ==3098==    by 0x485DB88: ldb_match_message (ldb_match.c:572)
  ==3098==    by 0x558F8FA: search_func (ldb_kv_search.c:549)
  ==3098==    by 0x48C78CA: ??? (in /usr/lib64/libtdb.so.1.3.17)
  ==3098==    by 0x48C7A60: tdb_traverse_read (in /usr/lib64/libtdb.so.1.3.17)
  ==3098==    by 0x557B7C4: ltdb_traverse_fn (ldb_tdb.c:274)
  ==3098==    by 0x558FBFA: ldb_kv_search_full (ldb_kv_search.c:594)
  ==3098==    by 0x558FBFA: ldb_kv_search (ldb_kv_search.c:854)
  ==3098==    by 0x558E497: ldb_kv_callback (ldb_kv.c:1713)
  ==3098==    by 0x48FCD58: tevent_common_invoke_timer_handler (in /usr/lib64/libtevent.so.0.9.38)
  ==3098==
  # record 1
  dn: cn=test_multi_test_multi_test_multi,o=University of Michigan,c=TEST
  cn: test_multi_test_multi_test_multi
  description: test multi wildcards matching
  objectclass: person
  sn: multi_test
  name: test_multi_test_multi_test_multi
  distinguishedName: cn=test_multi_test_multi_test_multi,o=University of Michiga
   n,c=TEST

  # returned 1 records
  # 1 entries
  # 0 referrals

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

Signed-off-by: Lukas Slebodnik <lslebodn at fedoraproject.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
745b99fc by Andrew Bartlett at 2019-02-25T20:26:11Z
CVE-2019-3824 ldb: Extra comments to clarify no pointer wrap in wildcard processing

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
9427806f by Andrew Bartlett at 2019-02-25T20:26:11Z
CVE-2019-3824 ldb: Improve code style and layout in wildcard processing

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
8d34d172 by Gary Lockyer at 2019-02-25T20:26:11Z
CVE-2019-3824 ldb: ldb_parse_tree use talloc_zero

Initialise the created ldb_parse_tree with talloc_zero, this ensures
that it is correctly initialised if inadvertently passed to a function
expecting a different operation type.

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
34383981 by Gary Lockyer at 2019-02-25T20:26:11Z
CVE-2019-3824 ldb: wildcard_match check tree operation

Check the operation type of the passed parse tree, and return
LDB_INAPPROPRIATE_MATCH if the operation is not LDB_OP_SUBSTRING.

A query of "attribute=*" gets parsed as LDB_OP_PRESENT, checking the
operation and failing ldb_wildcard_match should help prevent confusion
writing tests.

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
42f0f57e by Gary Lockyer at 2019-02-25T20:26:12Z
CVE-2019-3824 ldb: wildcard_match end of data check

ldb_handler_copy and ldb_val_dup over allocate by one and add a trailing '\0'
to the data, to make them safe to use the C string functions on.

However testing for the trailing '\0' is not the correct way to test for
the end of a value, the length should be checked instead.

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
45b75db5 by Gary Lockyer at 2019-02-25T20:26:12Z
CVE-2019-3824 ldb: Add tests for ldb_wildcard_match

Add cmocka tests for ldb_wildcard_match.

Running test_wildcard_match under valgrind reproduces
 CVE-2019-3824 out of bounds read in wildcard compare (bug 13773)

 valgrind --suppressions=lib/ldb/tests/ldb_match_test.valgrind\
          bin/ldb_match_test

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
de3bb5cd by Gary Lockyer at 2019-02-25T21:54:13Z
CVE-2019-3824 ldb: Release ldb 1.6.1

* CVE-2019-3824 out of bounds read in wildcard compare (bug 13773)

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Mon Feb 25 22:54:13 CET 2019 on sn-devel-144

- - - - -
5ed5c337 by David Mulder at 2019-02-26T09:39:24Z
Search for location of waf script

When calling make from the ldb, talloc, tdb, and
tevent bundles, we need to first find the
location of the waf script. Currently the build
fails since it can't find waf.

Fixes regression caused by a660b7f.

Signed-off-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f0d26dd1 by Stefan Metzmacher at 2019-02-26T09:39:24Z
tdb: version 1.3.18

* Fix build problems with older python versions.
* C99 build fixes.
* Fix standalone build of tdb.

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
3fe1551b by Stefan Metzmacher at 2019-02-26T09:39:24Z
talloc: version 2.1.16

* Fix standalone build of talloc.

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
db58a502 by Stefan Metzmacher at 2019-02-26T09:39:24Z
tevent: version 0.9.39

* py_tevent: add_timer takes float argument
* C99 build fixes.
* Fix standalone build of tevent.

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
09d281d6 by Stefan Metzmacher at 2019-02-26T11:10:40Z
ldb: version 1.6.2

* Fix standalone build of ldb.

Signed-off-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue Feb 26 12:10:40 CET 2019 on sn-devel-144

- - - - -
e3902283 by Volker Lendecke at 2019-02-27T00:35:18Z
addns: Remove some unused defines

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

- - - - -
8284ed9c by Volker Lendecke at 2019-02-27T00:35:18Z
pdbtest: Use dom_sid_str_buf

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

- - - - -
258d7d1c by Volker Lendecke at 2019-02-27T00:35:18Z
libads: Use dom_sid_str_buf

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

- - - - -
f5cd535b by Volker Lendecke at 2019-02-27T00:35:18Z
libads: Align integer types

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

- - - - -
d8374109 by Volker Lendecke at 2019-02-27T00:35:18Z
winbindd: Fix typos

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

- - - - -
d48aa9a5 by Volker Lendecke at 2019-02-27T00:35:18Z
winbind: Align integer types

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

- - - - -
e8efe16b by Volker Lendecke at 2019-02-27T00:35:18Z
winbind: Fix an error path memleak

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

- - - - -
7d9b7604 by Volker Lendecke at 2019-02-27T00:35:19Z
winbind: Avoid a "==False"

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

- - - - -
071af60d by Volker Lendecke at 2019-02-27T00:35:19Z
audit_log: Use dom_sid_str_buf

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

- - - - -
54d2e88f by Volker Lendecke at 2019-02-27T00:35:19Z
dsdb: Align integer types

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

- - - - -
908ef165 by Volker Lendecke at 2019-02-27T00:35:19Z
libnet: Use dom_sid_str_buf

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

- - - - -
a89b0f3f by Volker Lendecke at 2019-02-27T00:35:19Z
rpc_server: Use dom_sid_str_buf

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

- - - - -
e9ee003b by Andreas Schneider at 2019-02-27T00:35:19Z
libcli:smb: Zero sensitive memory after use

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
b451168d by Andreas Schneider at 2019-02-27T00:35:19Z
auth:gensec: Make sure we zero the checksum after use

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0045a919 by Andreas Schneider at 2019-02-27T02:22:50Z
libcli:auth: Avoid explicit ZERO_STRUCT

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Feb 27 03:22:50 CET 2019 on sn-devel-144

- - - - -
0ee398e8 by Andreas Schneider at 2019-02-27T07:59:26Z
lib:crypto: Include only the required header files

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
b09f6468 by Andreas Schneider at 2019-02-27T07:59:27Z
krb5_wrap: Only use the required md4 header

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
75a5db9c by Andreas Schneider at 2019-02-27T07:59:27Z
libcli:auth: Only use the required md4 header

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
a1a005cb by Andreas Schneider at 2019-02-27T07:59:27Z
libcli:auth: Only use the required md4 header

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
195322b8 by Andreas Schneider at 2019-02-27T07:59:27Z
s4:dsdb: Only use the required md4 header file

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
5890eb77 by Andreas Schneider at 2019-02-27T07:59:27Z
s4:dsdb: Only use the required md4 and md5 header files

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
79207884 by Andreas Schneider at 2019-02-27T07:59:27Z
libcli:samsync: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
5854fcdb by Andreas Schneider at 2019-02-27T07:59:27Z
s4:dsdb: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
53fbd4b9 by Andreas Schneider at 2019-02-27T07:59:27Z
s4:torture: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
eb13f70e by Andreas Schneider at 2019-02-27T10:00:32Z
libcli:auth: Remove unused header file

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Wed Feb 27 10:00:32 UTC 2019 on sn-devel-144

- - - - -
ec115b90 by Stefan Metzmacher at 2019-02-27T10:16:10Z
s4:selftest: move very slow tests on ad_dc_ntvfs into one location in tests.py

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
62eeab8f by Stefan Metzmacher at 2019-02-27T10:16:10Z
selftest:Samba4: add fl2008dc as alias to ad_dc_ntvfs

Using aliases it will be possible to split the large amount
of tests which use ad_dc_ntvfs into multiple autobuild/ci
tasks/jobs later.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
07b662e2 by Stefan Metzmacher at 2019-02-27T10:16:10Z
s4:selftest: use the fl2008dc alias when looping over all functional levels

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c82b60c8 by Stefan Metzmacher at 2019-02-27T10:16:10Z
selftest:Samba4: add ad_dc_slowtests alias to ad_dc_ntvfs

This will allow us to run really slow tests in an isolated
autobuild/ci task later.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3385b33c by Stefan Metzmacher at 2019-02-27T10:16:10Z
s4:selftest: make use of ad_dc_slowtests

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c217a15a by Stefan Metzmacher at 2019-02-27T10:16:10Z
selftest:Samba4: add ad_dc_default alias to ad_dc_ntvfs

This will allow us to run really most tests in an isolated
autobuild/ci task later.

This will apply to tests, which may not rely on the ntvfs backend, so
the ad_dc_default alias can point to another environment in future.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
780cceae by Stefan Metzmacher at 2019-02-27T10:16:10Z
s4:selftest: make use of ad_dc_default

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
13fe139f by Stefan Metzmacher at 2019-02-27T10:16:10Z
selftest:Samba4: add ad_dc_backup alias to ad_dc

This will allow us to run really most tests in an isolated
autobuild/ci task later.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
cd42d70d by Stefan Metzmacher at 2019-02-27T10:16:10Z
s4:selftest: make use of ad_dc_backup

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3cf317c9 by Stefan Metzmacher at 2019-02-27T10:16:10Z
autobuild: move nt4_dc_schannel out of 'samba'

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
1bc2456b by Stefan Metzmacher at 2019-02-27T10:16:10Z
autobuild: move maptoguest and simpleserver to 'samba-fileserver'

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2d576c3a by Stefan Metzmacher at 2019-02-27T10:16:10Z
autobuild: run ad_dc_backup tests in samba-ad-dc-backup

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
54278049 by Stefan Metzmacher at 2019-02-27T10:16:11Z
autobuild: add samba-ad-member task

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e0bd12e0 by Stefan Metzmacher at 2019-02-27T10:16:11Z
autobuild: spread ad-dc tests over 6 autobuild/ci separate tasks/jobs

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
253acdaf by Stefan Metzmacher at 2019-02-27T10:16:11Z
.gitlab-ci.yml: use .shared_template for samba

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
be6cf83c by Stefan Metzmacher at 2019-02-27T10:16:11Z
autobuild: try to distribute the tasks a bit more

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
4f307f23 by Stefan Metzmacher at 2019-02-27T11:24:59Z
selftest: force running with TZ=UTC

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Wed Feb 27 11:24:59 UTC 2019 on sn-devel-144

- - - - -
5a7e7280 by David Disseldorp at 2019-02-27T14:53:18Z
vfs_ceph: add missing fallocate hook

SMB_VFS_FALLOCATE() calls atop a vfs_ceph share currently fall through
to vfs_default, which results in a local filesystem I/O attempt using a
libcephfs file-descriptor. Add the missing fallocate hook to vfs_ceph.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13807

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
70329c36 by David Disseldorp at 2019-02-27T14:53:18Z
vfs_ceph: fix strict_allocate_ftruncate()

The vfs_ceph "strict allocate = yes" ftruncate wrapper may attempt
*local* filesystem ftruncate(). Fix this.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13807

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
155f1289 by David Disseldorp at 2019-02-27T14:53:19Z
vfs_ceph: remove ceph_fallocate/ceph_ftruncate fallback

Both libcephfs functions are supported and capable of extending files,
so fallback can be dropped.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13807

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
f43cc62f by David Disseldorp at 2019-02-27T14:53:19Z
vfs_ceph: drop ifdef HAVE_FCHOWN/_FCHMOD

The cephwrap_fchown() and cephwrap_fchmod() wrappers call the
corresponding libcephfs functions. It doesn't make sense to make this
logic dependent on regular fchown()/fchmod() function presence, so remove
the ifdefs.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
eb62dc39 by David Disseldorp at 2019-02-27T16:22:27Z
docs: fix minor typo in smb.conf "log level" section

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Wed Feb 27 16:22:27 UTC 2019 on sn-devel-144

- - - - -
d8a7caa5 by Volker Lendecke at 2019-02-28T12:57:23Z
libwbclient: Protect wbcCtxUnixIdsToSids against integer-wrap

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
d9303e8e by Volker Lendecke at 2019-02-28T12:57:23Z
lib: Make idmap_cache return negative mappings

Without this we'd query non-existent mappings over and over
again.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
4faf3e9f by Volker Lendecke at 2019-02-28T12:57:23Z
idmap_cache: Only touch "sid" on success in find_xid_to_sid

Why? This makes the negative mapping condition (is_null_sid) more
explicit in the code.

The callers in lookup_sid initialized "psid" anyway before, and the ones
in wb_xids2sids now do as well. This is more in line with other APIs we
have: Only touch output parameters if you have something to say.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
8c28c127 by Volker Lendecke at 2019-02-28T12:57:23Z
winbind: Initialize "expired" parameter to idmap_cache_xid2sid

The code in idmap_cache only touches its output parameters upon success

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
95d33ca7 by Volker Lendecke at 2019-02-28T12:57:23Z
winbind: Now we explicitly track if we got ids from cache

This now properly makes us use negative cache entries

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
bb8122dd by Volker Lendecke at 2019-02-28T12:57:24Z
idmap_cache: Introduce idmap_cache_find_xid2sid

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
e5a903ba by Volker Lendecke at 2019-02-28T12:57:24Z
torture: Add tests for idmap cache

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
bc9824bd by Volker Lendecke at 2019-02-28T12:57:24Z
winbind: Use idmap_cache_find_xid2sid

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
ef706a3e by Volker Lendecke at 2019-02-28T12:57:24Z
lib: Introduce winbind_xid_to_sid

This does not merge a winbind communication error into
"global_sid_NULL" (S-1-0-0), which by the way non-intuitively does not
go along with is_null_sid(). Instead, this just touches the output sid
when winbind returned success. This success might well be a negative
mapping indicated by S-0-0, which *is* is_null_sid()...

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
92f27ebb by Volker Lendecke at 2019-02-28T12:57:24Z
passdb: Introduce xid_to_sid

This explicitly avoids the legacy_[ug]id_to_sid calls, which create
long-term cache entries to S-1-22-x-y if anthing fails. We can't do
this, because this will turn temporary winbind communication failures
into long-term problems: A short hickup in winbind_uid_to_sid will
create a mapping to S-1-22-1-uid for a week. It should be up to the
lower layers to do the caching.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
40de67f1 by Volker Lendecke at 2019-02-28T12:57:24Z
passdb: Make [ug]id_to_sid use xid_to_sid

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813

- - - - -
c906153c by Volker Lendecke at 2019-02-28T13:53:40Z
lib: Remove some unused code

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Thu Feb 28 13:53:41 UTC 2019 on sn-devel-144

- - - - -
9f4ee052 by Ralph Boehme at 2019-02-28T18:21:11Z
s4:libcli: remember return code from maximum access

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13812

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

- - - - -
3ca38d2c by Ralph Boehme at 2019-02-28T18:21:12Z
s4:torture: add a Maximum Access check with an Owner Rights ACE

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13812

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

- - - - -
5cf0764b by Ralph Boehme at 2019-02-28T19:18:16Z
libcli/security: add "Owner Rights" calculation to access_check_max_allowed()

This was missing in 44590c1b70c0a24f853c02d5fcdb3c609401e2ca.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13812

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Thu Feb 28 19:18:16 UTC 2019 on sn-devel-144

- - - - -
cef18c2d by Swen Schillig at 2019-03-01T00:32:09Z
util: Add two wrapper for string to int conversion

Adding wrapper strtoull_err and strtoul_err to handle
error conditions of the conversion process.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c9f4b92a by Swen Schillig at 2019-03-01T00:32:10Z
lib: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
fef2a7ca by Swen Schillig at 2019-03-01T00:32:10Z
groupdb: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e82228f2 by Swen Schillig at 2019-03-01T00:32:10Z
utils: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c957f6cc by Swen Schillig at 2019-03-01T00:32:10Z
passdb: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
fdd52979 by Swen Schillig at 2019-03-01T00:32:10Z
winbindd: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c067429c by Swen Schillig at 2019-03-01T00:32:10Z
modules: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
414bc374 by Swen Schillig at 2019-03-01T00:32:10Z
rpcclient: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e96bccc8 by Swen Schillig at 2019-03-01T00:32:10Z
ctdb-protocol: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
55acae77 by Swen Schillig at 2019-03-01T00:32:11Z
ctdb-server: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
81cc7a35 by Swen Schillig at 2019-03-01T00:32:11Z
ctdb-tools: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ea7231dc by Swen Schillig at 2019-03-01T00:32:11Z
libwbclient: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ebeae5dc by Swen Schillig at 2019-03-01T00:32:11Z
wbinfo: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e7b7c634 by Swen Schillig at 2019-03-01T00:32:11Z
common-lib: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
58e2c153 by Swen Schillig at 2019-03-01T00:32:11Z
libcli: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2b2ff12e by Swen Schillig at 2019-03-01T00:32:11Z
source4: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
fa2c919e by Swen Schillig at 2019-03-01T00:32:11Z
ctdb-utils: Use wrapper for string to integer conversion

In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
f3392f0f by Swen Schillig at 2019-03-01T00:32:12Z
lib: modify string conversion wrapper to handle signed input

The standard string conversion routines convert a "signed string"
into the positive representation of the resulting value.
This is not wanted and therefore now detected and flag'ed as an error.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a787c319 by Volker Lendecke at 2019-03-01T00:32:12Z
libsmb: Reformat the cli_smb2_create_fnum_send args

We'll add parameters in the next commit, make that commit a bit more obvious

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

- - - - -
56e08d39 by Volker Lendecke at 2019-03-01T00:32:12Z
libsmb: Avoid a separate "cblobs" var sending smb2 create

Less lines of code, and we will add custom cblobs soon. This change
makes that logic easier.

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

- - - - -
02f40802 by Volker Lendecke at 2019-03-01T00:32:12Z
libsmb: add in/out cblobs to cli_smb2_create_fnum

This is driven by the imminent smb2 unix extensions, we'll want to make use of
it from source3/libsmb.

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

- - - - -
99ef0ba0 by Volker Lendecke at 2019-03-01T01:30:34Z
libsmb: Make cli_smb2_rmdir asynchronous

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Mar  1 01:30:35 UTC 2019 on sn-devel-144

- - - - -
42e96696 by Björn Jacke at 2019-03-01T17:05:19Z
wafbuild: create missing private library symlinks on platforms without soname support for shared libs

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

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Björn Jacke <bjacke at samba.org>
Autobuild-Date(master): Fri Mar  1 17:05:19 UTC 2019 on sn-devel-144

- - - - -
278eb236 by Amitay Isaacs at 2019-03-01T17:21:15Z
ctdb-daemon: Fix maybe-uninitialized error with picky developer

263/386] Compiling ctdb/server/ctdb_recovery_helper.c
In file included from ../../server/ctdb_recovery_helper.c:24:0:
../../server/ctdb_recovery_helper.c: In function ‘main’:
../../../lib/talloc/talloc.h:911:34: error: ‘mem_ctx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define TALLOC_FREE(ctx) do { if (ctx != NULL) { talloc_free(ctx); ctx=NULL; } } while(0)

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e7351603 by David Disseldorp at 2019-03-01T18:34:18Z
ctdb_mutex_ceph_rados_helper: revert strtoull_err() usage

Compilation currently fails, as ctdb_mutex_ceph_rados_helper doesn't
include or link against the samba-util library. Revert back to the
previous strtoull() behaviour, which works fine.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Mar  1 18:34:18 UTC 2019 on sn-devel-144

- - - - -
743b922a by Volker Lendecke at 2019-03-01T23:58:11Z
libsmb: Use tevent_req_simple_finish_ntstatus()

Less lines... Just rediscovered this function :-)

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

- - - - -
65c269d5 by Volker Lendecke at 2019-03-01T23:58:11Z
libsmb: Use tevent_req_simple_finish_ntstatus()

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

- - - - -
d1c2fe89 by Volker Lendecke at 2019-03-02T00:55:56Z
libsmb: Make cli_posix_unlink/rmdir proper tevent_req/subreq pairs

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Mar  2 00:55:56 UTC 2019 on sn-devel-144

- - - - -
7798bc14 by Ralph Boehme at 2019-03-04T13:59:42Z
CI: don't use swap

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Mon Mar  4 13:59:42 UTC 2019 on sn-devel-144

- - - - -
9fc1a09b by David Disseldorp at 2019-03-04T18:11:15Z
vfs: drop lseek stat-open checks

b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329 added fd==-1 checks to the
lseek() path to handle "stat opens". Current reply.c and
smb2_ioctl_filesys.c callers do not invoke SMB_VFS_LSEEK() with
stat-open fsp structs, so the fd==-1 checks can be removed from the
VFS.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2e181e34 by Jeremy Allison at 2019-03-04T18:11:16Z
s4:torture: Fix the test_owner_rights() test to show permissions are additive.

Tested against Windows.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
fadc4c1b by Jeremy Allison at 2019-03-04T18:11:16Z
s4:torture: Add test_owner_rights_deny().

Shows that owner and SID_OWNER_RIGHTS ACE
entries interact in max permissions requests.

Tested against Windows.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
9722f757 by Ralph Boehme at 2019-03-04T18:11:16Z
libcli/security: correct access check and maximum access calculation for Owner Rights ACEs

We basically must process the Owner Rights ACEs as any other ACE wrt to the
order of adding granted permissions and checking denied permissions. According
to MS-DTYP 2.5.3.2 Owner Rights ACEs must be evaluated in the main loop over
the ACEs in an ACL and the corresponding access_mask must be directly applied
to bits_remaining. We currently defer this to after the loop over the ACEs in
ACL, this is wrong.

We just have to do some initial magic to determine if an ACL contains and
Owner Rights ACEs, and in case it doesn't we grant SEC_STD_WRITE_DAC |
SEC_STD_READ_CONTROL at the *beginning*. MS-DTYP:

-- the owner of an object is always granted READ_CONTROL and WRITE_DAC.
CALL SidInToken(Token, SecurityDescriptor.Owner, PrincipalSelfSubst)
IF SidInToken returns True THEN
   IF DACL does not contain ACEs from object owner THEN
       Remove READ_CONTROL and WRITE_DAC from RemainingAccess
       Set GrantedAccess to GrantedAccess or READ_CONTROL or WRITE_OWNER
   END IF
END IF

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0ebd8c99 by Jeremy Allison at 2019-03-04T18:11:16Z
s4:torture: Add test_owner_rights_deny1().

Creates a 3-element ALLOW + ALLOW + DENY ACE showing that when
calculating maximum access already seen allow bits are not removed.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
b205d695 by Ralph Boehme at 2019-03-04T18:11:16Z
s4:torture: Add test_deny1().

Creates a 2-element ALLOW + DENY ACE showing that when calculating
effective permissions and maximum access already seen allow bits are not
removed.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8d355dd9 by Ralph Boehme at 2019-03-04T18:11:16Z
libcli/security: fix handling of deny type ACEs in access_check_max_allowed()

Deny ACEs must always be evaluated against explicitly granted rights
from previous ACEs.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
128e195e by Ralph Boehme at 2019-03-04T18:11:16Z
s4:torture: add a test with additional bits in SEC_FLAG_MAXIMUM_ALLOWED

When access_mask contains SEC_FLAG_MAXIMUM_ALLOWED, the server must still
proces other bits from access_mask. Eg if access_mask contains a right that
the requester doesn't have, the function must validate that against the
effective permissions.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c8c6da2c by Ralph Boehme at 2019-03-04T18:11:16Z
s3:libsmb: add cli_smb2_query_mxac()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
52e1171e by Ralph Boehme at 2019-03-04T18:11:17Z
s3:libsmb: add cli_query_mxac()

Works only for SMB2.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ec8984f8 by Ralph Boehme at 2019-03-04T18:11:17Z
smbcacls: add -x argument, prints maximum access

Signed-off-by: Ralph Boehme <slow at samba.org>

- - - - -
4a9f7d24 by Ralph Boehme at 2019-03-04T19:11:06Z
tests: add a simple test for smbcacls -x

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Mar  4 19:11:06 UTC 2019 on sn-devel-144

- - - - -
3ce28f91 by Tim Beale at 2019-03-04T21:41:16Z
tests: Remove redundant credentials from auth_log tests

The LDB connection in these tests is to the direct sam.ldb file on disk,
so the credentials are not actually needed (and in fact, weren't event
initialized correctly). These tests always need to run on the DC itself
(i.e. :local testenv) because they use ncalrpc connections.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
25544e10 by Tim Beale at 2019-03-04T21:41:16Z
s4:tests: Avoid passing unnecessary env variables to auth_log tests

These tests all use the ncalrpc connection, so they're always testing a
connection that's local to the server-side. Therefore passing in the
CLIENT_IP and SOCKET_WRAPPER_DEFAULT_IFACE variables (in order to try to
simulate a client connecting) is unnecessary.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
15dda1a8 by Tim Beale at 2019-03-04T21:41:16Z
s4:tests: Move duplicated test cases into loop

This is more consistent with how we run tests elsewhere.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3dab6563 by Tim Beale at 2019-03-04T21:41:16Z
s4:tests: Remove unused DC_ENV variable

I believe this was a leftover remnant from an earlier patch revision -
it's now been replaced by the DC_SERVERCONFFILE variable.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4f21f1ca by Tim Beale at 2019-03-04T21:41:16Z
tests: Remove explicit SOCKET_WRAPPER usage from auth_log tests

The auth-logging tests are an odd combination of server and client
behaviour. On the one hand we want a IRPC connection to see the auth
events being logged on the server. On the other hand, we want the auth
events to appear to be happening on a client. Currently we hardcode in
the use of a SOCKET_WRAPPER interface to make this happen.

We can avoid this explicit socket wrapper usage by using the server
smb.conf instead in the one place we actually want to act like the
server (creating the IRPC connection). Then we can switch from using
the 'ad_dc*:local' testenvs to use 'ad_dc*', in order to act like a
client by default. The SERVERCONFFILE environment variable has already
been added for the few cases where a test needs explicit access to the
server's smb.conf.

However, for samba.tests.auth_log, the samlogon test cases are still
reliant on being run on the :local testenv, and so we can't switch them
over just yet. This is because the samlogon is using the DC's machine
creds underneath, which will fail on the non-local testenv. We could
create separate machine creds for the client and use those, but this is
a non-trivial rework of the test code.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c185bf1d by Tim Beale at 2019-03-04T21:41:16Z
tests: Work audit_log CLIENT_IP out from config instead of env var

Instead of passing the CLIENT_IP to the audit_log tests, we can just
work out the source-IP that the client will use from its smb.conf file.
Because the audit_log tests are all run on the non-local testenv,
they'll already use the client.conf and the 127.0.0.11 address.

The main advantage of this change is it avoids having hardcoded IP
addresses in the selftest framework.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a7d09580 by Tim Beale at 2019-03-04T21:41:17Z
tests: Work auth_log CLIENT_IP out from config instead of env var

Instead of passing the CLIENT_IP to the auth_log tests, we can just
work out the source-IP that the client will use from its smb.conf file.

This only works for auth_log_pass_change, but not auth_log.py - the
latter still needs to be run on the :local testenv for other reasons, so
it doesn't use the client.conf. However, we can still update the base
code to use the client.conf IP, as auth_log.py overrides
self.remoteAddress anyway.

The main advantage of this change is it avoids having hardcoded IP
addresses in the selftest framework.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c1b6fe62 by Andreas Schneider at 2019-03-04T21:41:17Z
s4:torture: Make sure we do not create a shadow 'struct params'

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4d8aa4a1 by Douglas Bagnall at 2019-03-04T21:41:17Z
s4/auth/krb: fix spelling of entries

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4ddfe8fc by Douglas Bagnall at 2019-03-04T21:41:17Z
dns_hub: use python 3 shebang

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
edfd33ab by Douglas Bagnall at 2019-03-04T21:41:17Z
tests/rodc_rwdc: p.communicate() gives bytes, not str

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
16f4c694 by Douglas Bagnall at 2019-03-04T21:41:17Z
dsdb:util_links: count el->values with unsigned int

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1f973220 by Douglas Bagnall at 2019-03-04T21:41:17Z
dsdb/group_audit: use common get_parsed_dns_trusted()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0673ad09 by Douglas Bagnall at 2019-03-04T21:41:17Z
replmd/la: disambiguate error messages a bit

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7d8cfe02 by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb/pytests: sanity checks for links under subtree renames

These tests will ensure that linked attributes continue to be handled
correctly under forthcoming changes. The la_move_ou_tree_big() test
will show that the changes make this much faster, after which it can
perhaps be removed.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bf50324f by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb:replmd: add compatible feature helper function

repl_meta_data.c uses the compatible features attribute of the
"@SAMBA_DSDB" special object to record that linked attributes are
being stored in the database in a sorted order. Soon the
linked_attributes module is going to want to know the same thing, and
in time other modules will want to know about other compatible
features, so we introduce a helper function.

Error checking is slightly improved.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
518320ae by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb: linked_attributes module knows about sorted links

Until now the linked attrbutes module has allocated its private data
on a per transaction basis, but we prefer to check the sorted links
feature less often than that. So the private data struct is given
module life time and a transaction member to carry out the old role.

In coming patches, the sorted links flag will be used.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8765ed2f by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb linked attributes: fix forward links faster

Rename operations can be very slow in large database with many group
memberships, because the linked attributes need to be found and
rewritten for each moved object and the way we did that was naive.

For a while now Samba has kept forward links in sorted order, so
finding group memberships can be an O(log n) rather than O(n)
operation. This patch makes use of that.

The backlinks are not sorted, nor are forward links in old databases,
so we have to use a linear search in those cases.

There is a little bit of extra work to handle the few kinds of forward
links (e.g. msDS-RevealedUsers) that have DN+Binary values.

Tim and Garming came up with the basic idea and a prototype.

Pair-programmed-with: Tim Beale <timbeale at catalyst.net.nz>
Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6d01cb51 by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb/linked_attributes: initialise more pointers to NULL

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4f812c1f by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb/linked_attributes: improve formatting in some places

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e4ac7fb9 by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb/linked_attributes: shortcut exit for backlink fix

In most cases there can only be one link for each GUID. If we assume
that is true, we can skip half the search, on average.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c942614e by Douglas Bagnall at 2019-03-04T21:41:18Z
dsdb pytsts: reduce scale of subtree rename speed test

The speed test, when it was introduced a few patches ago, was
deliberately slow so that we could see how much better the changes
were. It used 500 users, 50 groups, and 27 computers.

Before the changes, it took this long:

rename ou took 64.373s
rename group took 0.160s
rename user took 0.004s
rename computer took 0.123s

After using the sorted links, it took this long:

rename ou took 12.984s
rename group took 0.161s
rename user took 0.004s
rename computer took 0.122s

And with the final patch to stop the linear search early on success:

rename ou took 11.680s
rename group took 0.089s
rename user took 0.004s
rename computer took 0.128s

"rename ou" is the one we were aiming at. Now that we have done that,
we reduce the size of the test so as not to slow down everyone's
autobuilds.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f0ecfd38 by Douglas Bagnall at 2019-03-04T22:41:01Z
pidl/Python: initialise a datablob

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Mar  4 22:41:01 UTC 2019 on sn-devel-144

- - - - -
6a7dd7ab by Aaron Haslett at 2019-03-05T13:10:43Z
tests: Reduce likelihood of auth_log test locking up during CI

We would sometimes see the auth_log test hang during a CI run. The CI
job would eventually fail after consuming a costly 10 hours of CI
runtime.

We believe the problem is around the test creating multiple instances of
the Messaging() context. This is a similar race condition to what was
seen in 19f34b2161dee26.

Currently a new Messaging() context is created for every test case. By
using classmethods instead, the Messaging context is only created once
per python test file execution (i.e. creation of the python class,
rather than initialization of the python object, which happens for every
test-case).

This means the test will only create one Messaging() context, which
should avoid any race conditions.

Changes:
+ removed msg_ctxs - this wasn't actually used for anything.
+ use classmethods to setup and tear-down the Messaging() context (and
tweak lp initialization accordingly).
+ fix discardMessages() - the loop wasn't actually discarding any
messages previously (this may also have been the cause of the test
hanging).

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Tue Mar  5 13:10:43 UTC 2019 on sn-devel-144

- - - - -
5e09d392 by Tim Beale at 2019-03-05T23:27:30Z
selftest: Add helper functions to get IP addresses

Let's centralize these assumptions in one place.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
572f83d6 by Tim Beale at 2019-03-05T23:27:30Z
selftest: dns_hub doesn't need to store $swiface

dns_hub doesn't need to store $ctx->{swiface}. Other testenvs store this
and export it as SOCKET_WRAPPER_DEFAULT_IFACE (i.e. for the tests to
use), but dns_hub doesn't need to do this.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2b60936d by Tim Beale at 2019-03-05T23:27:30Z
selftest: Avoid hard-coding client IP address

We implicitly assume the client IP used by selftest is always
127.0.0.11. Add an iface entry for the client to make this a little more
explicit.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d1e145d6 by Tim Beale at 2019-03-05T23:27:30Z
selftest: Cleanup Samba.pm iface mapping

It looks a bit cleaner if we declare the hash-map in one go, rather than
adding each entry one at a time. Also added a comment explaining what
the hash-map is for, and fixed up tab vs spaces inconsistencies.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
90ea8c2a by Tim Beale at 2019-03-05T23:27:30Z
selftest: Try to tie dns_hub IP mapping to Samba.pm better

dns_hub.py maps the testenv realm to an IP and Samba.pm maps the testenv
NetBIOS name to an IP. We need to keep the two places consistent, as we
add or remove testenvs.

This patch changes dns_hub.py so that it uses a similar hashmap to
Samba.pm. We now have a hashmap with the same name in 2 different
places, so hopefully that's easier to tie them together and keep them in
sync.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d6d8ecb5 by Tim Beale at 2019-03-05T23:27:31Z
selftest: Split out dns_hub's testenv realm-to-IP logic

Add a separate helper function, as the realm-to-IPv4-addr logic is
fairly self-contained.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cbcd4f8f by Tim Beale at 2019-03-05T23:27:31Z
selftest: Pass realm-to-IP mapping to dns_hub as an argument

Instead of storing hashmaps in 2 different files, we can just convert a
perl hashmap into a string, pass it to dns_hub, and convert it back into
a python dictionary.

The main reason for doing this is the IP-to-testenv mapping now all
lives in a single file (Samba.pm). All this logic is right next to each
other rather than being split across multiple files. Hopefully this will
make it easier to keep it up to date as we add new testenvs.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
327ed975 by Tim Beale at 2019-03-05T23:27:31Z
selftest: Map realm to IP address (instead of iface)

The code is more readable if the hashmap translates between realm and
DC-name, rather than realm-to-iface. We already have a function to map
between DC-name and iface (and since we're doing this, we might as well
map straight to IP address).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2cd65a7a by Tim Beale at 2019-03-05T23:27:31Z
dns_hub: Minor variable rename

We've dropped the iface logic now - this dictionary maps from
realm-to-IP.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1d5583c9 by Tim Beale at 2019-03-06T00:48:43Z
dns_hub: Add some debug as to what DNS proxying is happening

This should make it clear at run-time how dns_hub is actually proxying
DNS requests, which will hopefully aid in debugging problems (i.e.
forgetting to add a mapping when adding a new DNS realm).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Mar  6 00:48:43 UTC 2019 on sn-devel-144

- - - - -
4b1e4c22 by Christof Schmitt at 2019-03-06T00:50:14Z
lib/winbind_util: Move include out of ifdef

This fixes compile errors about missing prototypes with
--picky-developer and --without-winbind

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
73bac6f9 by Christof Schmitt at 2019-03-06T00:50:15Z
lib/winbind_util: Remove winbind_[gu]id_to_sid

Commit c906153cc7 removed these functions, now also remove them for the
--without-winbind case.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4125ff89 by Christof Schmitt at 2019-03-06T01:53:16Z
lib/winbind_util: Add winbind_xid_to_sid for --without-winbind

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Mar  6 01:53:16 UTC 2019 on sn-devel-144

- - - - -
c059b8cb by Mathieu Parent at 2019-03-06T03:16:14Z
Enable make test even without lmdb

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13630

Signed-off-by: Mathieu Parent <math.parent at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
6da3664f by Stefan Metzmacher at 2019-03-06T03:16:14Z
ndr_spoolss_buf: fix out of scope use of stack variable in NDR_SPOOLSS_PUSH_ENUM_OUT()

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Björn Jacke <bjacke at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
ce83b21b by Isaac Boukris at 2019-03-06T03:16:15Z
sam.c: fix incorrect check of talloc_new() allocation

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
d94c8992 by Isaac Boukris at 2019-03-06T04:30:22Z
sam.c: allocate account_sid on tmp_ctx

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Mar  6 04:30:22 UTC 2019 on sn-devel-144

- - - - -
72c79e30 by Garming Sam at 2019-03-07T00:33:16Z
web_server: Remove the unused Python WSGI web server

SWAT was removed in Samba 4.1 and there isn't any reason to keep a web
server in our codebase. The web server was not turned on by default.

The web server plainly does not hold up to modern web server standards
and allows for resource exhaustion (and probably generally has bugs).
Credit goes to Michael Hanselmann for prompting us to remove this
service entirely.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4d2260d8 by Garming Sam at 2019-03-07T00:33:16Z
web_server: Remove the web port smb.conf parameter

With the removal of the web server, there are not any users of this
parameter and so should just be removed.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ccb64532 by Christof Schmitt at 2019-03-07T01:30:49Z
passdb: Increase ABI version to 0.28.0

The change from c906153cc lib: Remove some unused code
removed functions, but only updated the minor version
of the ABI. Update the passdb version to 0.28.0
to reflect this change.
file.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Mar  7 01:30:49 UTC 2019 on sn-devel-144

- - - - -
4a9a77f4 by Garming Sam at 2019-03-07T02:14:15Z
paged_results: Remove C++ commment and unneeded TODO

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
ff58f458 by Garming Sam at 2019-03-07T03:17:52Z
WHATSNEW: Add the removal of the web server

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Garming Sam <garming at samba.org>
Autobuild-Date(master): Thu Mar  7 03:17:52 UTC 2019 on sn-devel-144

- - - - -
0c52a6be by Andrew Bartlett at 2019-03-07T03:50:20Z
dsdb: Unify samdb_{get,set}_ntds_{objectGUID,invocation_id}

The new unified versions have better debugging and ensure
that both functions continue to have the same control flow.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
30f93bc7 by Andrew Bartlett at 2019-03-07T03:50:20Z
kcc: Give a better error message when samdb_ntds_objectGUID fails

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6f2558ca by Andrew Bartlett at 2019-03-07T03:50:20Z
dsdb: Provide better error strings in rootdse GUID attribute handling

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8b18da27 by Andrew Bartlett at 2019-03-07T04:58:42Z
s4-server: Open and close a transaction on sam.ldb at startup

This fixes upgrading from 4.7 and earlier releases, and makes the DB
reindexing more transparent. It should also make it easier to handle
future normalisation rule changes, e.g. if we change the pack-format
of integer indexes in a future release.

Without this change, the  should have still handled reindexing the
database. We don't know why exactly this wasn't happening correctly,
but opening a transaction early in the samba process startup should
now guarantee that the DB is correctly reindexed by the time the main
samba code runs.

An alternative fix would have been to open a transaction in the the
DSDB module stack every time we connect to the database. However, this
would add an extra write lock every time we open the DB, whereas
starting samba happens much more infrequently.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Mar  7 04:58:42 UTC 2019 on sn-devel-144

- - - - -
02c7b8c0 by Joe Guo at 2019-03-07T12:01:25Z
subunit/run.py: make iso8601 UTC usage python 2/3 compatible

In `iso8601/iso8601.py`:

    if sys.version_info >= (3, 2, 0):
        UTC = datetime.timezone.utc
        ...
    else:
        class Utc(datetime.tzinfo):
            ...

        UTC = Utc()

The class `Utc` is only available for python < 3.2.0.
Use `UTC` instance instead, which is python 2/3 compatible.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
10109f62 by Joe Guo at 2019-03-07T12:01:25Z
tests/auto_log_pass_change.py: only care about the last expected message other than exact messages count

The messages count could be different because of racing condition.
And we should only care about the last expected one.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett abartlet at samba.org
Reviewed-by: Noel Power npower at samba.org

- - - - -
80cf852d by Joe Guo at 2019-03-07T13:03:56Z
subunit/run.py: change shebang to python3

always use explicit python version at current stage.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Thu Mar  7 13:03:56 UTC 2019 on sn-devel-144

- - - - -
36adf08f by Kristján Valur at 2019-03-07T14:08:21Z
pygpo: Replace the use of SystemError with RuntimeError.

SystemError is reserved for internal errors in the interpreter.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
08b5b11b by Kristján Valur at 2019-03-07T14:08:21Z
pygpo: Proper exception exit in py_ads_connect().

connect() now succeeds or raises an exception.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
a8b316d1 by Kristján Valur at 2019-03-07T14:08:21Z
pygpo: Fix error handing when getting gpo unix path.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
1ff252e3 by Kristján Valur at 2019-03-07T14:08:22Z
pygpo: More python exception cleanup.

* Don't override existing exceptions.

* Careful with talloc contexts.

* Return NULL on error.

* Add more information to exception messages from internal functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
d2a75489 by Kristján Valur at 2019-03-07T14:08:22Z
pygpo: keep a reference to python credentials in the ADS struct to keep the internal pointer valid.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
18638535 by Kristján Valur at 2019-03-07T14:08:22Z
pygpo: Fix module initialization.

* Add reference count to type.

* Add error checking.

* Remove unnecessary tp_new method.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
5b4618ca by Kristján Valur at 2019-03-07T14:08:22Z
pygpo: Safer handling of memory for ads_ptr.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
c25e7953 by Kristján Valur at 2019-03-07T15:08:19Z
pygpo: take ownership of password pointer

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan at rvx.is>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Thu Mar  7 15:08:19 UTC 2019 on sn-devel-144

- - - - -
3ddb5429 by Joe Guo at 2019-03-08T00:42:18Z
samba-o3: fix -Werror=strict-overflow error in lib/ldb-samba/ldb_ildap module

samba-o3 test failed in ubuntu:16.04 docker container:

    ==> /home/samba/samba/samba-o3.stderr <==
    ../../lib/ldb-samba/ldb_ildap.c: In function ‘ildb_handle_request’:
    ../../lib/ldb-samba/ldb_ildap.c:535:2: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
      for (i = 0; i < n; i++) {
      ^
    ../../lib/ldb-samba/ldb_ildap.c:579:2: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
      for (i = 0; i < n; i++) {
      ^
    cc1: all warnings being treated as errors

Change type to mute errors.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
16d40ffc by Joe Guo at 2019-03-08T00:42:19Z
samba-o3: fix -Werror=strict-overflow error in s4/torture/raw/eas module

samba-o3 test failed in ubuntu:16.04 docker container:

    ==> /home/samba/samba/samba-o3.stderr <==
    ../../source4/torture/raw/eas.c: In function ‘test_max_eas’:
    ../../source4/torture/raw/eas.c:286:12: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
     static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx)
                ^
    cc1: all warnings being treated as errors

`total += j` may overflow. Change total type to `size_t` to mute error.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5bc215f7 by Joe Guo at 2019-03-08T00:42:19Z
samba-o3: fix -Werror=maybe-uninitialized in lib/mscat/mscat_pks7.c

samba-o3 test failed in ubuntu:1804 image with:

    ../../lib/mscat/mscat_pkcs7.c: In function ‘mscat_pkcs7_import_catfile’:
    ../../lib/mscat/mscat_pkcs7.c:143:18: error: ‘blob.length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      mscat_data.size = blob.length;
      ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
    ../../lib/mscat/mscat_pkcs7.c:142:18: error: ‘blob.data’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      mscat_data.data = blob.data;
      ~~~~~~~~~~~~~~~~^~~~~~~~~~~
    ../../lib/mscat/mscat_pkcs7.c: In function ‘mscat_pkcs7_verify’:
    ../../lib/mscat/mscat_pkcs7.c:225:16: error: ‘blob.length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       ca_data.size = blob.length;
       ~~~~~~~~~~~~~^~~~~~~~~~~~~
    ../../lib/mscat/mscat_pkcs7.c:224:16: error: ‘blob.data’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       ca_data.data = blob.data;
       ~~~~~~~~~~~~~^~~~~~~~~~~
    cc1: all warnings being treated as errors

Since in `mscat_read_file`, it may still return rc = 0 while goto error,
ends up with blob uninitialized.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c71334ec by Andreas Schneider at 2019-03-08T01:41:27Z
lib:util: Move debug message for mkdir failing to log level 1

If you connnect to a host with smbclient this gets always printed.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Mar  8 01:41:27 UTC 2019 on sn-devel-144

- - - - -
3873437e by Volker Lendecke at 2019-03-08T18:20:10Z
libsmb: Simplify cli_smb2_mxac

smb2_create_blob_find() can search for a create blob for us

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

- - - - -
20ebd176 by Volker Lendecke at 2019-03-08T18:20:10Z
libsmb: Make cli_smb2_unlink async

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

- - - - -
7fc3b2b2 by Volker Lendecke at 2019-03-08T18:20:10Z
libsmb: Add "in_cblobs" to cli_smb2_rmdir

This reveals the fact that rmdir is an open/close in smb2 through the
API. This is not nice, but it's an internal API with currently only
one user. And it enables posix semantics for the open easily.

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

- - - - -
9a38dc0c by Volker Lendecke at 2019-03-08T18:20:10Z
libsmb: Add "in_cblobs" to cli_smb2_unlink

This reveals the fact that unlink is an open/close in smb2 through the
API. This is not nice, but it's an internal API with currently only
one user. And it enables posix semantics for the open easily.

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

- - - - -
7caf2cbd by Volker Lendecke at 2019-03-08T19:16:18Z
libsmb: Use tevent_req_simple_finish_ntstatus

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Mar  8 19:16:18 UTC 2019 on sn-devel-144

- - - - -
3e6b84f8 by Karolin Seeger at 2019-03-11T19:40:58Z
VERSION: Bump version up to 4.9.6...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
abf2e7c4 by Douglas Bagnall at 2019-03-12T00:42:18Z
pidl/s4/python: call export "export" in py exceptions

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ed562c04 by Douglas Bagnall at 2019-03-12T00:42:18Z
selftest/format-subunit-json: remove useless py2 print

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4a231855 by Douglas Bagnall at 2019-03-12T00:42:18Z
selftest/filter-subunit: use py3 print

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
561b654b by Douglas Bagnall at 2019-03-12T00:42:18Z
s4/scripting: MORE py3 compatible print functions

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
287abca7 by Douglas Bagnall at 2019-03-12T00:42:18Z
test/blackbox: py3 compatible print in documentation.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0a804d38 by Douglas Bagnall at 2019-03-12T00:42:18Z
s4/scripting/autoidl: p3 exception syntax

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a27c39c2 by Michael Hanselmann at 2019-03-12T00:42:19Z
Avoid NULL pointer dereference in SMBsendend handler

The "reply_sendend" function wouldn't check whether the connection had
any pending message state. A client sending an out-of-order SMBsendend
message would trigger a NULL pointer dereference.

Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e18610a1 by Volker Lendecke at 2019-03-12T00:42:19Z
lib: Make sid_parse return the parsed length

Use a temporary struct as a return value to make the compiler catch all
callers. If we just changed bool->ssize_t, this would just generate a
warning. struct sid_parse_ret will go away in the next commit

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d7de2f77 by Volker Lendecke at 2019-03-12T00:42:19Z
lib: Remove "struct sid_parse_ret" again

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
afd5d34f by Volker Lendecke at 2019-03-12T00:42:19Z
libsmb: Use sid_parse()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d959bea2 by Andrew Bartlett at 2019-03-12T00:42:19Z
modules: Add dependency on tirpc to vfs_nfs4acl_xattr

This is done as a new subsystem (either filled or empty) rather than via string
manipulation.

This will fix compile error on fedora.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
5514b98f by Garming Sam at 2019-03-12T00:42:19Z
gpo: Ensure that gplink works when empty

It appears that RSAT can leave a space in the gPLink field, which we need to handle.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bcb0270c by Garming Sam at 2019-03-12T00:42:19Z
gpo: Add tests to make sure that an empty gplink works

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2e231541 by Garming Sam at 2019-03-12T00:42:20Z
py3: io.open takes a numeric buffering argument at index 2

It's unsure why this doesn't fail generically, but it fails on my machine sometimes...

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f301b20e by Garming Sam at 2019-03-12T00:42:20Z
gpo: Restore gPCMachineExtensionNames and gPCUserExtensionNames

After creating a backup and calling 'gpo restore', this makes it so that
restoring a GPO will instantly enable it for use.

There might be some cases where we might not want to do this, but for now just do it.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
70681d41 by Garming Sam at 2019-03-12T00:42:20Z
gpo: Add test for saving gPCXXXExtensionNames in backup

The test only checks that the LDAP values are equal before and after.
The format and specifics should be up to the implementation -- and be
amenable to changes later. As long as the extension doesn't match
.SAMBABACKUP or .xml, it won't be detected by the tools.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
75cf7283 by Garming Sam at 2019-03-12T00:42:20Z
gpo: Parse GPT.INI with Latin-1

For some reason the French version of RSAT turns accents into ISO-8859-1.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
52e01601 by Garming Sam at 2019-03-12T00:42:20Z
gpo: During restore clobber GPT.INI with a blank version

Generally speaking, there is not much value to keeping this file. The
display name does not ever seem to be used and the version only applies
to the original domain or DC it was on. The command line option to
revert this behaviour is mostly for the tests or for having a straight
1:1 backup-restore for pure restoration.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1364ae3a by Garming Sam at 2019-03-12T01:41:32Z
gpo: Backup a policy folder containing GPE.INI

The GPE.INI file does not appear to be documented anywhere in the
protocol specifications and seems to be due to legacy code. It appears
that it used to be how the gPCUserExtensionNames and
gPCMachineExtensionNames were maintained without the requirement for
LDAP.

All we do is ignore the parsing of this file and copy it over as binary.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Mar 12 01:41:32 UTC 2019 on sn-devel-144

- - - - -
31aecee1 by Andrew Bartlett at 2019-03-12T01:53:26Z
samba-tool domain provision: Fix --interactive module in python3

The prompts were not being printed to the screen because the stream
was not being flushed.

As reported on the samba mailing list by Adam Xu:
https://lists.samba.org/archive/samba/2019-March/221753.html

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
3bee2443 by Tim Beale at 2019-03-12T01:53:26Z
selftest: Remove unused SELFTEST_INTERFACES

This doesn't appear to be used anywhere and dates back to 2008.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0dbb9238 by Tim Beale at 2019-03-12T01:53:26Z
selftest: Move @exported_envvars into Samba.pm

This brings it closer to the code that actually sets these variables
(i.e. Samba3/4.pm).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d192ba4e by Tim Beale at 2019-03-12T01:53:26Z
selftest: Add helper function to create exports file for a testenv

This writes out the environment variables that are normally setup in the
testenv xterm to a file. This allows them to be sourced later.

This function is currently unused. However, it provides an alternative
replacement for the selftest-vars.sh script (which is really out of
date). I do plan to make use of this function in a subsequent patch-set.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a64c2e3b by Tim Beale at 2019-03-12T01:53:26Z
s4/scripting: Remove legacy selftest-vars.sh script

This script was added in 2010 and has only been sporadically kept
up-to-date since. It doesn't appear to work (I think that selftest
and the testenvs have perhaps grown in complexity since 2010 and it's no
longer possible to try to access a testenv from a different
process-space, due to how we use the cwrap libraries).

There's now an alternative (export_envvars_to_file()) in the selftest
code to regenerate a similar file, if anyone actually needs it.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
345c33d1 by Tim Beale at 2019-03-12T01:53:26Z
selftest: Remove RUN_FROM_BUILD_FARM env variable

The build farm is no longer used, so we can remove checks for this
environment variable in the selftest code.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a68e8af2 by Tim Beale at 2019-03-12T02:56:05Z
testsuite: Remove build_farm testsuites

This test code is not run (and has not been run for about a decade).
Let's remove it - it's there in the git history if we ever want to try
to repurpose it again.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Mar 12 02:56:05 UTC 2019 on sn-devel-144

- - - - -
00baebb8 by Volker Lendecke at 2019-03-12T12:47:29Z
lib: Make idmap_cache return negative mappings

Without this we'd query non-existent mappings over and over
again.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit d9303e8eb90d48f09f2e2e8bdf01f4a7c3c21d11)

- - - - -
d9b762a3 by Volker Lendecke at 2019-03-12T12:47:29Z
idmap_cache: Only touch "sid" on success in find_xid_to_sid

Why? This makes the negative mapping condition (is_null_sid) more
explicit in the code.

The callers in lookup_sid initialized "psid" anyway before, and the ones
in wb_xids2sids now do as well. This is more in line with other APIs we
have: Only touch output parameters if you have something to say.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit 4faf3e9f6da7515fc263d79f77226d105c2f8524)

- - - - -
bdeacbab by Volker Lendecke at 2019-03-12T12:47:29Z
winbind: Initialize "expired" parameter to idmap_cache_xid2sid

The code in idmap_cache only touches its output parameters upon success

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit 8c28c12702c0935a852c7fed6565987623f09fee)

- - - - -
527ecdbe by Volker Lendecke at 2019-03-12T12:47:30Z
winbind: Now we explicitly track if we got ids from cache

This now properly makes us use negative cache entries

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit 95d33ca79cc315f1a2e41cd60859ef01d6548c77)

- - - - -
71f7738c by Volker Lendecke at 2019-03-12T12:47:30Z
idmap_cache: Introduce idmap_cache_find_xid2sid

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit bb8122dd8c53bb307819a79b7888cc0940a7c13b)

- - - - -
d74b8a1c by Volker Lendecke at 2019-03-12T12:47:30Z
torture: Add tests for idmap cache

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit e5a903bab6eda8f7ff2a7c8149d51022d9d8aede)

- - - - -
5bf41f42 by Volker Lendecke at 2019-03-12T12:47:30Z
winbind: Use idmap_cache_find_xid2sid

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit bc9824bd42d9370279819ea0d927e236f6041324)

- - - - -
713c48eb by Volker Lendecke at 2019-03-12T12:47:30Z
lib: Introduce winbind_xid_to_sid

This does not merge a winbind communication error into
"global_sid_NULL" (S-1-0-0), which by the way non-intuitively does not
go along with is_null_sid(). Instead, this just touches the output sid
when winbind returned success. This success might well be a negative
mapping indicated by S-0-0, which *is* is_null_sid()...

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit ef706a3e63b3e25edd27e0f99c3e2d8ff7209cb6)

- - - - -
522b8501 by Volker Lendecke at 2019-03-12T12:47:30Z
lib: Add dom_sid_str_buf

This is modeled after server_id_str_buf, which as an API to me is easier to
use: I can rely on the compiler to get the buffer size right.

It is designed to violate README.Coding's "Make use of helper variables", but
as this API is simple enough and the output should never be a surprise at all,
I think that's worth it.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Nov  2 20:11:11 CET 2018 on sn-devel-144

(cherry picked from commit 8b9d36221930a487ca5c51bf2e38ed04de9d50f7)

- - - - -
f175abcc by Volker Lendecke at 2019-03-12T12:47:30Z
passdb: Introduce xid_to_sid

This explicitly avoids the legacy_[ug]id_to_sid calls, which create
long-term cache entries to S-1-22-x-y if anthing fails. We can't do
this, because this will turn temporary winbind communication failures
into long-term problems: A short hickup in winbind_uid_to_sid will
create a mapping to S-1-22-1-uid for a week. It should be up to the
lower layers to do the caching.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit 92f27ebb14c0c18b1d0fd49544ad851aeb14781c)

- - - - -
1f915119 by Volker Lendecke at 2019-03-12T12:47:30Z
passdb: Make [ug]id_to_sid use xid_to_sid

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813
(cherry picked from commit 40de67f1fcc46b7a64a7364c91dcedb474826d51)

- - - - -
f506180c by Christof Schmitt at 2019-03-12T12:47:30Z
passdb: Update ABI to 0.27.2

This change is for the backport only. The change in master increased the
ABI version to 0.28.0 and removed some functions; this should not happen
in a backport.

Signed-off-by: Christof Schmitt <cs at samba.org>

- - - - -
7f74413a by Christof Schmitt at 2019-03-12T12:47:30Z
lib/winbind_util: Move include out of ifdef

This fixes compile errors about missing prototypes with
--picky-developer and --without-winbind

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4b1e4c22128bdefe549a58b181e9b755854f4c3e)

- - - - -
65c85aee by Christof Schmitt at 2019-03-12T12:47:30Z
lib/winbind_util: Add winbind_xid_to_sid for --without-winbind

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Mar  6 01:53:16 UTC 2019 on sn-devel-144

(cherry picked from commit 4125ff89e44a3e98882cfc38c06e559a6e1e56a5)

- - - - -
f232cd76 by Ralph Boehme at 2019-03-12T12:47:31Z
CI: don't use swap

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Mon Mar  4 13:59:42 UTC 2019 on sn-devel-144

(adapted from from commit 7798bc14fbdae3461eb30421923d53978b3f781d
by Andrew Bartlett)

- - - - -
aaefa8ea by Günther Deschner at 2019-03-12T12:47:31Z
WHATSNEW: mention new vfs_glusterfs_fuse module

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>

- - - - -
fc40f87e by Andreas Schneider at 2019-03-12T16:13:29Z
lib:util: Move debug message for mkdir failing to log level 1

If you connnect to a host with smbclient this gets always printed.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

(cherry picked from commit c71334ec0c92e791022a9b7c900aa0dd649226c2)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Tue Mar 12 16:13:29 UTC 2019 on sn-devel-144

- - - - -
c69092e9 by Douglas Bagnall at 2019-03-14T02:12:18Z
s4/scripting: remove obsolete w32err_code.py

This has been replaced by gen_werror.py which shares common code with other scripts
(e.g. gen_ntstatus) and is more likely to work with conteporary microsoft HTML.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a3da2f63 by Tim Beale at 2019-03-14T02:12:18Z
selftest: Remove secondary client interfaces

I can't see anything in the tests that ever tries to use these other IP
addresses. While it makes sense that we might want the tests to simulate
multiple different clients (with different IPs), we don't appear to do
this currently.

Removing the spare client addresses minimizes the number of hard-coded
IP addresses in selftest.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e9c01fdb by Tim Beale at 2019-03-14T02:12:18Z
selftest: Add helper function to get interfaces config

Add a helper function to return the IPv4/IPv6 addresses for the
smb.conf. This keeps the netmask assumptions in the same places as
the IP subnet assumptions.

This refactor means we no longer need to store $ctx->{interfaces}, as it
was only used in one place.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1fb01c5b by Tim Beale at 2019-03-14T02:12:19Z
tests: Make IPv4 assumption explicit

This test is asserting the expected number of *IPv4* addresses, not any
interface address (including IPv6). It works currently because the
selftest client doesn't have an IPv6 address in its smb.conf.

This patch makes the IPv4 assumption explicit by importing
interface_ips_v4() from the provision code. We need to tweak this to
pass through an 'all_interfaces' flag, otherwise it filters out the
loopback IP addresses that the testenv is using.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
18ebdc31 by Tim Beale at 2019-03-14T02:12:19Z
selftest: Use new helper function for client's smb.conf IP

This has the side-effect of giving the client an IPv6 address, which it
hasn't had up until now. But it at least makes the client and server
interfaces settings consistent, and gets rid of a hard-coded IP address.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
50abab31 by Tim Beale at 2019-03-14T02:12:19Z
selftest: Use consistent env variables for dns_hub

Setting up a testenv involves populating 2 different hashmaps - an
intermediary one (usually called 'ctx') and one that is used to populate
the testenv environment variables (usually called 'env_vars' or
'dcvars').
Because the dns_hub setup is very simple, it doesn't need two different
hashmaps. However, the variable names are still a mix of the two
hashmaps.

This patch updates dns_hub to use the second, more finalized hashmap
variable-names.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3075b85c by Tim Beale at 2019-03-14T02:12:19Z
selftest: Remove unnecessary dns_hub hashmap entries

These are only used within the function, and there's already a local
variable that stores the same info.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8ba6f1c8 by Stefan Metzmacher at 2019-03-14T02:12:19Z
blackbox/*.sh: pass -u to 'diff'

This is what we work with every day...

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5357f591 by Stefan Metzmacher at 2019-03-14T02:12:19Z
blackbox/dbcheck-links.sh: reproduce lost deleted object problem

When a parent object is removed during the tombstone garbage collection
before a child object and samba-tool dbcheck runs at the same time, the
following can happen:

- If the object child had DISALLOW_MOVE_ON_DELETE in systemFlags,
  samba-tool dbcheck moves the object under the LostAndFound[Config]
  object (as an originating update!)
- The lastKnownParent attribute is removed (as an originating update!)

These originating updates cause the object to have an extended time
as tombstone. And these changes are replicated to other DCs,
which very likely already removed the object completely!

This means the destination DC of replication has no chance to handle
the object it gets from the source DC with just 2 attributes (name, lastKnownParent).

The destination logs something like:

  No objectClass found in replPropertyMetaData

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3e8a435d by Stefan Metzmacher at 2019-03-14T02:12:19Z
dsdb:repl_meta_data: allow CONTROL_DBCHECK_FIX_LINK_DN_NAME to by pass rename

We need a way to rename an object without updating the replication meta
data.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
07a83267 by Stefan Metzmacher at 2019-03-14T02:12:19Z
dbcheck: use DSDB_CONTROL_DBCHECK_FIX_LINK_DN_NAME when renaming deleted objects

We should never do originating updates on deleted objects.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9afcd533 by Stefan Metzmacher at 2019-03-14T02:12:20Z
dbcheck: do isDeleted, systemFlags and replPropertyMetaData detection first

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6d50ee74 by Stefan Metzmacher at 2019-03-14T02:12:20Z
dbcheck: don't move already deleted objects to LostAndFound

This would typically happen when the garbage collection
removed a parent object before a child object (both with
the DISALLOW_MOVE_ON_DELETE bit set in systemFlags),
while dbcheck is running at the same time as the garbage collection.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e388e599 by Stefan Metzmacher at 2019-03-14T02:12:20Z
dbcheck: don't remove dangling one-way links on already deleted objects

This would typically happen when the garbage collection
removed a parent object before a child object (both with
the DISALLOW_MOVE_ON_DELETE bit set in systemFlags),
while dbcheck is running at the same time as the garbage collection.
In this case the lastKnownParent attributes points a non existing
object.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
598e38d2 by Stefan Metzmacher at 2019-03-14T02:12:20Z
dbcheck: add find_repl_attid() helper function

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1ccc21a3 by Stefan Metzmacher at 2019-03-14T02:12:20Z
blackbox/dbcheck-links.sh: add regression test for lost deleted object repair

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a1658b30 by Stefan Metzmacher at 2019-03-14T02:12:20Z
dbcheck: detect the change after deletion bug

Old versions of 'samba-tool dbcheck' could reanimate
deleted objects, when running at the same time as the
tombstone garbage collection.

When the (deleted) parent of a deleted object
(with the DISALLOW_MOVE_ON_DELETE bit in systemFlags),
is removed before the object itself, dbcheck moved
it in the LostAndFound[Config] subtree of the partition
as an originating change. That means that the object
will be in tombstone state again for 180 days on the local
DC. And other DCs fail to replicate the object as
it's already removed completely there and the replication
only gives the name and lastKnownParent attributes, because
all other attributes should already be known to the other DC.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b61d580f by Stefan Metzmacher at 2019-03-14T02:12:20Z
python/samba/netcmd: provide SUPPRESS_HELP via Option class

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6f9c5ed8 by Stefan Metzmacher at 2019-03-14T02:12:20Z
dbcheck: add --selftest-check-expired-tombstones cmdline option

This will be used by dbcheck tests which operate on static/old provision
dumps in the following commits.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5fccc4e9 by Stefan Metzmacher at 2019-03-14T02:12:21Z
blackbox/dbcheck*.sh: pass --selftest-check-expired-tombstones to dbcheck

These tests operate on provision dumps created long ago, they still
want to run tests on deleted objects, when the next commits remove
processing expired tombstone objects in dbcheck.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b096a311 by Stefan Metzmacher at 2019-03-14T02:12:21Z
blackbox/dbcheck-links.sh: prepare regression test for skipping expired tombstones

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a2c5f8cf by Stefan Metzmacher at 2019-03-14T03:12:27Z
dbcheck: don't check expired tombstone objects by default anymore

These will be removed anyway and any change on them risks to
be an originating update that causes replication problems.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Mar 14 03:12:27 UTC 2019 on sn-devel-144

- - - - -
a215d201 by Martin Schwenke at 2019-03-15T05:17:13Z
ctdb-tests: Build cluster mutex path manually

CTDB_CLUSTER_MUTEX_HELPER can't be depended on because it is only set
when the tests are not installed and setting it unconditionally for
this particular use would be wrong.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
539b5ff3 by Zhu Shangzhong at 2019-03-15T05:17:13Z
ctdb: Initialize addr struct to zero before reparsing as IPV4

Failed to kill the tcp connection that using IPv4-mapped IPv6 address
(e.g. ctdb_killtcp eth0 ::ffff:192.168.200.44:2049
::ffff:192.168.200.45:863).

When the ctdb_killtcp is used to kill the tcp connection, the IPs and
ports in the connection will be parsed to conn.client and conn.server
(call stack: main->ctdb_sock_addr_from_string->ip_from_string). In
the ip_from_string, as we are using IPv4-mapped IPv6 addresses, the
ipv6_from_string will be used to parse ip to addr.ip6 first. The next
step the ipv4_from_string will be used to reparse ip to addr.ip.

As a result, the data that dump from conn.server is "2 0 8 1 192 168
200 44 0 0 0 0 0 0 0 0 0 0 255 255 192 168 200 44 0 0 0 0", the data
from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0 0 0 0 0 0 255 255
192 168 200 45 0 0 0 0". The connection will be add to conn_list by
ctdb_connection_list_add. Then the reset_connections_send uses conn_list
as parameter to start to reset connections in the conn_list.

In the reset_connections_send, the database "connections" will be
created. The connections from conn_list will be written to the
database(call db_hash_add), and use the data that dump from conn_client
and conn_server as key.

In the reset_connections_capture_tcp_handler, the
ctdb_sys_read_tcp_packet will receive data on the raw socket. And
extract the IPs and ports from the tcp packet. when extracting IP and
port, the tcp4_extract OR tcp6_extract will be used. Then we got the
new conn.client and conn.server. the data that dump from the
conn.server is "2 0 8 1 192 168 200 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0", the data from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0". Finally, we use the data as key to check
if this connection is one being reset(call db_hash_delete). The
db_hash_delete will return ENOENT. Because the two key that being used
by db_hash_delete and db_hash_add are different.

So, the TCP RST will be NOT sent for the connection forever. We should
initialize addr struct to zero before reparsing as IPV4 in the
ip_from_string.

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

Signed-off-by: Zhu Shangzhong <zhu.shangzhong at zte.com.cn>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
d9286701 by Martin Schwenke at 2019-03-15T05:17:13Z
ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsing

ctdb_sock_addr values are hashed in some contexts.  This means that
all of the memory used for the ctdb_sock_addr should be consistent
regardless of how parsing is done.  The first 2 cases are just sanity
checks but the 3rd case involving an IPv4-mapped IPv6 address is the
real target of this test addition.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
b2b8dce4 by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-packaging: ctdb package should not own system library directory

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
957c38b6 by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-packaging: Test package requires tcpdump

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
2fce893b by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-tests: export CTDB_SCRIPTS_TOOLS_BIN_DIR

This isn't used anywhere that requires it to be exported, but the lack
of consistency will cause problems and confusion at some later stage.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
6555fbce by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-tests: Shell cleanups in wait_until() function

This file is included by local_daemons.sh, which is not a bash script
and wait_until() uses the "local" keyword.  Prefixing variable names
with '_' to indicate that they are local changes a lot of lines in
this function.  So, fix indentation, potential quoting problems and
other ShellCheck hits while touching this function.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
627a5cf1 by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-tests: Fix remaining common.sh ShellCheck hits

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
8c2ff3f2 by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-daemon: Add an environment variable to set version

This can be used to test the version checking logic.  Cache the
version to avoid re-checking the environment variable each time.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
2c3df581 by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-tests: Add a test for version consistency checking

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
05c28fee by Stefan Metzmacher at 2019-03-15T05:17:14Z
ctdb-build: use a fixed ctdb_version.h using SAMBA_VERSION_STRING

This way we don't get constant rebuild as SAMBA_VERSION_STRING
is "4.7.0pre1.DEVELOPERBUILD" for the binaries under bin/
instead of "4.7.0pre1.GIT.59e51f6".

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
14830667 by Martin Schwenke at 2019-03-15T05:17:14Z
ctdb-build: Drop creation of .distversion in tarball

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

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
edd4a23d by Amitay Isaacs at 2019-03-15T06:31:50Z
ctdb-version: Simplify version string usage

There is no need to write SAMBA_VERSION_STRING as CTDB_VERSION_STRING.
Wherever required use SAMBA_VERSION_STRING directly.

Avoids the confusion with two version.h files.

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

Signed-off-by: Amitay Isaacs <amitay at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Fri Mar 15 06:31:50 UTC 2019 on sn-devel-144

- - - - -
1375e085 by David Disseldorp at 2019-03-15T11:32:04Z
smbd: fix check_parent_access() talloc stackframe leaks

check_parent_access() currently leaks a number of allocations onto the
talloc_tos() context in both success and error paths.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Fri Mar 15 11:32:04 UTC 2019 on sn-devel-144

- - - - -
fad5e4ea by Andreas Schneider at 2019-03-18T15:30:13Z
s3:script: Fix jobid check in test_smbspool.sh

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>

- - - - -
43160184 by Andreas Schneider at 2019-03-18T15:30:13Z
s3:client: Pass DEVICE_URI and AUTH_INFO_REQUIRED env to smbspool

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>

- - - - -
5274b09f by Andreas Schneider at 2019-03-18T15:30:14Z
s3:client: Evaluate the AUTH_INFO_REQUIRED variable set by cups

This should not switch to username,password if cups has been configured
to use negotiate (Kerberos authentication).

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>

- - - - -
129ae279 by Andreas Schneider at 2019-03-18T15:30:14Z
s3:client: Make sure we work on a copy of the title

We can't be sure we can write to the input buffer.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>

- - - - -
69d7a496 by Andreas Schneider at 2019-03-18T16:47:55Z
s3:client: Fix smbspool device uri handling

If we are executed as a CUPS backend, argv[0] is set to the device uri.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Mar 18 16:47:55 UTC 2019 on sn-devel-144

- - - - -
38f780ae by Volker Lendecke at 2019-03-18T19:21:22Z
rpc_server: Give epmd its header file

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

- - - - -
2f47163a by Volker Lendecke at 2019-03-18T19:21:22Z
rpc_server: Give lsasd its header file

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

- - - - -
311d8681 by Volker Lendecke at 2019-03-18T19:21:22Z
rpc_server: Give fssd its header file

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

- - - - -
10c70e23 by Volker Lendecke at 2019-03-18T19:21:22Z
rpc_server: Give mdssd its header file

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

- - - - -
6625d356 by Volker Lendecke at 2019-03-18T19:21:22Z
idl: Fix a typo

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

- - - - -
636c09c8 by Volker Lendecke at 2019-03-18T19:21:23Z
libcli: Add a comment explaining lack of overflow checks

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

- - - - -
d5877ec4 by Volker Lendecke at 2019-03-18T19:21:23Z
idl: Remove a trailing empty line

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

- - - - -
2f3e251d by Volker Lendecke at 2019-03-18T19:21:23Z
libcli: Align integer types

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

- - - - -
068f42be by Volker Lendecke at 2019-03-18T19:21:23Z
libsmb: Use a direct struct initializer

There's a few ways to initialize a DATA_BLOB to NULL. There's the
variable data_blob_null, there's ZERO_STRUCTP, and the explicit
initializer. And there's the data_blob() macro which calls into
data_blob_talloc_named. You have to look at that routine to see that
this is nothing more than a ZERO_STRUCT() and not calling into
talloc. Choose the more direct way.

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

- - - - -
769b51da by Volker Lendecke at 2019-03-18T19:21:23Z
torture3: Fix an error message

We tried to open "dname", not "fname"

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

- - - - -
855b785a by Volker Lendecke at 2019-03-18T19:21:23Z
smbd: Remove two unnecessary return; statements

return; is unnecessary at the end of a void function

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

- - - - -
2040196e by Volker Lendecke at 2019-03-18T19:21:23Z
libsmb: Use tevent_req_simple_finish_ntstatus

Less lines of code

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

- - - - -
cfc3f320 by Volker Lendecke at 2019-03-18T19:21:23Z
libsmb: Make cli_posix_[sym|hard]link proper tevent_req functions

Simplify adding SMB2 to those functions

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

- - - - -
7e699156 by Volker Lendecke at 2019-03-18T19:21:24Z
libsmb: Change cli_posix_stat_send to take a pointer to sbuf

This moves the parsing work from the _recv function into the _done
function. This makes writing the SMB2 call easier later on: We can
have a smb2-specific done function doing the smb2-specific work and we
don't have to fork on protocol in the _recv function.

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

- - - - -
5909709e by Volker Lendecke at 2019-03-18T19:21:24Z
libsmb: Add cli_smb2_query_info_fnum

This wraps getting the file handle from the fnum

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

- - - - -
4e6f32ad by Volker Lendecke at 2019-03-18T19:21:24Z
libsmb: Use cli_smb2_query_info_fnum

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

- - - - -
d0dc4033 by Volker Lendecke at 2019-03-18T19:21:24Z
heimdal: Fix "assuming signed overflow doesnt occur" error

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
7da54f6f by Volker Lendecke at 2019-03-18T19:21:24Z
libsmb: Align integer types

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e872227b by Volker Lendecke at 2019-03-18T19:21:24Z
libsmb: Fix a "assuming signed overflow does not occur" error

Eventually we need to convert internal_resolve_name to "size_t" for
"return_count". But that's a patch for another day :-)

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
6fa6ab1c by Ralph Boehme at 2019-03-18T19:21:24Z
nfs4acl_xattr: identifiers are XDR encoded as integers

The structs nfsacl41 and nfsace4 are not RFC 3530 compliant, let's
rename them adding a trailing "i" that indicates that the structs store
identifiers as integers.

  struct nfsace4  -> struct nfsace4i
  struct nfsacl41 -> struct nfsacl41i

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
10a230b9 by Ralph Boehme at 2019-03-18T19:21:25Z
nfs4acl_xattr: append 'i' to nfs4acl functions

This reflects the new struct names the functions use.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3490a6e2 by Ralph Boehme at 2019-03-18T19:21:25Z
nfs4acl_xattr: move some functions to a seperate file

These functions will be called from another translation unit in a
subsequent commit.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ba1fe6d1 by Ralph Boehme at 2019-03-18T19:21:25Z
nfs4acl_xattr: move a define to a common header file

In preperation of a adding real NFS backend.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
068721f4 by Ralph Boehme at 2019-03-18T19:21:25Z
nfs4acl_xattr: add RFC compliant NFS 4.0 and 4.1 ACL defintions

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ebf98261 by Ralph Boehme at 2019-03-18T19:21:25Z
nfs4acl_xattr: reformat enum nfs4acl_encoding to one per line

In preperation of adding another enum value.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c6ab2e6b by Ralph Boehme at 2019-03-18T19:21:25Z
vfs_nfs4acl_xattr: support for NFS 4.0 and 4.1 ACLs from NFS4 mount

This adds a new main switch "nfs" to "nfs4acl_xattr:encoding" which
enables to use NFS4 ACLs from an NFS4 mount on a Linux box. Tested with
a FreeBSD NFS4 server.

Supports both NFS 4.0 and 4.1 ACLs.

By default NFS4 servers send user and group identifiers in ACLs as
strings in the format "[USER|GROUP]@DNSDOMAIN". Some NFS4 servers
support sending identifiers as numeric strings. This module does support
this as well, the config knob "nfs4acl_xattr:nfs4_id_numeric = yes|no"
controls behaviour.

When "nfs4acl_xattr:encoding" is set to "nfs", the new option
"nfs4acl_xattr:validate_mode", which defauts to "yes" is set to "no" to
avoid checking and munging the mode on files.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
6a1e5fbf by Ralph Boehme at 2019-03-18T19:21:25Z
selftest: test vfs_nfs4acl_xattr in nfs mode

The same tests as for the other modes xdr and ndr are marked as
knownfail.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
7d486561 by Ralph Boehme at 2019-03-18T20:19:30Z
vfs_nfs4acl_xattr: check status for NT_STATUS_ACCESS_DENIED in take ownership override

This was missing in commit 8b1b1cd8cc561378058b915e03996ff567355d81.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Mar 18 20:19:30 UTC 2019 on sn-devel-144

- - - - -
b2c2c4c3 by Andreas Schneider at 2019-03-19T12:38:50Z
talloc: Fix alignment issues for casting pointers

warning: cast from 'char *' to 'struct talloc_chunk *' increases required
alignment from 1 to 8

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Mar 19 12:38:50 UTC 2019 on sn-devel-144

- - - - -
74ca95f8 by Volker Lendecke at 2019-03-19T17:48:28Z
smbd: Enhance debugging for setting hard links

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

- - - - -
7e77f1fe by Volker Lendecke at 2019-03-19T18:46:28Z
smbd: Focus smb_file_link_information on correct posix'ness

In the SMB1 unix extensions, posix'ness is a property of the SMB
request, because it's tied to the connection. In the upcoming SMB3
extensions, this will become a property of the file name, it's being
set at SMB2_CREATE time. To correctly transfer posix'ness of the
filename to the destination name, we can't look at the
req->posix_pathnames here, the SMB2_SETINFO call has not set
that. This is still correct for SMB1, as the per-connection posix'ness
has spilled into the filename there too.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Mar 19 18:46:28 UTC 2019 on sn-devel-144

- - - - -
944c577a by Jeremy Allison at 2019-03-19T22:55:11Z
s3: smbd: Clarify POSIX name handling in SMB2 get/setinfo calls.

We should never be looking at the info level here, the create
call will have set the correct POSIX flag on the smb_filename
struct.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Mar 19 22:55:11 UTC 2019 on sn-devel-144

- - - - -
a40b0f45 by Andrew Bartlett at 2019-03-20T05:25:48Z
build: Allow build when --disable-gnutls is set

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Douglas Bagnall <dbagnall at samba.org>
Autobuild-Date(master): Wed Mar 20 05:25:48 UTC 2019 on sn-devel-144

- - - - -
305346d3 by Michael Hanselmann at 2019-03-20T05:26:17Z
Fix typos in "valid"

s/vald/valid/

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
aa6b3558 by Michael Hanselmann at 2019-03-20T05:26:17Z
regfio: Use correct function names in debug information

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9b2cb845 by Michael Hanselmann at 2019-03-20T05:26:18Z
regfio: Add trivial unit test

An upcoming commit will resolve two cases of insufficient handling of
mangled registry hive files and will include unit tests.

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
601afd69 by Michael Hanselmann at 2019-03-20T05:26:18Z
regfio: Improve handling of malformed registry hive files

* next_record: A malformed file can lead to an endless loop.
* regfio_rootkey: Supplying a malformed registry hive file to the
  registry hive I/O code can lead to out-of-bounds reads.

Test cases are included. Both issues resolved have been identified using
AddressSanitizer.

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
acbf103f by Andrew Bartlett at 2019-03-20T05:26:18Z
regfio: Update code near recent changes to match README.Coding

This file long predates our current code conventions.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
68c0fc43 by Andrew Bartlett at 2019-03-20T05:26:18Z
regfio tests: Update comment style to match README.Coding

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
c0aca17a by Douglas Bagnall at 2019-03-20T06:36:05Z
py/graph: use 2.6 compatible check for set membership

It is better this way anyway.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Mar 20 06:36:05 UTC 2019 on sn-devel-144

- - - - -
bf469343 by Andreas Schneider at 2019-03-20T13:11:28Z
s4:librpc: Fix installation of Samba

This breaks installation of Samba 4.10 on Fedora.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Mar 20 13:11:28 UTC 2019 on sn-devel-144

- - - - -
4f5b9e50 by Volker Lendecke at 2019-03-20T22:07:45Z
libsmb: Add cli_smb2_set_info_fnum

This wraps getting the file handle from the fnum

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

- - - - -
32c5b6c1 by Volker Lendecke at 2019-03-20T22:07:45Z
libsmb: Simplify cli_smb2_delete_on_close

Use cli_smb2_set_info_fnum, remove "state" variables

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

- - - - -
c013aad7 by Volker Lendecke at 2019-03-20T22:07:45Z
libsmb: Simplify cli_smb2_ftruncate

We don't need to talloc 8 bytes, they can live on the stack. When we
go async, this can go into the state struct.

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

- - - - -
b4c87b09 by Volker Lendecke at 2019-03-20T22:07:45Z
libsmb: Use cli_smb2_set_info_fnum()

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

- - - - -
b5af004b by Volker Lendecke at 2019-03-20T22:07:45Z
libsmb: Introduce protocol-agnostic cli_hardlink

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

- - - - -
8c12a705 by Volker Lendecke at 2019-03-20T22:07:46Z
utils: Use cli_hardlink instead of cli_nt_hardlink

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

- - - - -
2a430625 by Volker Lendecke at 2019-03-20T23:32:31Z
libsmb: Make SMB1-only cli_nt_hardlink calls static

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Mar 20 23:32:31 UTC 2019 on sn-devel-144

- - - - -
fa980eb6 by Andrew Bartlett at 2019-03-21T04:06:14Z
pytalloc: Remove deprecated pytalloc_CObject_FromTallocPtr()

This function makes it harder to remove the --extra-python handlers and is only
provided for Python 2.x, support for which Samba is removing.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
270d04e4 by Andrew Bartlett at 2019-03-21T04:06:14Z
build: Remove --extra-python

This option is quite invasive in waf and was mainly for the python3 transition.

Testing with multiple python versions can be done by testing a full compile against
multiple versions, likewise multiple different binding versions can be created
the same way.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
fdb6305c by Andrew Bartlett at 2019-03-21T04:06:14Z
build: Remove bld.gen_python_environments()

This was part of --extra-python support.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
beda359b by Andrew Bartlett at 2019-03-21T04:06:15Z
selftest: Remove support for running multiple tests against python versions in a single run

The extra_python support was added to aid the python3 transition

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6a6a178b by Andrew Bartlett at 2019-03-21T04:06:15Z
selftest: Remove obsolete py3_compatible=True markers

All our tests now run in python3.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
709ac663 by Andrew Bartlett at 2019-03-21T04:06:15Z
selftest: Remove mention of --extra-python from comment

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
ad3ba599 by Andrew Bartlett at 2019-03-21T04:06:15Z
build: Remove distinct .py3 ABI files

The only difference between the two built libraries is pytalloc_CObject_FromTallocPtr()
which is deprecated.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
24127aca by Andrew Bartlett at 2019-03-21T04:06:15Z
ABI: Remove unused .py3*.sigs files

These are no longer used by the build system so avoid
confusion by removing them from the tree.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
760b176d by Andrew Bartlett at 2019-03-21T04:06:15Z
build: Do not make python mandatory to build

Clearly we have python or else we would not be running, so this is about if
we have a new enough version.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
63d20d78 by Andrew Bartlett at 2019-03-21T04:06:15Z
build: Set default minimum python version to 3.4.0

This is the current minimum, but this may change before the 4.11 release.

Python 2.x support is no longer available except to build using --disable-python.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a4596500 by Andrew Bartlett at 2019-03-21T04:06:16Z
build: Remove manual specification of minimum python version

We now used the default of 3.4 from conf.SAMBA_CHECK_PYTHON()

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a574e8f5 by Andrew Bartlett at 2019-03-21T04:06:16Z
build: Standardise on calling conf.SAMBA_CHECK_PYTHON() in libraries

We do this by removing the confusing mandatory option to
conf.SAMBA_CHECK_PYTHON{,_HEADERS}(), instead just use the value of
--disable-python internally

This follows the default minimum of Python 3.4 and keeps things consistent
with the main Samba build where --disable-python is required to skip building
python bindings.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
b80140ba by Andrew Bartlett at 2019-03-21T04:06:16Z
talloc: Release talloc 2.2.0

 * Remove pytalloc_CObject_FromTallocPtr()
 * Remove --extra-python (a build time mode to produce Python2 and Python3
   bindings at the same time)
 * New minor version to allow Samba 4.10 to release a talloc if
   required from that branch

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
fe69d807 by Andrew Bartlett at 2019-03-21T04:06:16Z
tdb: Release tdb 1.4.0

 * Remove Python 2.x support except to build just the bare C library
 * Remove --extra-python (a build time mode to produce Python2 and Python3
   bindings at the same time)
 * New minor version to allow Samba 4.10 to release a tdb if
   required from that branch

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6f227801 by Andrew Bartlett at 2019-03-21T04:06:16Z
tevent: Release tevent 0.10.0

* Remove Python 2.x support except to build just the bare C library
* Remove --extra-python (a build time mode to produce Python2 and Python3
  bindings at the same time)
* New minor version to allow Samba 4.10 to release a tevent if
  required from that branch

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
81648d57 by Andrew Bartlett at 2019-03-21T05:08:49Z
ldb: Release ldb 1.6.3

* Remove Python 2.x support except to build just the bare C library
* Remove --extra-python (a build time mode to produce Python2 and Python3
  bindings at the same time)

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Mar 21 05:08:49 UTC 2019 on sn-devel-144

- - - - -
312e408c by Andreas Schneider at 2019-03-21T15:10:29Z
s3:lib: Increase debug level for messaging_send_buf message

This is spamming the console when running 'make test' and we set the log
level to 1 by default in selftest.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
88343683 by Andreas Schneider at 2019-03-21T15:10:29Z
s3:script: Fix running rsync in fake_snap.pl

We need to unset BASH_ENV or we get:
    Insecure $ENV{BASH_ENV} while running setgid

This probably only happens on recent perl versions.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

- - - - -
52bf5c25 by Andreas Schneider at 2019-03-21T16:41:33Z
s3:script: Fix running cp in modprinter.pl

We need to unset BASH_ENV or we get:
    Insecure $ENV{BASH_ENV} while running setgid

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Mar 21 16:41:33 UTC 2019 on sn-devel-144

- - - - -
dd6f0dad by Stefan Metzmacher at 2019-03-21T16:42:19Z
dbcheck: use the str() value of the "name" attribute

We do the same with the rdn attribute value
and we need the same logic on both in order to
check they are the same.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
261ef9d5 by Stefan Metzmacher at 2019-03-21T18:15:20Z
dbcheck: fix the err_empty_attribute() check

ldb.bytes('') == '' is never True in python3,
we nee ldb.bytes('') == b'' in order to
check that on attribute has an empty value,
that seems to work for python2 and python3.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Thu Mar 21 18:15:20 UTC 2019 on sn-devel-144

- - - - -
3eee4394 by Andreas Schneider at 2019-03-21T20:38:32Z
libcli: Use a define for the SMB_SUICIDE_PACKET

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
16331870 by Andreas Schneider at 2019-03-21T20:38:32Z
s3:smbd: Make clear that we got a suicide packet

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
9b1d79a5 by Andreas Schneider at 2019-03-21T20:38:32Z
s3:torture: Move the init of the locking out of the loop

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e1ba84a5 by Andreas Schneider at 2019-03-21T20:38:33Z
s3:torture: Improve the debug message output

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
eace58b5 by Andreas Schneider at 2019-03-21T21:40:20Z
s3:waf: Fix the detection of makdev() macro on Linux

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Mar 21 21:40:20 UTC 2019 on sn-devel-144

- - - - -
1e408871 by Marcos Mello at 2019-03-22T09:55:33Z
Send status to systemd on daemon start

systemd service files run in no-forking mode (--foreground) since
8b6f58194da7e849cdb9d20712dff49b17a93a77.

Rearrange sd_notify() call in become_daemon() to only send status to systemd
in this mode (Type=notify is not designed to monitor forking). Drop READY=0
(it does nothing) and MAINPID= (unnecessary because the process spawned by
systemd is already the main PID).

Also remove STATUS= prefix from debug messages.

Signed-off-by: Marcos Mello <marcosfrm at gmail.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 440ddf8470b11a46066d282bf8945201d547c192)

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

- - - - -
166dd92d by Stefan Metzmacher at 2019-03-22T09:55:33Z
ndr_spoolss_buf: fix out of scope use of stack variable in NDR_SPOOLSS_PUSH_ENUM_OUT()

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Björn Jacke <bjacke at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 6da3664f8a11397fd3fb38e89c2432b8bf321e59)

- - - - -
6c2d5bca by Andreas Schneider at 2019-03-22T09:55:34Z
s3:script: Fix jobid check in test_smbspool.sh

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>
(cherry picked from commit fad5e4eaeb9202c1b63c42ea09254c17c473e33a)

- - - - -
d311eff5 by Andreas Schneider at 2019-03-22T09:55:34Z
s3:client: Pass DEVICE_URI and AUTH_INFO_REQUIRED env to smbspool

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>
(cherry picked from commit 43160184d254a57f87bb2adeba47f48d8539533a)

- - - - -
590fd475 by Andreas Schneider at 2019-03-22T09:55:34Z
s3:client: Evaluate the AUTH_INFO_REQUIRED variable set by cups

This should not switch to username,password if cups has been configured
to use negotiate (Kerberos authentication).

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>
(cherry picked from commit 5274b09fbaa5e45cc58f3301818d4e9f6a402845)

- - - - -
e07b8444 by Andreas Schneider at 2019-03-22T09:55:35Z
s3:client: Make sure we work on a copy of the title

We can't be sure we can write to the input buffer.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>
(cherry picked from commit 129ae27946318a075e99c9e6d1bacf8963f72282)

- - - - -
7f4492c7 by Andreas Schneider at 2019-03-22T09:55:35Z
s3:client: Fix smbspool device uri handling

If we are executed as a CUPS backend, argv[0] is set to the device uri.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Bryan Mason <bmason at redhat.com>
Signed-off-by: Guenther Deschner <gd at samba.org>

(cherry picked from commit 69d7a496d3bf52eaa10e81132bb61430863fdd8a)

- - - - -
6e76e884 by Martin Schwenke at 2019-03-22T09:55:35Z
ctdb-packaging: ctdb package should not own system library directory

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit b2b8dce4fc56c27ef0131104b316346565369dd7)

- - - - -
9e4b17aa by Martin Schwenke at 2019-03-22T09:55:36Z
ctdb-packaging: Test package requires tcpdump

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 957c38b65ca060eabe1e676f8dfb54839d706155)

- - - - -
eb4e66cd by Zhu Shangzhong at 2019-03-22T09:55:36Z
ctdb: Initialize addr struct to zero before reparsing as IPV4

Failed to kill the tcp connection that using IPv4-mapped IPv6 address
(e.g. ctdb_killtcp eth0 ::ffff:192.168.200.44:2049
::ffff:192.168.200.45:863).

When the ctdb_killtcp is used to kill the tcp connection, the IPs and
ports in the connection will be parsed to conn.client and conn.server
(call stack: main->ctdb_sock_addr_from_string->ip_from_string). In
the ip_from_string, as we are using IPv4-mapped IPv6 addresses, the
ipv6_from_string will be used to parse ip to addr.ip6 first. The next
step the ipv4_from_string will be used to reparse ip to addr.ip.

As a result, the data that dump from conn.server is "2 0 8 1 192 168
200 44 0 0 0 0 0 0 0 0 0 0 255 255 192 168 200 44 0 0 0 0", the data
from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0 0 0 0 0 0 255 255
192 168 200 45 0 0 0 0". The connection will be add to conn_list by
ctdb_connection_list_add. Then the reset_connections_send uses conn_list
as parameter to start to reset connections in the conn_list.

In the reset_connections_send, the database "connections" will be
created. The connections from conn_list will be written to the
database(call db_hash_add), and use the data that dump from conn_client
and conn_server as key.

In the reset_connections_capture_tcp_handler, the
ctdb_sys_read_tcp_packet will receive data on the raw socket. And
extract the IPs and ports from the tcp packet. when extracting IP and
port, the tcp4_extract OR tcp6_extract will be used. Then we got the
new conn.client and conn.server. the data that dump from the
conn.server is "2 0 8 1 192 168 200 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0", the data from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0". Finally, we use the data as key to check
if this connection is one being reset(call db_hash_delete). The
db_hash_delete will return ENOENT. Because the two key that being used
by db_hash_delete and db_hash_add are different.

So, the TCP RST will be NOT sent for the connection forever. We should
initialize addr struct to zero before reparsing as IPV4 in the
ip_from_string.

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

Signed-off-by: Zhu Shangzhong <zhu.shangzhong at zte.com.cn>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 539b5ff32b32b7c75dfaaa119e41f5af6ff1e6fc)

- - - - -
5f94bc51 by Martin Schwenke at 2019-03-22T09:55:36Z
ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsing

ctdb_sock_addr values are hashed in some contexts.  This means that
all of the memory used for the ctdb_sock_addr should be consistent
regardless of how parsing is done.  The first 2 cases are just sanity
checks but the 3rd case involving an IPv4-mapped IPv6 address is the
real target of this test addition.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit d9286701cd9253bf3b42cac3d850ae8c23743e6d)

- - - - -
b861e5e9 by Andreas Schneider at 2019-03-22T13:39:46Z
s4:librpc: Fix installation of Samba

This breaks installation of Samba 4.10 on Fedora.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>

(cherry picked from commit bf469343f577e2d78df0e38d80e7976b351eaf0d)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Fri Mar 22 13:39:46 UTC 2019 on sn-devel-144

- - - - -
55b21728 by Andreas Schneider at 2019-03-22T14:03:19Z
third_party: Update socket_wrapper to version 1.2.3

* Added environment variable to disable deep binding
* Fixed installation of socket_wrapper
* Fixed several small bugs
* Fixed missing NULL check for socket_wrapper_dir()
* Fixes building in Samba source tree

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
4a526ec4 by Andreas Schneider at 2019-03-22T14:03:19Z
selftest: Increase nss_wrapper max host entries handling

The logs are spammed with:
nwrap_ed_inventarize_add_new: Hash table is full (Cannot allocate memory)!

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
88804bc2 by Samuel Cabrero at 2019-03-22T14:03:19Z
s4:torture: Initialize tm struct

The samba3.blackbox.shadow_copy_torture tests call to strptime passing
an uninitalized tm structure as an argument, but the strptime function
does not write the tm.tm_isdst field.

These tm structures are passed later as the mktime argument, which
produces different values depending on whether the arbitrary value
of the tm.tm_isdst field is lower or equal to zero or greather than
zero.

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
fc25fe80 by Samuel Cabrero at 2019-03-22T14:03:19Z
selftest: Woraround uid wrapper issues when using bash shell

UID_WRAPPER_ROOT=1 is not working properly when tests run in bash shell
instead of dash. After some debugging the reason may be dash spawns a
subshell to run commands, but bash calls execve instead. Traces attached
as reference:

/bin/sh -> dash:

[2(2)/2 at 17s, 1 errors] samba.blackbox.pdbtest(nt4_dc)(nt4_dc:local)
UWRAP_DEBUG(3145) - uwrap_init: Initialize uid_wrapper
UWRAP_DEBUG(3145) - uwrap_init_env: uwrap_init_env
UWRAP_DEBUG(3145) - uwrap_init: Enabled uid_wrapper as root (real uid=1000)
UWRAP_DEBUG(3145) - uwrap_init: Successfully initialized uid_wrapper
UWRAP_DEBUG(3144) - uwrap_init: Initialize uid_wrapper
UWRAP_DEBUG(3144) - uwrap_init_env: uwrap_init_env
UWRAP_DEBUG(3144) - uwrap_init: Enabled uid_wrapper as root (real uid=1000)
UWRAP_DEBUG(3144) - uwrap_init: Successfully initialized uid_wrapper

/bin/sh -> bash:

[2(2)/2 at 17s, 1 errors] samba.blackbox.pdbtest(nt4_dc)(nt4_dc:local)
UWRAP_DEBUG(3352) - uwrap_export_ids: uwrap_export_ids
UWRAP_DEBUG(3354) - uwrap_export_ids: uwrap_export_ids
UWRAP_DEBUG(3354) - uwrap_init: Initialize uid_wrapper
UWRAP_DEBUG(3354) - uwrap_init_env: uwrap_init_env
UWRAP_DEBUG(3354) - uwrap_init_env: Initialize ruid with 1000
UWRAP_DEBUG(3354) - uwrap_init_env: Initalize euid with 1000
UWRAP_DEBUG(3354) - uwrap_init_env: Initalize suid with 1000
UWRAP_DEBUG(3354) - uwrap_init_env: Initialize ruid with 1000
UWRAP_DEBUG(3354) - uwrap_init_env: Initalize egid with 1000
UWRAP_DEBUG(3354) - uwrap_init_env: Initalize sgid with 1000
UWRAP_DEBUG(3354) - uwrap_init_env: Initalize groups with 4,24,27,30,46,108,1000
UWRAP_DEBUG(3354) - uwrap_init: Enabled uid_wrapper as user (real uid=1000)
UWRAP_DEBUG(3354) - uwrap_init: Successfully initialized uid_wrapper
UWRAP_DEBUG(3353) - uwrap_export_ids: uwrap_export_ids
UWRAP_DEBUG(3353) - uwrap_init: Initialize uid_wrapper
UWRAP_DEBUG(3353) - uwrap_init_env: uwrap_init_env
UWRAP_DEBUG(3353) - uwrap_init_env: Initialize ruid with 1000
UWRAP_DEBUG(3353) - uwrap_init_env: Initalize euid with 1000
UWRAP_DEBUG(3353) - uwrap_init_env: Initalize suid with 1000
UWRAP_DEBUG(3353) - uwrap_init_env: Initialize ruid with 1000
UWRAP_DEBUG(3353) - uwrap_init_env: Initalize egid with 1000
UWRAP_DEBUG(3353) - uwrap_init_env: Initalize sgid with 1000
UWRAP_DEBUG(3353) - uwrap_init_env: Initalize groups with 4,24,27,30,46,108,1000
UWRAP_DEBUG(3353) - uwrap_init: Enabled uid_wrapper as user (real uid=1000)
UWRAP_DEBUG(3353) - uwrap_init: Successfully initialized uid_wrapper

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
e23425a0 by Samuel Cabrero at 2019-03-22T14:03:19Z
s4:dsdb: Check errno to determine if crypt or crypt_r succeeded

The behavior of these functions upon errors depends on the implementation.
The GNU libc implementation seems to return a null hash, but others like
libxcrypt returns a invalid hash string '*0'.

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
0063aacb by Samuel Cabrero at 2019-03-22T14:03:19Z
selftests:password_hash: Raise SHA256 rounds to 5000

Some crypt_r implementations like libxcrypt require a higher value.

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
5826b31f by Samuel Cabrero at 2019-03-22T14:03:19Z
selftest: Do not include system krb5.conf in s4 test environments

If built with system MIT krb5 and dns_lookup_kdc is set to false in
system krb5.conf tests fail because KDC is not found.

Pair-Programmed-With: Andreas Schneider <asn at samba.org>
Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
63084375 by Andreas Schneider at 2019-03-22T15:03:43Z
docs: Update smbclient manpage for --max-protocol

We default to SMB3 now.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Fri Mar 22 15:03:43 UTC 2019 on sn-devel-144

- - - - -
1220f69c by Volker Lendecke at 2019-03-22T18:02:16Z
rpc_server: Simplify make_server_pipes_struct

Do an early return on error

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

- - - - -
a6c653a9 by Volker Lendecke at 2019-03-22T18:02:16Z
rpc_server: Fix an error path memleak in make_server_pipes_struct

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

- - - - -
9bebe5c7 by Volker Lendecke at 2019-03-22T18:02:16Z
rpc_server: Make make_server_pipes_struct API safer

Make it clear that we talloc_steal by NULLing out the caller's
session_info

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

- - - - -
46a34367 by Volker Lendecke at 2019-03-22T18:02:16Z
rpc_server: Favor talloc_move over talloc_steal

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

- - - - -
02d884ed by Volker Lendecke at 2019-03-22T18:02:17Z
rpc_server: Simplify named_pipe_accept_function

Make use of named_pipe_client_init

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

- - - - -
bd51c7d3 by Volker Lendecke at 2019-03-22T18:02:17Z
rpc_server: Avoid casts in DBG statements

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

- - - - -
7bea3541 by Volker Lendecke at 2019-03-22T18:02:17Z
tstream_npa: Avoid an unnecessary ZERO_STRUCTP

tevent_req_create already zeros out "state"

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

- - - - -
9d4bf6bb by Volker Lendecke at 2019-03-22T18:02:17Z
tsocket: Simplify tsocket.h

tevent.h already includes talloc.h

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

- - - - -
13b66508 by Volker Lendecke at 2019-03-22T18:02:17Z
librpc: Add a required #include

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

- - - - -
7841c62a by Volker Lendecke at 2019-03-22T19:02:32Z
rpc_server3: Add a \n to a DEBUG message

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Mar 22 19:02:32 UTC 2019 on sn-devel-144

- - - - -
6c62e054 by Garming Sam at 2019-03-26T03:03:23Z
dlz: Add test to ensure there are writable zones

This is currently broken since 28e2a518ff32

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
526c6d0b by Michael Saxl at 2019-03-26T03:03:23Z
s4:dlz make b9_has_soa check dc=@ node

the zone node does not hold the dnsRecord values, so for the zone level
the node dc=@,dc=zonename has to be queried

regression introduced with 28e2a518ff32, BUG: https://bugzilla.samba.org/show_bug.cgi?id=13466

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

Signed-off-by: Michael Saxl <mike at mwsys.mine.bz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
af325301 by Mathieu Parent at 2019-03-26T03:03:23Z
Fix tests whithout lmdb

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

Signed-off-by: Mathieu Parent <math.parent at gmail.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0c7c44a2 by Michael Hanselmann at 2019-03-26T03:03:23Z
Split oLschema2ldif into library and binary

The oLschema2ldif program was contained in a single file, making reuse
of its parsing logic elsewhere impossible. With this change the majority
of the code is moved to a new file, "lib.c", while the CLI interface is
now in a "main.c" file.

End-of-line whitespace is also removed.

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1e9b74e8 by Michael Hanselmann at 2019-03-26T03:03:23Z
Remove ad2oLschema man page

ad2oLschema itself was removed in commit 17aac8cad2b in March 2009. Also
remove the last reference to the program.

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9ac45960 by Kristján Valur at 2019-03-26T03:03:23Z
pytalloc: Refactor the pytalloc_reference and pytalloc_steal to use a common method.

Signed-off-by: Kristján Valur <kristjan at rvx.is>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
417a359b by Kristján Valur at 2019-03-26T03:03:23Z
pytalloc: Further refactoring to eliminate duplicate code.

Signed-off-by: Kristján Valur <kristjan at rvx.is>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b272d161 by Kristján Valur at 2019-03-26T03:03:23Z
pytalloc: Handle memory errors when creating pytalloc objects.

Don't create superfluous exceptions.

Signed-off-by: Kristján Valur <kristjan at rvx.is>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0fa5a77f by Kristján Valur at 2019-03-26T03:03:23Z
pytalloc: Check for errors during module initialization.

Signed-off-by: Kristján Valur <kristjan at rvx.is>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5c6fdb5d by Volker Lendecke at 2019-03-26T03:03:23Z
libsmb: Fix cli_smb2_get_reparse_point_fnum_send

Use the correct state variable type

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ac487bf4 by Volker Lendecke at 2019-03-26T04:43:40Z
lib: Make fd_load work for non-regular files

Follow-up to

https://lists.samba.org/archive/samba/2018-September/217992.html

and following. This also fixes a small and very theoretical race: Between the
fstat and the read call the file size might change. This would make us fail on
potentially legitimate files.

This is more complex and probably slower, but looking at the use cases I don't
think the speed matters.

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Mar 26 04:43:40 UTC 2019 on sn-devel-144

- - - - -
f9a6992e by Volker Lendecke at 2019-03-27T11:20:23Z
libsmb: Fix valgrind errors in cli_smb2_get_reparse_point

Both tevent_req_nterror and tevent_req_is_nterror invalidate
"state". Pull the variables out of "state" before calling those two
functions.

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

- - - - -
c7fae52f by Volker Lendecke at 2019-03-27T11:20:23Z
libsmb: Rename "readlink_state" to "cli_posix_readlink_state"

This is more in line with most other users of tevent_req: The state is
called fully after the routines it acts as a state repository for.

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

- - - - -
3478e9d1 by Volker Lendecke at 2019-03-27T11:20:23Z
libsmb: Don't pass "cli" to cli_posix_readlink_recv

>From my point of view the option to change "cli" between
cli_posix_readlink_send and _recv is not necessary.

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

- - - - -
3e1d8ab1 by Volker Lendecke at 2019-03-27T12:31:37Z
libsmb: Change cli_posix_readlink to return talloc'ed target

This is a deviation from the Posix readlink function that from my
point of view makes this function easier to use. In Posix, probably
the assumption is that readlink is cheap, so someone under memory
constraints could just start with a small buffer and incrementally
increase the buffer size. For us, it's a network round-trip, and we
have the luxury of [mt]alloc, which the syscall kernel interface does
not have.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Mar 27 12:31:37 UTC 2019 on sn-devel-144

- - - - -
a4d433ae by Tim Beale at 2019-03-27T13:31:27Z
selftest: Restore IPs 12-16 for selftest client

The assumption that tests only used the .11 IP was wrong. The
winsreplication test tries to use multiple different IPs - CI doesn't
fail when we remove the additional IPs, but it starts to skip test
cases.

+ Update get_interfaces_config() and get_ipv4_addr() so we can add
multiple different IPs for the same host.
+ Update selftest.pl so the client gets 6 IP addresses.
+ Update comments to better reflect this dependency.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
991d32a1 by Tim Beale at 2019-03-27T13:31:27Z
s4/torture: Update winsreplication to only use IPv4 addresses

This test was failing now that the client had an IPv6 address, however,
the test was marked as flapping so this failure wasn't obvious.

Use iface_list_n_is_v4() to filter out only the IPv4 addresses, as
that's all the test cares about.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ffad76ae by Andreas Schneider at 2019-03-27T13:31:27Z
s3:utils: Add 'smbstatus -L --resolve-uids' to show usernames

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6106b8a0 by Andreas Schneider at 2019-03-27T13:31:27Z
selftest: Add smbstatus to testhelper

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2e7f4b1d by Andreas Schneider at 2019-03-27T14:33:35Z
s3:tests: Add test for smbstatus and smbstatus --resolve_uids

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Mar 27 14:33:35 UTC 2019 on sn-devel-144

- - - - -
c68d9c9e by David Disseldorp at 2019-03-27T18:21:38Z
vfs_snapper: drop unneeded fstat handler

fstat is handle based, and unlike vfs_shadow_copy2, we don't need to
make any changes to the returned sbuf, so remove the existing handler
which does nothing.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13858

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Mar 27 18:21:38 UTC 2019 on sn-devel-144

- - - - -
139da67c by Noel Power at 2019-03-28T08:35:20Z
python/samba: PY3 port for ridalloc_exop test to work

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit fc13a1268a4a9de94efd312a8309aa55d331ae19)

- - - - -
5602db1b by Noel Power at 2019-03-28T08:35:20Z
python/samba: extra ndr_unpack needs bytes function

(cherry picked from commit 8db43696e70d7c4cb21172b7e7461cf6a72914a2)

- - - - -
7bcb0729 by Stefan Metzmacher at 2019-03-28T08:35:20Z
selftest: force running with TZ=UTC

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Wed Feb 27 11:24:59 UTC 2019 on sn-devel-144

(cherry picked from commit 4f307f2302b0fe8fd0fc6379eb8e6491faf8520c)

- - - - -
9339b096 by Stefan Metzmacher at 2019-03-28T08:35:20Z
blackbox/dbcheck-links.sh: reproduce lost deleted object problem

When a parent object is removed during the tombstone garbage collection
before a child object and samba-tool dbcheck runs at the same time, the
following can happen:

- If the object child had DISALLOW_MOVE_ON_DELETE in systemFlags,
  samba-tool dbcheck moves the object under the LostAndFound[Config]
  object (as an originating update!)
- The lastKnownParent attribute is removed (as an originating update!)

These originating updates cause the object to have an extended time
as tombstone. And these changes are replicated to other DCs,
which very likely already removed the object completely!

This means the destination DC of replication has no chance to handle
the object it gets from the source DC with just 2 attributes (name, lastKnownParent).

The destination logs something like:

  No objectClass found in replPropertyMetaData

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 5357f591accffbf8c62335c308b985811b66f0b5)

- - - - -
44c83b09 by Stefan Metzmacher at 2019-03-28T08:35:20Z
dsdb:repl_meta_data: allow CONTROL_DBCHECK_FIX_LINK_DN_NAME to by pass rename

We need a way to rename an object without updating the replication meta
data.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 3e8a435d27da899d0e3dab7cbc0a1c738067eba3)

- - - - -
0aaf7c98 by Stefan Metzmacher at 2019-03-28T08:35:21Z
dbcheck: use DSDB_CONTROL_DBCHECK_FIX_LINK_DN_NAME when renaming deleted objects

We should never do originating updates on deleted objects.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 07a8326746f0c444eedf3860b178fc29d84e8d16)

- - - - -
76de43f0 by Stefan Metzmacher at 2019-03-28T08:35:21Z
dbcheck: do isDeleted, systemFlags and replPropertyMetaData detection first

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 9afcd5331ce567bd80d35175f8e4e21c506e9347)

- - - - -
07ebd654 by Stefan Metzmacher at 2019-03-28T08:35:21Z
dbcheck: don't move already deleted objects to LostAndFound

This would typically happen when the garbage collection
removed a parent object before a child object (both with
the DISALLOW_MOVE_ON_DELETE bit set in systemFlags),
while dbcheck is running at the same time as the garbage collection.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 6d50ee74920c39cdb18b427bfaaf200775bf2d73)

- - - - -
7402d9cf by Stefan Metzmacher at 2019-03-28T08:35:21Z
dbcheck: don't remove dangling one-way links on already deleted objects

This would typically happen when the garbage collection
removed a parent object before a child object (both with
the DISALLOW_MOVE_ON_DELETE bit set in systemFlags),
while dbcheck is running at the same time as the garbage collection.
In this case the lastKnownParent attributes points a non existing
object.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit e388e599495b6d7c38b8b6966332e27f8b958783)

- - - - -
45850169 by Stefan Metzmacher at 2019-03-28T08:35:21Z
dbcheck: add find_repl_attid() helper function

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 598e38d2a5e0832429ba65b4e55bf7127618f894)

- - - - -
860b04aa by Stefan Metzmacher at 2019-03-28T08:35:21Z
blackbox/dbcheck-links.sh: add regression test for lost deleted object repair

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 1ccc21a34d295be3bb2ab481a5918003eae88bf4)

- - - - -
107883df by Stefan Metzmacher at 2019-03-28T08:35:21Z
dbcheck: detect the change after deletion bug

Old versions of 'samba-tool dbcheck' could reanimate
deleted objects, when running at the same time as the
tombstone garbage collection.

When the (deleted) parent of a deleted object
(with the DISALLOW_MOVE_ON_DELETE bit in systemFlags),
is removed before the object itself, dbcheck moved
it in the LostAndFound[Config] subtree of the partition
as an originating change. That means that the object
will be in tombstone state again for 180 days on the local
DC. And other DCs fail to replicate the object as
it's already removed completely there and the replication
only gives the name and lastKnownParent attributes, because
all other attributes should already be known to the other DC.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit a1658b306d85452407388b91a745078c9c1f7dc7)

- - - - -
aebf46d9 by Stefan Metzmacher at 2019-03-28T08:35:21Z
python/samba/netcmd: provide SUPPRESS_HELP via Option class

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit b61d580fb7dba8ff94e9e98c958e324865cd2f1d)

- - - - -
02f3d0a1 by Stefan Metzmacher at 2019-03-28T08:35:21Z
dbcheck: add --selftest-check-expired-tombstones cmdline option

This will be used by dbcheck tests which operate on static/old provision
dumps in the following commits.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 6f9c5ed8de47bb98e21e8064d8e90f963f2f71ca)

- - - - -
543fc3e9 by Stefan Metzmacher at 2019-03-28T08:35:22Z
blackbox/dbcheck*.sh: pass --selftest-check-expired-tombstones to dbcheck

These tests operate on provision dumps created long ago, they still
want to run tests on deleted objects, when the next commits remove
processing expired tombstone objects in dbcheck.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 5fccc4e9044d2e57be33471f5e6b9be7cc37ac3a)

- - - - -
3fca3dcc by Stefan Metzmacher at 2019-03-28T08:35:22Z
blackbox/dbcheck-links.sh: prepare regression test for skipping expired tombstones

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit b096a3117ed9249fd6f65f3221a26c88efbba3b8)

- - - - -
693c3498 by Stefan Metzmacher at 2019-03-28T08:35:22Z
dbcheck: don't check expired tombstone objects by default anymore

These will be removed anyway and any change on them risks to
be an originating update that causes replication problems.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Mar 14 03:12:27 UTC 2019 on sn-devel-144

(cherry picked from commit a2c5f8cf41c2dfdc4f122e8427d1dfeabb6ba311)

- - - - -
42b62465 by Stefan Metzmacher at 2019-03-28T08:35:22Z
dbcheck: use the str() value of the "name" attribute

We do the same with the rdn attribute value
and we need the same logic on both in order to
check they are the same.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Noel Power <npower at samba.org>
(cherry picked from commit dd6f0dad218ec1d5aa38ea8aa6848ec81035cb3f)

- - - - -
d44f2157 by Douglas Bagnall at 2019-03-28T08:35:22Z
py/graph: use 2.6 compatible check for set membership

It is better this way anyway.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13837
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Mar 20 06:36:05 UTC 2019 on sn-devel-144

(cherry picked from commit c0aca17a4c9ec06f0127d5c972f3fa979a87a77f)

- - - - -
87ffad41 by Douglas Bagnall at 2019-03-28T08:35:22Z
py/kcc_utils: py2.6 compatibility

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13837
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
4644b23b by Michael Hanselmann at 2019-03-28T08:35:22Z
Fix typos in "valid"

s/vald/valid/

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 305346d360d3c13fd315c1af27b037f46fd10650)

- - - - -
223352ee by Michael Hanselmann at 2019-03-28T08:35:22Z
regfio: Use correct function names in debug information

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit aa6b355858a0d8b77bf49384e5329642add1a5ff)

- - - - -
b5ae06cc by Michael Hanselmann at 2019-03-28T08:35:22Z
regfio: Add trivial unit test

An upcoming commit will resolve two cases of insufficient handling of
mangled registry hive files and will include unit tests.

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 9b2cb845b23cd1c91ab3b5ea8ad791b18b3ab733)

- - - - -
f3552ad5 by Michael Hanselmann at 2019-03-28T08:35:23Z
regfio: Improve handling of malformed registry hive files

* next_record: A malformed file can lead to an endless loop.
* regfio_rootkey: Supplying a malformed registry hive file to the
  registry hive I/O code can lead to out-of-bounds reads.

Test cases are included. Both issues resolved have been identified using
AddressSanitizer.

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 601afd690346087fbd53819dba9b1afa81560064)

- - - - -
0cc35082 by Andrew Bartlett at 2019-03-28T08:35:23Z
regfio: Update code near recent changes to match README.Coding

This file long predates our current code conventions.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
(cherry picked from commit acbf103fcaa4150a57bfbab2450e36b5b39e399b)

- - - - -
055b971a by Andrew Bartlett at 2019-03-28T08:35:23Z
regfio tests: Update comment style to match README.Coding

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
(cherry picked from commit 68c0fc4335d0c3c526a38481538a33290be6d58a)

- - - - -
5b716115 by Andreas Schneider at 2019-03-28T13:46:27Z
s3:waf: Fix the detection of makdev() macro on Linux

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit eace58b539a382c61edd7c2be6fdfab31114719f)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Thu Mar 28 13:46:27 UTC 2019 on sn-devel-144

- - - - -
c2761b00 by Stefan Metzmacher at 2019-03-28T23:09:32Z
s4:libcli/raw: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8dea0718 by Stefan Metzmacher at 2019-03-28T23:09:33Z
s4:libcli/smb2: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
7a091aa9 by Stefan Metzmacher at 2019-03-28T23:09:33Z
s4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior when running under valgrind.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
6171a7ff by Stefan Metzmacher at 2019-03-28T23:09:33Z
s4:torture/smb2: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior when running under valgrind.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
7dbd8e44 by Stefan Metzmacher at 2019-03-28T23:09:33Z
s3:smb2_write: add missing initialization of state->in_offset

This is just used in DEBUG messages, but still confusing.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
4c6156ed by Stefan Metzmacher at 2019-03-28T23:09:33Z
s3:smbd: fix SAFE_FREE() vs. TALLOC_FREE() in list_sessions()

It's very unlikely that sessionid_traverse_read() fails,
but we should not segfault.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
1d934857 by Stefan Metzmacher at 2019-03-28T23:09:34Z
s3:smbd: handle IO_REPARSE_TAG_DFS in SMB_FIND_FILE_FULL_DIRECTORY_INFO

This completes commit 74829fecd7a4e806ee441cd75141bede2eefef1a,
which missed SMB_FIND_FILE_FULL_DIRECTORY_INFO

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
827dd014 by Stefan Metzmacher at 2019-03-28T23:09:34Z
smb2_ioctl_network_fs: remove unused fsctl_srv_copychunk_state->aapl_copyfile

This is not used since commit 74e018f476608429caa1c3594102485ccc17afce.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4760b852 by Stefan Metzmacher at 2019-03-28T23:09:34Z
smb2_server: allow smbd_smb2_request_pending_queue(0) to avoid STATUS_PENDING

This has the same meaning as smb2_request_set_async_internal(),
but this will simplifies callers.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
23792449 by Stefan Metzmacher at 2019-03-28T23:09:34Z
smb2_sesssetup: avoid STATUS_PENDING responses for session setup

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12845
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13796

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8a11da42 by Stefan Metzmacher at 2019-03-28T23:09:35Z
smb2_tcon: avoid STATUS_PENDING responses for tree connect

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d6403842 by Stefan Metzmacher at 2019-03-28T23:09:35Z
smb2_sesssetup: avoid STATUS_PENDING completely on session logoff

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
1dc00254 by Stefan Metzmacher at 2019-03-28T23:09:35Z
smb2_tcon: avoid STATUS_PENDING completely on tdis

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2abf9e9a by Stefan Metzmacher at 2019-03-28T23:09:35Z
vfs_default: fix DEBUG messages in vfswrap_offload_write_*_done()

SMB_VFS_{PREAD,PWRITE}_RECV() don't set errno, so we need to
use strerror(aio_state.error) in the debug messages.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4d6cd932 by Stefan Metzmacher at 2019-03-28T23:09:35Z
vfs_default: fix vfswrap_offload_write_send() NT_STATUS_INVALID_VIEW_SIZE check

This fixes a regression introduced in commit
60e45a2d25401eaf9a15a86d19114670ccfde259, where the 'num' variable
was renamed to 'to_copy', but a new 'num' variable was introduced.

Note that off_t is signed!
In future we need to watch out for filesystems supporting
FMODE_UNSIGNED_OFFSET on Linux. Which means they use it unsigned.

This is more or less a theoretical problem, The
NT_STATUS_INVALID_PARAMETER cases are catched before by
SMB_VFS_PREAD_SEND/RECV.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
829f692f by Stefan Metzmacher at 2019-03-28T23:09:36Z
smb2_server: grant all 8192 credits to clients

This seems to match Windows Server 2016.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ee2574ae by Stefan Metzmacher at 2019-03-28T23:09:36Z
s4:libcli/smb2: fix smb2_getinfo_send() marshalling

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c88c2bf3 by Stefan Metzmacher at 2019-03-28T23:09:36Z
s4:libcli/smb2: calculate the correct credit charge in smb2_getinfo_send()

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
97b4e6e2 by Stefan Metzmacher at 2019-03-28T23:09:36Z
s4:libcli/smb2: align struct smb_ioctl.smb2 to [MS-SMB2] names

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
5a07c294 by Stefan Metzmacher at 2019-03-28T23:09:36Z
s4:libcli/smb2: calculate the correct credit charge in smb2_ioctl_send()

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e6fa76b6 by Stefan Metzmacher at 2019-03-28T23:09:37Z
s4:libcli/smb2: calculate the correct credit charge in smb2_notify_send()

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4ffb517f by Stefan Metzmacher at 2019-03-28T23:09:37Z
s4:torture/smb2: add smb2_create_simple_file() and torture_setup_simple_file()

Instead of the *_complex_file() versions these don't use EA's nor
complex timestamps.

A lot of tests currently using *_complex_file() only fail because
smbd doesn't implement the correct 'change_time' update behavior.
That should not be the reason why all smb2 related tests fail.

Timestamps should be tested in dedicated tests.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d6fce7c0 by Stefan Metzmacher at 2019-03-28T23:09:37Z
s4:torture/smb2/notify: make use of torture_setup_simple_file() in test_valid_request()

There's no reason to use torture_setup_complex_file(), when we want to
test notify code. The test pass fine against Samba this way and don't
fail because of unrelated timestamp behavior.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
12fb3ec1 by Stefan Metzmacher at 2019-03-28T23:09:37Z
s4:torture/smb2: replace torture:cn_max_buffer_size option with the negotiated max trans size

Both:

 smbtorture //w2012r2-188/torture -Ua%b smb2.notify.valid-req --smb-ports=139

and:

 smbtorture //w2012r2-188/torture -Ua%b smb2.notify.valid-req --smb-ports=445

work against Windows 2008R2, 2012R2 and 2016 now and it reflects what
we have implemented in Samba.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
11f25834 by Stefan Metzmacher at 2019-03-29T00:35:39Z
s3:smbd: fix max_buffer handling of initial notify requests

The max_buffer value is only evaluated on the first notify
request on a directory handle.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Mar 29 00:35:39 UTC 2019 on sn-devel-144

- - - - -
7f1b6455 by Aaron Haslett at 2019-03-29T17:29:31Z
paged_search: perf testing paged search

Adding medley performance run with paged search module.

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

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
24efa3ca by Aaron Haslett at 2019-03-29T17:29:31Z
ldb: cmocka test for empty attributes bug

Cmocka test exposing LDB bug where a request with an empty attributes
list returns a response containing all attributes.  The bug is in the
ACL module and will be fixed in the next commit.

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

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a2b1970a by Garming Sam at 2019-03-29T18:37:29Z
acl_read: Fix regression caused by db15fcfa899e1fe4d6994f68ceb299921b8aa6f1 for empty lists

The original code never dereferenced attrs and only added "*" if attrs
was NULL (not if attrs[0] was NULL).

This causes significant performance issues with the new paged_results
module introduced for 4.10 as the initial GUID search requests no
attributes. This GUID search turns into a search for "*" and ends up
allocating memory for the entire database.

This never appears to cause changes in the final result set, only
intermediate processing.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Mar 29 18:37:29 UTC 2019 on sn-devel-144

- - - - -
30ce81d2 by Mathieu Parent at 2019-03-30T18:42:52Z
Upload 2:4.9.5+dfsg-2 to unstable

- - - - -
ed0060d3 by Douglas Bagnall at 2019-03-30T22:21:26Z
selftest: use test smb.conf in provision

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
53afa138 by Björn Baumbach at 2019-03-30T22:21:27Z
samba-tool: fix some typos

All command descriptions have a dot '.' at the end.
The ou and visualize command need this too.

  ...
  group       - Group management.
  ldapcmp     - Compare two ldap databases.
  ntacl       - NT ACLs manipulation.
  ou          - Organizational Units (OU) management
  ...
  user        - User management.
  visualize   - Produces graphical representations of Samba network state

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5131fc5c by Björn Baumbach at 2019-03-30T22:21:27Z
doc: add missing samba-tool user edit documentation

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f8d3180d by Björn Baumbach at 2019-03-30T22:21:27Z
doc: fix typos in samba-tool documentation

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
14070f8d by Björn Baumbach at 2019-03-30T22:21:27Z
doc: add missing "samba-tool computer" entry

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f9ee6b67 by Björn Baumbach at 2019-03-30T23:33:39Z
doc: add missing "samba-tool ou" entry

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Douglas Bagnall <dbagnall at samba.org>
Autobuild-Date(master): Sat Mar 30 23:33:39 UTC 2019 on sn-devel-144

- - - - -
865b7b0c by Philipp Gesang at 2019-03-31T01:11:09Z
libcli: permit larger values of DataLength in SMB2_ENCRYPTION_CAPABILITIES of negotiate response

Certain Netapp versions are sending SMB2_ENCRYPTION_CAPABILITIES
structures containing DataLength field that includes the padding
[0]. Microsoft has since clarified that only values smaller than
the size are considered invalid [1].

While parsing the NegotiateContext it is ensured that DataLength
does not exceed the message bounds. Also, the value is not
actually used anywhere outside the validation. Thus values
greater than the actual data size are safe to use. This patch
makes Samba fail only on values that are too small for the (fixed
size) payload.

[0] https://lists.samba.org/archive/samba/2019-February/221139.html
[1] https://lists.samba.org/archive/cifs-protocol/2019-March/003210.html

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

Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sun Mar 31 01:11:09 UTC 2019 on sn-devel-144

- - - - -
d7e187c1 by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Reindent some functions prior to making changes

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
9981353a by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Rename variable nfslock_service to nfs_lock_service

There will be more of these variable for other services so, for
readability, it makes sense for them to start with "nfs_".

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
e72c3c80 by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Add test variable CTDB_NFS_DISTRO_STYLE

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
8de0a339 by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Factor out nfs_load_config()

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
42103b56 by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Stop/start mount/rquotad/status via NFS call-out

When an NFS check restarts a failed service by hand then systemd will
be unable to stop or start this service again because (at least) the
PID file will be wrong.  Do this via the NFS Linux kernel call-out
instead.  Allow the call-out to use the services instead of doing
manual restarts.  Add variables for mount, status and rquotad services
to support this.

Adding systemd NFS services to the call-out will follow.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
708c0407 by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Start NFS quota service if defined

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
a8fafd37 by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Add systemd services to NFS call-out

At least Red Hat and Debian appear to use (a variant of?) the upstream
systemd units for NFS, so adding support for these services is
relatively easy.  Distributions using Sys-V init can patch the
call-out to use the relevant Sys-V init services.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
2833ddcf by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-tests: Update NFS test infrastructure to support systemd services

The tests are written around the default of sysvinit-redhat.  Add
support for systemd-redhat.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
95283bdf by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Default to using systemd services in NFS call-out

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
0d67ea5f by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Allow load_system_config() to take multiple alternatives

The situation for NFS config has got more complicated and is probably
broken in statd-callout on Debian-like systems at the moment.  Allow
several alternative configuration names to be tried.  Stop after the
first that is found and loaded.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
a2bd4085 by Martin Schwenke at 2019-03-31T10:45:20Z
ctdb-scripts: Update statd-callout to try several configuration files

The alternative seems to be to try something via CTDB_NFS_CALLOUT.
That would be complicated and seems like overkill for something this
simple.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

- - - - -
f1a1c300 by Martin Schwenke at 2019-03-31T11:47:44Z
ctdb-scripts: Do not "correct" number of nfsd threads when it is 0

While 0 may indicate that all threads have exited after being stuck,
it may also indicate that nfsd should not be running due to being shut
down.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Sun Mar 31 11:47:44 UTC 2019 on sn-devel-144

- - - - -
aac20390 by Volker Lendecke at 2019-04-01T17:58:16Z
libsmb: Rename InfoType from [MS-SMB2] according to the spec

This makes it easier to find this via internet search

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

- - - - -
c05ff617 by Volker Lendecke at 2019-04-01T17:58:17Z
libsmb: Make "struct smb2_lock_element" generally usable

This struct will be of interest when we add locking capabilities to
libcli/smb/smb2cli*

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

- - - - -
0876712c by Volker Lendecke at 2019-04-01T19:00:11Z
libsmb: Make cli_posix_chown/chmod proper tevent_req functions

This prepares for making them smb2-aware

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Apr  1 19:00:11 UTC 2019 on sn-devel-144

- - - - -
40669e37 by Andreas Schneider at 2019-04-02T01:12:09Z
s3:libads: Print more information when LDAP fails

Currently we just get an error but don't know what exactly we tried to
do in 'net ads join -d10'.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
011a47f0 by Andreas Schneider at 2019-04-02T01:12:09Z
s3:libsmb: Add some useful debug output to cliconnect

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3a33c360 by Guenther Deschner at 2019-04-02T01:12:10Z
s3:libnet: Fix debug message in libnet_DomainJoin()

A newline is missing but also use DBG_INFO macro and cleanup spelling.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9e926548 by Guenther Deschner at 2019-04-02T01:12:10Z
auth:ntlmssp: Add back CRAP ndr debug output

This got lost somehow during refactoring. This is still viable
information when trying to figure out what is going wrong when
authenticating a user over NTLMSSP.

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

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5c7f0a69 by Andreas Schneider at 2019-04-02T01:12:10Z
auth:creds: Prefer the principal over DOMAIN/username when using NTLM

If we want to authenticate using -Wadmin at otherdomain the DC should do
take care of the authentication with the right DC for us.

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

Pair-Programmed-With: Guenther Deschner <gd at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b7f0c645 by Andreas Schneider at 2019-04-02T01:12:10Z
s3:libnet: Use more secure name for the JOIN krb5.conf

Currently we create krb5.conf..JOIN, use krb5.conf._JOIN_ instead.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c016afc8 by Andreas Schneider at 2019-04-02T01:12:10Z
s3:libads: Make sure we can lookup KDCs which are not configured

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

Pair-Programmed-With: Guenther Deschner <gd at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2044ca0e by Guenther Deschner at 2019-04-02T01:12:10Z
s3:ldap: Leave add machine code early for pre-existing accounts

This avoids numerous LDAP constraint violation errors when we try to
re-precreate an already existing machine account.

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

Pair-Programmed-With: Andreas Schneider <asn at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
720396f0 by Mathieu Parent at 2019-04-02T01:12:10Z
Spelling fix s/informations/information/

Signed-off-by: Mathieu Parent <math.parent at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
6064543d by Mathieu Parent at 2019-04-02T01:12:11Z
Spelling fixes s/overrided/overridden/

Signed-off-by: Mathieu Parent <math.parent at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
882d8a5b by Mathieu Parent at 2019-04-02T01:12:11Z
Spelling fixes s/conficts/conflicts/

Signed-off-by: Mathieu Parent <math.parent at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
959a4837 by Mathieu Parent at 2019-04-02T01:12:11Z
Spelling fixes s/verson/version/

Signed-off-by: Mathieu Parent <math.parent at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
92c726dc by Kristján Valur at 2019-04-02T02:12:48Z
make some auth functions return an NTSTATUS like other similar functions for better diagnostics.

Signed-off-by: Kristján Valur <kristjan at rvx.is>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Apr  2 02:12:48 UTC 2019 on sn-devel-144

- - - - -
9c52fdc1 by Andreas Schneider at 2019-04-02T09:11:45Z
s3:lib: Fix the debug message for adding cache entries.

To get correct values, we need to cast 'timeout' to 'long int' first in
order to do calculation in that integer space! Calculations are don in
the space of the lvalue!

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 5822449a7340f53987ce4c04851652427f5b49e8)

- - - - -
d59cefc8 by Philipp Gesang at 2019-04-02T13:44:38Z
libcli: permit larger values of DataLength in SMB2_ENCRYPTION_CAPABILITIES of negotiate response

Certain Netapp versions are sending SMB2_ENCRYPTION_CAPABILITIES
structures containing DataLength field that includes the padding
[0]. Microsoft has since clarified that only values smaller than
the size are considered invalid [1].

While parsing the NegotiateContext it is ensured that DataLength
does not exceed the message bounds. Also, the value is not
actually used anywhere outside the validation. Thus values
greater than the actual data size are safe to use. This patch
makes Samba fail only on values that are too small for the (fixed
size) payload.

[0] https://lists.samba.org/archive/samba/2019-February/221139.html
[1] https://lists.samba.org/archive/cifs-protocol/2019-March/003210.html

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

Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sun Mar 31 01:11:09 UTC 2019 on sn-devel-144

(cherry picked from commit 865b7b0c7d2ba7fa0a045586d1e83a72028a0864)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Tue Apr  2 13:44:38 UTC 2019 on sn-devel-144

- - - - -
9314bd0b by Joe Guo at 2019-04-02T16:09:25Z
samba_dnsupdate: small tweaks to make code more pythonic

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
47278bfa by Michael Hanselmann at 2019-04-02T17:28:40Z
waf: Simplify condition for undefined symbol detection

There's no need to check for OpenBSD twice.

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Tue Apr  2 17:28:40 UTC 2019 on sn-devel-144

- - - - -
3378a561 by Björn Baumbach at 2019-04-03T00:13:10Z
s4:rpc_server: add missing newline to error debug message

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Apr  3 00:13:10 UTC 2019 on sn-devel-144

- - - - -
ea3b4d6a by Gary Lockyer at 2019-04-03T01:40:22Z
prefork tests: disable restart tests MIT

The prefork restart tests use the kdc to test restart back off.  These
tests need to use a process that has not been restarted to ensure that
the process restart counters are sitting at 0 when the tests start.

As MIT kerberos is experimental the heimdal builds will still ensure
that this functionality is tested.

At some stage the echo server should be converted to run in pre-fork and
this process can then be used to test the restart backoff.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
4ae2fb2e by Mathieu Parent at 2019-04-03T01:40:22Z
Relax GPGME version check

The current method require at least the same version as during the build. This is not needed.

Used symbols indicate the minimum is 1.2.0

Bug-Debian: http://bugs.debian.org/886333

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

Signed-off-by: Mathieu Parent <math.parent at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
29d7c80e by Michael Hanselmann at 2019-04-03T02:43:07Z
oLschema2ldif: Resolve multiple parsing bugs

The "oLschema2ldif" program contained multiple bugs triggered by
malformed inputs:

* Iteration beyond list of recognized dsdb syntax OIDs when value wasn't
  found (bug 9567)
* NULL pointer dereference when input didn't define a name
* Heap buffer overflows for unterminated token values

Tests are added to reproduce all identified bugs.

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Then adapted to use ARRAY_SIZE() consistently as suggested by
metze.

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Apr  3 02:43:07 UTC 2019 on sn-devel-144

- - - - -
b7f7e5a3 by Andreas Schneider at 2019-04-03T06:48:21Z
lib:util: Add support to keep talloc chunks secret

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>

- - - - -
c4baf2f6 by Andreas Schneider at 2019-04-03T06:48:21Z
lib:util: Add test for talloc_keep_secret()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>

- - - - -
c7f403d3 by Andreas Schneider at 2019-04-03T07:50:03Z
lib:util: Include talloc_keep_secret.h in samba_util.h

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Apr  3 07:50:03 UTC 2019 on sn-devel-144

- - - - -
d01c5bc9 by Philipp Gesang at 2019-04-03T10:11:49Z
provision: use ASCII quotes

Remove some Unicode quotes that cause problems under the C
locale.

Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
7a413a6d by Philipp Gesang at 2019-04-03T11:33:38Z
python/samba: ignore encoding errors while reading files

Provisioning fails on C locale due to the Unicode quotes in ldif
data. Patch read_and_sub_file() to read the files as UTF-8.

Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Wed Apr  3 11:33:38 UTC 2019 on sn-devel-144

- - - - -
2a926231 by Volker Lendecke at 2019-04-03T16:55:27Z
rpc: Don't crash if npa_accept fails

We can only rely on session_info_transport to be filled correctly upon
success of the accept_existing_recv function

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

- - - - -
a0f03be7 by Volker Lendecke at 2019-04-03T16:55:27Z
auth: Add necessary decoration to auth/auth_util.h

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

- - - - -
a80ea6bf by Volker Lendecke at 2019-04-03T17:53:30Z
rpc: Fix a typo

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Apr  3 17:53:30 UTC 2019 on sn-devel-144

- - - - -
ea29aa27 by Günther Deschner at 2019-04-03T17:54:25Z
s3-libnet_join: always pass down admin domain to ads layer

Otherwise we could loose the information that a non-default domain name
has been used for admin creds.

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
68121f46 by Günther Deschner at 2019-04-03T17:54:25Z
s3-libnet_join: setup libnet join error string when AD connect fails

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
377d2735 by Günther Deschner at 2019-04-03T18:57:31Z
s3-libnet_join: allow fallback to NTLMSSP auth in libnet_join

When a non-DNS and non-default admin domain is provided during the join
sometimes we might not be able to kinit with 'user at SHORTDOMAINNAME'
(e.g. when the winbind krb5 locator is not installed). In that case lets
fallback to NTLMSSP, like we do in winbind.

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Apr  3 18:57:31 UTC 2019 on sn-devel-144

- - - - -
5ba049b5 by Gary Lockyer at 2019-04-04T06:40:16Z
flapping tests: Add samba3.smb2.notify

Add samba3.smb2.notify until Metze gets time to follow it up.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
267cc71f by Gary Lockyer at 2019-04-04T06:40:16Z
lib ldb key_value: Remove index cache lazy initialisation

Remove the lazy initialisation of the index cache. This make setting
the size of the cache for re-indexing easier, which will be done in
later commits.

Performance testing shows that the removal of lazy initialisation makes
no appreciable difference to performance.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8f7bf13b by Gary Lockyer at 2019-04-04T06:40:16Z
lib ldb key_value: Pass index cache size

Pass the index cache size to ldb_kv_index_transaction_start.  This will
allow it to be set for reindex and join operations, where the current
defaults result in a significant performance penalty on large databases.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6129a05c by Gary Lockyer at 2019-04-04T06:40:17Z
lib ldb key_value: Add get_size method

Add the get_size method to the ldb_key_value layer, this will allow the
reindexing code to get an estimate of the number of records in the
database.

The lmdb backend returns an accurate count of the number of records in
the database withe the mdb_env_stat call.

The tdb backend does not provide a low cost method to determine the
number of records on the database.  It does provide a tdb_summary call
however this this walks the entire database.

So for tdb we use the map size divided by 500, this over estimates the counts
for small domains, but the extra memory allocated for the cache should
not be significant.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0952f98e by Gary Lockyer at 2019-04-04T06:40:17Z
lib ldb key_value: set the cache size for re-indexing

Set the index cache size to the number of records in the databse when
reindexing.

This significantly improves reindex performance.  For a domain with
100,000 users the reindex times are reduced from 17 minutes to 45
seconds.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
69408654 by Gary Lockyer at 2019-04-04T06:40:17Z
lib ldb key_value: Set index cache size on open

Set the default index cache from the passed option
"transaction_index_cache_size" on open.  This allows the default cache
size to be overridden when processing large transactions i.e. joining a
large domain.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
00874b61 by Gary Lockyer at 2019-04-04T07:45:03Z
python join: Set index transaction cache size.

The default value is too small for joining a large domain.  So we specify a
size of 200,000 which is suitable for domains with up to 100,000 users.

At a later date this could be added as a parameter to the join, but
200,000 should be suitable for now.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Apr  4 07:45:03 UTC 2019 on sn-devel-144

- - - - -
b4d4778d by Ralph Wuerthner at 2019-04-04T22:39:31Z
s3-messages: modify msg_pool_usage() to allow enhanced memory reports

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
15afc4fb by Ralph Wuerthner at 2019-04-04T23:39:25Z
s3-messages: add mallinfo() information to pool-usage report

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Thu Apr  4 23:39:25 UTC 2019 on sn-devel-144

- - - - -
05c35875 by Volker Lendecke at 2019-04-05T00:00:10Z
rpc: Add tstream_u32_read

In npa_tstream.c we have two next_vector functions reading a big
endian uin32_t length and then the blob described by the length. This
factors that next_vector out into a central routine.

Why? I'll add another NPA protocol in the future, and this would add
yet another two copies of that next_vector code

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

- - - - -
60e31c55 by Volker Lendecke at 2019-04-05T01:00:48Z
rpc: Convert npa_tstream.c to use tstream_u32_read_send

This avoids a bit of code duplication. Overall the last two commits
add a few lines, but that also contains the header file and another GPL
header for tstream_u32_read.c.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Apr  5 01:00:48 UTC 2019 on sn-devel-144

- - - - -
7545eff1 by Douglas Bagnall at 2019-04-05T04:41:25Z
perf-tests: rename paged search test for regex disambiguation

We like to use "TESTS=medley" for the old ad_dc_medley.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c078ea78 by Douglas Bagnall at 2019-04-05T04:41:25Z
spell "recursive"

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
927a5e3c by Douglas Bagnall at 2019-04-05T04:41:25Z
dsdb mods/extended_dn_store: used the ldb we already have

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c5f7b07a by Douglas Bagnall at 2019-04-05T04:41:25Z
dsdb/modules: minor comment typos in samba_dsdb

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
dad98d03 by Douglas Bagnall at 2019-04-05T04:41:25Z
autobuild: attempt authenticated email if environment suggests it

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2da9d7d1 by Douglas Bagnall at 2019-04-05T05:46:55Z
ldb_kv_search: avoid handling uninitialised dn

If ldb_kv_filter_attrs() fails, we don't know that the dn of filtered_msg
is OK.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Apr  5 05:46:55 UTC 2019 on sn-devel-144

- - - - -
d247a600 by Tim Beale at 2019-04-05T07:01:15Z
tests: Add test for setting min/maxPwdAge

Currently setting maxPwdAge doesn't work at all.

While we're adding a test, we might as well assert that minPwdAge
can't be greater than maxPwdAge as well.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b43f997f by Tim Beale at 2019-04-05T07:01:15Z
netcmd: Use python constant for -0x8000000000000000

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
940306a2 by Tim Beale at 2019-04-05T07:01:15Z
netcmd: Add some timestamp conversion helper functions

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
49231313 by Karolin Seeger at 2019-04-05T07:26:54Z
VERSION: Bump version up to 4.9.6...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
(cherry picked from commit 3e6b84f8b43f769b823c13852237f47ebfad6d77)

- - - - -
b708ce3f by Tim Beale at 2019-04-05T07:48:18Z
CVE-2019-3870 tests: Extend smbd tests to check for umask being overwritten

The smbd changes the umask - if the code fails to restore the umask to
what it was, then this is very bad. Add an extra check to every
smbd-related test that the umask at the end of the test is the same as
what it was at the beginning (i.e. if the smbd code changed the umask
then it correctly restored the value afterwards).

As the selftest sets the umask for all tests to zero, it makes it hard
to detect this problem, so the test setUp() needs to set it to something
else first.

This extra checking is added to the setUp()/tearDown() so that it
applies to all test-cases. However, any failure that occur with this
approach will not be able to be known-failed.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

(This backport to Samba 4.9 by Andrew Bartlett was not a pure
cherry-pick due to merge conflicts)

- - - - -
83cc536a by Tim Beale at 2019-04-05T07:48:18Z
CVE-2019-3870 tests: Add test to check file-permissions are correct after provision

This provisions a new DC and checks there are no world-writable
files in the new DC's private directory.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
65a175aa by Andrew Bartlett at 2019-04-05T07:48:18Z
CVE-2019-3870 pysmbd: Include tests to show the outside umask has no impact

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
30db4865 by Andrew Bartlett at 2019-04-05T07:48:18Z
CVE-2019-3870 pysmbd: Move umask manipuations as close as possible to users

Umask manipulation was added to pysmbd with e146fe5ef96c1522175a8e81db15d1e8879e5652 in 2012
and init_files_struct was split out in 747c3f1fb379bb68cc7479501b85741493c05812 in 2018 for
Samba 4.9. (It was added to assist the smbd.create_file() routine used in the backup and
restore tools, which needed to write files with full metadata).

This in turn avoids leaving init_files_struct() without resetting the umask to
the original, saved, value.

Per umask(2) this is required before open() and mkdir() system calls (along
side other file-like things such as those for Unix domain socks and FIFOs etc).

Therefore for safety and clarify the additional 'belt and braces' umask
manipuations elsewhere are removed.

mkdir() will be protected by a umask() bracket, for correctness, in the next patch.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

(This backport to Samba 4.9 by Andrew Bartlett is not a pure
cherry-pick due to merge conflicts)

- - - - -
c92ac5ad by Andrew Bartlett at 2019-04-05T07:48:18Z
CVE-2019-3870 pysmbd: Ensure a zero umask is set for smbd.mkdir()

mkdir() is the other call that requires a umask of 0 in Samba.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d53121af by Jeremy Allison at 2019-04-05T07:48:18Z
CVE-2019-3880 s3: rpc: winreg: Remove implementations of SaveKey/RestoreKey.

The were not using VFS backend calls and could only work
locally, and were unsafe against symlink races and other
security issues.

If the incoming handle is valid, return WERR_BAD_PATHNAME.

[MS-RRP] states "The format of the file name is implementation-specific"
so ensure we don't allow this.

As reported by Michael Hanselmann.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
424563db by Karolin Seeger at 2019-04-05T07:48:18Z
WHATSNEW: Add release notes for Samba 4.9.6.

CVE-2019-3870 (World writable files in Samba AD DC private/ dir)
CVE-2019-3880 (Save registry file outside share as unprivileged user)

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
dd7b68d1 by Karolin Seeger at 2019-04-05T07:48:18Z
VERSION: Disable GIT_SNAPSHOT for the 4.9.6 release.

CVE-2019-3870 (World writable files in Samba AD DC private/ dir)
CVE-2019-3880 (Save registry file outside share as unprivileged user)

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
7a410ccb by Tim Beale at 2019-04-05T08:03:08Z
netcmd: Fix passwordsettings --max-pwd-age command

The min_pwd_age and max_pwd_age parameters are both optional and default
to None. However, if we just set the max-pwd-age, then the check
'min_pwd_age >= max_pwd_age' will throw a Python exception because it's
trying to compare an int to NoneType (min_pwd_age). This works on Python 2
but is a problem on Python 3.

We could just add a check that min_pwd_age is not None, but that defeats
the point of having the check if you're only setting either the min or
max age indepedently.

This patch gets the current min/max password age from the DB (in ticks).
If either setting is changed, the ticks will be updated. Then at the end
we check the min is still less than the max (to do this, we convert the
ticks back to days in the interests of readability).

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Apr  5 08:03:08 UTC 2019 on sn-devel-144

- - - - -
d5ca39f6 by Mathieu Parent at 2019-04-05T14:44:43Z
samba-libs: Fix Breaks+Replaces: libndr-standard0 (<< 2:4.0.9) (Closes: #910242)

- - - - -
ecdb31ca by Jeremy Allison at 2019-04-05T14:47:18Z
CVE-2019-3880 s3: rpc: winreg: Remove implementations of SaveKey/RestoreKey.

The were not using VFS backend calls and could only work
locally, and were unsafe against symlink races and other
security issues.

If the incoming handle is valid, return WERR_BAD_PATHNAME.

[MS-RRP] states "The format of the file name is implementation-specific"
so ensure we don't allow this.

As reported by Michael Hanselmann.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4c1b4d9e by Mathieu Parent at 2019-04-05T14:47:18Z
Add patch for CVE-2019-3880 Save registry file outside share as unprivileged user in Samba 4.x

- - - - -
40af26fa by Tim Beale at 2019-04-05T14:48:05Z
CVE-2019-3870 tests: Extend smbd tests to check for umask being overwritten

The smbd changes the umask - if the code fails to restore the umask to
what it was, then this is very bad. Add an extra check to every
smbd-related test that the umask at the end of the test is the same as
what it was at the beginning (i.e. if the smbd code changed the umask
then it correctly restored the value afterwards).

As the selftest sets the umask for all tests to zero, it makes it hard
to detect this problem, so the test setUp() needs to set it to something
else first.

This extra checking is added to the setUp()/tearDown() so that it
applies to all test-cases. However, any failure that occur with this
approach will not be able to be known-failed.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

(This backport to Samba 4.9 by Andrew Bartlett was not a pure
cherry-pick due to merge conflicts)

- - - - -
84f97107 by Tim Beale at 2019-04-05T14:48:05Z
CVE-2019-3870 tests: Add test to check file-permissions are correct after provision

This provisions a new DC and checks there are no world-writable
files in the new DC's private directory.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0761b15b by Andrew Bartlett at 2019-04-05T14:48:05Z
CVE-2019-3870 pysmbd: Include tests to show the outside umask has no impact

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e9b33016 by Andrew Bartlett at 2019-04-05T14:48:05Z
CVE-2019-3870 pysmbd: Move umask manipuations as close as possible to users

Umask manipulation was added to pysmbd with e146fe5ef96c1522175a8e81db15d1e8879e5652 in 2012
and init_files_struct was split out in 747c3f1fb379bb68cc7479501b85741493c05812 in 2018 for
Samba 4.9. (It was added to assist the smbd.create_file() routine used in the backup and
restore tools, which needed to write files with full metadata).

This in turn avoids leaving init_files_struct() without resetting the umask to
the original, saved, value.

Per umask(2) this is required before open() and mkdir() system calls (along
side other file-like things such as those for Unix domain socks and FIFOs etc).

Therefore for safety and clarify the additional 'belt and braces' umask
manipuations elsewhere are removed.

mkdir() will be protected by a umask() bracket, for correctness, in the next patch.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

(This backport to Samba 4.9 by Andrew Bartlett is not a pure
cherry-pick due to merge conflicts)

- - - - -
f891f41e by Andrew Bartlett at 2019-04-05T14:48:06Z
CVE-2019-3870 pysmbd: Ensure a zero umask is set for smbd.mkdir()

mkdir() is the other call that requires a umask of 0 in Samba.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
b8a241f7 by Mathieu Parent at 2019-04-05T14:48:47Z
Add patch for CVE-2019-3870 pysmbd: missing restoration of original umask after umask(0)

- - - - -
391829bb by Mathieu Parent at 2019-04-05T14:51:20Z
Release 2:4.9.5+dfsg-3

- - - - -
7c44f2f7 by Christof Schmitt at 2019-04-06T05:12:21Z
memcache: Introduce struct for storing talloc pointer

This allows extending the additional data stored for talloced objects
later.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a04ca6f3 by Christof Schmitt at 2019-04-06T05:12:21Z
memcache: Properly track the size of talloc objects

With memcache_add_talloc, the talloc object becomes part of the pool and
the memcache_element stores a pointer to the talloc object. The
size of the the talloc object was not used when tracking the used space,
allowing the cache to grow larger than defined in the memcache_init
call.

Fix this by adding the size of the talloc object to the used space.

Also record the initial size of the talloc object for proper adjustment
of the used space in the cache later. This is in case the size of the
talloc object is modified while being owned by the cache (e.g.
allocating talloc child objects). This should never happen, but better
be safe than ending up with a broken cache usage counter.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
9ff5c0ba by Christof Schmitt at 2019-04-06T05:12:21Z
memcache: Increase size of default memcache to 512k

With the fixed accounting of talloc objects, the default cache size
needs to increase. The exact increase required depends on the workloads,
going form 256k to 512k seems like a reasonable guess.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
b7028c42 by Christof Schmitt at 2019-04-06T06:08:42Z
torture: Add test for talloc size accounting in memcache

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Apr  6 06:08:42 UTC 2019 on sn-devel-144

- - - - -
bb1e3229 by Volker Lendecke at 2019-04-06T10:47:13Z
ctdb: Slightly simplify ctdb_ltdb_lock_fetch_requeue

Reduce indentation with an early return

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
43cacaad by Volker Lendecke at 2019-04-06T11:51:55Z
ctdb: Fix a typo

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Sat Apr  6 11:51:55 UTC 2019 on sn-devel-144

- - - - -
fc2e521a by Garming Sam at 2019-04-08T02:07:22Z
libnet vampire: NULL access bug fix

NULL pointer access bug fix

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e4ea408f by Garming Sam at 2019-04-08T02:07:22Z
lmdb: iterate_range implementation

Adding iterate_range to LDB API and implementing in LMDB.  This
operation takes a start_key and end_key and returns all records between
the two, inclusive of both.  This will be used to implementing indexing
for <= and >= expressions.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1b5df443 by Aaron Haslett at 2019-04-08T02:07:22Z
lmdb: iterate_range cmocka testing

Cmocka testing for LMDB iterate_range operation added in previous commit.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
9b3021b8 by Aaron Haslett at 2019-04-08T02:07:22Z
ldb: <= and >= indexed searching

Full implementation of <= and >= indexed searching using iterate_range
backend operation.  Adds index_format_fn to ldb_schema_syntax so
requires an ABI version bump.  The function must be provided for any
type for which <= and >= indexing is required, and must return a
lexicographically ordered canonicalization of a value.  This causes
index entries to be written in correct order to the database, so
iterate_range on the index DNs can be used.

ldb_kv_index_key is modified to return an index DN with attribute name
but without value if an empty value is provided.  This is needed for
constructing keys that match the beginning or end of an index DN range.

Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a8945152 by Garming Sam at 2019-04-08T02:07:22Z
ldb_kv_index: Make the edge keys slightly cleaner and generic

It makes no difference in our standard case because \0 will always go
before any value for our index_format_fn, but this is better for
correctness (in case we do mess up our NUL terminations elsewhere).

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f7756065 by Garming Sam at 2019-04-08T02:07:22Z
ldb_kv_index: Add a giant comment in regards to index_format_fn

The reason we needed it in the first place was that the original
canonicalize is being used for non-index functions and it never produced
the right order originally (at least for integers).

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c9b2a372 by Aaron Haslett at 2019-04-08T02:07:23Z
ldb: activating <= and >= indexing for integers

Activating <= and >= mdb indexing in samba for int32 and int64 attributes by:
1. Adding index_format_fn to LDB_SYNTAX_SAMBA_INT32 in ldb_samba
2. Cloning the 64bit LDB_SYNTAX_INTEGER type as LDB_SYNTAX_ORDERED_INTEGER
3. Adding index_format_fn to the new type
4. Modifying LargeInteger use the new type in samba schema
5. Bumping the index version to trigger reindexing

Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
db584d50 by Garming Sam at 2019-04-08T02:07:23Z
schema_syntax: Add comments for our index format functions

We had to devise our own scheme for writing integers in a human readable
format which also sorted correctly numerically. This might look a bit
confusing to outsiders, so here's a large comment as a peace offering.

Pair-programmed-with: Tim Beale <timbeale at catalyst.net.nz>

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6062d724 by Garming Sam at 2019-04-08T02:07:23Z
ldb: Add ORDERED_INTEGER to the proto-schema handling

Adding ordered integer proto schema handling in kv index cache.  This
allows ordered 64 bit integers to be used in cached fields like
@ATTRIBUTES

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
18438c8a by Aaron Haslett at 2019-04-08T02:07:23Z
ldb: tests for <= and >= integer indexing

Testing max, min and negative values for indexed 32 and 64 bit types.
This has to be done in two different files because the 64 bit type is
LDB_SYNTAX_INTEGER which is implemented at the ldb level, while the 32
bit is added in the ldb-samba module.  Schema syntax binding added for
ldb-samba.

We also need to make sure that full scans are not invoked for LMDB.

Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2e05fd78 by Garming Sam at 2019-04-08T02:07:23Z
ldb: tests for <= and >= integer indexing with duplicates

We need to make sure that duplicates are correctly returned (uSNChanged
for instance is UNIQUE but, we should be able to index on attributes
which are not unique).

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9d0b0036 by Garming Sam at 2019-04-08T02:07:23Z
ldb_mdb: Add some warnings about poorly constructed callbacks

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
15d1ecdc by Aaron Haslett at 2019-04-08T02:07:23Z
ldb: version 2.0.0

* Version bump for adding index_format_fn to the schema syntax structure.
* Range index support added, allowing <= and >= operations to be indexed
* Improved reindex performance by setting the in-memory TDB hash size correctly

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
21d501bf by Andrew Bartlett at 2019-04-08T03:09:42Z
selftest: Correct name of flapping smb2.notify test

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Apr  8 03:09:42 UTC 2019 on sn-devel-144

- - - - -
60481037 by Tim Beale at 2019-04-08T10:27:34Z
CVE-2019-3870 tests: Extend smbd tests to check for umask being overwritten

The smbd changes the umask - if the code fails to restore the umask to
what it was, then this is very bad. Add an extra check to every
smbd-related test that the umask at the end of the test is the same as
what it was at the beginning (i.e. if the smbd code changed the umask
then it correctly restored the value afterwards).

As the selftest sets the umask for all tests to zero, it makes it hard
to detect this problem, so the test setUp() needs to set it to something
else first.

This extra checking is added to the setUp()/tearDown() so that it
applies to all test-cases. However, any failure that occur with this
approach will not be able to be known-failed.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0c8ad9c9 by Tim Beale at 2019-04-08T10:27:34Z
CVE-2019-3870 tests: Add test to check file-permissions are correct after provision

This provisions a new DC and checks there are no world-writable
files in the new DC's private directory.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d7580706 by Andrew Bartlett at 2019-04-08T10:27:34Z
CVE-2019-3870 pysmbd: Include tests to show the outside umask has no impact

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
1899e16e by Andrew Bartlett at 2019-04-08T10:27:34Z
CVE-2019-3870 pysmbd: Move umask manipuations as close as possible to users

Umask manipulation was added to pysmbd with e146fe5ef96c1522175a8e81db15d1e8879e5652 in 2012
and init_files_struct was split out in 747c3f1fb379bb68cc7479501b85741493c05812 in 2018 for
Samba 4.9. (It was added to assist the smbd.create_file() routine used in the backup and
restore tools, which needed to write files with full metadata).

This in turn avoids leaving init_files_struct() without resetting the umask to
the original, saved, value.

Per umask(2) this is required before open() and mkdir() system calls (along
side other file-like things such as those for Unix domain socks and FIFOs etc).

Therefore for safety and clarify the additional 'belt and braces' umask
manipuations elsewhere are removed.

mkdir() will be protected by a umask() bracket, for correctness, in the next patch.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
17b3d2eb by Andrew Bartlett at 2019-04-08T10:27:34Z
CVE-2019-3870 pysmbd: Ensure a zero umask is set for smbd.mkdir()

mkdir() is the other call that requires a umask of 0 in Samba.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c79f719a by Jeremy Allison at 2019-04-08T10:27:34Z
CVE-2019-3880 s3: rpc: winreg: Remove implementations of SaveKey/RestoreKey.

The were not using VFS backend calls and could only work
locally, and were unsafe against symlink races and other
security issues.

If the incoming handle is valid, return WERR_BAD_PATHNAME.

[MS-RRP] states "The format of the file name is implementation-specific"
so ensure we don't allow this.

As reported by Michael Hanselmann.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8ee79597 by Karolin Seeger at 2019-04-08T10:29:09Z
Merge tag 'samba-4.9.6' into v4-9-test

samba: tag release samba-4.9.6

- - - - -
d162726a by Karolin Seeger at 2019-04-08T10:29:27Z
VERSION: Bump version up to 4.9.7.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
b1582a4d by Jeremy Allison at 2019-04-08T11:43:31Z
CVE-2019-3880 s3: rpc: winreg: Remove implementations of SaveKey/RestoreKey.

Remove the now unused code implementations of
registry file io.

As reported by Michael Hanselmann.

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

Signed-off-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(master): Mon Apr  8 11:43:31 UTC 2019 on sn-devel-144

- - - - -
b1d1f5f5 by Andreas Schneider at 2019-04-09T09:49:51Z
docs: Update smbclient manpage for --max-protocol

We default to SMB3 now.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 63084375e3c536f22f65e7b7796d114fa8c804c9)

- - - - -
be37e77b by Andreas Schneider at 2019-04-09T09:49:51Z
s3:libads: Print more information when LDAP fails

Currently we just get an error but don't know what exactly we tried to
do in 'net ads join -d10'.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 40669e3739eb5cde135c371e2c8134d3f11a16a5)

- - - - -
0acb2e42 by Andreas Schneider at 2019-04-09T09:49:52Z
s3:libsmb: Add some useful debug output to cliconnect

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 011a47f04dabe22095a30d284662d8ca50463ee8)

- - - - -
7dce8031 by Guenther Deschner at 2019-04-09T09:49:52Z
s3:libnet: Fix debug message in libnet_DomainJoin()

A newline is missing but also use DBG_INFO macro and cleanup spelling.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 3a33c360071bb7cada58f1f71ccd8949fda70662)

- - - - -
1a239fa0 by Guenther Deschner at 2019-04-09T09:49:52Z
auth:ntlmssp: Add back CRAP ndr debug output

This got lost somehow during refactoring. This is still viable
information when trying to figure out what is going wrong when
authenticating a user over NTLMSSP.

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

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 9e92654899db3c951bee0203415a15737402e7b7)

- - - - -
33ec6f82 by Andreas Schneider at 2019-04-09T09:49:52Z
auth:creds: Prefer the principal over DOMAIN/username when using NTLM

If we want to authenticate using -Wadmin at otherdomain the DC should do
take care of the authentication with the right DC for us.

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

Pair-Programmed-With: Guenther Deschner <gd at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 5c7f0a6902cfdd698e5f4159d37537bb4c9c1cc3)

- - - - -
cf210317 by Andreas Schneider at 2019-04-09T09:49:52Z
s3:libnet: Use more secure name for the JOIN krb5.conf

Currently we create krb5.conf..JOIN, use krb5.conf._JOIN_ instead.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit b7f0c64514a28cfb5d2cdee683c18943b97ea753)

- - - - -
55da00ce by Andreas Schneider at 2019-04-09T09:49:52Z
s3:libads: Make sure we can lookup KDCs which are not configured

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

Pair-Programmed-With: Guenther Deschner <gd at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit c016afc832543514ebf7ecda1fbe6b272ea533d6)

- - - - -
e933ddb7 by Guenther Deschner at 2019-04-09T09:49:52Z
s3:ldap: Leave add machine code early for pre-existing accounts

This avoids numerous LDAP constraint violation errors when we try to
re-precreate an already existing machine account.

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

Pair-Programmed-With: Andreas Schneider <asn at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 2044ca0e20bd3180720a82506b3af041d14b5c68)

- - - - -
4147349c by Günther Deschner at 2019-04-09T09:49:52Z
s3-libnet_join: always pass down admin domain to ads layer

Otherwise we could loose the information that a non-default domain name
has been used for admin creds.

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit ea29aa27cbac4253ee1701fed99a3e0811f7475d)

- - - - -
d101da49 by Günther Deschner at 2019-04-09T09:49:53Z
s3-libnet_join: setup libnet join error string when AD connect fails

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 68121f46c74df9cef7a377040d01ba75cdcf5a26)

- - - - -
7f1811ee by Günther Deschner at 2019-04-09T09:49:53Z
s3-libnet_join: allow fallback to NTLMSSP auth in libnet_join

When a non-DNS and non-default admin domain is provided during the join
sometimes we might not be able to kinit with 'user at SHORTDOMAINNAME'
(e.g. when the winbind krb5 locator is not installed). In that case lets
fallback to NTLMSSP, like we do in winbind.

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Apr  3 18:57:31 UTC 2019 on sn-devel-144

(cherry picked from commit 377d27359ccdb8f2680fda36ca388f44456590e5)

- - - - -
d78118d0 by Douglas Bagnall at 2019-04-09T13:52:03Z
py/provision: fix for Python 2.6

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13882
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Tue Apr  9 13:52:03 UTC 2019 on sn-devel-144

- - - - -
c0b2272a by Volker Lendecke at 2019-04-09T18:29:13Z
lib: Initialize getline() arguments

Keep "len" valid across the loop iterations for getline to consume

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13892

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
bcb27521 by Volker Lendecke at 2019-04-09T18:29:14Z
lib: Initialize variables in parse_resolvconf_fp

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
cc4513dd by Volker Lendecke at 2019-04-09T18:29:14Z
smbd: Factor out map_lease_type_to_oplock

grant_fsp_oplock_type has enough complex logic, make this a bit shorter

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

- - - - -
ee53763a by Volker Lendecke at 2019-04-09T18:29:14Z
leases_db: Make leases_db_rename atomic

Do the rename under one lock to protect against potential races while
we don't hold it.

Factor out the NDR marshalling into leases_db_do_locked(), leaving the
rename function pretty simple.

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

- - - - -
885d433b by Volker Lendecke at 2019-04-09T18:29:14Z
leases_db: Make leases_db_add use leases_db_do_locked

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

- - - - -
bfbe24d8 by Volker Lendecke at 2019-04-09T19:31:09Z
leases_db: Make leases_db_del use leases_db_do_locked

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Apr  9 19:31:09 UTC 2019 on sn-devel-144

- - - - -
5c1009b3 by Swen Schillig at 2019-04-09T23:14:19Z
ctdb-test: Modify ctdb_io_test test_setup to provide queue reference

Some test scenarios require access to the created queue.
Prepare the test_setup function to provide it as additional parameter.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
1f193174 by Swen Schillig at 2019-04-09T23:14:19Z
ctdb-test: Adding test case verifying data in buffer move

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
9ee32f3a by Swen Schillig at 2019-04-10T00:17:37Z
ctdb-test: Adding test case to verify queue resizeing

If a data packet arrives which exceeds the queue's current buffer size,
the buffer needs to be increased to hold the full packet. Once the packet
is processed the buffer size should be decreased to its standard size again.
This test case verifies this process.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Wed Apr 10 00:17:37 UTC 2019 on sn-devel-144

- - - - -
56f933fa by Christof Schmitt at 2019-04-10T01:17:28Z
vfs_full_audit: Fix logging of get_real_filename output

result == 0 indicated success. In that case log the available
found_name.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Apr 10 01:17:28 UTC 2019 on sn-devel-144

- - - - -
49b77d8d by Andrew Bartlett at 2019-04-10T06:23:39Z
ldb_kv: Skip @ records early in a search full scan

@ records like @IDXLIST are only available via a base search on the specific name
but the method by which they were excluded was expensive, after the unpack the
DN is exploded and ldb_match_msg_error() would reject it for failing to match the
scope.

This uses the fact that @ records have the DN=@ prefix on their TDB/LMDB key
to quickly exclude them from consideration.

Based on analysis by Garming Sam.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Apr 10 06:23:39 UTC 2019 on sn-devel-144

- - - - -
140a6733 by Stefan Metzmacher at 2019-04-11T04:17:09Z
drsuapi.idl: add DRSUAPI_ATTID_schemaInfo

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
e34abefb by Aaron Haslett at 2019-04-11T04:17:09Z
samdb: test for schemainfo update with relax control

Currently schema info's revision field isn't incremented if relax
control is present.  This is so that no increment is done during
provision, but we need the relax control in other situations where the
increment is desired.  This patch adds a failing test to expose the
problem.

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

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
b5b572d5 by Stefan Metzmacher at 2019-04-11T04:17:10Z
ldapcmp: ignore 'schemaInfo' if two domains are compared

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
5ea84af2 by Stefan Metzmacher at 2019-04-11T04:17:10Z
s4:provision: split out provision_self_join_modify_schema.ldif

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
7652439f by Stefan Metzmacher at 2019-04-11T04:17:10Z
python/provision: use provision and relax controls for schema provision

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
b7c17527 by Aaron Haslett at 2019-04-11T04:17:10Z
dsdb:samdb: schemainfo update with relax control

Currently schema info's revision field isn't incremented if relax
control is present.  This is so that no increment is done during
provision, but we need the relax control in other situations where
the increment is desired, so we should use the provision control instead
to disable schema info update.

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

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
661dc457 by Stefan Metzmacher at 2019-04-11T04:17:10Z
dsdb/repl: we need to replicate the whole schema before we can apply it

Otherwise we may not be able to construct a working schema that's
required to apply the changes.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
4336c058 by Tim Beale at 2019-04-11T04:17:10Z
selftest: Add new 2-DC testenv for live schema upgrade

This adds a new 2-DC testenv that:
1. Provisions an AD DC with 2008R2 schema
2. Joins another AD DC with 2008R2 schema
3. Starts Samba
4. Performs a live schema upgrade on the PDC
Testenv targetting in tests.py files for this testenv required that we
extend the environment dependencies system to include optional post-startup
dependencies specified in ENV_DEPS_POST maps.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
350fc49e by Aaron Haslett at 2019-04-11T04:17:11Z
selftest: tagging tests for new schemaupgrade_dc target

Tagging schema tests against schemaupgrade_dc test target and fixing
some DN assertions to be more generic.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
5d8895f3 by Aaron Haslett at 2019-04-11T04:17:11Z
repl: test for schema object and LA repl across chunks

During replication, transmission of objects and linked attributes are
split into chunks.  These two tests check behavioural consistency across
chunks for regular schema objects and linked attributes.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
59ee3c86 by Aaron Haslett at 2019-04-11T04:17:11Z
selftest: split schemaupgrade testenv out

Schemaupgrade tests are particularly resource intensive and are causing
runners to hit their memory and CPU limits, so we need to split them
out.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
65303bf5 by Garming Sam at 2019-04-11T04:17:11Z
ldb_kv: Remove unnecessary space

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d6b1d556 by Garming Sam at 2019-04-11T04:17:11Z
ldb_mdb: Change function declaration as per README.coding

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a76d2865 by Garming Sam at 2019-04-11T04:17:11Z
ldb_kv: Avoid memdup of database records in the case of base searches

This makes LDAP bind significantly faster in the case of having many
members, due to large size of these records (with tens of thousands of
member links). During the nested group calculation, you are only
interested in memberOf not the member links.

(We add a bit-field to determine whether or not the backend actually
supports pointing into database memory. For some reason TDB pointers
aren't stable, so for now we set this option just on LMDB backends.)

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
74091115 by Garming Sam at 2019-04-11T05:25:02Z
tests/ldb_kv: Add another case for completeness

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Apr 11 05:25:02 UTC 2019 on sn-devel-144

- - - - -
da80b6d2 by Swen Schillig at 2019-04-11T22:29:25Z
lib: modify string conversion wrapper to handle invalid strings

The standard string conversion routines convert a "non-number string"
to zero and do not flag an error.
This is changed now by returning EINVAL if no conversion occured.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
7adaebe5 by Swen Schillig at 2019-04-11T22:29:26Z
lib: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
8ca4b1f6 by Swen Schillig at 2019-04-11T22:29:26Z
utils: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
1bdec2ce by Swen Schillig at 2019-04-11T22:29:26Z
modules: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
c0c1004c by Swen Schillig at 2019-04-11T22:29:26Z
ctdb-protocol: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
6c1068ac by Swen Schillig at 2019-04-11T22:29:27Z
ctdb-tools: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
6461a992 by Swen Schillig at 2019-04-11T22:29:27Z
common-lib: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
beb3012e by Swen Schillig at 2019-04-11T22:29:27Z
libcli: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
5ff48f64 by Swen Schillig at 2019-04-11T22:29:27Z
source4: Update error check for new string conversion wrapper

The new string conversion wrappers detect and flag errors
which occured during the string to integer conversion.
Those modifications required an update of the callees
error checks.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
2029fe72 by Swen Schillig at 2019-04-11T23:34:51Z
lib: remove duplicate check

This check was supposed to be removed by c9f4b92a613.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Thu Apr 11 23:34:51 UTC 2019 on sn-devel-144

- - - - -
d970e843 by Volker Lendecke at 2019-04-11T23:35:15Z
build: Move smbstatus definition to source3/utils/wscript_build

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

- - - - -
e8ce1c64 by Volker Lendecke at 2019-04-11T23:35:15Z
smbd: Remove some unused includes

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

- - - - -
fccd9c8c by Volker Lendecke at 2019-04-12T00:37:05Z
utils: Move conn_tdb.c to utils/

That's a wrapper that only smbstatus and net status use by now.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Apr 12 00:37:05 UTC 2019 on sn-devel-144

- - - - -
075a078d by Andrew Bartlett at 2019-04-12T04:38:14Z
ldb: Avoid calling talloc_get_type() in ldb_kv_parse_data_unpack()

We have the ldb_kv in the caller, just fill it into the context and
so avoid the cost of the talloc_get_type().

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
10dd1501 by Michael Hanselmann at 2019-04-12T04:38:14Z
ndrdump: Remove local variables for pipes

There's no need for the local variables as the NDR call structure
pointer is kept around anyway.

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c9e6331a by Andrew Bartlett at 2019-04-12T04:38:14Z
ndrdump: change behaviour of flags to operate as flags

These are called flags because that is what they become to the ndr_pull function,
but to avoid total confusion treat them as flags generally even if the values are
always exclusive (at the moment).

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
bfd762b5 by Garming Sam at 2019-04-12T05:41:36Z
selftest: rename schemaupgrade_dc (+pair) to schema_dc

This is needed because the name of the autobuild job and
the name of the selftest env end up in the socket path
for ncalrpc sockets.

The challenge is that (for example)
/memdisk/autobuild/fl/b2424063/samba-schemaupgrade/bin/ab/schemaupgrade_pair_dc/ncalrpc/np/protected_storage
does not fit in a struct sockaddr_un.

Signed-off-by: Garming Sam <garming at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Apr 12 05:41:36 UTC 2019 on sn-devel-144

- - - - -
10291d91 by Martin Schwenke at 2019-04-12T07:11:30Z
Revert "ctdb-scripts: Do not "correct" number of nfsd threads when it is 0"

I thought this was being triggered during automated testing.
However, it appears that a poor choice of fixed ports for NFS RPC
services was the real problem.  Revert, since the original behaviour
may be useful.

This reverts commit f1a1c300e192d43f5c9faf9450ffbf16341a2661.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
38dc6d11 by Martin Schwenke at 2019-04-12T07:11:30Z
ctdb-daemon: Revert "We can not assume that just because we could complete a TCP handshake"

We also can not assume that nodes can be marked as connected via only
the keepalive mechanism.  Keepalives are not sent to disconnected
nodes so, in the absence of other packets (e.g. broadcasts), 2 nodes
may never become marked as connected to each other.

Revert to marking nodes as connected in the TCP transport code.  If a
connection is to a non(-operational) ctdbd then it will revert to
disconnected after a short while and may actually flap.  This should
be rare.

This reverts commit 66919db3d7ab1e091223faf515b183af8bfddc83.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
d415458f by Martin Schwenke at 2019-04-12T07:57:10Z
ctdb-scripts: Reindent some functions prior to making changes

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit d7e187c1a7046196ec96637bdc14cc6b042eafcc)

- - - - -
11758628 by Martin Schwenke at 2019-04-12T07:57:10Z
ctdb-scripts: Rename variable nfslock_service to nfs_lock_service

There will be more of these variable for other services so, for
readability, it makes sense for them to start with "nfs_".

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 9981353ab79dce81b698c535977be4a681119d1e)

- - - - -
022b9a6c by Martin Schwenke at 2019-04-12T07:57:10Z
ctdb-scripts: Add test variable CTDB_NFS_DISTRO_STYLE

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit e72c3c800a50fe746164e319e21180c44d041619)

- - - - -
f0082767 by Martin Schwenke at 2019-04-12T07:57:10Z
ctdb-scripts: Factor out nfs_load_config()

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 8de0a339b550e7363d265af04ad69f2179af75c6)

- - - - -
5a97b7f0 by Martin Schwenke at 2019-04-12T07:57:11Z
ctdb-scripts: Stop/start mount/rquotad/status via NFS call-out

When an NFS check restarts a failed service by hand then systemd will
be unable to stop or start this service again because (at least) the
PID file will be wrong.  Do this via the NFS Linux kernel call-out
instead.  Allow the call-out to use the services instead of doing
manual restarts.  Add variables for mount, status and rquotad services
to support this.

Adding systemd NFS services to the call-out will follow.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 42103b568698d8087d27f0848b402ccb7cfac86b)

- - - - -
7932032d by Martin Schwenke at 2019-04-12T07:57:11Z
ctdb-scripts: Start NFS quota service if defined

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 708c04071af8d6ddc3bf2bddbde4d5847f440c0e)

- - - - -
aee71ea6 by Martin Schwenke at 2019-04-12T07:57:11Z
ctdb-scripts: Add systemd services to NFS call-out

At least Red Hat and Debian appear to use (a variant of?) the upstream
systemd units for NFS, so adding support for these services is
relatively easy.  Distributions using Sys-V init can patch the
call-out to use the relevant Sys-V init services.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit a8fafd377ff0cb07ab161e437c5fe024704345eb)

- - - - -
14069988 by Martin Schwenke at 2019-04-12T07:57:11Z
ctdb-tests: Update NFS test infrastructure to support systemd services

The tests are written around the default of sysvinit-redhat.  Add
support for systemd-redhat.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 2833ddcfcb780497264e0f412a9ad6e26a9bc657)

- - - - -
dae0e8ec by Martin Schwenke at 2019-04-12T07:57:11Z
ctdb-scripts: Allow load_system_config() to take multiple alternatives

The situation for NFS config has got more complicated and is probably
broken in statd-callout on Debian-like systems at the moment.  Allow
several alternative configuration names to be tried.  Stop after the
first that is found and loaded.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit 0d67ea5fcca766734ecc73ad6b0139f7c13a15c5)

- - - - -
49fa0881 by Martin Schwenke at 2019-04-12T07:57:11Z
ctdb-scripts: Update statd-callout to try several configuration files

The alternative seems to be to try something via CTDB_NFS_CALLOUT.
That would be complicated and seems like overkill for something this
simple.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at samba.org>
(cherry picked from commit a2bd4085896804ee2da811e17f18c78a5bf4e658)

- - - - -
116c874f by Christof Schmitt at 2019-04-12T07:57:11Z
memcache: Introduce struct for storing talloc pointer

This allows extending the additional data stored for talloced objects
later.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 7c44f2f76eefb9156cb1d170c92b4ff07dd6a3d5)

- - - - -
a54038bf by Christof Schmitt at 2019-04-12T07:57:11Z
memcache: Properly track the size of talloc objects

With memcache_add_talloc, the talloc object becomes part of the pool and
the memcache_element stores a pointer to the talloc object. The
size of the the talloc object was not used when tracking the used space,
allowing the cache to grow larger than defined in the memcache_init
call.

Fix this by adding the size of the talloc object to the used space.

Also record the initial size of the talloc object for proper adjustment
of the used space in the cache later. This is in case the size of the
talloc object is modified while being owned by the cache (e.g.
allocating talloc child objects). This should never happen, but better
be safe than ending up with a broken cache usage counter.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit a04ca6f3438595ba7e1a110877f53d1cac0f0402)

- - - - -
e09262b7 by Christof Schmitt at 2019-04-12T07:57:11Z
memcache: Increase size of default memcache to 512k

With the fixed accounting of talloc objects, the default cache size
needs to increase. The exact increase required depends on the workloads,
going form 256k to 512k seems like a reasonable guess.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 9ff5c0bab76c5d3d7bea1fcb79861d0c9a3b9839)

- - - - -
28920127 by Amitay Isaacs at 2019-04-12T08:19:29Z
ctdb-common: Avoid race between fd and signal events

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

In run_proc, there was an implicit assumption that when a process exits,
fd event (pipe between parent and child) would be processed first and
signal event (SIGCHLD for the child) would be processed later.

However, that is not the case.  SIGCHLD can be received asynchronously
any time even when the pipe data has not fully been read.  This causes
run_proc to miss some of the output from child process in tests.

When SIGCHLD is being processed, if the pipe between parent and child is
still open, then do an explict read from the pipe to ensure we read any
data still in the pipe before closing the pipe.

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Fri Apr 12 08:19:29 UTC 2019 on sn-devel-144

- - - - -
e974e440 by Christof Schmitt at 2019-04-12T11:29:26Z
torture: Add test for talloc size accounting in memcache

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Apr  6 06:08:42 UTC 2019 on sn-devel-144

(cherry picked from commit b7028c42462c34cf86cb949bfdb16ebc7ed0a6c6)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Fri Apr 12 11:29:26 UTC 2019 on sn-devel-144

- - - - -
2b5dbb35 by David Disseldorp at 2019-04-12T18:38:20Z
build: add explicit cephfs include path for vfs_ceph builds

Needed if building with a custom --with-libcephfs path.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4982e282 by David Disseldorp at 2019-04-12T18:38:20Z
vfs_ceph: explicitly enable libcephfs POSIX ACL support

libcephfs disables ACL support by default and returns -EOPNOTSUPP in the
POSIX ACL get/setxattr paths as a result. Enable support by setting the
following Ceph config parameters during mount:
        client acl type = posix_acl
        fuse default permissions = false

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13896

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
58314d71 by David Disseldorp at 2019-04-12T19:40:25Z
docs/vfs_ceph: describe new ACL behaviour

vfs_ceph now explicitly enables libcephfs POSIX ACL support.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13896

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Apr 12 19:40:25 UTC 2019 on sn-devel-144

- - - - -
24bc99e6 by Stefan Metzmacher at 2019-04-12T19:41:25Z
.gitlab-ci.yml: remove before_script section of .private_template

It's already inherited from .shared_template.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
a6428d5f by Stefan Metzmacher at 2019-04-12T19:41:25Z
.gitlab-ci.yml: print out /etc/os-release

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
664cd722 by Stefan Metzmacher at 2019-04-12T19:41:25Z
.gitlab-ci.yml: print out /proc/swaps

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
98521ce5 by Stefan Metzmacher at 2019-04-12T20:42:27Z
.gitlab-ci.yml: show the system state also as after_script

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Fri Apr 12 20:42:27 UTC 2019 on sn-devel-144

- - - - -
b3d0c7e3 by Volker Lendecke at 2019-04-14T04:01:30Z
smbd: Small optimization for break_to_none

We don't need to memzero the struct when we can struct-initialize it a
bit later, implicitly initializing the rest to zero.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
6e485441 by Volker Lendecke at 2019-04-14T04:01:30Z
smbd: Introduce a helper variable in delay_for_oplock()

Why? I am preparing a patchset that will remove
"share_mode_lease". This patch is a micro-step towards that, removing
a set of references to this struct.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
3eed19de by Volker Lendecke at 2019-04-14T04:01:30Z
smbd: Introduce a helper variable in delay_for_oplock()

This removes a few explicit share_mode_lease dereferences

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
a69db298 by Volker Lendecke at 2019-04-14T04:01:30Z
smbd: Pass lease parameters explicitly to find_fsp_lease

This avoids a use of "struct share_mode_lease"

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
f46023ed by Volker Lendecke at 2019-04-14T04:01:30Z
leases_db: Add share_mode_lease info to leases.tdb

This is the data stored in share_mode_lease inside the leases[] array in
locking.tdb. This and all the following patches move all leases array to
looking at the leases.tdb.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
5f850a80 by Volker Lendecke at 2019-04-14T04:01:30Z
leases_db: Add getter/setter for share_mode_lease metadata

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
6cd59da1 by Volker Lendecke at 2019-04-14T04:01:30Z
smbd: Use leases_db_set()

Whenever we update the share_mode_lease struct, also update the leases.tdb
entry.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
10a60df1 by Volker Lendecke at 2019-04-14T04:01:30Z
smbd: Add lease key to share_mode_entry

Instead of indexing into the leases[] array, put the lease_db reference into
the share_mode_entry. For simplicity, put in the client guid as well. We
*might* be able to retrieve that from somewhere else, but as other smbd
processes have to look at the lease values, put in the full leases_db index
data.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
70fd809d by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use share_mode_entry's lease data in delay_for_oplock()

This was the last "share_mode_lease" reference in this function, remove
variable "l".

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
f33cb162 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use share_mode_entry's lease data in delay_rename_for_lease_break()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
909147e8 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use share_mode_entry's lease data in is_same_lease()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
1ae77361 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use share_mode_entry's lease data in remove_share_mode_lease()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
9ca5b611 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use share_mode_entry's lease data in remove_share_mode_lease()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
b9b35947 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use share_mode_entry's lease data in vfs_default_durable_reconnect()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
c2ca8217 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use share_mode_entry's lease data in lease_match()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
b2214873 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use leases_db in delay_for_oplock()

Remove a reference to share_mode_data->leases[]

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
b4b941f2 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use leases_db in get_lease_type()

Remove a reference to share_mode_data->leases[]

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
1269bfe4 by Volker Lendecke at 2019-04-14T04:01:31Z
smbd: Use leases_db in fsp_lease_update()

Remove a reference to "struct share_mode_lease"

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
c54d27b1 by Volker Lendecke at 2019-04-14T04:01:31Z
utils: Use leases_db in smbstatus

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
552faa91 by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Don't pass lease_idx down to set_share_mode()

Temporary patch to keep the code running. The new code in set_share_mode() will
leave again once the patchset to remove share_mode_lease and thus the lease_idx
in share_mode_entry goes away.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
2ea2605e by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Don't pass up lease_idx from grant_fsp_lease

The only reason for grant_fsp_lease to return the lease_idx was to pass it down
to set_share_mode. That does not need it anymore.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
fa2cea30 by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Add update_share_mode_lease_from_db()

This is an interim function supposed to be around for just a few patches as
long as we have both the leases.tdb entries and the leases[] in
share_mode_entries around. It makes it easier to transition to just use
leases.tdb while keeping the code running.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
7cc9b426 by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Split up grant_fsp_lease()

Simple refactoring into simpler routines. View best with "git show -b"

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
7fc76c47 by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Use leases_db in try_lease_upgrade()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
274f5d95 by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Use leases_db in downgrade_lease()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
8ff60fcc by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Use leases_db in vfs_default_durable_reconnect()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
29ce005f by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Use leases_db in process_oplock_break_message()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
b656ebf5 by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Make find_share_mode_lease() static

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
fbe6b3e9 by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Use leases_db in lease_match()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
302bdd7f by Volker Lendecke at 2019-04-14T04:01:32Z
smbd: Add share_mode_forall_leases()

Function to walk all leases for a file exactly once. This used to be simpler
with the leases[] array, thus this function that encapsulates the complexity.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
c12641e8 by Volker Lendecke at 2019-04-14T04:01:33Z
smbd: Use share_mode_forall_leases in rename_share_filename()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
310c85e7 by Volker Lendecke at 2019-04-14T04:01:33Z
smbd: Use share_mode_forall_leases in do_break_to_none()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
ad413ce9 by Volker Lendecke at 2019-04-14T04:01:33Z
smbd: Use share_mode_forall_leases in share_mode_cleanup_disconnected()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
a187b7ef by Volker Lendecke at 2019-04-14T05:18:14Z
smbd: Remove share_mode_lease and the leases array from share_mode_entry

This also removes the temporary functions introduced during the patchset.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Sun Apr 14 05:18:14 UTC 2019 on sn-devel-144

- - - - -
d9c47cb8 by Martin Schwenke at 2019-04-15T08:28:11Z
ctdb-daemon: Revert "We can not assume that just because we could complete a TCP handshake"

We also can not assume that nodes can be marked as connected via only
the keepalive mechanism.  Keepalives are not sent to disconnected
nodes so, in the absence of other packets (e.g. broadcasts), 2 nodes
may never become marked as connected to each other.

Revert to marking nodes as connected in the TCP transport code.  If a
connection is to a non(-operational) ctdbd then it will revert to
disconnected after a short while and may actually flap.  This should
be rare.

This reverts commit 66919db3d7ab1e091223faf515b183af8bfddc83.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 38dc6d11a26c2e9a2cae7927321f2216ceb1c5ec)

- - - - -
945a41d3 by Amitay Isaacs at 2019-04-15T12:55:46Z
ctdb-common: Avoid race between fd and signal events

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

In run_proc, there was an implicit assumption that when a process exits,
fd event (pipe between parent and child) would be processed first and
signal event (SIGCHLD for the child) would be processed later.

However, that is not the case.  SIGCHLD can be received asynchronously
any time even when the pipe data has not fully been read.  This causes
run_proc to miss some of the output from child process in tests.

When SIGCHLD is being processed, if the pipe between parent and child is
still open, then do an explict read from the pipe to ensure we read any
data still in the pipe before closing the pipe.

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Fri Apr 12 08:19:29 UTC 2019 on sn-devel-144

(cherry picked from commit 289201277cd983b27cdfd5376c607eab112b4082)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Mon Apr 15 12:55:46 UTC 2019 on sn-devel-144

- - - - -
e3c894fb by Günther Deschner at 2019-04-16T15:14:50Z
lib/replace: define NAME_MAX for platforms that don't have it

This allows the vfs_glusterfs_fuse build to complete on AIX.

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Tue Apr 16 15:14:50 UTC 2019 on sn-devel-144

- - - - -
67b16058 by Stefan Metzmacher at 2019-04-16T16:15:24Z
.gitlab-ci.yml: run samba-schemaupgrade on the private runner

The related jobs often fail with timeouts
because the shared runners (4GB RAM + 2GB SWAP)
will use ~450MB of the swapfile.

The private runners use 8GB RAM without any swap.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
b369faba by Stefan Metzmacher at 2019-04-16T16:15:24Z
.gitlab-ci.yml: remove outdated comments

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
45fee29d by Stefan Metzmacher at 2019-04-16T17:45:35Z
.gitlab-ci.yml: require samba-ci-private tag for our private runners

This makes it more clear that we need our own private runners.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue Apr 16 17:45:35 UTC 2019 on sn-devel-144

- - - - -
9c33b193 by Joe Guo at 2019-04-18T12:09:32Z
bootstrap/config.py: mv locale setup from bootstrap.sh

In future, samba developers could run `bootstrap.sh` to update
dependencies on their workstation, this is very useful when new people
get on board or new dependencies introduced.

But currenly it will override locale, which is not expected for this case.

Remove locale setup cmds from bootstrap.sh, add a separate script for this.

Although this script is written in a generic way and has no variable so far,
still follow the same routine as `bootstrap.sh` to keep consistent.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
50fde627 by Joe Guo at 2019-04-18T12:09:32Z
bootstrap/config.py: change UTF-8 to utf8 for locale name in Dockerfile ENV

While generating locales, glibc/localedef/locale-gen will normalize
`UTF-8` to `utf8`, use same name style to avoid string mismatch issues.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3e9af703 by Joe Guo at 2019-04-18T12:09:32Z
bootstrap/config.py: adjust package list to align current ci image

Adjust packages to make `dpkg -l` output align current ci image.
The ones not required are ignored, add a few missing python3 ones.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
dd1d04e8 by Joe Guo at 2019-04-18T12:09:32Z
bootstrap/config.py: add missing dev packages

Add a few extra dev packages missing in current ci image but should be included.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
932756e2 by Joe Guo at 2019-04-18T12:09:32Z
bootstrap/config.py: rm ENV for ccache since we didn't use it any more

When ccache is not installed, this will cause failure.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
077f8eaf by Joe Guo at 2019-04-18T12:09:33Z
bootstrap/config.py: add ARG in Dockerfile to allow add sha1sum into docker image

Add ARG SHA1SUM, then we can pass it to docker build with --build-arg

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
47c826ed by Joe Guo at 2019-04-18T12:09:33Z
bootstrap/config.py: link ld to ld.gold when available

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
154a7b7d by Stefan Metzmacher at 2019-04-18T12:09:33Z
bootstrap/config.py: add patch, rsync and tar

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
1ca1cc2b by Ralph Boehme at 2019-04-18T12:09:33Z
bootstrap/config.py: add glib2-dev

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
6009e47d by Ralph Boehme at 2019-04-18T12:09:33Z
bootstrap/config.py: add libicu-dev/libicu-devel

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f749f17f by Samuel Cabrero at 2019-04-18T12:09:33Z
bootstrap/config.py: Add gzip, which and hostname to base packages

The openSUSE Leap 15.0 container does not include gzip and which

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
aa29211b by Samuel Cabrero at 2019-04-18T12:09:33Z
bootstrap/config.py: Use generic lsb-release package name

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3b431486 by Samuel Cabrero at 2019-04-18T12:09:33Z
bootstrap/config.py: Fix lmdb-utils package name for RPM family

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
27b61082 by Samuel Cabrero at 2019-04-18T12:09:33Z
bootstrap/config.py: Create the 'samba' group in containers

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
31f5b751 by Samuel Cabrero at 2019-04-18T12:09:33Z
bootstrap/config.py: Add openSUSE Leap 15.0

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
0b2bbeb5 by Stefan Metzmacher at 2019-04-18T12:09:33Z
bootstrap/config.py: add a hind how to rebuild generated files

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
033eca2d by Stefan Metzmacher at 2019-04-18T12:09:33Z
bootstrap/config.py: generate rendered files into bootstrap/generated-dists/

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c15bbb0e by Joe Guo at 2019-04-18T12:09:33Z
bootstrap/template.py: render locale.sh for each dist and make shell scripts executable

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
da0567e0 by Stefan Metzmacher at 2019-04-18T12:09:34Z
bootstrap/template.py: generate Vagrantfile just once

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
37676409 by Joe Guo at 2019-04-18T12:09:34Z
bootstrap/template.py: add sha1sum support

1. calc sha1sum for files under bootstrap/ (except README.md
   and *.pyc files) after render and write to bootstrap/sha1sum.txt file.
2. add a new option to print sha1sum, so we can use it to compare in ci

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

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f1b1bba5 by Stefan Metzmacher at 2019-04-18T12:09:34Z
bootstrap: remove unused docker.py

We'll generate docker images during a gitlab-ci run.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2300a38d by Joe Guo at 2019-04-18T12:09:34Z
bootstrap/.gitlab-ci.yml: add ci file to trigger image auto build

Depending on 'SAMBA_CI_REBUILD_IMAGES=yes' (and
'SAMBA_CI_REBUILD_BROKEN_IMAGES=yes') as environment
variables on a custom gitlab ci pipeline we'll generate und upload
container images.

bootstrap/README.md will get more details in the next commits.

Please note ci in this file did NOT add the `latest` tag,
since we want main ci to always use a fixed image based on the sha1sum of
everything under bootstrap/ from now on.
This also implies the new built image will not replace/break anything.

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

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c36c1022 by Stefan Metzmacher at 2019-04-18T12:09:34Z
bootstrap: add the result of bootstrap/template.py --render

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
09cd5178 by Stefan Metzmacher at 2019-04-18T12:09:34Z
bootstrap/READMD.md: update the instructions to reflect the current code

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
82e0986b by Joe Guo at 2019-04-18T12:09:34Z
.gitlab-ci.yml: make use of bootstrap/.gitlab-ci.yml and use the new defined image

See bootstrap/README.md for the instructions to create and upload the
images via a custom gitlab ci pipeline.

The key is that it's always possible to regenerate the image if
it's not present in the container registry, where we are free to
delete old images. But it should be possible to rebuild images
if someone has the need to run a pipeline based on an old
branch.

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

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
ad2c23ee by Stefan Metzmacher at 2019-04-18T12:09:34Z
.gitlab-ci.yml: split AUTOBUILD_JOB_NAME from CI_JOB_NAME

This will make it easier extend the templates later.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
84f6fdce by Stefan Metzmacher at 2019-04-18T13:10:49Z
.gitlab-ci.yml: run the samba-o3 job on each working container image

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Thu Apr 18 13:10:49 UTC 2019 on sn-devel-144

- - - - -
d006c769 by Christof Schmitt at 2019-04-18T17:21:17Z
nsswitch: Add testcase for checking output of wbinfo --sid-to-name

The username should always be returned in the DOMAISHORTNAME/USERNAME
format.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
60b0e912 by Christof Schmitt at 2019-04-18T17:21:17Z
winbind: Query domain from msrpc name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
562551c0 by Christof Schmitt at 2019-04-18T17:21:17Z
winbind: Query domain from winbind rpc name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
32e3f066 by Christof Schmitt at 2019-04-18T17:21:18Z
winbind: Query domain from winbind sam_name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
640e0ef4 by Christof Schmitt at 2019-04-18T17:21:18Z
winbind: Return queried domain name from name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
aec9bda2 by Christof Schmitt at 2019-04-18T17:21:18Z
winbind: Use domain name from lsa query for sid_to_name cache entry

When winbindd is asked to map a name like realm.com\name to a SID ,that
is sucessfully resolved through the lsa lookup name call. The same call
also returns the short domain name (netbios name of the domain). Use
that short domain name for the sid_to_name cache entry, so that
subsequent sid_to_name queries return the expected netbiosname\name
result and not realm.com\name.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
f7082723 by Christof Schmitt at 2019-04-18T18:20:26Z
nsswitch: Fix usage information of test_wbinfo_name_lookup.sh

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Thu Apr 18 18:20:26 UTC 2019 on sn-devel-144

- - - - -
b9e1b4ad by Ralph Wuerthner at 2019-04-18T20:38:23Z
s3:debug: use struct initializer

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
a4567587 by Ralph Wuerthner at 2019-04-18T20:38:24Z
s3:debug: adjust indention

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
9b30fcda by Ralph Wuerthner at 2019-04-18T22:21:15Z
s3:debug: enable logging for early startup failures

Commit c89a33a07a 'debug: Use backends instead of explicitly logging to
syslog or file' introduced a regression where early startup failures (e.g.
unable to connect to CTDB) are no longer logged because the debug subsystem
is not yet fully initialized. Enable logging again with reasonable defaults
when reopen_logs() is called and the parameter file is not yet parsed.

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Thu Apr 18 22:21:15 UTC 2019 on sn-devel-144

- - - - -
14922438 by Günther Deschner at 2019-04-19T17:27:12Z
s4-torture: include torture/util.h in lease break handler

Signed-off-by: Günther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8274303f by Günther Deschner at 2019-04-19T17:27:12Z
s4-torture: add new smb2 multichannel suite skeleton.

Also Skip MC tests for s4 ntvfs fileserver, it's not supported at all.
Use knownfail for s3 fileserver for the time being (until socketwrapper
supports fd-passing).

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
7a73c569 by Günther Deschner at 2019-04-19T17:27:12Z
s4-torture: move oplock break handler out of the replay testsuite.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
aa28477b by Sachin Prabhu at 2019-04-19T17:27:12Z
s4-torture: move torture_wait_for_oplock_break() to central oplock handler.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e1a96b1a by Sachin Prabhu at 2019-04-19T17:27:12Z
s4-torture: Add function declarations to lease_break_handler.h

Do not completely depend on proto.h.

Also move torture_reset_break_info() to lease_break_handler.h so that
the layout is similar to that of oplock_break_handler.*

Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4e685895 by Sachin Prabhu at 2019-04-19T17:27:13Z
s4-torture: Add handlers to ignore incoming oplock/lease break requests

For use in multichannel oplock break tests. These handers ignore
incoming oplock and lease break requests so that we can test the
oplock/lease break retries on the server.

This is meant for use with samba servers which rely on receiving a reply
from the client before timeout.
Windows servers rely on underlying tcp commands to decide if the oplock
break command was delivered successfully to the client and therefore
cannot be tested with this method.

Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
f115b53c by Sachin Prabhu at 2019-04-19T17:27:13Z
s4-torture: Increase timeout for lease/oplock break handlers

0.1 seconds is not enough when running tests against a server over the
network and are causing timing related bugs. We increase this to 1
second.

Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
1739468c by Günther Deschner at 2019-04-19T17:27:13Z
s4-torture: add test for interface information retrieval for multichannel.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0d7d6070 by Günther Deschner at 2019-04-19T17:27:13Z
s4-torture: add torture_block/torture_unblock smb2 transport functions

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2a5b0d5b by Sachin Prabhu at 2019-04-19T17:27:13Z
s4-torture: Add #defines required by the new tests

New macros used by our tests.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
018845d4 by Sachin Prabhu at 2019-04-19T17:27:13Z
s4-torture: Add helper functions to create channels.

Helper functions used by both oplock and lease break tests.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3dc532cb by Sachin Prabhu at 2019-04-19T17:27:13Z
s4-torture: Add handlers to block channels for testing

We use two methods to block channels

1) Simply ignore incoming oplock break requests and do not respond to
them.
This method doesn't work against Microsoft Windows based servers which
rely on the tcp stack for confirmation that the oplock break command was
sent to the client machine. This is meant to be used with samba servers
and is the default method.

2) Use iptables to block the channel.
The method requires the use of a privileged account and can only be used
on Linux systems with iptables installed. To use this blocking method,
pass the option
--option=torture:use_iptables=true

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
31c9b74d by Sachin Prabhu at 2019-04-19T17:27:14Z
s4-torture: Add oplock break retry tests - test1

Test to confirm that server sends oplock breaks as expected.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ee0a247a by Sachin Prabhu at 2019-04-19T17:27:14Z
s4-torture: Add oplock break retry tests - test2

Test to see if oplock break retries are sent by the server.
Also checks to see if new channels can be created and used
after an oplock break retry.

The test by default blocks channels by ignoring incoming lease break
requests on that channel. This does not work when testing against a
windows server.
Use --option=torture:use_iptables=true to use iptables to block ports
instead when testing against windows servers.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
311c024b by Sachin Prabhu at 2019-04-19T17:27:14Z
s4-torture: Add lease break retry tests - test1

Test to check if lease breaks are sent by the server as expected.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
63b4b4ce by Sachin Prabhu at 2019-04-19T17:27:14Z
s4-torture: Add lease break retry tests - test2

Test to check if lease breaks are sent by the server as expected.

The test by default blocks channels by ignoring incoming lease break
requests on that channel. This does not work when testing against a
windows server.
Use --option=torture:use_iptables=true to use iptables to block ports
instead when testing against windows servers.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
befac485 by Sachin Prabhu at 2019-04-19T17:27:14Z
s4-torture: Add lease break retry tests - test3

Check to see how the server behaves if lease break response is sent
over a different channel to one over which the break is received.

The test by default blocks channels by ignoring incoming lease break
requests on that channel. This does not work when testing against a
windows server.
Use --option=torture:use_iptables=true to use iptables to block ports
instead when testing against windows servers.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
7a4dad60 by Sachin Prabhu at 2019-04-19T17:27:14Z
s4-torture: Add lease break retry tests - test4

Test to see how the server behaves when the client flushes data back to
the server but doesn't send the lease break response over the channel.
Does it then retry the lease break?

This test is specifically expected to run against Samba and will not
work against a MS Windows servers because it uses the ignore method to
ignore oplock breaks sent by the server.

Signed-off-by: Guenther Deschner <gd at samba.org>
Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ef35d4d8 by Sachin Prabhu at 2019-04-19T18:26:18Z
s4-torture: add test to check for max. number of channels per session.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Apr 19 18:26:18 UTC 2019 on sn-devel-144

- - - - -
0b203d94 by Christof Schmitt at 2019-04-22T23:00:41Z
vfs_gpfs: Remove usage of gpfs_prealloc

All supported versions of GPFS now support fallocate. Use the default
codepath instead of the API call. Keep the function stub as it will
be used for a check later.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
066ec8d6 by Christof Schmitt at 2019-04-22T23:00:41Z
vfs_gpfs: Remove gpfs:prealloc from manpage

The option is no longer in the code, remove it from the manpage as well.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a0bc1f9d by Christof Schmitt at 2019-04-22T23:00:42Z
gpfswrap: Remove unused gpfs_prealloc wrapper

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
1c3731cc by Christof Schmitt at 2019-04-23T00:33:03Z
vfs_gpfs: Block punchhole calls for non-sparse files

The core smbd code implements ZERO_DATA for non-sparse files by punching
a hole and filling it again with a fallocate(FL_KEEP_SIZE) call. As GPFS
does not provide the fallocate(FL_KEEP_SIZE) call and non-sparse files
should not contain holes, block the punchhole; effectively only allowing
ZERO_DATA/punchhole calls for sparse files.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Apr 23 00:33:03 UTC 2019 on sn-devel-144

- - - - -
c36d743f by Andrew Bartlett at 2019-04-23T01:06:21Z
selftest: Move simple-dc-steps.sh to correct folder

This script helps re-create the environment for the dbcheck-oldrelease.sh links test.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
e24e344d by Lutz Justen at 2019-04-23T02:08:56Z
waf: install: Remove installation of PIDL and manpages.

It's not used outside of Samba other than wireshark
who have their own vendor fork.

Signed-off-by: Lutz Justen <ljusten at google.com>
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Apr 23 02:08:56 UTC 2019 on sn-devel-144

- - - - -
1d7dee58 by Douglas Bagnall at 2019-04-23T18:00:13Z
pytest/segfault: segfault with nameless element

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
76967b33 by Douglas Bagnall at 2019-04-23T19:03:35Z
pyldb: avoid segfault when adding an element with no name

We don't want to see this:

python3 -c "import sys
sys.path.insert(0, 'bin/python')
import ldb
m = ldb.Message()
e = ldb.MessageElement('q')
try:
    m.add(e)
except ldb.LdbError:
    pass
print(m)
"
Segmentation fault (core dumped)

instead we want this:

Traceback (most recent call last):
File "<string>", line 7, in <module>
ValueError: The element has no name

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Tue Apr 23 19:03:35 UTC 2019 on sn-devel-144

- - - - -
1646baa3 by Stefan Metzmacher at 2019-04-24T01:01:57Z
.gitlab-ci.yml: use the ubuntu1804 image as default

This matches our move from sn-devel-144 to sn-devel-184
for the final autobuild.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Wed Apr 24 01:01:58 UTC 2019 on sn-devel-184

- - - - -
d7b5ad5e by Christof Schmitt at 2019-04-24T01:02:17Z
selftest: Add gid-to-sid lookup to idmap_ad test

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8266bd1f by Christof Schmitt at 2019-04-24T01:02:17Z
selftest: Use fl2008r2dc for ad_member_idmap_ad

fl2008r2dc already has a trusted domain. That will be used to use
idmap_ad for querying idmap attributes from the trusted domain.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
281fb81a by Christof Schmitt at 2019-04-24T01:02:17Z
selftest: Make trusted domain information available for idmap_ad environment

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
65e1d783 by Christof Schmitt at 2019-04-24T01:02:17Z
selftest: Add idmap configuration for trusted domain for idmap_ad

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ac0f8656 by Christof Schmitt at 2019-04-24T01:02:17Z
selftest: Pass trusted domain information to idmap_ad test

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2577f43a by Christof Schmitt at 2019-04-24T01:02:17Z
selftest: Add trusted domain tests for idmap_ad

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3020050b by Volker Lendecke at 2019-04-24T02:25:56Z
winbind: Fix overlapping id ranges

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Apr 24 02:25:56 UTC 2019 on sn-devel-184

- - - - -
7aa443a3 by Stefan Metzmacher at 2019-04-24T07:00:29Z
s3:smbd: handle IO_REPARSE_TAG_DFS in SMB_FIND_FILE_FULL_DIRECTORY_INFO

This completes commit 74829fecd7a4e806ee441cd75141bede2eefef1a,
which missed SMB_FIND_FILE_FULL_DIRECTORY_INFO

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 1d9348575914891dbb5638bc9b8d51eda98fe554)

- - - - -
8d6361b6 by Stefan Metzmacher at 2019-04-24T07:00:29Z
smb2_server: allow smbd_smb2_request_pending_queue(0) to avoid STATUS_PENDING

This has the same meaning as smb2_request_set_async_internal(),
but this will simplifies callers.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4760b85243f335bb2094fc779802ce4b52db0ccb)

- - - - -
dc06b1b3 by Stefan Metzmacher at 2019-04-24T07:00:29Z
smb2_sesssetup: avoid STATUS_PENDING responses for session setup

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12845
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13796

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 23792449694b5221f6ea422166c96fac494e3e2c)

- - - - -
6122f423 by Stefan Metzmacher at 2019-04-24T07:00:29Z
smb2_tcon: avoid STATUS_PENDING responses for tree connect

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 8a11da429bd3c89766f43c2bff681837a769987c)

- - - - -
d8d3e689 by Stefan Metzmacher at 2019-04-24T07:00:29Z
smb2_sesssetup: avoid STATUS_PENDING completely on session logoff

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit d64038425f250e253dce707d69899c7a5d8cb32e)

- - - - -
c8bdbc39 by Stefan Metzmacher at 2019-04-24T07:00:30Z
smb2_tcon: avoid STATUS_PENDING completely on tdis

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 1dc002548336b969979c3bf85b531c059d87f015)

- - - - -
dedeaf37 by David Disseldorp at 2019-04-24T07:00:30Z
vfs_snapper: drop unneeded fstat handler

fstat is handle based, and unlike vfs_shadow_copy2, we don't need to
make any changes to the returned sbuf, so remove the existing handler
which does nothing.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13858

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Mar 27 18:21:38 UTC 2019 on sn-devel-144

(cherry picked from commit c68d9c9ef367c1e85619ac2d027a0a425164ca8a)

- - - - -
a50c4d7a by Stefan Metzmacher at 2019-04-24T07:00:30Z
vfs_default: fix DEBUG messages in vfswrap_offload_write_*_done()

SMB_VFS_{PREAD,PWRITE}_RECV() don't set errno, so we need to
use strerror(aio_state.error) in the debug messages.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2abf9e9a95cbdf76109b3501dee3e0c34ad09194)

- - - - -
74001095 by Stefan Metzmacher at 2019-04-24T07:00:30Z
vfs_default: fix vfswrap_offload_write_send() NT_STATUS_INVALID_VIEW_SIZE check

This fixes a regression introduced in commit
60e45a2d25401eaf9a15a86d19114670ccfde259, where the 'num' variable
was renamed to 'to_copy', but a new 'num' variable was introduced.

Note that off_t is signed!
In future we need to watch out for filesystems supporting
FMODE_UNSIGNED_OFFSET on Linux. Which means they use it unsigned.

This is more or less a theoretical problem, The
NT_STATUS_INVALID_PARAMETER cases are catched before by
SMB_VFS_PREAD_SEND/RECV.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4d6cd932a955a99ca33cc4aedd7f612e56e0b1de)

- - - - -
7abc1442 by Stefan Metzmacher at 2019-04-24T07:00:30Z
smb2_server: grant all 8192 credits to clients

This seems to match Windows Server 2016.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 829f692fb1552e56c6a9726036a995b4328731dd)

- - - - -
c5089041 by David Disseldorp at 2019-04-24T07:00:30Z
vfs_ceph: explicitly enable libcephfs POSIX ACL support

libcephfs disables ACL support by default and returns -EOPNOTSUPP in the
POSIX ACL get/setxattr paths as a result. Enable support by setting the
following Ceph config parameters during mount:
        client acl type = posix_acl
        fuse default permissions = false

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13896

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4982e282f2f2246952854ccc10d4787ac6653a7f)

- - - - -
92f30f91 by Lutz Justen at 2019-04-24T07:32:31Z
waf: build: Respect --disable-python for third_party modules

Skips installation of samba/third_party stuff into the python directory if
--disable-python is set.

Added test after install that confirms no python modules installed.

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

Signed-off-by: Lutz Justen <ljusten at google.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Apr 24 07:32:31 UTC 2019 on sn-devel-184

- - - - -
571f7034 by David Disseldorp at 2019-04-24T11:05:08Z
docs/vfs_ceph: describe new ACL behaviour

vfs_ceph now explicitly enables libcephfs POSIX ACL support.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13896

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Apr 12 19:40:25 UTC 2019 on sn-devel-144

(cherry picked from commit 58314d71ea63e36d5f1bbd2c3e190b1edffee726)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Wed Apr 24 11:05:08 UTC 2019 on sn-devel-144

- - - - -
d5166089 by Ralph Boehme at 2019-04-24T18:32:14Z
bootstrap: move flex to common packages

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
adbb6e91 by Ralph Boehme at 2019-04-24T18:32:14Z
waf: fix array access out of bounds exception in the check for flex

If flex is not installed the following expection is triggered:

Checking for flex
Checking for program 'flex'                                                       : not found
Traceback (most recent call last):
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Scripting.py", line 158, in waf_entry_point
    run_commands()
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Scripting.py", line 251, in run_commands
    ctx = run_command(cmd_name)
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Scripting.py", line 235, in run_command
    ctx.execute()
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Configure.py", line 159, in execute
    super(ConfigurationContext, self).execute()
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Context.py", line 204, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Context.py", line 286, in recurse
    user_function(self)
  File "/home/slow/git/samba/scratch/wscript", line 307, in configure
    conf.RECURSE('source3')
  File "./buildtools/wafsamba/samba_utils.py", line 66, in fun
    return f(*k, **kw)
  File "./buildtools/wafsamba/samba_utils.py", line 481, in RECURSE
    return ctx.recurse(relpath)
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Context.py", line 286, in recurse
    user_function(self)
  File "/home/slow/git/samba/scratch/source3/wscript", line 1660, in configure
    flex.configure(conf)
  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Tools/flex.py", line 59, in configure
    if re.search (r"\\msys\\[0-9.]+\\bin\\flex.exe$", conf.env.FLEX[0]):
IndexError: list index out of range

This happens because when the detection of flex fails, an excpetion is
thrown in Configure.py:find_program by calling self.fatal(), but as
Configure.py:find_program() is called from
samba_waf18.py:find_program_samba() which sets the keyword argument
mandatory=False, Configure.py:conf:fun() catches the expection.

As a result in flex.py the call to conf.find_program('flex', var='FLEX')
does not abort and

  if re.search (r"\\msys\\[0-9.]+\\bin\\flex.exe$", conf.env.FLEX[0])

is executed even though conf.env.FLEX is None.

As this is a not a problem of upstream Samba, but triggered by our
samba_waf18.py:find_program_samba(), I don't pursue an upstream
fix. Instead, just use conf.find_program() directly instead of the
wrapper in flex.py.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
f79acc51 by Ralph Boehme at 2019-04-24T18:32:14Z
s3: build: seperate out check for Gnome Tracker from Spotlight

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
f52e4020 by Ralph Boehme at 2019-04-24T18:32:14Z
s3:wscript: fix flex and bison detection message when not installed

If flex or bison are not installed, conf.env['BISON'] and
conf.env['FLEX'] respectively return an empty string, so
conf.CHECK_COMMAND() runs

 $ /bin/sh -c " --version  | head -n1"

and

 $ /bin/sh -c " --version"

which results in the following message

  /bin/sh: []: command not found

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
2f87661c by Ralph Boehme at 2019-04-24T18:32:14Z
s3:wscript: fix flex and bison detection

conf.env['BISON'] and conf.env['FLEX'] return lists.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
fa39a7b2 by Ralph Boehme at 2019-04-24T18:32:14Z
s3/lib: new tevent_glib_glue subsystem

tevent_glib_glue_create() takes glib GMainContext and adds its event
sources to a tevent context. tevent will poll the sources and run
handlers for pending events as detailed in the glib documentation:

https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
1f836d4c by Ralph Boehme at 2019-04-24T18:32:14Z
s3/lib: add a tevent_glib_glue subsystem test

Tests adapted from glib2 glib/tests/mainloop.c.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
6592daf5 by Ralph Boehme at 2019-04-24T18:32:15Z
s3/lib: tevent-glib-glue test utiltity with Tracker

A small utilitly useful for tesing the tevent_glib_glue code. It runs a
tracker-sparql search query against your local tracker store that must
be setup and running.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
675902f8 by Ralph Boehme at 2019-04-24T18:32:15Z
s3-mdssvc: add tevent context arg to mds_init_ctx

This is needed later when adding tevent_glib_glue support, not used for now.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
bc053abd by Ralph Boehme at 2019-04-24T18:32:15Z
s3-mdssvc: call [un]become_authenticated_pipe_user()

This ensures we're running as the authenticated user int the tevent
callback which might be running in an arbitrary impersonation context.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
55b2cca1 by Ralph Boehme at 2019-04-24T18:32:15Z
s3-mdssvc: use tevent_glib_glue in mdssvc RPC service

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
984c890c by Ralph Boehme at 2019-04-24T18:32:15Z
s3-mdssvc: use default g_main context

Way back when the module was developed it seemed to be necessary the use
a private context with push/pop as thread default. Maybe there was a bug
in libtracker-sparql dispatching callback in the wrong (global)
context. It's not necessary anymore with a recent libtracker-sparql
version.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
91c9c034 by Ralph Boehme at 2019-04-24T18:32:15Z
s3-mdssvc: add missing call to g_cancellable_new()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
003b5d3e by Ralph Boehme at 2019-04-24T18:32:15Z
s3-mdssvc: make mds_ctx_destructor_cb static

This is only used in this compilation unit.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
613acd3d by Ralph Boehme at 2019-04-24T19:32:12Z
s3-mdssvc: add a comment to mds_init()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Apr 24 19:32:12 UTC 2019 on sn-devel-184

- - - - -
94f2ed3e by Christof Schmitt at 2019-04-25T00:54:16Z
wscript: Remove checks for shm_open and shmget

Commit 74a16a1094278 "s3:smbprofile: Replace sysv shmem with tdb"
removed the usage of the shared memory segment for profiling data. As
there are no other users of shared memory segments, remove the configure
check for these functions.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Apr 25 00:54:16 UTC 2019 on sn-devel-184

- - - - -
f1bf02c7 by Andreas Schneider at 2019-04-25T10:47:16Z
autobuild: Build also Samba AD with MIT Kerberos

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
bd5b4a16 by Andreas Schneider at 2019-04-25T10:47:16Z
s3:modules: Fix size types

error: assuming signed overflow does not occur when simplifying
conditional to constant [-Werror=strict-overflow]

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
fefb84b5 by Andreas Schneider at 2019-04-25T10:47:16Z
s4:heimdal: Disable format truncation warnings

We build that code and do not treat warnings as errors anyway,
so just disable format truncation.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
a6aff733 by Andreas Schneider at 2019-04-25T10:47:16Z
bootstrap: Fix dnf commands

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
8b2fbd79 by Andreas Schneider at 2019-04-25T10:47:16Z
bootstrap: Add missing packages on RPM distributions

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
ae21dc71 by Andreas Schneider at 2019-04-25T10:47:16Z
bootstrap: Add missing packages for XFS quota support

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
dfa4d3cd by Andreas Schneider at 2019-04-25T10:47:16Z
bootstrap: Add glusterfs and cephfs packages

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
b1426d06 by Andreas Schneider at 2019-04-25T11:46:23Z
gitlab-ci: Enable fedora29 and update generated dists

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Apr 25 11:46:23 UTC 2019 on sn-devel-184

- - - - -
b50ca162 by Andreas Schneider at 2019-04-25T16:52:57Z
gitlab-ci: Remove Ubuntu 14.04

Ubuntu 14.04 a compiler which complains about valid C99 code and also it
doesn't offer GnuTLS >= 3.2 which we require to move to GnuTLS.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Apr 25 16:52:57 UTC 2019 on sn-devel-184

- - - - -
8e3a042e by Anoop C S at 2019-04-26T12:04:20Z
s3/vfs_glusterfs: Dynamically determine NAME_MAX

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

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
e28d172b by Anoop C S at 2019-04-26T12:04:21Z
s3/vfs_glusterfs_fuse: Dynamically determine NAME_MAX

This allows the vfs_glusterfs_fuse build to complete on AIX.

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

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
633698c9 by Günther Deschner at 2019-04-26T13:03:05Z
Revert "lib/replace: define NAME_MAX for platforms that don't have it"

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

This reverts commit e3c894fb6b87df8aa56e29ef3b16ae1ef456a875.

Signed-off-by: Günther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Fri Apr 26 13:03:05 UTC 2019 on sn-devel-184

- - - - -
d24c9d5f by Ralph Boehme at 2019-04-29T16:04:28Z
s3:utils: use struct initializer in async-tracker long_options

s3:utils: use struct initializer in async-tracker long_options

The previous initializer list was missing a NULL as last element. Using struct
initializers instead for correct initialisation.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e0b9281c by Andreas Schneider at 2019-04-29T16:04:28Z
lib:audit_logging: Use C99 initializer for server_id in audit_logging

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
2a1c19b8 by Andreas Schneider at 2019-04-29T16:04:28Z
s3:lib: Use correct C99 initializer for 'struct flock' in messages_dgm

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
bbef2686 by Andreas Schneider at 2019-04-29T16:04:28Z
s4:dsdb: Use C99 initializer in dsdb util_trusts

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
99eb7203 by Andreas Schneider at 2019-04-29T16:04:28Z
s3:libsmb: Fix C99 initializer in cli_smb2_fnum.c

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
cf79ee15 by Andreas Schneider at 2019-04-29T16:04:28Z
wafsamba: Enable warnings for missing field initializer

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
40f91924 by Andreas Schneider at 2019-04-29T16:04:28Z
gitlab-ci: Install missing krb5-kdc package on Ubuntu/Debian

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
cbee3037 by Ralph Boehme at 2019-04-29T17:07:02Z
waf: only set mandatory to False if not already set by the caller

There are a bunch of callers that call find_program with mandatory=True,
we should not overwrite this when explicity passed, eg:

  ctx.find_program('objcopy', var='OBJCOPY', mandatory=True)

  conf.SAMBA_CHECK_PERL(mandatory=True)
    -> conf.find_program('perl', var='PERL', mandatory=mandatory)

With this patch we only change the default from False to True, but allow
callers to choose specific behaviour.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Apr 29 17:07:02 UTC 2019 on sn-devel-184

- - - - -
c12914c6 by Samuel Cabrero at 2019-04-29T18:10:09Z
selftests: Place credential cache file inside environment directory

Pair-Programmed-With: Andreas Schneider <asn at samba.org>
Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
937ad9d2 by Samuel Cabrero at 2019-04-29T18:10:09Z
credentials: Initialize krb5 client to retrieve creds from ccache

MIT kerberos require krb5_creds.client to be initialized to match
krb5_creds.server with the cached credentials.

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d88f1c82 by Samuel Cabrero at 2019-04-29T19:15:48Z
credentials: Workaround krb5_cc_remove_cred not implemented in MIT kerberos

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Apr 29 19:15:48 UTC 2019 on sn-devel-184

- - - - -
f6907809 by Anoop C S at 2019-04-30T11:29:27Z
s3/vfs_glusterfs_fuse: Dynamically determine NAME_MAX

This allows the vfs_glusterfs_fuse build to complete on AIX.

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

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit e28d172b00cadf492c22bd892e2dda3bf2fe2d70)

- - - - -
16462634 by Anoop C S at 2019-04-30T16:05:51Z
s3/vfs_glusterfs: Dynamically determine NAME_MAX

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

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 8e3a042eb9e502821b147f1bbb2d98d59f17a095)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Tue Apr 30 16:05:51 UTC 2019 on sn-devel-144

- - - - -
09962c1b by Christof Schmitt at 2019-04-30T17:34:21Z
wafsamba: Add compiler check for missing field initializer check

The commit cf79ee15

    wafsamba: Enable warnings for missing field initializer

enabled a compiler check for warnings about missing initializers for all
developer builds. This fails with older compilers, e.g. gcc on RHEL7.
Add a waf check around adding the compiler option to avoid the failure
with older compilers.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
9e29ddd4 by Andreas Schneider at 2019-04-30T17:34:21Z
bootstrap: Only install required packages on Fedora

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
e48a6c84 by Andreas Schneider at 2019-04-30T17:34:21Z
bootstrap: Only install required packages on openSUSE

This should reduce the amount of packages installed. And make building
the image much faster!

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
4dd8db32 by Andreas Schneider at 2019-04-30T18:48:18Z
gitlab-ci: Update for building new containers

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Apr 30 18:48:18 UTC 2019 on sn-devel-184

- - - - -
4f2af93a by Samuel Cabrero at 2019-04-30T23:18:26Z
.gitlab-ci.yml: Allow overriding the default image using a variable

This way one can run all tests in a different container without having
to modify the gitlab ci file, just setting the SAMBA_CI_CONTAINER_IMAGE
variable in the gitlab's GUI.

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
9d1d44dc by Andreas Schneider at 2019-04-30T23:18:26Z
replace: Add ZERO_ARRAY_LEN() macro

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8ad4c157 by Andreas Schneider at 2019-04-30T23:18:26Z
lib:util: Sync memory.h with replace.h

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
382d5908 by Andreas Schneider at 2019-04-30T23:18:26Z
waf: Add mandatory requirement for GnuTLS >= 3.2.0

We plan to move to GnuTLS for crypto in Samba, this is the first step to
make it mandatory and to require a version which is in LTS
distributions.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
daa128f8 by Andreas Schneider at 2019-04-30T23:18:26Z
s3:tls: Remove #ifdef for GnuTLS

This is a requirement now.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b63bf295 by Andreas Schneider at 2019-04-30T23:18:27Z
s4:rpc_server: Remove obsolete gcrypt init

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1fa3c9a3 by Andreas Schneider at 2019-04-30T23:18:27Z
waf: Remove configure steps from source4/lib/tls

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
324a2eec by Andreas Schneider at 2019-04-30T23:18:27Z
waf: Move gnutls_pkcs7_get_embedded_data_oid to main gnutls file

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e35a8598 by Andreas Schneider at 2019-04-30T23:18:27Z
waf: Add check for gnutls_x509_crt_set_subject_unique_id()

This is used by the GnuTLS backupkey implementation.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
155f697e by Andreas Schneider at 2019-04-30T23:18:27Z
waf: Move check for gnutls_aead_cipher_init to main gnutls wscript

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
712e464f by Andreas Schneider at 2019-04-30T23:18:27Z
waf: Remove unused GNUTLS defines

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9bbb9f7b by Andreas Schneider at 2019-04-30T23:18:27Z
s3:modules: Use GnuTLS SHA256 in vfs_acl_common

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6fb78373 by Andreas Schneider at 2019-04-30T23:18:27Z
s4:utils: Use gnutls SHA256 in oLschema2ldif

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
75d45f6d by Andreas Schneider at 2019-04-30T23:18:27Z
s4:libcli:smb2: Use GnuTLS SHA256 HMAC for signing

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8bed91c9 by Andreas Schneider at 2019-04-30T23:18:27Z
libcli:auth: Use GnuTLS SHA256 HMAC for credentials

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5d876109 by Andreas Schneider at 2019-04-30T23:18:27Z
libcli:auth: Add return code for netlogon_creds_init_hmac_sha256()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cda938cd by Andreas Schneider at 2019-04-30T23:18:27Z
libcli:smb: Use GnuTLS SHA256 HMAC in smb2_key_derivation()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
eca425ef by Andreas Schneider at 2019-04-30T23:18:27Z
libcli:smb: Use GnuTLS SHA256 HMAC in smb2_signing_sign_pdu()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
604c0b26 by Andreas Schneider at 2019-04-30T23:18:27Z
libcli:smb: Use GnuTLS SHA256 HMAC in smb2_signing_check_pdu()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
11e3552c by Andreas Schneider at 2019-04-30T23:18:28Z
libcli:smb: Introduce a structure for the smb2_singing_key

This also adds a new function to validate the structure.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
17e22e02 by Andreas Schneider at 2019-04-30T23:18:28Z
libcli:smb: Use 'struct smb2_signing_key' in smbXcli_base.c

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d02f7907 by Andreas Schneider at 2019-04-30T23:18:28Z
s3:librpc: Rename the data blobs for keys in smbXsrv.idl

The original names will be used with a new structure to cache mac and
cipher handles for gnutls later.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f7929c66 by Andreas Schneider at 2019-04-30T23:18:28Z
s3:librpc: Add smb2_signing_key to smbXsrv.idl

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9e16adff by Andreas Schneider at 2019-04-30T23:18:28Z
s3:smbd: Start to use the smb2_signing_key structure

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3f252816 by Andreas Schneider at 2019-04-30T23:18:28Z
libcli:smb: Add smb2_signing_key_destructor()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
dcf37228 by Andreas Schneider at 2019-04-30T23:18:28Z
libcli:smb: Use smb2_signing_key for smb2_signing_sign_pdu()

This caches the gnutls hmac handle in the struct so we only allocate it
once.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
015e4d2d by Andreas Schneider at 2019-04-30T23:18:28Z
libcli:smb: Use smb2_signing_key for smb2_signing_check_pdu()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c04571d4 by Andreas Schneider at 2019-04-30T23:18:28Z
auth:gensec: Use GnuTLS SHA256 HMAC for schannel

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
83d228b6 by Andreas Schneider at 2019-04-30T23:18:28Z
auth:gensec: Add return code for netsec_do_sign()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
826e3721 by Andreas Schneider at 2019-04-30T23:18:28Z
lib:crypto: Remove unused SHA256 and HMAC SHA256

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
641d74cb by Tim Beale at 2019-04-30T23:18:28Z
traffic_replay: Assign users to groups by default

The traffic_replay script has a myriad of options, but by default when
it creates user accounts it does not assign these users to any groups
(you have to specify extra options to do that). This isn't really a fair
test of samba performance, because it's unlikely that real world setups
will have users that are in no groups (other than the default ones).

This patch changes the default behaviour so that it will assign the new
users to groups automatically, if no other group options were
specified.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e387cf92 by Tim Beale at 2019-04-30T23:18:28Z
traffic_replay: Avoid Exception if no packet rate is specified

traffic_replay would throw an exception if you didn't specify some sort
of packet rate. We can avoid this by using --scale-traffic=1.0 as the
default if nothing else was specified.

 script/traffic_replay model.txt $SERVER.$REALM --duration=10
   --fixed-password=blahblah12# -U$USERNAME%$PASSWORD
INFO 2019-04-10 01:03:01,809 pid:47755 script/traffic_replay #280: Using
the specified model file to generate conversations
Traceback (most recent call last):
  File "script/traffic_replay", line 438, in <module>
    main()
  File "script/traffic_replay", line 293, in main
    opts.conversation_persistence)
  File "bin/python/samba/emulate/traffic.py", line 1295, in
generate_conversation_sequences
    target_packets = int(packet_rate * duration)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e98340e3 by Joe Guo at 2019-04-30T23:18:28Z
traffic: make code more pythonic

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
35e52ebd by Joe Guo at 2019-04-30T23:18:29Z
traffic: define kerberos_state to simplify code

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2ee72cc6 by Joe Guo at 2019-05-01T01:10:42Z
traffic: load dns query from file and write stats to file

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May  1 01:10:42 UTC 2019 on sn-devel-184

- - - - -
5ac626e7 by Christof Schmitt at 2019-05-01T03:12:07Z
smbd: Move deadtime default to parameter definition and man page

The code has a default of one week (10080 minutes) if the parameter is
set to 0. Make this the public default of the parameter, instead of
hiding it in the code. This change also has the code match the
documentation that setting this parameter to 0 disables the check.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8488651b by Douglas Bagnall at 2019-05-01T03:12:07Z
s4/replmd: delete checks flag before laborious search

Most (perhaps all) attributes that are in the "must not remove" list also
have the PRESERVEONDELETE bit set, and checking bits is much cheaper
than a linear search involving strcasecmp. If we check the bit first
we save work.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c5e387d2 by Douglas Bagnall at 2019-05-01T03:12:07Z
s4/replmd delete: optimise attribute preservation with binary search

When we get here it is very likely that the attribute will not be
preserved, as the preserved ones should have had the flag set, but we
still end up loking through the whole list to confirm. With a binary
search, we end up looking at ~5 attributes to confirm.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
62ba14a4 by Andreas Schneider at 2019-05-01T03:12:07Z
lib:torture: Fix size type in torture macro

Found by csbuild.
https://gitlab.com/samba-team/devel/samba/-/jobs/204481431

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2a5bf72b by Andreas Schneider at 2019-05-01T05:02:22Z
s4:samdb: Make sure value is initialized with 0

Found by csbuild.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May  1 05:02:22 UTC 2019 on sn-devel-184

- - - - -
0a5c5e2f by Joe Guo at 2019-05-01T05:32:25Z
.gitlab-ci.yml: keep samba-ci-private tag only for private jobs

This will help us give the legacy 'private' tag, used in branches
under maintenance, more resources without those jobs running on the
normal production runners (therefore avoiding the additional cost for
the 90% of builds that are for master).

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5a0df7ae by Douglas Bagnall at 2019-05-01T05:32:25Z
dsdb/pytest/ldap: revive commented out test for attr size range

The test was presumably commented out because we fail it, and
known-failing it would have hidden the attr-too-short tests that it
was bundled with. If we disentangle them we can knwn-fail it, which
serves as a TODO list.

(passes against WIN2012R2).

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
fd9859d4 by Douglas Bagnall at 2019-05-01T05:32:25Z
dsdb/pytest/ldap: use idiomatic 'e' for exceptions

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
865e464d by Douglas Bagnall at 2019-05-01T05:32:25Z
s4/tests.py: shorten lines with common path

A small step

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c73888ff by Douglas Bagnall at 2019-05-01T05:32:25Z
dsdb pytests: test the effect of reordering modify requests

Do we interpret these the same way as Windows? In many cases, no.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e5a09948 by Douglas Bagnall at 2019-05-01T05:32:25Z
pytests: try ldap.modify_order with normal user

We run the tests again, trying to modify as a normal user rather than
Administrator.

It turns out that we do not always return the same error code as
Windows, but in all these tests both Windows and Samba always return
some kind of error (as you might hope).

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a047e71b by Douglas Bagnall at 2019-05-01T05:32:25Z
pytests: slightly better errors in Testcase.insta_creds()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
60620273 by Douglas Bagnall at 2019-05-01T05:32:25Z
dsdb/modules: a module to count attribute searches and results

The dsdb module stack can turn a simple search request into a
complicated tree of sub-queries that include attributes not originally
asked for and excluding those that were. The corresponding replies
might contain unrequested attributes or (for good reasons, according
to some module) hide requested ones. The entire stack is there to
meddle and that is what is does. Except *this* module. It just counts.
To understand dsdb performance it helps to have some idea what
requests and replies are flying too and fro. This module, when
inserted anywhere in the stack, counts the requests and replies
passing through and the attributes they contain. This data is stored
in on-disk tdbs in the private/debug directory.

The module is not loaded by default. To load it you need to patch the
source4/dsdb/samdb/ldb_modules/samba_dsdb.c and put "count_attrs"
somewhere in the module lists in the samba_dsdb_init() function. For
example, to examine the traffic between repl_meta_data and
group_audit_log, you would do something like this around line 316:

          "subtree_delete",
          "repl_meta_data",
  +       "count_attrs",
          "group_audit_log",
          "encrypted_secrets",

and recompile. Samba will then write to a number of tdb files in the
debug directory as requests and replies pass through. A simple script
is included to read these files. Doing this:

./script/attr_count_read st/ad_dc/private/debug/debug/attr_counts_not_found.tdb

will print a table showing how often various attritbutes were
requested but not found (from the point of view of the module).

A more sophisticated version of the script is coming in the next
commit, but this one is included first because in its simplicity it
documents the storage format reasonably well. The tdb keys are
attribute names, and the values are uint32_t in machine native order.

When the module is included in the stack there will be a very small
decrease in performance.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b9fac394 by Karolin Seeger at 2019-05-01T05:46:13Z
WHATSNEW: Add release notes for Samba 4.9.7.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
c8e9b9fe by Karolin Seeger at 2019-05-01T05:46:13Z
VERSION: Disable GIT_SNAPSHOT for the 4.9.7 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
86de3470 by Karolin Seeger at 2019-05-01T05:46:48Z
VERSION: Bump version up to 4.9.8...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
bd53819b by Douglas Bagnall at 2019-05-01T06:46:36Z
script/attr_count_read: load and correlate all data

This changes script/attr_count_read to take the samba private directory
as an argument and load all the databases at once, printing them as
one big table. It isn't extremely clear what it all means, but it
*tries* to tell you.

With --plot, it will attempt to load matplotlib and plot the number of
requested attributes against the number returned, with colour
of each point indicating its relative frequency. It is a scatterplot
that wants to be a heatmap.

With --no-casefold, you can get an extra confusing table where,
for instance, something repeatedly asks for "attributeId" which is not
accounted for, while in a completely different row an unrequested
"attributeID" is found many times over.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May  1 06:46:36 UTC 2019 on sn-devel-184

- - - - -
b5c4fdbf by Stefan Metzmacher at 2019-05-01T17:22:25Z
s4:torture/smb2: add smb2.stream.names3 test

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2a69c091 by Stefan Metzmacher at 2019-05-01T17:22:26Z
smbd: allow case insensitive opens of named streams

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0c602319 by Stefan Metzmacher at 2019-05-01T17:22:26Z
s4:libcli/raw: add RAW_FILEINFO_NORMALIZED_NAME_INFORMATION support

This is supported over the wire in SMB 3.1.1 on starting with
Windows 10 1803.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8a5828de by Stefan Metzmacher at 2019-05-01T17:22:26Z
s4:torture/smb2: add smb2.getinfo.normalized test

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
b20fd15e by Stefan Metzmacher at 2019-05-01T18:33:00Z
smbd: implement SMB_FILE_NORMALIZED_NAME_INFORMATION handling

Windows 10 (1803 and higher) support and use
SMB_FILE_NORMALIZED_NAME_INFORMATION calls over the network. As a
fallback (in case the server don't support it) the client traverses all
path components, which is very expensive.

Implementing SMB_FILE_NORMALIZED_NAME_INFORMATION is very cheap for us
as the open already went through unix_convert() and we have the
information the client is asking for.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed May  1 18:33:00 UTC 2019 on sn-devel-184

- - - - -
966fc0dc by Robert Sander at 2019-05-02T19:34:11Z
s3: modules: ceph: use current working directory instead of share path

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

Signed-off-by: Robert Sander <r.sander at heinlein-support.de>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May  2 19:34:11 UTC 2019 on sn-devel-184

- - - - -
d397d567 by Volker Lendecke at 2019-05-03T22:34:16Z
smbd: Use smbd_check_access_rights in reply_setatr()

That was the only caller of check_access outside of trans2.c, and it
passed an explicit NULL for fsp. Use the lower-level call, so we can
make check_access() static to trans2.c

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

- - - - -
a34d6a78 by Volker Lendecke at 2019-05-03T22:34:16Z
smbd: Make "check_access()" static to trans2.c

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

- - - - -
ef289136 by Volker Lendecke at 2019-05-03T22:34:16Z
smbd: Use a struct initializer

With -O3 this saves 32 bytes of .text

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

- - - - -
7738a538 by Volker Lendecke at 2019-05-03T22:34:16Z
libcli: Remove an unnecessary #include

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

- - - - -
26a0f0aa by Volker Lendecke at 2019-05-03T22:34:16Z
libcli: Align integer types

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

- - - - -
abf5d7d7 by Volker Lendecke at 2019-05-03T23:45:55Z
smbd: Use "ISDOT" in reply_setatr

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri May  3 23:45:55 UTC 2019 on sn-devel-184

- - - - -
051af002 by Joe Guo at 2019-05-05T22:07:19Z
bootstrap: add lcov to generate code coverage report

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ee54661d by Joe Guo at 2019-05-05T22:07:19Z
.gitlab-ci.yml: rm abs path in artifacts

According to doc: https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html#defining-artifacts-in-gitlab-ciyml
all paths in artifacts must be relative to the cloned repo, so this line
actually never worked.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f9800450 by Joe Guo at 2019-05-05T23:22:54Z
.gitlab-ci.yml: add docker tag back for private jobs

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Sun May  5 23:22:54 UTC 2019 on sn-devel-184

- - - - -
ad3af7cd by Gary Lockyer at 2019-05-06T01:18:21Z
lib util debug: Increase format buffer to 4KiB

Increase the debug line buffer to 4KiB, the existing size of 1KiB is too
small for dsdbChange JSON audit messages.  These messages were then
split across multipe lines causing issues in log ingestion tools
expecting single line messages.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13902

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Mon May  6 01:18:22 UTC 2019 on sn-devel-184

- - - - -
64bccb9b by Aaron Haslett at 2019-05-06T04:23:51Z
ldap: test for empty attributes list

Test for LDAP request with an empty attribute list.  LDB responds with
no attributes, but LDAP responds with all attributes.  Fix is attached
to the bug below but we can't push it upstream until we've found all
instances of incorrect empty attribute list usage in Samba.

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

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bc1583d3 by Aaron Haslett at 2019-05-06T05:45:55Z
selftest: correcting empty attribute usage in requests

Many parts of Samba use an empty attribute list in requests expecting
all attributes to be returned in the response, which is incorrect.  This
patch corrects the instances found by current CI tests.  Static analysis
and debugging will need to be done before changing ildap to the correct
semantics.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>

Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Garming Sam <garming at samba.org>
Autobuild-Date(master): Mon May  6 05:45:55 UTC 2019 on sn-devel-184

- - - - -
16929089 by Andrew Bartlett at 2019-05-06T05:46:10Z
build: Remove build of replacetort

This is built close to the code it tests in lib/replace/wscript_build as
replace_testsuite.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
6cc68c1c by Andrew Bartlett at 2019-05-06T05:46:11Z
replace: Fix "make test" to actually test libreplace

Found by Joe Guo during preperation for automated code coverage output.

In order to allow the Makefile wrapper to work we need to rename the
test directory to tests.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
305617a1 by Andrew Bartlett at 2019-05-06T05:46:11Z
talloc: Follow pattern of ldb and tdb to ensure "make test" depends on a build

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
e9874a09 by Andrew Bartlett at 2019-05-06T05:46:11Z
pidl: No longer use Python3 compat define: PyInt_FromLong -> PyLong_FromLong

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
26d8d68c by Andrew Bartlett at 2019-05-06T05:46:11Z
pidl: Always call PyLong_FromLongLong() in ndr_PyLong_FromLongLong()

The C type is "long long" so use that always, as the Python type is now always the same.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
b0714c70 by Andrew Bartlett at 2019-05-06T05:46:11Z
pidl: Always call PyLong_FromUnsignedLongLong() in ndr_PyLong_FromUnsignedLongLong()

The C type is "unsigned long long" so use that always, as the Python type is now always the same.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
819ee849 by Andrew Bartlett at 2019-05-06T05:46:11Z
pidl: Call PyLong_FromLongLong() directly rather than via inline helper

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
4229c278 by Andrew Bartlett at 2019-05-06T05:46:11Z
pidl: Call PyLong_FromUnsignedLongLong directly rather than via inline helper

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
154370a2 by Andrew Bartlett at 2019-05-06T05:46:11Z
build: Remove ndr_PyLong_FromUnsignedLongLong wrapper from NT_STATUS and W_ERROR table generator

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
e995c9c1 by Andrew Bartlett at 2019-05-06T05:46:11Z
s4-winbindd: Removed unused wb_utils.c

Garming noticed this was untested code in the lcov report, and it turns out to be unused.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
eb15acdd by Andrew Bartlett at 2019-05-06T05:46:11Z
lib/tls: Remove unused source4/lib/tls/tls.c (tls socket wrapper)

The last caller was removed in 72c79e30f07bcc98610cca878f5de50e7db239a0
to remove the web server as all other callers use tls_tstream.

Found by callcatcher.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
65a24621 by Andrew Bartlett at 2019-05-06T05:46:11Z
torture: Remove unused torture_ldap_connection2()

The last caller was removed by 'r7626: a new ldap client library'
in 2005 with bab977dad76e9204278c7afe0bb905cda064f488.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
7ba65310 by Andrew Bartlett at 2019-05-06T05:46:11Z
torture: Remove unused torture_join_server_dn_str()

The last caller was removed in 2010 by
s4:torture Rework NET-API-BECOMEDC test to use libnet_vampire callbacks.
in ecf782da87b67b8d977aa1bbfce21f1b6ed8288a

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
e608a84f by Andrew Bartlett at 2019-05-06T05:46:11Z
torture: Remove unused dsdb_attribute_ldb_to_drsuapi()

The last caller was removed in s4-drs: GetNCChanges() to return correct (in AD-way) ATTIDs
(6a51afcfdbcbce7813fb59c0655e4178268ca70e) by Kamen Mazdrashki in 2010

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
7671eb2c by Andrew Bartlett at 2019-05-06T05:46:11Z
libnet: Remove unused source4/libnet/libnet_samsync_ldb.c

The last caller was removed in samba-tool: Remove C version of samba-tool
(e2af38415163f248e3dbd5a2abc156761e74b87c) by Amitay Isaacs in 2011

This was a prototype tool to sync a genine NT4 DC (never Samba) into ldb.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
71cc8983 by Andrew Bartlett at 2019-05-06T07:11:51Z
libnet: Remove unused source4/libnet/libnet_sam{dump,sync}:

The last caller was removed in samba-tool: Remove C version of samba-tool
(e2af38415163f248e3dbd5a2abc156761e74b87c) by Amitay Isaacs in 2011

This was a tool to dump a genine NT4 DC (never Samba) into smbpasswd file.

It did work against Windows AD, but DRS replication is much
more comprehensive.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Mon May  6 07:11:51 UTC 2019 on sn-devel-184

- - - - -
3e5a2749 by Noel Power at 2019-05-06T07:12:18Z
s4/scripting/bin Remove unecessary scripts

Apparently we get official schema from MS these days

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
63ae5e5f by Gary Lockyer at 2019-05-06T07:12:18Z
s4 heimdal_build: disable leak checks for asn1 compiler

Disable Address Sanitizer leak checking for the heimdal asn1 compiler, this
allows a samba build with Address Sanitizer enabled.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e129d4ea by Gary Lockyer at 2019-05-06T07:12:18Z
selftest: Utils.cmd_output returns byte string

Convert the returned byte string into a string.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
193b4446 by Gary Lockyer at 2019-05-06T08:55:22Z
nsswitch pam_winbind: Fix Asan use after free

Fix use after free condition detected by Address Sanitizer triggered by
wbcLogonUserInfoDestructor, wbcFreeMemory has code to detect and prevent a
double free.  This patch prevents the Address Sanitizer error, allowing
tests to be run with Address Sanitizer enabled.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13927

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon May  6 08:55:22 UTC 2019 on sn-devel-184

- - - - -
1b9cd2ac by Andreas Schneider at 2019-05-07T00:11:25Z
waf: Also check for gnutls_privkey_export_x509()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4607ed73 by Andreas Schneider at 2019-05-07T00:11:25Z
bootstrap: Fix yum commands

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
05791f40 by Andreas Schneider at 2019-05-07T00:11:25Z
bootstrap: Make sure that the python3 interpreter is installed

We need it for waf ;-)

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3c47066e by Andreas Schneider at 2019-05-07T00:11:25Z
bootstrap: Move to python 3.6 on CentOS

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
86d48369 by Andreas Schneider at 2019-05-07T00:11:25Z
bootstrap: Install correct python modules on CentOS7

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1d8c4c64 by Andreas Schneider at 2019-05-07T01:45:37Z
gitlab-ci: Enable building on CentOS7

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue May  7 01:45:37 UTC 2019 on sn-devel-184

- - - - -
d2a4088c by Andreas Schneider at 2019-05-07T03:04:28Z
libcli:smb: Use GnuTLS SHA512 in smbXcli_base

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b99c04fc by Andreas Schneider at 2019-05-07T03:04:30Z
s3:smbd: Use GnuTLS SHA512 in smb2 server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
812f5d60 by Andreas Schneider at 2019-05-07T03:04:30Z
s3:smbd: Use GnuTLS SHA512 in smb2 session setup

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
20099588 by Andreas Schneider at 2019-05-07T03:04:30Z
lib:crypto: Remove unused SHA512

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3d42e257 by Gary Lockyer at 2019-05-07T05:03:26Z
s4 dns_server Bind9: Log opertion durations

Add duration debug logging to the samba bind9 dlz driver and the
dnsserver_common routines.  This should aid future diagnosis of
performance issues, and could be used to monitor DNS performance.

The logs are currently Human readable text only, i.e. no JSON formatted
output.

Log lines are of the form:

<function>: DNS timing: result: [<result>] \
duration: (<duration>) zone: [<zone>] name: [<name>] \
data: [<data>]

e.g.

dns_common_wildcard_lookup: DNS timing: result: [WERR_OK] \
duration: (111) zone: [] \
name: [DC=_ldap._tcp.Default-First-Site-Name._sites.ForestDnsZones,\
DC=chgdcpassword.samba.example.com,CN=MicrosoftDNS,DC=DomainDnsZones,\
DC=chgdcpassword,DC=samba,DC=example,DC=com] data: []

Enabled by setting log level to "dns:10"

durations are in microseconds.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue May  7 05:03:26 UTC 2019 on sn-devel-184

- - - - -
87032cce by Martin Schwenke at 2019-05-07T05:45:34Z
ctdb-build: Add check for getrusage()

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
95477e69 by Martin Schwenke at 2019-05-07T05:45:34Z
ctdb-daemon: Log when ctdbd CPU utilisation exceeds a threshold

This is to help us notice when ctdbd is using the full capacity of a
CPU, so is saturated.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
f78d9388 by Martin Schwenke at 2019-05-07T05:45:34Z
ctdb-tools: Fix ctdb dumpmemory to avoid printing trailing NUL

Fix ctdb rddumpmemory too.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
8108b313 by Martin Schwenke at 2019-05-07T05:45:34Z
ctdb-tests: Extend test to cover ctdb rddumpmemory

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
b80967f5 by Martin Schwenke at 2019-05-07T05:45:34Z
ctdb-scripts: Drop script configuration variable CTDB_MONITOR_SWAP_USAGE

CTDB's system memory monitoring in 05.system.script monitors both main
memory and swap.  The swap monitoring was originally based on
the (possibly incorrect, see below) idea that swap space stacks on top
of main memory, so that when a system starts filling swap space then
this is supposed to be a good sign that the system is running out of
memory.  Additionally, performance on a Linux system tends to be
destroyed by the I/O associated with a lot of swapping to spinning
disks.

However, some platforms default to creating only 4GB of swap space
even when there is 128GB of main memory.  With such a small swap to
main memory ratio, memory pressure can force swap to be nearly full
even when a significant amount of main memory is still available and
the system is performing well.  This suggests that checking swap
utilisation might be less than useful in many circumstances.

So, remove the separate swap space checking and change the memory
check to cover the total of main memory and swap space.

Test function set_mem_usage() still takes an argument for each of main
memory and swap space utilisation.  For simplicity, the same number is
now passed twice to make the intended results comprehensible.  This
could be changed later.

A couple of tests are cleaned up to no longer use hard-coded
/proc/meminfo and ps output.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
7c3819d1 by Martin Schwenke at 2019-05-07T05:45:34Z
ctdb-tests: Change sanity_check_output() to internally use $out

All callers are currently passed $out.  Global variable $out is used
in many other places so use it here to simplify the interface and make
future changes simpler.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
9d02452a by Martin Schwenke at 2019-05-07T05:45:34Z
ctdb-tests: Make try_command_on_node less error-prone

This sometimes fails, apparently due to a cat process in onnode
getting EAGAIN.  The conclusion is that tests that process large
amounts of output should not depend on a sub-shell delivering that
output into a shell variable.

Change try_command_on_node() to leave all of the output in file
$outfile and just put the first 1KB into $out.  $outfile is removed
after each test completes.

Change the implementation of sanity_check_output() to use $outfile
instead of $out.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
066cc5b0 by Martin Schwenke at 2019-05-07T05:45:35Z
ctdb-tests: Avoid bulk output in $out, prefer $outfile

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
3cb53a7a by Martin Schwenke at 2019-05-07T05:45:35Z
ctdb-tests: Wait to allow database attach/detach to take effect

Sometimes the detach test fails:

  Check detaching single test database detach_test1.tdb
  BAD: database detach_test1.tdb is still attached
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.0/db/volatile/detach_test4.tdb.0
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.0/db/volatile/detach_test3.tdb.0
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.0/db/volatile/detach_test2.tdb.0
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.0/db/volatile/detach_test1.tdb.0
  Number of databases:3
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.1/db/volatile/detach_test4.tdb.1
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.1/db/volatile/detach_test3.tdb.1
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.1/db/volatile/detach_test2.tdb.1
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.2/db/volatile/detach_test4.tdb.2
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.2/db/volatile/detach_test3.tdb.2
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.2/db/volatile/detach_test2.tdb.2
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.2/db/volatile/detach_test1.tdb.2
  *** TEST COMPLETED (RC=1) AT 2019-04-27 03:35:40, CLEANING UP...

When issued from a client, the detach control re-broadcasts itself
asynchronously to all nodes and then returns success.  The controls to
some nodes to do the actual detach may still be in flight when success
is returned to the client.  Therefore, the test should wait for a few
seconds to allow the asynchronous controls to complete.

The same is true for the attach control, so workaround the problem in
the attach test too.

An alternative is to make the attach and detach controls synchronous
by avoiding the broadcast and waiting for the results of the
individual controls sent to the nodes.  However, a simple
implementation would involve adding new nested event loops.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
a2ab6485 by Martin Schwenke at 2019-05-07T05:45:35Z
ctdb-tests: Fix usage message

Since commit 0e9ead8f28fced3ebfa888786a1dc5bb59e734a3 daemons have
been shut down after each test, so this option no longer has anything
to do with killing daemons.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
5a9e3383 by Martin Schwenke at 2019-05-07T06:56:01Z
ctdb-tests: Don't clean up test var directory in autotest target

If the directory is always cleaned up then it is not possible to look
at daemon logs to debug test failures.

This target is only really used by autobuild.py, which (optionally)
cleans up the parent directory anyway.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Tue May  7 06:56:01 UTC 2019 on sn-devel-184

- - - - -
bc1b0ade by Karolin Seeger at 2019-05-07T10:22:10Z
VERSION: Bump version up to 4.9.8...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
(cherry picked from commit 86de3470b4c342857d1c8408929ef4637fdf1937)

- - - - -
52200468 by Isaac Boukris at 2019-05-07T10:22:28Z
CVE-2018-16860 selftest: Add test for S4U2Self with unkeyed checksum

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
de3fa5d6 by Isaac Boukris at 2019-05-07T10:22:28Z
CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ff8e3fba by Karolin Seeger at 2019-05-07T10:24:55Z
WHATSNEW: Add release notes for Samba 4.9.8.

CVE-2018-16860 (Samba AD DC S4U2Self/S4U2Proxy unkeyed checksum)

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
9dfd4419 by Karolin Seeger at 2019-05-07T10:27:29Z
VERSION: Disable GIT_SNAPSHOT for the 4.9.8 release.

CVE-2018-16860 (Samba AD DC S4U2Self/S4U2Proxy unkeyed checksum)

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
d16e9dfc by Andreas Schneider at 2019-05-07T17:31:23Z
ctdb: Fix format in db_hash_test

error: ‘%04d’ directive writing between 4 and 11 bytes into a region of
size 5 [-Werror=format-overflow=]
   sprintf(key, "key%04d", i);

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
e6f84048 by Andreas Schneider at 2019-05-07T17:31:23Z
wafsamba: Enable warnings about format overflows

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
bead4fdb by Andreas Schneider at 2019-05-07T18:45:04Z
wafsamba: Enable warnings about zero-length formats

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue May  7 18:45:06 UTC 2019 on sn-devel-184

- - - - -
a4973270 by Garming Sam at 2019-05-07T23:22:22Z
CID 1363287: Resource leak using str_list_append

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
93061fb8 by Garming Sam at 2019-05-08T00:36:14Z
CID 1363286: Resource leak by failing to free tmp_ctx

There are a few oddities in this function, including a duplicated NULL
check, a talloc_free of a context which is passed in and a number of
missing frees before a return.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Wed May  8 00:36:14 UTC 2019 on sn-devel-184

- - - - -
bd29f3fc by Andreas Schneider at 2019-05-08T16:33:24Z
s4:auth: Fix debug statement in gensec_gssapi

The 'role' is set to null, we should first set it to the correct value
before printing anything.

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
790d7e34 by Andreas Schneider at 2019-05-08T16:33:24Z
s3:rpc_server: Do not free the tdbname before we printed it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
6da032df by Andreas Schneider at 2019-05-08T16:33:24Z
s4:ntvfs: Do not free eadb before we printed an error

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
be72dfbc by Andreas Schneider at 2019-05-08T16:33:24Z
s4:torture: Do not print NULL strings we just checked before

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a8f773e3 by Andreas Schneider at 2019-05-08T16:33:24Z
lib:torture: Fix string comparison macros where we directly pass NULL

See e.g. lib/util/tests/strlist.c +177

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
46f036d3 by Andreas Schneider at 2019-05-08T16:33:24Z
s4:torture: Do not free full_name before we printed it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
830cb7e6 by Andreas Schneider at 2019-05-08T16:33:24Z
ctdb:common: Do not print NULL if we don't get a sockpath

sock_socket_start_recv() might not fill sockpath if we return early.

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e333425e by Andreas Schneider at 2019-05-08T16:33:24Z
s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3653dc70 by Andreas Schneider at 2019-05-08T16:33:24Z
s3:utils: If share is NULL in smbcquotas, don't print it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
2b957bde by Andreas Schneider at 2019-05-08T16:33:24Z
s3:utils: If share is NULL in smbcacls, don't print it

Found by GCC 9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
30abea88 by Volker Lendecke at 2019-05-08T16:33:25Z
dbwrap: Fix tdb_data_buf()

IIRC there are platforms that don't like memcpy() with len=0.

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

- - - - -
08a31c90 by Volker Lendecke at 2019-05-08T16:33:25Z
dbwrap: Adapt tdb_data_buf's overflow handling to modern conventions

This is the way we do it right now, avoid confusion why "tmp" might be
needed

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

- - - - -
8992cf4a by Volker Lendecke at 2019-05-08T16:33:25Z
g_lock: Apply some const

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

- - - - -
b93ae77a by Volker Lendecke at 2019-05-08T17:47:39Z
g_lock: Fix a typo

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed May  8 17:47:39 UTC 2019 on sn-devel-184

- - - - -
9a309f24 by Isaac Boukris at 2019-05-08T19:52:09Z
CVE-2018-16860 selftest: Add test for S4U2Self with unkeyed checksum

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8e695f93 by Isaac Boukris at 2019-05-08T19:52:09Z
CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0e2bf254 by Mathieu Parent at 2019-05-08T19:52:59Z
Add patches for CVE-2018-16860 S4U2Self with unkeyed checksum

- - - - -
964bd6a6 by Mathieu Parent at 2019-05-08T19:55:59Z
Release 2:4.9.5+dfsg-4

- - - - -
ae9fb933 by Gary Lockyer at 2019-05-08T20:03:42Z
s4 lib socket: Ensure address string owned by parent struct

The local address string was not owned by it's parent structure, which
caused a use after free error in
continue_ip_open_socket source4/librpc/rpc/dcerpc_sock.c:267

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May  8 20:03:42 UTC 2019 on sn-devel-184

- - - - -
04c0e521 by David Disseldorp at 2019-05-09T04:24:56Z
ctdb/build: fix ctdb_mutex_ceph_rados_helper builds

2b5dbb352553699afce62dca4964eb0bd64477f8 fixed builds with an explicit
--with-libcephfs but broke builds against system Ceph libraries. This
change handles both cases.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Thu May  9 04:24:56 UTC 2019 on sn-devel-184

- - - - -
fd4b1f4f by Andreas Schneider at 2019-05-09T16:46:05Z
s3:smbspool: Fix regression printing with Kerberos credentials

This is a regression which has been introduced with Samba 4.8.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu May  9 16:46:05 UTC 2019 on sn-devel-184

- - - - -
219bc189 by Ralph Boehme at 2019-05-09T20:43:53Z
s3:smbd: don't use recvfile on streams

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13938

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Thu May  9 20:43:53 UTC 2019 on sn-devel-184

- - - - -
ff2b0e24 by Douglas Bagnall at 2019-05-09T22:39:26Z
talloc torture: avoid NULL dereference

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
a9e6300a by Douglas Bagnall at 2019-05-09T22:39:27Z
rpc/dnsdata: do not crash if message attr missing (CID: 1414773)

This should be hard to trigger, but goto fail is always nicer than sig 11.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
74cd11df by Douglas Bagnall at 2019-05-09T22:39:27Z
rpc/dnsdata: avoid crash on missing attr (CID: 1414757)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
5389df9b by Douglas Bagnall at 2019-05-09T22:39:27Z
rpc/dns: leak less on memory failure (CID 1363191)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
51e4a1e4 by Douglas Bagnall at 2019-05-09T22:39:27Z
rpc/dns: reduce the CID count on temporary variables

CID 1363189 and others.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
01e2bdaf by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/rpc/dns: check for IP address errors at startup

The silent failure might leave an indeterminate or zero address.

CID: 1272838

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
95d7e939 by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/rpc/drsuapi/writespn: check the actual error code (CID 1034691)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
353d50a8 by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273065)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
b289cc19 by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273062)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
9fd3939a by Douglas Bagnall at 2019-05-09T22:39:27Z
tdbtool: avoid theoretical NULL dereference (CID 1361462)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
6c01ff46 by Douglas Bagnall at 2019-05-09T22:39:27Z
lib/texpect: avoid theoretical NULL dereference (CID 1273099)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
05863957 by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/auth/sam: silence CID 1435849

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
8ad8f9ba by Douglas Bagnall at 2019-05-09T22:39:27Z
dsdb/modules/acl: avoid deref of missing data (CID 1107200)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
2852dce5 by Douglas Bagnall at 2019-05-09T22:39:27Z
dsdb/modules/dirsync: avoid possible NULL dereference (CID 1034800)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
9a6c0a66 by Douglas Bagnall at 2019-05-09T22:39:27Z
dsdb/modules/dirsync: remove useless function call

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
23f72c4d by Douglas Bagnall at 2019-05-09T22:39:27Z
dsdb/modules/dirsync: ensure attrs exist (CID 1107212)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
b18f0dce by Douglas Bagnall at 2019-05-09T22:39:27Z
dsdb/modules/linked_attrs: remove pointless check (CID 240768)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
2bd79a0c by Douglas Bagnall at 2019-05-09T22:39:27Z
auth/creds/guess: avoid segfault with NULL lp (CID 241187)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
4954a96e by Douglas Bagnall at 2019-05-09T22:39:27Z
auth/creds/torture: add a test showing segfault

This file isn't actually run...

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
06068603 by Douglas Bagnall at 2019-05-09T22:39:27Z
pyrpc: ndr PY_CHECK_TYPE checks for NULL as well as type

Addresses CID 1361477 and others.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
eb873af9 by Douglas Bagnall at 2019-05-09T22:39:27Z
pyrpc: remove crutch for python <= 2.5

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
aa18f62a by Douglas Bagnall at 2019-05-09T22:39:27Z
ldb: avoid NULL deref in ldb_dn_from_ldb_val (CID 1034730)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
5dc86038 by Douglas Bagnall at 2019-05-09T22:39:27Z
ldb_ldif: avoid NULL dereference with unexpected arguments (CID 1107195)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
3de7f430 by Douglas Bagnall at 2019-05-09T22:39:27Z
ldb_map: check a return value (CID 241354)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
bfcfae72 by Douglas Bagnall at 2019-05-09T22:39:27Z
ldb_mdb: check fcntl return values (CID 1435851)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
47f2264c by Douglas Bagnall at 2019-05-09T22:39:27Z
ldb modules: paged_search checks control is not NULL (CID 241355)

It is unlikely to be NULL, since we're in the callback.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
c737b61c by Douglas Bagnall at 2019-05-09T22:39:27Z
librpc/ndr: make push_charset_to_null UTF-16 safe (CID 1399648)

The length is in test units, not bytes, and includes terminating
nulls. For 16-bit character sets, the terminating null must be two
bytes.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
e79c839a by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/dnsserver: handle broken zone values in sort (CID 1414763, 1414769)

We sort NULL values to the end of the list. What happens to the after
that is another question.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
cb9fe036 by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/dnsserver: delay return when trying to log (CID 1444976)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
215eef5b by Douglas Bagnall at 2019-05-09T22:39:27Z
s4/dsdb/util_samr: check some return codes (CID 1444977)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
79111dd0 by Douglas Bagnall at 2019-05-09T23:54:35Z
dsdb/mod/count_attrs: set ldb var before using it (CID 1444979)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Douglas Bagnall <dbagnall at samba.org>
Autobuild-Date(master): Thu May  9 23:54:35 UTC 2019 on sn-devel-184

- - - - -
667db8e8 by Jeremy Allison at 2019-05-10T01:14:02Z
s3: SMB1: Don't allow recvfile on stream fsp's.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri May 10 01:14:02 UTC 2019 on sn-devel-184

- - - - -
2f0c49e6 by Andreas Schneider at 2019-05-10T01:15:16Z
gitlab-ci: Install libtasn1-tools on Fedora based distributions

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
858e9eee by Michael Hanselmann at 2019-05-10T01:15:16Z
read_smb_length: Use correct function name in debug message

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a82f9241 by Douglas Bagnall at 2019-05-10T01:15:16Z
s4/ldap_bind: notice backend init failure

This should silence CID 1418508 and CID 1418512

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
597709aa by Douglas Bagnall at 2019-05-10T01:15:17Z
s4/messaging: do not deref NULL state (CID 1437973)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
79629b42 by Douglas Bagnall at 2019-05-10T01:15:17Z
s4/policy/gp_filesys: avoid SIZE_MAX smbcli write (CID 1034779)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c2e882b2 by Douglas Bagnall at 2019-05-10T01:15:17Z
ldb.h: improve comment for LDB_ATTR_FLAG_INDEXED

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
985a4b78 by Douglas Bagnall at 2019-05-10T01:15:17Z
ldb.h: spelling of 'means'

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
49048b24 by Douglas Bagnall at 2019-05-10T01:15:17Z
dsdb/util: spell "equivalence"!

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
18966b6e by Douglas Bagnall at 2019-05-10T01:15:17Z
kdb_kv_search: spell 'linearized'

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8f081b7f by Douglas Bagnall at 2019-05-10T01:15:17Z
ldb: use ldb_msg_new(), not talloc/talloc_zero

ldb_msg_new() is currently the same as talloc_zero(), but it might
not always be.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4624957d by Douglas Bagnall at 2019-05-10T01:15:17Z
s4: use ldb_msg_new(), not talloc/talloc_zero

ldb_msg_new() is currently the same as talloc_zero(), but it might
not always be.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1e61b171 by Douglas Bagnall at 2019-05-10T01:15:17Z
dsdb/mod/extended_dn_out: zero whole fake_msg struct

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
14db3072 by Douglas Bagnall at 2019-05-10T01:15:17Z
dsdb mods/extended_dn_out: remove element using ldb_msg api

The bare memmove is not strictly safe at the end of the list.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4e47d5df by Douglas Bagnall at 2019-05-10T01:15:18Z
dsdb/replmd: use ldb_msg_remove_element()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2a144ea7 by Douglas Bagnall at 2019-05-10T01:15:18Z
ldb_ldap: trust db_msg_new() to return empty message

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ce2bf5c7 by Douglas Bagnall at 2019-05-10T01:15:18Z
ldb_ldap: use ldb_msg API to add elements

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
85b6674a by Douglas Bagnall at 2019-05-10T01:15:18Z
ldb/tools/ldbtest: initialise msg object

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
652a4015 by Douglas Bagnall at 2019-05-10T01:15:18Z
ldb_kv: use ldb_msg_remove_element()

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
06a02cb8 by Douglas Bagnall at 2019-05-10T01:15:18Z
ldb_msg: remove_element() checks element array bounds

Previously we half-heartedly checked one end.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9c254572 by Douglas Bagnall at 2019-05-10T01:15:18Z
dsdb/mod/extended_dn_out: use faster removal filters

When filtering out multiple elements, we end up memmove()ing the same
elements many times over. It is simpler to not do that by keeping track
of how many elements we are keeping.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
93d63071 by Douglas Bagnall at 2019-05-10T01:15:18Z
dsdb mod/linked_attributes: fix_link_slow(): clarify a comment.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3d0f9491 by Douglas Bagnall at 2019-05-10T01:15:18Z
s4/lib/policy/gp_ldap: use ldb API to find messages

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
658128e2 by Noel Power at 2019-05-10T01:15:18Z
s3/registry: Fix func cast error (diff in params size_t vs uint32)

reg_parse_callback_key_t alread has size_t for number of elemens in key
but
reg_parse_callback_val_t uses uint32_t for length of value data.

Many internal function seem to take size_t as data len (see reg_format_value
etc.) It seems changing the signature of the callback aligns it more closely
with the existing api.

../../source3/registry/reg_format.c:438:10: error: cast between incompatible function types from ‘int (*)(reg_format *, const char *, uint32_t,  const uint8_t *, size_t)’ {aka ‘int (*)(struct reg_format *, const char *, unsigned int,  const unsigned char *, long unsigned int)’} to ‘int (*)(void *, const char *, uint32_t,  const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int,  const unsigned char *, unsigned int)’} [-Werror=cast-function-type]
   .val = (reg_parse_callback_val_t)&reg_format_value,

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
61dd7d6f by Noel Power at 2019-05-10T01:15:18Z
s3/registry: Fix incompatible func casts

[3425/3524] Compiling source3/registry/reg_parse.c
../../source3/registry/reg_parse.c: In function ‘reg_parse_new’:
../../source3/registry/reg_parse.c:223:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char **, size_t,  _Bool)’ {aka ‘int (*)(void *, const char **, long unsigned int,  _Bool)’} [-Werror=cast-function-type]
   cb.key = (reg_parse_callback_key_t)&nop;
            ^
../../source3/registry/reg_parse.c:226:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *, uint32_t,  const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int,  const unsigned char *, unsigned int)’} [-Werror=cast-function-type]
   cb.val = (reg_parse_callback_val_t)&nop;
            ^
../../source3/registry/reg_parse.c:229:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type]
   cb.val_del = (reg_parse_callback_val_del_t)&nop;
                ^
../../source3/registry/reg_parse.c:232:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type]
   cb.comment = (reg_parse_callback_comment_t)&nop;

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
09c4611b by Noel Power at 2019-05-10T01:15:19Z
s3/registry: fix various 'cast between incompatible function' warnings

[3395/3524] Compiling source3/registry/reg_import.c
../../source3/registry/reg_import.c: In function ‘reg_import_adapter’:
../../source3/registry/reg_import.c:237:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **)’} [-Werror=cast-function-type]
   cb.openkey = (reg_import_callback_openkey_t)&nop;
                ^
../../source3/registry/reg_import.c:240:17: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *)’ {aka ‘struct <anonymous> (*)(void *, void *)’} [-Werror=cast-function-type]
   cb.closekey = (reg_import_callback_closekey_t)&nop;
                 ^
../../source3/registry/reg_import.c:243:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **, _Bool *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **, _Bool *)’} [-Werror=cast-function-type]
   cb.createkey = (reg_import_callback_createkey_t)&nop;
                  ^
../../source3/registry/reg_import.c:246:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type]
   cb.deletekey = (reg_import_callback_deletekey_t)&nop;
                  ^
../../source3/registry/reg_import.c:249:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type]
   cb.deleteval = (reg_import_callback_deleteval_t)&nop;

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5733f678 by Noel Power at 2019-05-10T02:26:02Z
s3/rpcclient: Fix bad (and illegal) func cast

../../source3/rpcclient/cmd_samr.c: In function ‘cmd_samr_get_usrdom_pwinfo’:
../../librpc/ndr/libndr.h:219:76: error: cast between incompatible function types from ‘void (*)(struct ndr_print *, const char *, uint32_t)’ {aka ‘void (*)(struct ndr_print *, const char *, unsigned int)’} to ‘void (*)(struct ndr_print *, const char *, const void *)’ [-Werror=cast-function-type]
 #define NDR_PRINT_STRUCT_STRING(ctx, type, p) ndr_print_struct_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
                                                                            ^
../../source3/rpcclient/cmd_samr.c:2646:4: note: in expansion of macro ‘NDR_PRINT_STRUCT_STRING’
    NDR_PRINT_STRUCT_STRING(mem_ctx,

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri May 10 02:26:02 UTC 2019 on sn-devel-184

- - - - -
165025a5 by Joe Guo at 2019-05-10T08:19:16Z
samba_dnsupdate: flush dns update cache file after write

While running samba python tests with `coverage.py`, `make test` failed
to start ad_dc env since dns_update_cache stays empty.
Flush the file after write fix the issue.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
d65b7641 by Gary Lockyer at 2019-05-10T08:19:16Z
s4 librpc rpc pyrpc: Ensure tevent_context deleted last

Ensure that the tevent_context is deleted after the connection, to
prevent a use after free.

Note: Py_DECREF calls dcerpc_interface_dealloc so the
TALLOC_FREE(ret->mem_ctx) calls in the error paths of
py_dcerpc_interface_init_helper needed removal.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13932

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b7804852 by Joe Guo at 2019-05-10T08:19:16Z
selftest/target/Samba4.pm: increase max_wait from 60s to 120s to avoid timeout failure in samba-ad-dc-backup

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
21475e95 by Joe Guo at 2019-05-10T08:19:16Z
wscript: mv --enable-coverage option to global

We want to enable gcov for all tasks, move it to global wscript.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
af0e0c54 by Joe Guo at 2019-05-10T08:19:16Z
script/autobuild.py: rename sdir to test_source_dir

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9ea81c0e by Joe Guo at 2019-05-10T08:19:16Z
script/autobuild.py: mv find_git_root and gitroot to top

so the reset of the code can use gitroot directly.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
332f19c7 by Joe Guo at 2019-05-10T08:19:17Z
script/autobuild.py: mv optionparse to top

so the rest of the code can use the option values directly.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
87ea55e4 by Joe Guo at 2019-05-10T08:19:17Z
script/autobuild.py: add --enable-coverage option

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0cdd8bd6 by Joe Guo at 2019-05-10T08:19:17Z
script/autobuild.py: replace more placeholders in cmds for coverage

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c5ae200b by Joe Guo at 2019-05-10T08:19:17Z
script/autobuild.py: add ENABLE_COVERAGE placeholder in configure cmd option

The value will be "--enable-coverage" or "".

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1b48d8a9 by Joe Guo at 2019-05-10T08:19:17Z
script/autobuild.py: define LCOV_CMD and run it after each make test

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5b2a1a39 by Joe Guo at 2019-05-10T08:19:17Z
.gitlab-ci.yml: add var SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE

keep this var empty by default, since gcov will slow down the build process.
set to `--enable-coverage` to enable coverage on demand.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
be005e53 by Joe Guo at 2019-05-10T08:19:17Z
.gitlab-ci.yml: add pages job to generate coverage report and publish to gitlab pages

- add new stage "report"
- add pages job in "report" stage to collect .info files, generate html report and publish to gitlab pages.
- only trigger when SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == '--enable-coverage'

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
71595201 by Joe Guo at 2019-05-10T08:19:17Z
script/.gitlab-ci.yml: do not run o3 jobs if coverage enabled

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a5d1df4a by Gary Lockyer at 2019-05-10T10:02:20Z
s3 rpc_client: Fix Asan stack use after scope

Fixes Asan error:

==1924==ERROR: AddressSanitizer: stack-use-after-scope on address
    0x7ffe63f873d0 at pc 0x7fb99dae1733 bp 0x7ffe63f86a00 sp 0x7ffe63f861a8
READ of size 24 at 0x7ffe63f873d0 thread T0
    #0 0x7fb99dae1732  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79732)
    #1 0x7fb99cfe5549 in memcpy
        /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
    #2 0x7fb99cfe5549 in ndr_push_bytes
        ../../librpc/ndr/ndr_basic.c:729
    #3 0x7fb99cfe5646 in ndr_push_array_uint8
        ../../librpc/ndr/ndr_basic.c:754
    #4 0x7fb99a69dd1b in ndr_push_netr_ChallengeResponse
        librpc/gen_ndr/ndr_netlogon.c:462
    #5 0x7fb99a6c5fab in ndr_push_netr_NetworkInfo
        librpc/gen_ndr/ndr_netlogon.c:556
    #6 0x7fb99a6c749d in ndr_push_netr_LogonLevel
         librpc/gen_ndr/ndr_netlogon.c:783
    #7 0x7fb99a7222de in ndr_push_netr_LogonSamLogonEx
         librpc/gen_ndr/ndr_netlogon.c:16547
    #8 0x7fb99c982c97 in dcerpc_binding_handle_call_send
         ../../librpc/rpc/binding_handle.c:416

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13936

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri May 10 10:02:21 UTC 2019 on sn-devel-184

- - - - -
21dc6f8e by David Disseldorp at 2019-05-10T12:59:05Z
vfs_ceph: fix cephwrap_flistxattr() debug message

The @list buffer may be uninitialised prior to ceph_flistxattr()
invocation, so only log the address.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13940

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Fri May 10 12:59:05 UTC 2019 on sn-devel-184

- - - - -
8663e0a6 by Martin Schwenke at 2019-05-13T07:27:24Z
ctdb-daemon: Never use 0 as a client ID

ctdb_control_db_attach() and ctdb_control_db_detach() assume that any
control with client ID 0 comes from another daemon and treat it
specially.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
a0a82f1b by Amitay Isaacs at 2019-05-13T07:27:24Z
ctdb-tests: Add reqid wrapping test

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

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
a60e7715 by Martin Schwenke at 2019-05-13T07:27:24Z
ctdb-tests: Add dump-logs command for local daemons

Dump a single merged log to stdout.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
97ad353a by Martin Schwenke at 2019-05-13T07:27:24Z
ctdb-tests: Actually restart if cluster doesn't become healthy

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
c75fbeaa by Martin Schwenke at 2019-05-13T08:42:44Z
ctdb-tests: Remove old socket wrapper state directory during setup

Otherwise, when looping tests for a long time, nodes are unable to
connect to each other.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Mon May 13 08:42:44 UTC 2019 on sn-devel-184

- - - - -
b0cc6d21 by Gary Lockyer at 2019-05-14T06:07:25Z
s4 dsdb: fix use after free in samldb_rename_search_base_callback

Fix use after free detected by AddressSanitizer

AddressSanitizer: heap-use-after-free on address 0x60f0002b2738
                  at pc 0x7f89b1a213b5 bp 0x7ffce9528810 sp 0x7ffce9528800
                  READ of size 8 at 0x60f0002b2738 thread T0
    #0 0x7f89b1a213b4 in samldb_rename_search_base_callback
        ../../source4/dsdb/samdb/ldb_modules/samldb.c:4203
    #1 0x7f89d3a0db4a in ldb_module_send_entry
        ../../lib/ldb/common/ldb_modules.c:793
    #2 0x7f89b6f27356 in es_callback
        ../../source4/dsdb/samdb/ldb_modules/encrypted_secrets.c:1418

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13942

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d1c15c26 by Karolin Seeger at 2019-05-14T06:22:26Z
Merge tag 'samba-4.9.8' into v4-9-test

samba: tag release samba-4.9.8

- - - - -
a9f7f1f7 by Karolin Seeger at 2019-05-14T06:23:03Z
VERSION: Bump version up to 4.9.9.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
b1a32dd7 by Gary Lockyer at 2019-05-14T07:20:28Z
selftest: enable undefined behaviour sanitizer

Add a --undefined-sanitizer option to configure, this causes the tests
to be run with the undefined behaviout sanitizer enabled.

Errors can be suppressed by adding entries to selftest/ubsan.supp

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue May 14 07:20:28 UTC 2019 on sn-devel-184

- - - - -
cf00db40 by Martin Schwenke at 2019-05-14T07:25:37Z
ctdb-tests: Capture output in $out on failure as well

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
8be4ee1a by Martin Schwenke at 2019-05-14T07:25:37Z
ctdb-tests: Make ctdb reloadips tests more reliable

ctdb reloadips will fail if it can't disable takover runs.  The most
likely reason for this is that there is already a takeover run in
progress.  We can't predict when this will happen, so retry if this
occurs.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
dc89db8c by Martin Schwenke at 2019-05-14T07:25:37Z
ctdb-tests: Fix logic error in simple ctdb reloadips test

There is a chance that restoring IP addresses to the test node will
result in different IP addresses being assigned to that node.
Removing a single IP address may then fail (or be a no-op) if it is
done after the restore.

So, swap the single IP address removal to happen first, then restore,
then remove all IP addresses.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
6a2941e2 by Martin Schwenke at 2019-05-14T07:25:37Z
ctdb-recoverd: Fix memory leak

state is always freed before exiting this function, so allocate fde
off it instead of long-lived ctdb context.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
30bc6e25 by Martin Schwenke at 2019-05-14T07:25:37Z
ctdb-common: Fix memory leak

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
b1f4c86e by Amitay Isaacs at 2019-05-14T08:59:03Z
ctdb-common: Fix memory leak in run_proc

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

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Tue May 14 08:59:03 UTC 2019 on sn-devel-184

- - - - -
5639e973 by Isaac Boukris at 2019-05-14T10:23:33Z
CVE-2018-16860 selftest: Add test for S4U2Self with unkeyed checksum

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
43958af1 by Isaac Boukris at 2019-05-14T11:45:13Z
CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(master): Tue May 14 11:45:13 UTC 2019 on sn-devel-184

- - - - -
76d7d05b by David Disseldorp at 2019-05-14T22:17:32Z
vfs_ceph: drop fdopendir handler

libcephfs doesn't currently offer an fdopendir equivalent, so the
existing implementation peeks at fsp->fsp_name->base_name, which can
break if vfs_ceph is used under a separate path-munging VFS module.

Return ENOSYS instead and rely on existing OpenDir_fsp() fallback.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
76f3b194 by David Disseldorp at 2019-05-14T22:17:32Z
vfs: add ceph_snapshots module

vfs_ceph_snapshots is a module for accessing CephFS snapshots as
Previous Versions. The module is separate from vfs_ceph, so that it can
also be used atop a CephFS kernel backed share with vfs_default.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
9345d11c by David Disseldorp at 2019-05-14T23:31:26Z
docs: add vfs_ceph_snapshots manpage

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Tue May 14 23:31:27 UTC 2019 on sn-devel-184

- - - - -
28518c57 by Andreas Schneider at 2019-05-15T00:45:58Z
s3:libsmb: Add missing OOM check in fill_quota_buffer()

Found by covscan (csbuild).

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Noel Power <nopower at suse.com>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed May 15 00:45:58 UTC 2019 on sn-devel-184

- - - - -
94989e4e by Andrew Bartlett at 2019-05-15T04:03:36Z
ldb_kv: Remove incorrect reference to LDB_UNPACK_DATA_FLAG_NO_DN

The DN is now exploded so as to improve other aspects of the search handling.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
73bf2949 by Andrew Bartlett at 2019-05-15T04:03:36Z
ldb_kv: Use ldb_msg_add_steal_value() in msg_add_distinguished_name()

This more modern routine allocates a nice talloc tree.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
ea7fd52a by Aaron Haslett at 2019-05-15T04:03:36Z
ldb: removing alloc from unpack_data

Making unpack flag LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC required
behaviour, since allocating data during unpack is slow and unnecessary
in all current usages. In any future unpack usage, if editing of
returned memory is required, some function that duplicates the message
should be used, such as one of the filter_attrs functions, or msg_copy.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
a36e20c4 by Aaron Haslett at 2019-05-15T04:03:36Z
ldb: perf test for pack format

Performance test for pack function and unpack function run with flag
LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC. Run this test before and after
forthcoming pack format changes to test throughput improvement. On my
machine, the unpack improvement is around 50%.
The test doesn't really belong in LDB torture but it's the only place
where all the required functions are available.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
9f9bbb5a by Aaron Haslett at 2019-05-15T04:03:36Z
ldb: removing msg and dn copying from filter attrs

Optimising filter_attrs by removing msg and dn allocation/copying. The
caller can construct the msg and possibly steal the dn.
Also giving the function an ldb for future use.

NOTE: Configure with --abi-check-disable to build this commit. This
patch is part of a set of LDB ABI changes, and the version update is
done on the last commit.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
9310d908 by Andrew Bartlett at 2019-05-15T04:03:37Z
ldb: move ldb_kv's filter into pack code

This patch moves ldb_kv's filter code into the pack code to replace
'only attr list' functionality which will be removed in forthcoming
commit. Unpacking data then filtering the result is not any slower
than the removed 'only attr list' approach.
'only attr list' test repurposed to test unpack -> filter flow.

NOTE: Configure with --abi-check-disable to build this commit. This
patch is part of a set of LDB ABI changes, and the version update is
done on the last commit.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
15f0c496 by Aaron Haslett at 2019-05-15T04:03:37Z
ldb: remove unpack only attr list functionality

Unpack functions currently take an attribute list to restrict the set of
attributes to be returned in the constructed message. This
functionality is never used and complicates implementation of
forthcoming new pack format. This patch removes that functionality.
Using the unpack function then filtering the result turns
out not to be any slower.

NOTE: Configure with --abi-check-disable to build this commit. This
patch is part of a set of LDB ABI changes, and the version update is
done on the last commit.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
85b6f71c by Andrew Bartlett at 2019-05-15T04:03:37Z
ldb: Release ldb 2.0.1

* Rework pack routines to remove unused features:
  - ldb_unpack_data_only_attr_list_flags() is removed
  - LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC is now always implied

  This improves the unpack performace significantly.

* Improve search performance via new internal flag
  LDB_UNPACK_DATA_FLAG_READ_LOCKED which removes a memdup

* Improve search performance during full scan by ignoring
  index records early.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
d1447aa8 by Fabrice Fontaine at 2019-05-15T04:03:37Z
test_regfio.c: include stdint.h before cmoka.h

This fix the following build failure on mips64el:
/usr/lfs/v0/rc-buildroot-test/scripts/instance-2/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/stdint.h:122:27: error: conflicting types for 'uintptr_t'
 typedef unsigned long int uintptr_t;
                           ^
In file included from ../source3/registry/tests/test_regfio.c:23:0:
../third_party/cmocka/cmocka.h:126:28: note: previous declaration of 'uintptr_t' was here
       typedef unsigned int uintptr_t;

Fixes:
 - http://autobuild.buildroot.org/results/bae0508e84c905dc23ad7cf1153cd1e9d8e4d734

Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
09355b78 by Douglas Bagnall at 2019-05-15T04:03:37Z
util/charset/convert_string: always set length

In failure cases the destination string pointer is set to NULL, but
the size is not changed. Some callers have not been checking the
return value and passing the destination pointer and uninitialised
length onto other functions. We can curse and blame those callers, but
let's also keep them safe.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
265b3b0c by Douglas Bagnall at 2019-05-15T04:03:37Z
util/charset/convert: do not overflow dest len

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
02507ebf by Douglas Bagnall at 2019-05-15T04:03:37Z
util/charset/convert: do not overflow dest len in corner case

Now, if destlen were SIZE_MAX - 1, destlen * 2 would wrap to SIZE_MAX - 3,
which makes (destlen * 2 + 2) == SIZE_MAX - 1, the same number again.
So we need the <= comparison in this case.

As things stand, it is not actually possible for destlen to be
SIZE_MAX (because it is always an even number after the first round,
and the first round is constrained to be < SIZE_MAX / 2, but *if*
destlen was SIZE_MAX, destlen * 2 + 2 would be 0, so that case is OK.
Similarly the SIZE_MAX - 2 and smaller cases were covered by the
original formula.

We add the comment for people who are wondering WTF is going on with
all this destlen manipulation.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a6f47b4f by Douglas Bagnall at 2019-05-15T04:03:37Z
util/charset/convert: when retrying, retry from the start

iconv() advances the inbuf pointer; if we decide to realloc and re-iconv,
we need to reset inbuf to the source string

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
103d248b by Douglas Bagnall at 2019-05-15T04:03:37Z
util/charset/convert: do not pretend to realloc

It seems very likely that our clever attempts to dynamically realloc
the output buffer were never triggered. Two lines of reasoning lead to
this conclusion:

1. We allocate 3 * srclen to start with, but no conversion we use will
   more than that. To be precise, from 8-bit charsets we will only deal
   with codepoints in the Unicode basic multilingual plane (up to 0xFFFF).

   These can all be expressed as 3 or fewer utf-8 bytes. In UTF16 they
   are naturally 2 bytes, while in the DOS codes they are 1 byte.

   We have checked the code tables, and can not find a plausible
   (e.g. not EBCDIC) DOS code page or unix charset that is outside
   this range.  Clients cannot chose the code page, the only code
   pages we will use come from 'unix charset' and 'dos charset'
   smb.conf parameters.

   Therefore the worst that can possibly happen is we expand 1 byte into 3
   (specifically, when converting some e.g. CP850 codepoints to UTF-8).

2. If the reallocation was ever used, the results would have been
   catastrophically wrong, as the input pointer was not reset.

Therefore we skip the complication of the goto loop and let E2BIG be
just another impossible error to report.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ac9333cb by Douglas Bagnall at 2019-05-15T04:03:37Z
util/charset/torture: ensure each cp850 high bytes is 3 utf8 bytes

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5841b164 by Garming Sam at 2019-05-15T04:03:37Z
ldap: Add a database open after fork to speed-up prefork binds

Removing this (system) database open from the later auth stack results
in a 15-30% improvement in different types of binds and on different
hardware (presumably better with slower disk speeds).

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4aa99243 by Andrew Bartlett at 2019-05-15T04:03:37Z
s4 dsdb/repl_meta_data: allocate new extended DNs during ADD on a better context

Lower down in this function new_values is assigned over el->values and is
filled in with the values of all the parsed DNs.  Therefore it is the natural
talloc parent.

This will allow el->values to be allocated on tmp_ctx in the next commit for
a working area during the function call.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0daa0ff9 by Gary Lockyer at 2019-05-15T05:35:47Z
s4 dsdb/repl_meta_data: fix use after free in dsdb_audit_add_ldb_value

Fix use after free detected by AddressSanitizer

AddressSanitizer: heap-use-after-free on address 0x61400026a4a0
                  at pc 0x7fd555c52f12 bp 0x7ffed7231180 sp 0x7ffed7231170
                  READ of size 1 at 0x61400026a4a0 thread T0
    #0 0x7fd555c52f11 in ldb_should_b64_encode
       ../../lib/ldb/common/ldb_ldif.c:197
    #1 0x7fd539dc9417 in dsdb_audit_add_ldb_value
       ../../source4/dsdb/samdb/ldb_modules/audit_util.c:491
    #2 0x7fd539dc9417 in dsdb_audit_attributes_json
       ../../source4/dsdb/samdb/ldb_modules/audit_util.c:651
    #3 0x7fd539dc6a7e in operation_json
       ../../source4/dsdb/samdb/ldb_modules/audit_log.c:305

The problem is that at the successful end of these functions
el->values is overwritten with new_values.  However get_parsed_dns()
points p->v at the supplied el and it effectively gets used
as a working area by replmd_build_la_val().  So we must duplicate it
because our caller only called ldb_msg_copy_shallow().

The reason this matters is that the audit_log module is
above repl_meta_data in the stack, and tries to log the
ldb_message it saw after the reply (to include the error code).
If that ldb_message is changed it is not only misleading,
it can point to memory that has since gone away.

In this case the memory for the full extended DN in the
member attribute ended up on 'ac', a context lost by
the time repl_meta_data has finished processing.

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May 15 05:35:47 UTC 2019 on sn-devel-184

- - - - -
d012a7e8 by Christof Schmitt at 2019-05-15T11:20:28Z
nsswitch: Add testcase for checking output of wbinfo --sid-to-name

The username should always be returned in the DOMAISHORTNAME/USERNAME
format.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit d006c769a9cad275339b18b08e13d48acb29d7fc)

- - - - -
cc3ca17a by Christof Schmitt at 2019-05-15T11:20:28Z
winbind: Query domain from msrpc name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 60b0e91237179b8782c4bd83b9579f51d5af2928)

- - - - -
ef63526b by Christof Schmitt at 2019-05-15T11:20:28Z
winbind: Query domain from winbind rpc name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 562551c0886bdef1f97059e16d375c2e97452b45)

- - - - -
b5c442b7 by Christof Schmitt at 2019-05-15T11:20:28Z
winbind: Query domain from winbind sam_name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 32e3f0663be39cf4a81639c818fc88e959791673)

- - - - -
b3876c30 by Christof Schmitt at 2019-05-15T11:20:28Z
winbind: Return queried domain name from name_to_sid

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 640e0ef4fd338ddf03b813a8d45cce67c7ec7a01)

- - - - -
03a91bf0 by Christof Schmitt at 2019-05-15T14:18:45Z
winbind: Use domain name from lsa query for sid_to_name cache entry

When winbindd is asked to map a name like realm.com\name to a SID ,that
is sucessfully resolved through the lsa lookup name call. The same call
also returns the short domain name (netbios name of the domain). Use
that short domain name for the sid_to_name cache entry, so that
subsequent sid_to_name queries return the expected netbiosname\name
result and not realm.com\name.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit aec9bda25f10ca2710d91fb680cca7904e92f9de)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Wed May 15 14:18:45 UTC 2019 on sn-devel-144

- - - - -
226544f6 by Jeremy Allison at 2019-05-15T21:26:12Z
s3: net: Harden guess_charset() against overflow errors.

Found by Michael Hanselmann using fuzzing tools

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b3bfad39 by Jeremy Allison at 2019-05-15T21:26:12Z
s3: net: Harden act_val_hex() act_val_sz() against errors.

Found by Michael Hanselmann using fuzzing tools

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
70025b4a by Jeremy Allison at 2019-05-15T21:26:12Z
s3: net: Harden srprs_str() against memcmp overread.

Found by Michael Hanselmann using fuzzing tools

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
11c35c8f by Jeremy Allison at 2019-05-15T21:26:12Z
s3: net: Rewrite of reg_parse_fd() to harden against buffer overwrites.

Remove unused handle_iconv_errno(). Fix leaks of iconv handles.

Found by Michael Hanselmann using fuzzing tools

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f0ea0800 by Jeremy Allison at 2019-05-15T23:08:58Z
s3: net: Test of fuzzer problems with net rpc registry import.

Found by Michael Hanselmann using fuzzing tools

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May 15 23:08:58 UTC 2019 on sn-devel-184

- - - - -
93131652 by Gary Lockyer at 2019-05-16T06:46:18Z
samba_autoconf: fix undefined behaviour sanitizer compile flags

Added the -g option, -fsaniize=null and -fsanitize=alignment, removed
the -fno-omit-frame-pointer option.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
076402cb by Volker Lendecke at 2019-05-16T06:46:18Z
smbd: Use a direct struct assignment in reply_setatr()

Saves .text bytes with -O3

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
546394a9 by Volker Lendecke at 2019-05-16T06:46:18Z
smbd: Fix a typo

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
82a40271 by Volker Lendecke at 2019-05-16T07:59:52Z
smbd: Slightly simplify delay_for_oplock()

We don't have to look at the leases.tdb record if it's our own lease.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu May 16 07:59:52 UTC 2019 on sn-devel-184

- - - - -
d6b1c33d by Noel Power at 2019-05-16T17:55:16Z
python: Create macro to hide ugly function signature cast

-Wcast-function-type triggers various warnings related to bad api
decisions in python source. To avoid these warnings we hide them
by casting to void first. Macro here is to hide the uglyness and
provide an easy place to either/or
  + fix better in a single place in the future
  + identify the places involved should python api change in a way
    this can be handled better

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3326bba4 by Noel Power at 2019-05-16T17:55:16Z
pidl: Call PY_DISCARD_FUNC_SIG in generated code to avoid ugly warning

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
8c8fe323 by Noel Power at 2019-05-16T17:55:17Z
s3/smbd: squash 'cast between incompatible function types' warning

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
0830485d by Noel Power at 2019-05-16T17:55:17Z
s3/ntvfs: squash 'cast between incompatible function types' warning

Fix various PyCFunction definitions to avoid
'cast between incompatible function types' warnings when compiled
with -Wcast-function-type

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
cc608669 by Noel Power at 2019-05-16T17:55:17Z
s4/librpc: squash 'cast between incompatible function types' warning

Where possible make PyCFunction definition signature match. Sometimes
this is not possible (e.g. when the c-function is associated with a
python method definition with 'METH_VARARGS|METH_KEYWORDS' in this
case we use the PY_DISCARD_FUNC_SIG macro.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
cea41645 by Noel Power at 2019-05-16T17:55:17Z
s3: squash 'cast between incompatible function types' warning

Some functions (e.g. py_smb_savefile) have an extra unecessary
*kwargs param in their signatures, these definitions are
causing 'cast between incompatible function types' warnings when
compiled with -Wcast-function-type. Some other functions have
the *kwargs which causes "cast between incompatible function types'
warnings which need to be squashed with use of the
PY_DISCARD_FUNC_SIG macro.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
a7d75a1c by Noel Power at 2019-05-16T17:55:17Z
s4: squash 'cast between incompatible function types' warning

To avoid warning above produced by using
 -Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg
  + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG
    macro
  + ensure PyCFunctions of type METH_KEYWORDS really actually use the
    problematic kargs param, if not remove it

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
cbdd3d0c by Noel Power at 2019-05-16T17:55:17Z
squash 'cast between incompatible function types' warning

To avoid warning above produced by using
-Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg
  + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG
    macro

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
5720f20a by Noel Power at 2019-05-16T17:55:17Z
lib/tdb: squash 'cast between incompatible function types' warning

squash 'cast between incompatible function types' warning

To avoid warning above produced by using
-Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg
  + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG
    macro

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
d93ec544 by Noel Power at 2019-05-16T17:55:17Z
lib/tevent: squash 'cast between incompatible function types' warning

squash 'cast between incompatible function types' warning

To avoid warning above produced by using
-Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg
  + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG
    macro

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
995e23f1 by Noel Power at 2019-05-16T17:55:17Z
lib/talloc: squash 'cast between incompatible function types' warning

To avoid warning above produced by using
-Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
51f146de by Noel Power at 2019-05-16T17:55:17Z
lib/ldb: squash 'cast between incompatible function types' warning

To avoid warning above produced by using
-Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg
  + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG
    macro

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
27d99eef by Noel Power at 2019-05-16T17:55:17Z
lib/ldb: Fix incorrect return type for (setter) func type

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

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
70a14064 by Noel Power at 2019-05-16T17:55:17Z
lib/ldb-samba: squash 'cast between incompatible function types' warning

To avoid warning above produced by using
-Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
16cf1d1a by Noel Power at 2019-05-16T17:55:17Z
lib/crypto: squash 'cast between incompatible function types' warning

To avoid warning above produced by using
-Wcast-function-type we;

      + ensure PyCFunctions of type METH_VARARGS do not declare
        unused and problematic kargs param.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
0fa490e8 by Shyamsunder Rathi at 2019-05-16T17:55:18Z
s3:loadparm: Ensure to truncate FS Volume Label at multibyte boundary

For FS_VOLUME_INFO/FS_INFO operation, a maximum of 32 characters are
sent back. However, since Samba chops off any share name with >32
bytes at 32, it is possible that a multi-byte share name can get chopped
off between a full character. This causes the string decoding for unicode
failure which sends back NT_STATUS_ILLEGAL_CHARACTER (EILSEQ) to the client
applications.

On Windows, Notepad doesn't like it, and refuses to open a file in this
case and fails with the following error:

  Invalid character. For multibyte character sets, only the leading byte is
  included without the trailing byte. For Unicode character sets, include
  the characters 0xFFFF and 0xFFFE.

Proposed fix:
- Find the last starting point of a multibyte codepoint if the character
  at 32nd byte is a subsequent byte of a MB codepoint.

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

Signed-off-by: Shyamsunder Rathi <shyam.rathi at nutanix.com>
Reviewed-by: Hemanth Thummala <hemanth.thummala at nutanix.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
749f1290 by Rikard Falkeborn at 2019-05-16T19:08:29Z
lib:util: Fix tfork return value if sigprocmask fails

Returning a non-zero value from a function with bool as return value is
the same as returning true. Change the return value to false if
sigprocmask or pthread_sigmask fails to indicate failure.

Detected with the help of cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu May 16 19:08:29 UTC 2019 on sn-devel-184

- - - - -
1078b273 by Richard Sharpe at 2019-05-16T22:33:21Z
s3: smbd: Don't log at WARNING level when exiting the server on error.

Signed-off-by: Richard Sharpe <realrichardsharpe at gmail.com>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8c6fd8bb by Volker Lendecke at 2019-05-16T22:33:21Z
smbd: Remove an obsolete comment from share_conflict()

delay_for_batch_oplocks() is no more. Also, open_mode_check (which
calls into this routine) is called before delay_for_oplock.

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

- - - - -
c67694ee by Volker Lendecke at 2019-05-16T22:33:21Z
smbd: Remove a pointless "continue" statement

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

- - - - -
3d9a720f by Volker Lendecke at 2019-05-16T22:33:21Z
smbd: Use send_break_message() in send_break_to_none()

Centralize the marshalling code

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

- - - - -
ab648a4c by Volker Lendecke at 2019-05-16T23:48:17Z
smbd: Do oplock break messages in ndr

The previous scheme was overloaded, a idl definition is easier to
print, and it clarifies what data is actually needed

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May 16 23:48:18 UTC 2019 on sn-devel-184

- - - - -
444b594f by Andrew Bartlett at 2019-05-17T06:48:10Z
tdb: Do not return errors from tdb_repack() in the tail of tdb_transaction_commit()

The call to tdb_repack() inside tdb_transaction_commit()
is an optimization, not part of the transaction itself,
so failing due to lock or other errors isn't a fatal error
that should cause the caller to think the transaction was
a failure by returning -1.

The tdb transaction itself has finished and been committed
onto stable storage via fsync and all locks released at the
point tdb_repack() is called.

tdb_repack() is only called here as it's a convenient point
to attempt to reduce tdb fragmentation without having to add
a timer call to repack in all users of tdb.

This causes lock ordering issues in Samba, showing up as:

ldb: ltdb: tdb(../private/sam.ldb.d/DC=SAMBA2008R2,DC=EXAMPLE,DC=COM.ldb): tdb_transaction_prepare_commit: failed to upgrade hash locks: Locking error

This is because Samba has multiple tdb databases open, and the lock order between them
is important.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
eafef2bb by Andrew Bartlett at 2019-05-17T06:48:10Z
dsdb: Add tests for large LDAP responses

This behaviour is Samba-specific, we have not traditionally cut of responses at 1000
or so as Windows does, and we need to change that behaviour carefully.

This triggers this bug in TDB:
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13952

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
bba9f065 by Douglas Bagnall at 2019-05-17T07:18:27Z
pytests/dns: use 2.6 compatible syntax

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13886
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
d4d41f0d by Gary Lockyer at 2019-05-17T07:18:27Z
lib util debug: Increase format buffer to 4KiB

Increase the debug line buffer to 4KiB, the existing size of 1KiB is too
small for dsdbChange JSON audit messages.  These messages were then
split across multipe lines causing issues in log ingestion tools
expecting single line messages.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13902

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Mon May  6 01:18:22 UTC 2019 on sn-devel-184

(cherry picked from commit ad3af7cdffb98b7998857db609548fc96f60c669)

- - - - -
0861417b by Christof Schmitt at 2019-05-17T07:18:27Z
selftest: Add gid-to-sid lookup to idmap_ad test

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit d7b5ad5e6159c224f70bea782bbdc46059e67978)

- - - - -
dcbffbb3 by Christof Schmitt at 2019-05-17T07:18:27Z
selftest: Use fl2008r2dc for ad_member_idmap_ad

fl2008r2dc already has a trusted domain. That will be used to use
idmap_ad for querying idmap attributes from the trusted domain.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 8266bd1f45d1b5b2a61d84006ab8e8e1ed0e52a9)

- - - - -
f807c76d by Christof Schmitt at 2019-05-17T07:18:28Z
selftest: Make trusted domain information available for idmap_ad environment

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 281fb81ab1c72831c752be44fd1bfdcfd10bd798)

- - - - -
4cf06197 by Christof Schmitt at 2019-05-17T07:18:28Z
selftest: Add idmap configuration for trusted domain for idmap_ad

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 65e1d783cb17904cd117d896569e7cbe79a3131b)

- - - - -
c1b0fb91 by Christof Schmitt at 2019-05-17T07:18:28Z
selftest: Pass trusted domain information to idmap_ad test

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit ac0f8656eed39a4527a5336cf93aa1508666f79b)

- - - - -
ac678f27 by Christof Schmitt at 2019-05-17T07:18:28Z
selftest: Add trusted domain tests for idmap_ad

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2577f43a133f8b8eb997b9529a38e21c77b5da22)

- - - - -
e7b1794c by Volker Lendecke at 2019-05-17T07:18:28Z
winbind: Fix overlapping id ranges

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

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Apr 24 02:25:56 UTC 2019 on sn-devel-184

(cherry picked from commit 3020050bdf9df077ec9a0e962a689557187174ac)

- - - - -
cd5fbcc9 by Ralph Boehme at 2019-05-17T07:18:28Z
debug: add an empty line

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2bc7e254a62cfc6a60ecff425fc71173c6d21a10)

- - - - -
2e2b539d by Ralph Boehme at 2019-05-17T07:18:28Z
debug: add a call to debug_parse_levels() to reopen_logs()

This allows correct refresh of the "log level" setting when reloading config.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4341f24069f991dc7119093e418aac392e0a1b50)

- - - - -
dea9042b by Ralph Wuerthner at 2019-05-17T07:18:28Z
s3:debug: use struct initializer

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit b9e1b4ad0033c211710da285c30d603ccb8b8d40)

- - - - -
adc1277e by Ralph Wuerthner at 2019-05-17T07:18:28Z
s3:debug: adjust indention

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
(cherry picked from commit a45675879ddcb43ab274d28496eedd6833466ae4)

- - - - -
9348090b by Ralph Wuerthner at 2019-05-17T07:18:28Z
s3:debug: enable logging for early startup failures

Commit c89a33a07a 'debug: Use backends instead of explicitly logging to
syslog or file' introduced a regression where early startup failures (e.g.
unable to connect to CTDB) are no longer logged because the debug subsystem
is not yet fully initialized. Enable logging again with reasonable defaults
when reopen_logs() is called and the parameter file is not yet parsed.

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Thu Apr 18 22:21:15 UTC 2019 on sn-devel-144

(cherry picked from commit 9b30fcda64080592d20de64b384fd6d3d0775cbf)

- - - - -
9f4cc1ff by Robert Sander at 2019-05-17T07:18:29Z
s3: modules: ceph: use current working directory instead of share path

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

Signed-off-by: Robert Sander <r.sander at heinlein-support.de>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May  2 19:34:11 UTC 2019 on sn-devel-184

(cherry picked from commit 966fc0dc604299a87e40e7170d80911475317db5)

- - - - -
b23a436e by Stefan Metzmacher at 2019-05-17T07:18:29Z
s4:torture/smb2: add smb2.stream.names3 test

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit b5c4fdbf99caa3a9e7c6446cfbc4f1b23b84b3c8)

- - - - -
e8a1f4c2 by Stefan Metzmacher at 2019-05-17T07:18:29Z
smbd: allow case insensitive opens of named streams

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2a69c0915586fb9fb2148239965d06bf9f93c803)

- - - - -
d2c87ba6 by Stefan Metzmacher at 2019-05-17T07:18:29Z
s4:libcli/raw: add RAW_FILEINFO_NORMALIZED_NAME_INFORMATION support

This is supported over the wire in SMB 3.1.1 on starting with
Windows 10 1803.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 0c602319194bda6b2a0efdd7c186078583f79264)

- - - - -
ffb6fb90 by Stefan Metzmacher at 2019-05-17T07:18:29Z
s4:torture/smb2: add smb2.getinfo.normalized test

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 8a5828de2bdd95223e5f30996d0490fef53742dd)

- - - - -
7db0d1a7 by Stefan Metzmacher at 2019-05-17T07:18:29Z
smbd: implement SMB_FILE_NORMALIZED_NAME_INFORMATION handling

Windows 10 (1803 and higher) support and use
SMB_FILE_NORMALIZED_NAME_INFORMATION calls over the network. As a
fallback (in case the server don't support it) the client traverses all
path components, which is very expensive.

Implementing SMB_FILE_NORMALIZED_NAME_INFORMATION is very cheap for us
as the open already went through unix_convert() and we have the
information the client is asking for.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed May  1 18:33:00 UTC 2019 on sn-devel-184

(cherry picked from commit b20fd15e04ce9292f90a7f70f4184e43034b4b9d)

- - - - -
08e229df by Martin Schwenke at 2019-05-17T07:18:29Z
ctdb-tools: Fix ctdb dumpmemory to avoid printing trailing NUL

Fix ctdb rddumpmemory too.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit f78d9388fb459dc83fafb4da6e683e3137ad40e1)

- - - - -
30b5d837 by Martin Schwenke at 2019-05-17T07:18:29Z
ctdb-tests: Extend test to cover ctdb rddumpmemory

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 8108b3134c017c22d245fc5b2207a88d44ab0dd2)

- - - - -
7c97bc83 by Martin Schwenke at 2019-05-17T07:18:29Z
ctdb-tests: Change sanity_check_output() to internally use $out

All callers are currently passed $out.  Global variable $out is used
in many other places so use it here to simplify the interface and make
future changes simpler.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 7c3819d1ac264acf998f426e0cef7f6211e0ddee)

- - - - -
b594f516 by Martin Schwenke at 2019-05-17T07:18:29Z
ctdb-tests: Make try_command_on_node less error-prone

This sometimes fails, apparently due to a cat process in onnode
getting EAGAIN.  The conclusion is that tests that process large
amounts of output should not depend on a sub-shell delivering that
output into a shell variable.

Change try_command_on_node() to leave all of the output in file
$outfile and just put the first 1KB into $out.  $outfile is removed
after each test completes.

Change the implementation of sanity_check_output() to use $outfile
instead of $out.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 9d02452a24625df5f62fd6d45a16effe2fa45fbe)

- - - - -
3f104bd0 by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-tests: Avoid bulk output in $out, prefer $outfile

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 066cc5b0c561464ed08890d9aa1a1a55b545e9cc)

- - - - -
814471f4 by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-tests: Wait to allow database attach/detach to take effect

Sometimes the detach test fails:

  Check detaching single test database detach_test1.tdb
  BAD: database detach_test1.tdb is still attached
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.0/db/volatile/detach_test4.tdb.0
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.0/db/volatile/detach_test3.tdb.0
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.0/db/volatile/detach_test2.tdb.0
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.0/db/volatile/detach_test1.tdb.0
  Number of databases:3
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.1/db/volatile/detach_test4.tdb.1
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.1/db/volatile/detach_test3.tdb.1
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.1/db/volatile/detach_test2.tdb.1
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.2/db/volatile/detach_test4.tdb.2
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.2/db/volatile/detach_test3.tdb.2
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.2/db/volatile/detach_test2.tdb.2
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.2/db/volatile/detach_test1.tdb.2
  *** TEST COMPLETED (RC=1) AT 2019-04-27 03:35:40, CLEANING UP...

When issued from a client, the detach control re-broadcasts itself
asynchronously to all nodes and then returns success.  The controls to
some nodes to do the actual detach may still be in flight when success
is returned to the client.  Therefore, the test should wait for a few
seconds to allow the asynchronous controls to complete.

The same is true for the attach control, so workaround the problem in
the attach test too.

An alternative is to make the attach and detach controls synchronous
by avoiding the broadcast and waiting for the results of the
individual controls sent to the nodes.  However, a simple
implementation would involve adding new nested event loops.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 3cb53a7a05409925024d6a67bcfaeb962d896e0b)

- - - - -
15e5d62b by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-tests: Fix usage message

Since commit 0e9ead8f28fced3ebfa888786a1dc5bb59e734a3 daemons have
been shut down after each test, so this option no longer has anything
to do with killing daemons.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit a2ab6485e027ebb13871c7d83b7626ac5c9b98c0)

- - - - -
1eb5d2e4 by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-tests: Don't clean up test var directory in autotest target

If the directory is always cleaned up then it is not possible to look
at daemon logs to debug test failures.

This target is only really used by autobuild.py, which (optionally)
cleans up the parent directory anyway.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Tue May  7 06:56:01 UTC 2019 on sn-devel-184

(cherry picked from commit 5a9e338330fe136908a3a17a5df81c054c5cc5b0)

- - - - -
0ffba514 by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-tests: Capture output in $out on failure as well

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit cf00db40355b49443263187f9d97934f91287e51)

- - - - -
9f679ba1 by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-tests: Make ctdb reloadips tests more reliable

ctdb reloadips will fail if it can't disable takover runs.  The most
likely reason for this is that there is already a takeover run in
progress.  We can't predict when this will happen, so retry if this
occurs.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 8be4ee1a28d5c037955832b6f827d40f28f02796)

- - - - -
24d70220 by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-tests: Fix logic error in simple ctdb reloadips test

There is a chance that restoring IP addresses to the test node will
result in different IP addresses being assigned to that node.
Removing a single IP address may then fail (or be a no-op) if it is
done after the restore.

So, swap the single IP address removal to happen first, then restore,
then remove all IP addresses.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit dc89db8ca6aadd4a9f7e8a85843c53709d04587c)

- - - - -
1c2c081f by Martin Schwenke at 2019-05-17T07:18:30Z
ctdb-daemon: Never use 0 as a client ID

ctdb_control_db_attach() and ctdb_control_db_detach() assume that any
control with client ID 0 comes from another daemon and treat it
specially.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 8663e0a64fbdb9ea16babbfe87d6f5d7a7b72bbd)

- - - - -
2ec15697 by Andreas Schneider at 2019-05-17T07:18:30Z
s4:auth: Fix debug statement in gensec_gssapi

The 'role' is set to null, we should first set it to the correct value
before printing anything.

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit bd29f3fcc023d00afde8e9cc2f9db22dcae49877)

- - - - -
541a98bc by Andreas Schneider at 2019-05-17T07:18:30Z
s3:rpc_server: Do not free the tdbname before we printed it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 790d7e34cbe4e190d6acdd24696efe53944cd4a6)

- - - - -
9fda18d7 by Andreas Schneider at 2019-05-17T07:18:31Z
s4:ntvfs: Do not free eadb before we printed an error

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 6da032df5450ef72f8608a19b3b5cc6e9185cd6e)

- - - - -
1f14d55f by Andreas Schneider at 2019-05-17T07:18:31Z
s4:torture: Do not print NULL strings we just checked before

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit be72dfbc8edc53ed191dc01668a53cafb5cd785d)

- - - - -
637b3b1a by Andreas Schneider at 2019-05-17T07:18:31Z
lib:torture: Fix string comparison macros where we directly pass NULL

See e.g. lib/util/tests/strlist.c +177

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit a8f773e326d6bdfc1c9eb87a74c00108f6620c56)

- - - - -
f00cb3c1 by Andreas Schneider at 2019-05-17T07:18:31Z
s4:torture: Do not free full_name before we printed it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 46f036d3231bc99cf37c7cabf82757d3c28c5cff)

- - - - -
925871f5 by Andreas Schneider at 2019-05-17T07:18:31Z
ctdb:common: Do not print NULL if we don't get a sockpath

sock_socket_start_recv() might not fill sockpath if we return early.

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 830cb7e67568de5f3ce359cb6af3be8ab545c824)

- - - - -
ca9e386a by Andreas Schneider at 2019-05-17T07:18:31Z
s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit e333425e0ff6be5691b74a920610b508e7d26892)

- - - - -
c98a190f by Andreas Schneider at 2019-05-17T07:18:31Z
s3:utils: If share is NULL in smbcquotas, don't print it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 3653dc7013518d90e6deb08a1f21d7472dc86675)

- - - - -
f8eb314b by Andreas Schneider at 2019-05-17T07:18:31Z
s3:utils: If share is NULL in smbcacls, don't print it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2b957bde5a2f0f670ee0c8acde6edae1f4aaf253)

- - - - -
1e9e531a by Ralph Boehme at 2019-05-17T07:18:31Z
s3:smbd: don't use recvfile on streams

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13938

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Thu May  9 20:43:53 UTC 2019 on sn-devel-184

(cherry picked from commit 219bc189472acff24410009ee16a409e0aaf8eef)

- - - - -
e3dd029d by Jeremy Allison at 2019-05-17T07:18:32Z
s3: SMB1: Don't allow recvfile on stream fsp's.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri May 10 01:14:02 UTC 2019 on sn-devel-184

(cherry picked from commit 667db8e8c7836c750085729f5062807669cbb204)

- - - - -
e1522725 by Andreas Schneider at 2019-05-17T07:18:32Z
s3:smbspool: Fix regression printing with Kerberos credentials

This is a regression which has been introduced with Samba 4.8.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
(cherry picked from commit fd4b1f4f16aee3e3c9a2cb449655edfed171963a)

- - - - -
f81a971c by David Disseldorp at 2019-05-17T07:18:32Z
vfs_ceph: fix cephwrap_flistxattr() debug message

The @list buffer may be uninitialised prior to ceph_flistxattr()
invocation, so only log the address.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13940

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Fri May 10 12:59:05 UTC 2019 on sn-devel-184

(cherry picked from commit 21dc6f8e8d82f84e4afda355a48fbbd39c7fe800)

- - - - -
76c73021 by Martin Schwenke at 2019-05-17T07:18:32Z
ctdb-recoverd: Fix memory leak

state is always freed before exiting this function, so allocate fde
off it instead of long-lived ctdb context.

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 6a2941e2a9fd6ab2d5b8dbac042b61a7b1b0b914)

- - - - -
54199785 by Martin Schwenke at 2019-05-17T07:18:32Z
ctdb-common: Fix memory leak

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

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 30bc6e2529cdd444d4ec7902844c3a6fb0858090)

- - - - -
75cad1d7 by Andrew Bartlett at 2019-05-17T08:21:52Z
tdb: Release tdb 1.4.1

* Do not propogate any errors from tdb_repack() to to tdb_transaction_commit()

  The repack may fail due to lock ordering or memory limits, but the original data has
  been written so the call must succeed.  (bug 13952)

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri May 17 08:21:52 UTC 2019 on sn-devel-184

- - - - -
8b523259 by Amitay Isaacs at 2019-05-17T10:56:19Z
ctdb-common: Fix memory leak in run_proc

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

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Tue May 14 08:59:03 UTC 2019 on sn-devel-184

(cherry picked from commit b1f4c86eea022999d5439e4a6ef3494fe41479b6)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Fri May 17 10:56:19 UTC 2019 on sn-devel-144

- - - - -
be589a1f by Andreas Schneider at 2019-05-17T19:33:25Z
lib:util: Remove unused ALIGN marcos from byteorder.h

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3f16e97f by Andreas Schneider at 2019-05-17T19:33:25Z
lib:util: Remove PPC big endian asm optimized code in byteorder.h

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ad04e5f5 by Andreas Schneider at 2019-05-17T19:33:25Z
lib:util: Move VWV macro to smb_constants.h

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0b8b04db by Andreas Schneider at 2019-05-17T20:44:36Z
lib:util: Add a test for byteorder.h

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri May 17 20:44:36 UTC 2019 on sn-devel-184

- - - - -
f1226bfb by Volker Lendecke at 2019-05-18T19:06:23Z
smbd: Add file_rename_message in idl

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

- - - - -
07bbcf3a by Volker Lendecke at 2019-05-18T20:18:54Z
smbd: Send "share_file_id" with the rename msg

file_id plus share_file_id remotely specify the fsp. This avoids the
explicit loop in the receiver.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat May 18 20:18:55 UTC 2019 on sn-devel-184

- - - - -
9a1df272 by Juergen Hoetzel at 2019-05-19T17:34:20Z
docs: Fix typo

Signed-off-by: Juergen Hoetzel <juergen at archlinux.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
519d72c5 by Fabrice Fontaine at 2019-05-19T17:34:20Z
Fix uClibc build on 64bit platforms by including stdint.h

Fixes an error detected by buildroot autobuilders:
http://autobuild.buildroot.net/results/573/573e2268e205e10d1352fa81122d8f225fdb4575/build-end.log

/home/rclinux/rc-buildroot-test/scripts/instance-1/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/stdint.h:122:27:
error: conflicting types for 'uintptr_t'
 typedef unsigned long int uintptr_t;
                           ^
In file included from ../lib/ldb/tests/ldb_msg.c:17:0:
../third_party/cmocka/cmocka.h:126:28: note: previous declaration of 'uintptr_t' was here
       typedef unsigned int uintptr_t;

The define __WORDSIZE is missing when cmocka.h decides how to
define uintptr_t, this patch includes stdint.h when needed.

Patch sent upstream:
https://lists.samba.org/archive/samba-technical/2018-January/125306.html

[updated for samba-4.8.4, v2 sent upstream
 https://lists.samba.org/archive/samba-technical/2018-August/129732.html,
 updated for samba-4.9.1]

Signed-off-by: Bernd Kuhls <bernd.kuhls at t-online.de>
[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/samba4/0003-Fix-uClibc-build-on-64bit-platforms-by-including-std.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
18965c0b by Rikard Falkeborn at 2019-05-19T17:34:21Z
vfs_catia: Fix return value in lock functions

Returning -1 in a function with bool as return value type is the same
as returning true. Change to false to indicate the error.

Detected by the help of cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3a4f2363 by Rikard Falkeborn at 2019-05-19T17:34:21Z
vfs_gpfs: Fix return value if getting data fails

Returning -1 in a function with bool as return value type is the same
as returning true. Change to false to indicate the error.

Detected by the help of cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
73003750 by Rikard Falkeborn at 2019-05-19T17:34:21Z
s3: libsmbclient: Fix return value if cli_open() fails

Returning -1 in a function with bool as return value type is the same
as returning true. Change to false to indicate the error.

Detected by the help of cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
594676c8 by Rikard Falkeborn at 2019-05-19T18:48:01Z
s3: torture: Fix return values

Torture tests should return true on success and false on failure.
Returning -1 is the same as returning true and returning 0 is the same
as returning false. Change the return values to true and false to fix
the return values.

Detected by the help of cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
Reviewed-by: Ralph Böhme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sun May 19 18:48:01 UTC 2019 on sn-devel-184

- - - - -
46677b8e by Andrew Bartlett at 2019-05-20T04:01:10Z
dsdb: Add random values to names in tests for large LDAP responses

This test is run agianst multiple DCs in the same domain, so there can
be a race with replication.  Therefore avoid using the same name twice
by adding a random suffix.

This is an improvement to a demonstrator for this bug in TDB:
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13952

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
7567f292 by Andrew Bartlett at 2019-05-20T04:01:10Z
dsdb/partition: Ensure metadata.tdb is opened early in partition_reload_if_required()

This allows metadata.tdb to be locked in the correct place in
in the lock order, as partition_reload_if_required() implicitly
calls partition_lock_read().

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
bc663a97 by Andrew Bartlett at 2019-05-20T04:01:10Z
dsdb/partition: Move in_transaction decrement to end of partition_del_trans()

It makes no sense for this to be mid-function.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
99867565 by Andrew Bartlett at 2019-05-20T04:01:10Z
dsdb/partition: Remove teardown of data->metadata on partition_metadata_set_sequence_number() failure

This changes variables that are not the responsiblity of this function, the unlock
implied by partition_del_trans() needs to be done carefully in the right spot.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
46185dae by Andrew Bartlett at 2019-05-20T04:01:10Z
dsdb: lock metadata.tdb during lock_read in partitions module

metadata.tdb was being locked during transactions, but not during read, and
we should ensure we take all our locks in order for consistency

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
98226287 by Andrew Bartlett at 2019-05-20T04:01:11Z
selftest: Remove gensec.FEATURE_SEAL from samba4.ldap.notification

This made it much harder to watch under wireshark and is not required (no password setting).

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
11c20e03 by Andrew Bartlett at 2019-05-20T04:01:11Z
ldap_server: Remove success_limit

This was always set to 0 so was poinless.  Any LDAP scope can return 0 entries,
even a SCOPE_BASE if the filter does not match.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
fd74b631 by Andrew Bartlett at 2019-05-20T04:01:11Z
ldap_server: Run the ldap_encode() step in ldapsrv_queue_reply()

This avoids holding the memory for the response twice,
by the time the result is queued it is only ASN.1 encoded.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
00b9a977 by Andrew Bartlett at 2019-05-20T04:01:11Z
ldap_server: Use an array of struct iovec to avoid data_blob_append()

This avoids a the implicit 256MB limit on LDAP replies (allowing this
to be increased in the future) and means we copy less memory around.

However because we can only have 1024 entries in a struct iovec (on Linux)
we will need to call tstream_writev_queue_send() multiple times.

Calling it in chunks of 1024 seems a reasonable compromise, the
gensec layer will chunk it out smaller if required.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
e8475f8e by Andrew Bartlett at 2019-05-20T04:01:11Z
ldap_server: Add explict repsonse size limit of 256MB

This allows us to replace the implicit limit via data_blob_append()
removed in the previous commit.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
8dfad9fa by Andrew Bartlett at 2019-05-20T04:01:11Z
ldap_server: chunk the writev() calls at 25MB

This should limit the amount we send to GENSEC at a
time where it may help avoid large realloc or memcpy calls.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
0559430a by Andrew Bartlett at 2019-05-20T04:01:11Z
ldap_server: Run ldapsrv_queue_reply() in the ldb callback, rather than waiting for the full result

Based on earlier work by Garming Sam.

This allows the server to stop working on a reply that will never
be sent to the client as it is too large.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
3b509129 by Andrew Bartlett at 2019-05-20T05:17:42Z
torture: Address flapping samba4.rpc.altercontext test

NT_STATUS_CONNECTION_DISCONNECTED and NT_STATUS_CONNECTION_RESET are
equivilent for the purposes of this test, both come from the server
shutting down the connection, the difference comes from two different
unix error numbers that can come from this.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon May 20 05:17:42 UTC 2019 on sn-devel-184

- - - - -
45a4a907 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 for E_md5hash() in smbcrypt

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
152cd8b4 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 in encode_or_decode_arc4_passwd_buffer()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2463d111 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 in encode_wkssvc_join_password_buffer()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
10a1caa4 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 in encode_or_decode_arc4_passwd_buffer()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
023e6b4f by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 in decode_wkssvc_join_password_buffer()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a2f88720 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 HMAC in ntv2_owf_gen()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e1c04866 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 HMAC in SMBOWFencrypt_ntv2()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6f4c0270 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 HMAC in SMBsesskeygen_ntv2()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d22aa6fc by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use 'bool ok' in ntv2_owf_gen()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1810daaf by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Use GnuTLS MD5 and HMAC MD5 in netlogon_creds_init_128bit

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
75ee0c83 by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:auth: Add return codes for netlogon_creds_init_128bit()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
54440f1b by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:drsuapi: Use GnuTLS MD5 in drsuapi_decrypt_attribute_value()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a6eeb49b by Andreas Schneider at 2019-05-21T00:03:20Z
libcli:drsuapi: Use GnuTLS MD5 in drsuapi_encrypt_attribute_value()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f7d95239 by Andreas Schneider at 2019-05-21T00:03:21Z
libcli:smb: Use GnuTLS MD5 and HMAC MD5 in smb_signing_md5()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
940e0c10 by Andreas Schneider at 2019-05-21T00:03:21Z
libcli:smb: Use GnuTLS HMAC MD5 in smb_key_derivation()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7368a200 by Andreas Schneider at 2019-05-21T00:03:21Z
libcli:smb: Return NTSTATUS for smb_signing_md5()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
754e1551 by Andreas Schneider at 2019-05-21T00:03:21Z
libcli:smb: Return NTSTATUS for smb_signing_sign_pdu()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
39a66546 by Andreas Schneider at 2019-05-21T00:03:21Z
libcli:smb: Check return code of smb_signing_md5()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5a0516be by Andreas Schneider at 2019-05-21T00:03:21Z
libcli:smb: Return NTSTATUS for smb_key_derivation()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
44fcb599 by Andreas Schneider at 2019-05-21T00:03:21Z
auth:ntlmssp: Use GnuTLS HMAC MD5 in ntlmssp client

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
898fe5a1 by Andreas Schneider at 2019-05-21T00:03:21Z
auth:ntlmssp: Use GnuTLS MD5 and HMAC MD5 in ntlmssp server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
fe2a9695 by Andreas Schneider at 2019-05-21T00:03:21Z
auth:ntlmssp: Use GnuTLS MD5 and HMAC MD5 in ntlmssp sign

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d3ea318b by Andreas Schneider at 2019-05-21T00:03:21Z
auth:creds: Use GnuTLS MD5 in ntlm creds

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6b413dab by Andreas Schneider at 2019-05-21T00:03:21Z
auth:gensec: Use GnuTLS HMAC MD5 in netsec_do_seq_num()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
71926c6e by Andreas Schneider at 2019-05-21T00:03:21Z
auth:gensec: Use GnuTLS HMAC MD5 in netsec_do_seal()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6aa30669 by Andreas Schneider at 2019-05-21T00:03:22Z
auth:gensec: Use GnuTLS HMAC MD5 and MD5 in netsec_do_sign()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
63170950 by Andreas Schneider at 2019-05-21T00:03:22Z
auth:gensec: Return NTSTATUS for netsec_do_seq_num()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2772c92e by Andreas Schneider at 2019-05-21T00:03:22Z
s3:smbd: Return NTSTATUS for srv_calculate_sign_mac()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bb273a00 by Andreas Schneider at 2019-05-21T00:03:22Z
s3:vfs: Use GnuTLS MD5 in vfs_streams_xattr

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
29151256 by Andreas Schneider at 2019-05-21T00:03:22Z
s3:vfs: Use GnuTLS MD5 in vfs_fruit

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
94b2f000 by Andreas Schneider at 2019-05-21T00:03:22Z
s3:profile: Use GnuTLS MD5

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1834b822 by Andreas Schneider at 2019-05-21T00:03:22Z
s3:rpc_client: Use GnuTLS MD5 for samr

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e6506dde by Andreas Schneider at 2019-05-21T00:03:22Z
s4:dsdb: Use GnuTLS MD5 in password_hash module

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
23296ec2 by Andreas Schneider at 2019-05-21T00:03:22Z
s3:libcli: Use GnuTLS MD5 for smb singing

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4b7b2ed9 by Andreas Schneider at 2019-05-21T00:03:22Z
s4:libnet: Use GnuTLS MD5 for samr passwords

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5e688793 by Andreas Schneider at 2019-05-21T00:03:22Z
s4:ntp_signd: Use GnuTLS MD5 in signd

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f02713c9 by Andreas Schneider at 2019-05-21T00:03:22Z
s4:rpc_server: Use GnuTLS MD5 for samr password

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
42affa8b by Andreas Schneider at 2019-05-21T00:03:23Z
s4:messaging: Use GnuTLS MD5 in messaging test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
efa27ec6 by Andreas Schneider at 2019-05-21T00:03:23Z
s3:torture: Use GnuTLS MD5

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e633187e by Andreas Schneider at 2019-05-21T00:03:23Z
s4:torture: Use GnuTLS MD5 and HMAC MD5 in samlogon test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a4abcf3d by Andreas Schneider at 2019-05-21T00:03:23Z
s4:torture: Use GnuTLS MD5 in ntp_signd test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4e6a2772 by Andreas Schneider at 2019-05-21T00:03:23Z
s4:torture: Use GnuTLS MD5 in samr password tests

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
eb8be250 by Andreas Schneider at 2019-05-21T00:03:23Z
s4:torture: Use GnuTLS MD5 for samr password

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5b73c68c by Andreas Schneider at 2019-05-21T00:03:23Z
s4:torture: Use GnuTLS MD5 for samba3rpc

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
03cbef2b by Andreas Schneider at 2019-05-21T01:18:08Z
lib:crypto: Remove obsolete MD5 and HMAC MD5

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue May 21 01:18:08 UTC 2019 on sn-devel-184

- - - - -
3e6661fd by Gary Lockyer at 2019-05-22T03:03:43Z
s4 librpc rpc pyrpc: Fix flapping dcerpc.bare tests

Commit d65b7641c84976c543ded8f0de5ab2da3c19b407 had the parameters to
talloc_reparent reversed.  This caused the dcerpc.bare tests to flap.

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Wed May 22 03:03:43 UTC 2019 on sn-devel-184

- - - - -
474e5552 by Aaron Haslett at 2019-05-22T04:42:28Z
ldb: baseinfo pack format check on init

We will be adding a new packing format in forthcoming commits and there
may be more versions in the future. We need to make sure the database
contains records in a format we know how to read and write.
Done by fetching the @BASEINFO record and reading the first 4
bytes which contain the packing format version.

NOTE: Configure with --abi-check-disable to build this commit. This
patch is part of a set of LDB ABI changes, and the version update is
done on the last commit.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
df1f8832 by Aaron Haslett at 2019-05-22T04:42:28Z
ldb: push and pull macros for pack format

Replacing push and pull functions (which may cause issues with Undefined
Sanitizer) with Andreas Schneider's excellent macros which are a work in
progress and not yet merged into master. Once his work is upstream, I'll
rebase and change this code to import his headers.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
5bf6f0ae by Aaron Haslett at 2019-05-22T04:42:28Z
ldb: replacing length increments with constants in pack

Since we're about to introduce a new packing format, it's a good time to
improve our code style and change some magic numbers into explicit
constants.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
38feff07 by Aaron Haslett at 2019-05-22T04:42:28Z
ldb: unpack function for new pack format

Unpack function for new pack format with values separated from other
data so that while unpacking, the value section (which is probably large)
doesn't have to be loaded into cache/memory.
Additionally, width of length field can now vary per-element to save space.
The old unpack routine is still present and is called if the old pack
format version number is found.
LDB torture suite is modified to run relevant tests on both old and new
pack format.

NOTE: Configure with --abi-check-disable to build this commit. This
patch is part of a set of LDB ABI changes, and the version update is
done on the last commit.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
8c0724fa by Aaron Haslett at 2019-05-22T04:42:28Z
ldb: pack function for new pack format

Pack function for new pack format with values separated from other data
so that while unpacking, the value section (which is probably large)
doesn't have to be loaded into cache/memory.
The new format is disabled for now.
Two tests are added that operate on a detailed binary breakdown of the
new format.

NOTE: Configure with --abi-check-disable to build this commit. This
patch is part of a set of LDB ABI changes, and the version update is
done on the last commit.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
bea24253 by Aaron Haslett at 2019-05-22T04:42:29Z
ldb: Release ldb 2.0.2

 * Checking pack format is version 1 and erroring if not (will change soon)
 * Pack format routines for unpack and pack version 2 (but not used)
 * Test fixes for issues caused by upcoming repack functionality for upgrade
 * Making ldbdump print out pack format info and keys so we have low level visibility for testing in python

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
64cdd038 by Aaron Haslett at 2019-05-22T04:42:29Z
ldb: removing unnecessary module pointer

We want to reuse the reindex context struct for repacking, but it has an
unnecessary module pointer on it. Turns out the existing code doesn't
need it either, so this patch deletes the pointer.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
36583831 by Aaron Haslett at 2019-05-22T04:42:29Z
ldb: ldb_key_value_test fix

In future commits we'll be adding more logging to LDB, which breaks the
ldb_key_value_test suite. By removing the debug handler, a bug
involving an expired debug_string variable being written to is avoided.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
a666a99e by Aaron Haslett at 2019-05-22T05:58:17Z
ldb: ldbdump key and pack format version comments

For testing we need to know the actual KV level key of records and each
record's pack format version. This patch makes ldbdump add comments with
that info. We will parse it out in python tests.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May 22 05:58:17 UTC 2019 on sn-devel-184

- - - - -
40a9b739 by Joe Guo at 2019-05-22T05:59:13Z
Makefile: add lcov command

A helper cmd to generate .info file from .gcno and .gcda file,
and then generate html report from .info file.

Usage:

./configure --enable-coverage
make -j
make test TESTS=mytest
make lcov

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
433296c6 by Andrew Bartlett at 2019-05-22T05:59:13Z
Remove unused auth_get_challenge_not_implemented

This became unused after eba87995145b0e14672c1f6993f7aa3422d62541 in 2012

Found by callcatcher

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
e421c13b by Andrew Bartlett at 2019-05-22T05:59:13Z
dsdb: Remove unsued dsdb_class_by_cn()

The callers moved to dsdb_class_by_cn_ldb_val() with
43aa546ecc3f05845793b1a7354685d50a77c170 in 2009.

Found by callcatcher

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
abe7b673 by Andrew Bartlett at 2019-05-22T05:59:13Z
libcli/auth: Remove des_crypt64() from smbdes

This has been unused since it was introduced by
ad8b47a2ba4e81420bc2272e8438a727cc2223ee in 2006

Found by callcatcher

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
a011e033 by Andrew Bartlett at 2019-05-22T05:59:13Z
s4-rpc_server: Remove unused dnsserver_find_partition()

This has been unused since it was introduced by
5673e2cec946502da84956f866658718e7632a3e in 2011.

Found by callcatcher

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
93db0aac by Andrew Bartlett at 2019-05-22T05:59:13Z
lib: Remove "tdb based replacement for gettext"

This is unused since SWAT was removed in Samba 4.1

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
3e197d43 by Andrew Bartlett at 2019-05-22T05:59:14Z
libcli/security: Remove unused dup_sec_desc_buf()

This has been unused since before
762e7e1dff89cc14b0130fc9a22038b0845630a2 in 2003.

Found by callcatcher

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
5b957f81 by Andrew Bartlett at 2019-05-22T05:59:14Z
libcli/ldap: Remove unsued ldap_transaction()

This is unsued since a87dea2a0894015cf4a3140995791f5468c40038 in 2007
when we moved to using LDB for LDAP in this area of the code.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
2017e291 by Andrew Bartlett at 2019-05-22T05:59:14Z
ntvfs: Remove unused nbench vfs module

A pass-though NTVFS module to write nbench files is a cute idea,
but this is untested and almost certainly unused.

Found by looking at the LCOV results.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
ee8b48df by Andrew Bartlett at 2019-05-22T05:59:14Z
ntvfs: Remove unused and untested SMB1 -> SMB2 proxy module

While this could have been a very interesting idea (particularly
if it allowed our main SMB server to disable SMB1), it has never
been enabled in our testsuite so relying on it would be quite
brave.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
679227d6 by Andrew Bartlett at 2019-05-22T05:59:14Z
s4-ntvfs: Remove untested stub vfs_print backend

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
31de52ed by Andrew Bartlett at 2019-05-22T07:15:43Z
s4-ntvfs: Remove untested ntvfs_cifsposix backend

It had a note:

WARNING: All file access is done as user root!!!
         Only use this module for testing, with only test data!!!

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Wed May 22 07:15:43 UTC 2019 on sn-devel-184

- - - - -
ebf95e62 by Volker Lendecke at 2019-05-22T18:54:24Z
smbd: Enable "smbd:suicide mode" for smb2

The next commit needs an smbd to just exit and leave data behind in the
locking.tdb file. Don't make it harder to eventually phase out SMB1: Do
the test in SMB2.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
febb933f by Volker Lendecke at 2019-05-22T18:54:24Z
smbtorture: Add a test to make smbd panic

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
30622ed8 by Volker Lendecke at 2019-05-22T20:09:29Z
smbd: Fix a panic

Opening a file with a stale (smbd died) LEVEL_II oplock makes

vfs_set_filelen-> ... ->contend_level2_oplocks_begin_default

trigger the immediate leading to do_break_to_none. This goes through
because fsp->oplock_type is not initialized yet, thus 0. Also,
file_has_read_oplocks is still valid, because the smbd that has died
could not clean up the brlock.tdb entry.

Later in the code the exclusive oplock is granted, which is then found
by do_break_to_none, making it panic.

This patch just runs the direct FTRUNCATE instead of vfs_set_filelen.
This means the contend_level2_oplock code is skipped.

The relevant break (LEVEL_II to NONE) is now done in delay_for_oplock()
with the nice effect of removing a comment that was very confusing to
me.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed May 22 20:09:29 UTC 2019 on sn-devel-184

- - - - -
6086efb6 by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Add the 'lp' group to the users groups

This is required to access files in /var/spool/cups which have been
temporarily created in there by CUPS.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
42492d54 by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Print the principal we use to authenticate with

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
3632bfef by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Add debug for finding KRB5CCNAME

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
be596ce3 by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Use %u format specifier to print uid

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
6bbdf69e by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Fallback to default ccache if KRB5CCNAME is not set

This could also support the new KCM credential cache storage.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
28127457 by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Print the filename we failed to open

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
3d719a1f by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Always try to authenticate using Kerberos

If username and password is given, then fallback to NTLM. However try
kinit first. Also we correctly handle NULL passwords in the meantime and
this makes it easier to deal with issues.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
93acd880 by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Add debug messages to kerberos_ccache_is_valid()

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
d9af3dc0 by Andreas Schneider at 2019-05-23T09:41:17Z
s3:smbspool: Use NTSTATUS return codes

This allows us to simplify some code and return better errors.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
3b608510 by Andreas Schneider at 2019-05-23T11:10:28Z
third_party: Update nss_wrapper to version 1.1.6

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu May 23 11:10:28 UTC 2019 on sn-devel-184

- - - - -
1a9da378 by Andrew Bartlett at 2019-05-23T14:25:52Z
sambaundoguididx: Add flags=ldb.FLG_DONT_CREATE_DB and port to Python3

In py3 we need to add an extra str() around the returned ldb value to
enable .split() to be used.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed By: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Thu May 23 14:25:52 UTC 2019 on sn-devel-184

- - - - -
564e0f25 by Volker Lendecke at 2019-05-23T16:56:17Z
smbd: Merge "print_lock_struct" into one DBG

Also, avoid some casts

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

- - - - -
77e37850 by Volker Lendecke at 2019-05-23T16:56:17Z
tdb: Fix typo in README

README is far from a complete, good and accurate document, but what's
in there should at least not have obvious errors.

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

- - - - -
1a59b0fa by Volker Lendecke at 2019-05-23T16:56:17Z
smbd: Calculate delay_mask only once in delay_for_oplock

"const" ist just a hint to make sure it's actually not modified inside
the loop

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

- - - - -
1f9b8964 by Volker Lendecke at 2019-05-23T18:08:36Z
ctdb: Remove unused ctdb_ltdb_fetch_with_header()

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May 23 18:08:36 UTC 2019 on sn-devel-184

- - - - -
f58127d0 by Christof Schmitt at 2019-05-23T23:26:14Z
selftest: Add test for case-preserving in 'net [rpc] conf showshare'

Add a test to verify that 'net [rpc] conf showshare' returns the correct
upper/lower case.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
91350d56 by Christof Schmitt at 2019-05-23T23:26:14Z
net: Return share name in correct case from net rpc conf showshare

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
cb6525e8 by Christof Schmitt at 2019-05-23T23:26:14Z
libsmbconf:registry: Return correct case for get_share

get_share (called from 'net conf showshare') does a lookup of the share
name case-insensitively. As the registry stores the share name in the
correct case and 'net conf list' prints the correct case, also lookup
the correct case for get_share.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c3d28d49 by Ralph Boehme at 2019-05-23T23:26:14Z
s4:torture/vfs/fruit: ensure test_adouble_conversion() uses a non-emtpy resourcefork

This ensures the resource fork is not deleted as part of the AppleDouble file
conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.

This is currently not a problem in selftest, as we don't enable the option, but
a subsequent commit will run all vfs.fruit tests against a share with this
option enabled.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
bb5a457f by Ralph Boehme at 2019-05-23T23:26:14Z
s4:torture/vfs/fruit: ensure test_adouble_conversion_wo_xattr() uses a non-emtpy resourcefork

This ensures the resource fork is not deleted as part of the AppleDouble file
conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.

This is currently not a problem in selftest, as we don't enable the option, but
a subsequent commit will run all vfs.fruit tests against a share with this
option enabled.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
8ed9b6b4 by Ralph Boehme at 2019-05-23T23:26:14Z
selftest: run vfs.fruit test against a share that deletes empty resource forks

This reveals a bug in the AppleDouble conversion code: the conversion code that
unlinks an empty resource fork AppleDouble sidecar file ("._file") gets
triggered as part of open_file_ntcreate(..., "file:AFP_AfpResource", ...):

after SMB_VFS_OPEN() has been called with O_CREAT, what created the file, we
call SMB_VFS_FSTAT() on the just created filehandle. This ends up in
ad_convert(), finds the resource fork empty and thus deletes the file.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4777d116 by Ralph Boehme at 2019-05-23T23:26:14Z
vfs_fruit: add a forward declaration for ad_get()

Will be needed in the next commit.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
78a4639b by Ralph Boehme at 2019-05-23T23:26:15Z
vfs_fruit: change trigger points of AppleDouble conversion

This moves the trigger points where AppleDouble file conversion is run by
ad_convert() from deep down the callchain in ad_read_rsrc_adouble() to high
level VFS entry points.

Currently ad_convert() will be triggered as part of open_file_ntcreate(...,
"file:AFP_AfpResource", ...): after SMB_VFS_OPEN() has been called with O_CREAT,
what created the file, we call SMB_VFS_FSTAT() on the just created
filehandle. This ends up in ad_convert(), finds the resource fork empty and thus
deletes the file.

This commit moves calling of the conversion funtion to the high level VFS entry
points where the converted metadata is needed:

o for directory enumerations SMB_VFS_READDIR_ATTR() is called to fill in the
  repurposed fields in the directory entry metadata

o obviously for SMB_VFS_CREATE_FILE() on an macOS stream

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e7424897 by Volker Lendecke at 2019-05-24T00:42:17Z
ctdb: Make TDB_SEQNUM work synchronously with ctdb

Old war story completely from memory, I could not find the commit that
introduced TDB_SEQNUM so far...:

Back in the days when ctdb was initially developed, TDB_SEQNUM's only
user was the notify.tdb that held one huge record for all notify
records. With that use case in mind it made perfect sense to keep the
SEQNUM stable locally, sacrificing precision. By now notify.tdb is
long gone, an the only user of TDB_SEQNUM right now is brlock.tdb,
which contains special case code for the imprecise ctdb implementation
of TDB_SEQNUM.

With this commit, that special code can go: The TDB_SEQNUM will also
increment when just the DMASTER header field changes, indicating to
smbd that someone else might have changed the record. This will of
course increase the SEQNUM frequency, but it should not increase the
load on ctdb: If you look at the brlock.c workaround, it just does not
do the caching that is possible with precise TDB_SEQNUMs working.

How did I get here? I want to move brl_num_read_oplocks() from
brlock.tdb into locking.tdb, and for that I need precise TDB_SEQNUMs
for locking.tdb.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri May 24 00:42:17 UTC 2019 on sn-devel-184

- - - - -
430968b3 by Andrew Bartlett at 2019-05-24T03:19:17Z
Run test for initshutdown

The test already existed but was not run.

Found by LCOV

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
8dd0421a by Andrew Bartlett at 2019-05-24T03:19:17Z
selftest: Add more testing of wkssvc in source3

The samba3.wkssvc test is not as comprehensive, but rpc.wkssvc needs to run against the
ad_member environment to get past a builtin administrators check.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
773e4762 by Andrew Bartlett at 2019-05-24T03:19:17Z
selftest: Remove infinite client/server loop in srvsvc_NetNameValidate test

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
d2f54775 by Andrew Bartlett at 2019-05-24T03:19:17Z
selftest: Run samba3.srvsvc tests covering more of the srvsvc server

Found by LCOV.

Some of the failures should be fixed by setting "restrict anonymous = 2"
as requested by bug 12775

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
a60e5973 by Tim Beale at 2019-05-24T03:19:17Z
selftest: Refactor duplicated code to set ENV vars

Whenever we started a process, we basically used the same code to setup
the ENV variables.

The s4 ENVNAME may now be slightly different in the child process that
runs samba (i.e. '$testenv.samba'), but that ENV var did not appeared to
be used much.

I'm not sure if the current difference in $skip_resolv_wrapper logic for
nmbd was deliberate or accidental, but I've preserved the logic for now.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0fd3685c by Tim Beale at 2019-05-24T03:19:17Z
selftest: remove unused variable (@optargs)

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ba9323ab by Tim Beale at 2019-05-24T03:19:17Z
selftest: Move fork cmd args up a level

This is a fairly simple move of code and is the first step in a larger
refactor.

It doesn't matter if we build up the command args prior to the fork (we
only use them in the forked child). But moving the code means the code
to handle the fork-and-exec becomes common code that is repeated in
several places throughout Samba3.pm and Samba4.pm.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ad30fdc6 by Tim Beale at 2019-05-24T03:19:17Z
selftest: Add helper function to build up s3 daemon cmd

The s3 daemons all basically use the same command logic, it's just they
use slightly different environment variables.

This adds a common helper function, which we can pass the specific
environment variables into.

(Note the slight parameter difference for winbind with --stdout vs
--log-stdout).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c79f0c19 by Tim Beale at 2019-05-24T03:19:17Z
selftest: Store fork-and-exec daemon info in a hashmap

This intermediary refactor adds a hashmap that stores the values needed
to run each samba daemon. This adds a bit more code in the short term,
but it basically means the code in 5 different places now becomes
identical, and we can extract it out to a common function.

The converting FULL_CMD from an array reference back to an array is a
bit ugly, but we can clean this up a bit once the code is all in one
place.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ae3e33d4 by Tim Beale at 2019-05-24T03:19:17Z
selftest: Rework setting env variables for nmbd

Instead of having a special $skip_resolv_conf parameter just for nmbd,
use the get_env_for_process() API and customize the hashmap returned.
Pass the customized hashmap in as an optional part of the daemon_ctx.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
746e1377 by Tim Beale at 2019-05-24T03:19:17Z
selftest: Rework setting env variables for other forked binaries

Final refactor to merge the fork-and-exec code into a common function.

We can now use $daemon_ctx{ENV_VARS} to customize differences between
the forked binaries:
- samba: add in extra env variables on top of the defaults.
- dns_hub: there are no ENV variables we need to export.
- winbindd/smbd: these use the defaults, so they pass through an
undefined $daemon_ctx{ENV_VARS} (purely to make the code common across
all 5 places).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b976502d by Tim Beale at 2019-05-24T03:19:17Z
selftest: Add common fork_and_exec() function

Now the code has been refactored, we can move it into a common function.
This reduces code duplication and means we have a common place where we
start samba daemons from.

Note that some daemons behave slightly different, but the $daemon_ctx
allows us to customize their behaviour a bit.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
163897f1 by Tim Beale at 2019-05-24T03:19:18Z
selftest: Use scalar variable for new daemon_ctx hashmap

The selftest code typically stores hashmaps as scalar variables (i.e.
it only ever uses references to hashmaps). So much so that using a regular
hashmap (and passing it by reference via \%daemon_ctx) looks out of
place.

Using the hashmap directly made more sense when it was only being used
locally, but now the hashmap is being passed by reference into a function
anyway, so storing it as a scalar doesn't make much difference.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6ccf74cf by Gary Lockyer at 2019-05-24T03:19:18Z
ldap tests: test scheme for referrals

Ensure that the referrals returned in a search request use the same
scheme as the request, i.e. referrals recieved via ldap are prefixed
with "ldap://" and those over ldaps are prefixed with "ldaps://"

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1958cd8a by Gary Lockyer at 2019-05-24T05:12:14Z
ldap server: generate correct referral schemes

Ensure that the referrals returned in a search request use the same
scheme as the request, i.e. referrals recieved via ldap are prefixed
with "ldap://" and those over ldaps are prefixed with "ldaps://"

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri May 24 05:12:14 UTC 2019 on sn-devel-184

- - - - -
39c15ab2 by Andreas Schneider at 2019-05-24T06:07:08Z
ctdb:tests: Add missing va_end() in ctdb_set_error()

Found by csbuild.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>

- - - - -
5cce3493 by Andreas Schneider at 2019-05-24T06:07:08Z
lib:mscat: Add missing return check for error in dumpsmcat

Found by csbuild.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>

- - - - -
de926429 by Andreas Schneider at 2019-05-24T06:07:08Z
s3:utils: Only declare variables if we're gonna use them

Found by covscan.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>

- - - - -
5dfbb0d2 by Andreas Schneider at 2019-05-24T07:23:42Z
s3:lib: Move up NULL check

Found by covscan.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Fri May 24 07:23:42 UTC 2019 on sn-devel-184

- - - - -
77117a14 by Karolin Seeger at 2019-05-24T11:02:18Z
docs: Add another dns forwarder in the example.

Clarify how to list several dns forwarders.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
Reviewed-by: Björn Baumbach <bb at samba.org>

Autobuild-User(master): Björn Baumbach <bb at sernet.de>
Autobuild-Date(master): Fri May 24 11:02:18 UTC 2019 on sn-devel-184

- - - - -
f20538de by Jeremy Allison at 2019-05-24T19:00:05Z
lib: popen: Prepare to remove sys_popen().

Add sys_popenv(char * const argl[]) that uses a NULL
terminated vector array of args. Change sys_popen() to
split up its command string and call sys_popenv().

Once all callers are converted to sys_popenv() we
can remove sys_popen().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
5c34fa0b by Jeremy Allison at 2019-05-24T19:00:05Z
lib: util: Add file_ploadv().

Not yet used.

Duplicate code to file_pload() except uses vectored
argument list. file_pload() will be removed once all
callers are converted.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
3b19412b by Jeremy Allison at 2019-05-24T19:00:05Z
s3: lib: util: Add file_lines_ploadv().

Not yet used.

Duplicate code to file_lines_pload() except uses vectored
argument list. file_lines_pload() will be removed once all
callers are converted.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
d6453e1f by Jeremy Allison at 2019-05-24T19:00:05Z
s3: smbd: Convert dfree code to use file_lines_ploadv().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
f9ccf1cc by Jeremy Allison at 2019-05-24T19:00:05Z
s3: smbd: Convert print_svid code to use file_lines_ploadv().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
4a63e3b9 by Jeremy Allison at 2019-05-24T19:00:05Z
s3: smbd: Convert sysquotas.c code to use file_lines_ploadv().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
02bc0ce9 by Jeremy Allison at 2019-05-24T19:00:05Z
s3: lib: Remove file_lines_pload().

No longer used.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
c5729ae4 by Jeremy Allison at 2019-05-24T19:00:05Z
lib: util: Remove file_pload()

No longer used.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
61054e53 by Jeremy Allison at 2019-05-24T19:00:05Z
s3: lib: Add file_ploadv_send().

Not yet used. Preparing to remove file_pload_send()
with this safer alternative.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
449d4994 by Jeremy Allison at 2019-05-24T19:00:05Z
s3: winbind: Convert idmap to use file_ploadv_send().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
d5c363d6 by Jeremy Allison at 2019-05-24T19:00:06Z
s3: lib: Remove file_pload_send().

No longer used.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
dbfa3cd1 by Ralph Boehme at 2019-05-24T19:00:06Z
s3: lib: Rename all uses of file_pload_XXX -> file_ploadv_XXX.

Keep naming consistent across all usage.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
9fa95d5b by Jeremy Allison at 2019-05-24T19:00:06Z
lib: util: Finally remove possibilities of using sys_popen() unsafely.

All code now uses sys_popenv() which is much
harder to use incorrectly.

Remove the extract_args() function that was the
cause of possible issues.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
77eabd74 by Jeremy Allison at 2019-05-24T20:12:01Z
docs: dfree command. Correct usage of dfree scripts.

Add quotes to the sample scripts to prevent incorrect
parameter usage.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri May 24 20:12:02 UTC 2019 on sn-devel-184

- - - - -
da87fa99 by Volker Lendecke at 2019-05-25T00:05:25Z
lib: Only compile resolvconftest if fmemopen exists

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13961
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat May 25 00:05:25 UTC 2019 on sn-devel-184

- - - - -
412afb2a by Gary Lockyer at 2019-05-27T01:29:48Z
Fix ubsan null pointer passed as argument 2

Fix ubsan warning null pointer passed as argument 2 when the source
pointer is NULL.  The calls to memcpy are now guarded by an
if (len > 0)

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Mon May 27 01:29:48 UTC 2019 on sn-devel-184

- - - - -
a1f95ba5 by Jeremy Allison at 2019-05-27T13:16:21Z
s3: winbind: Fix crash when invoking winbind idmap scripts.

Previously the private context was caching a pointer to
a string returned from lp_XXX(). This string can change
on config file reload. Ensure the string is talloc_strup'ed
onto the owning context instead.

Reported by Heinrich Mislik <Heinrich.Mislik at univie.ac.at>

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
e09053fa by Ralph Boehme at 2019-05-27T14:29:36Z
registry: add a missing include

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13840

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Mon May 27 14:29:36 UTC 2019 on sn-devel-184

- - - - -
bb0ffbf3 by Stefan Metzmacher at 2019-05-28T07:16:25Z
lib/util: fix call to dbghdrclass() for DEBUGC()

dbghdrclass() sets the global 'current_msg_class' and for that
DEBUGC() should pass the given dbgc_class instead of the per file
DBGC_CLASS.

This is important with the new per class logfile with:

 log level = 1 dsdb_audit:10@/var/log/samba/log.dsdb_audit

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
d98a9712 by Stefan Metzmacher at 2019-05-28T07:16:25Z
lib/util: remove unused prototypes in debug.h

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
0da12ff9 by Stefan Metzmacher at 2019-05-28T07:16:25Z
lib/util: set current_msg_{level,class} also during a DEBUGADD[C]() call

In some situations we use DEBUGADDC() in order to print out content
without a related debug header line.

This is important with the new per class logfile with:

 log level = 1 dsdb_json_audit:10@/var/log/samba/log.dsdb_json_audit

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
706aba5b by Stefan Metzmacher at 2019-05-28T07:16:25Z
dsdb:audit_log: avoid printing "... remote host [Unknown] SID [(NULL SID)] ..."

We better print "... remote host [Unknown] SID [S-1-5-18] ..."
in 'dsdb_audit' message, this matches what we print for
'dsdb_json_audit'.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
15032ec6 by Stefan Metzmacher at 2019-05-28T07:16:25Z
python/ntacls: we only need security.SEC_STD_READ_CONTROL in order to get the ACL

We should avoid security.SEC_FLAG_MAXIMUM_ALLOWED otherwise
we may get NT_STATUS_SHARING_VIOLATION when we run
'samba-tool domain backup online' against a Windows DC.
Windows DCs have hidden folders for the NtFrs or Dfsr services,
which are locked by the running service.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
2ef79a4c by Stefan Metzmacher at 2019-05-28T08:32:09Z
dbcheck: fallback to the default tombstoneLifetime of 180 days

If a domain was provisioned by Windows 2000 this value is missing in the
database.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue May 28 08:32:10 UTC 2019 on sn-devel-184

- - - - -
37de8208 by Stefan Metzmacher at 2019-05-28T10:34:24Z
winexe: Use C99 initializer for poptOption in winexe.c

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
fa2a530c by Stefan Metzmacher at 2019-05-28T10:34:24Z
bootstrap: add mingw packages

This makes sure we at least compile the example/winexe code

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
9053391f by Ralph Boehme at 2019-05-28T11:49:06Z
s3:mdssvc: fix flex compilation error

[4440/4495] Compiling bin/default/source3/rpc_server/mdssvc/sparql_lexer.lex.c
../../source3/rpc_server/mdssvc/sparql_lexer.l:26: error: "yyalloc" redefined [-Werror]
26 | #define yyalloc SMB_MALLOC

Looks like the dirty redefine trick doesn't work anymore with newer flex
versions. According to the flex manual the right thing to do is to provide own
functions for yyalloc and yyrealloc when passing the options "noyyalloc
noyyrealloc".

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue May 28 11:49:06 UTC 2019 on sn-devel-184

- - - - -
32999e14 by Volker Lendecke at 2019-05-28T20:27:14Z
lib: Fix CID 1445648 Null pointer dereferences

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

- - - - -
ff2ed907 by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Fix a typo

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

- - - - -
f11c5887 by Volker Lendecke at 2019-05-28T20:27:15Z
brlock: Remove clustering special case

With e7424897a127 we don't need this special case for clustering
anymore.

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

- - - - -
905698fb by Volker Lendecke at 2019-05-28T20:27:15Z
dbwrap: Use sizeof, not an integer constant

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

- - - - -
4e56d228 by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Fix a typo

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

- - - - -
df360668 by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Use "fsp->lease" instead of "lease"

See the SMB_ASSERT a few lines above. Why this? It makes the next
commit more obvious.

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

- - - - -
9891a44f by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Simplify fsp_lease_update()

We don't need a share mode lock from a data dependency point of view
anymore, the leases data moved to leases.tdb. However, from a
coherency point of view it's probably wise to do this under a share
mode lock.

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

- - - - -
953f9f7b by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Factor out fsps_lease_update()

Less lines of code, less .text bytes with -O3

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

- - - - -
f283b7a4 by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Fix a typo

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

- - - - -
1838a8df by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Avoid casts in smbd_do_locking()

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

- - - - -
72ba86dd by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Use tevent_req_simple_recv_ntstatus() in smbd_smb2_lock_recv()

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

- - - - -
a2c2235c by Volker Lendecke at 2019-05-28T20:27:15Z
smbtorture: Fix a typo

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

- - - - -
115e9ea3 by Volker Lendecke at 2019-05-28T20:27:15Z
smbd: Simplify an if-expression in smbd_do_locking()

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

- - - - -
2093ebc4 by Volker Lendecke at 2019-05-28T20:27:16Z
smbd: Align integer types in smbd_do_unlocking()

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

- - - - -
199bb3d7 by Volker Lendecke at 2019-05-28T20:27:16Z
smbd: Avoid casts in smbd_do_unlocking()

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

- - - - -
8b478aaf by Volker Lendecke at 2019-05-28T20:27:16Z
smbd: Avoid casts in do_unlock()

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

- - - - -
4a93fc68 by Volker Lendecke at 2019-05-28T20:27:16Z
smbd: Avoid casts in smbd_smb2_lock_send()

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

- - - - -
73080f25 by Volker Lendecke at 2019-05-28T22:22:28Z
smbd: Adapt brl_pending_overlap to README.Coding

Just reformatting, no behaviour change. This just looked too ugly to me.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue May 28 22:22:28 UTC 2019 on sn-devel-184

- - - - -
2de0aebe by Aaron Haslett at 2019-05-29T04:41:24Z
ldb: test for parse errors

Parse errors aren't passed up correctly by the tdb backend. This
patch modifies a test to expose the issue, next patch will fix it.

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

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
a3101b97 by Andrew Bartlett at 2019-05-29T04:41:24Z
ldb: Fix segfault parsing new pack formats

We need to check for the errors given by ldb_unpack() et al by preserving
the error code from kv_ctx->parser() called by tdb_parse_record() in
ltdb_parse_record().

Otherwise we will silently accept corrupt records and segfault later.

Likewise new pack formats will confuse the parser but not be
detected except by the incomplete struct ldb_message.

With this patch, the user will see a message like:

 Invalid data for index  DN=@BASEINFO

 Failed to connect to 'st/ad_dc/private/sam.ldb' with backend 'tdb': Unable to load ltdb cache records for backend 'ldb_tdb backend'
 Failed to connect to st/ad_dc/private/sam.ldb - Unable to load ltdb cache records for backend 'ldb_tdb backend'

This can be refined in the future by a specific check for
pack format versions in a higher caller, but this much is
needed regardless to detect corrupt records.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
40ca8ed5 by Andrew Bartlett at 2019-05-29T04:41:24Z
sambaundoguididx: fix for -s

Quick fix running this script with -s instead of -H. samdb_url() returns
a url with a protocol prefix, which causes issues further down in the
script.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
c0b679f6 by Aaron Haslett at 2019-05-29T04:41:24Z
sambaundoguididx: renamed to downgradedatabase

In forthcoming commits we're going to repurpose this script to do an
entire downgrade of a database, disabling all new database features.
downgradedatabase is a more appropriate name.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
09f2a187 by Andrew Bartlett at 2019-05-29T04:41:24Z
sambadowngradedatabase: Add "or later" to warning about using tools from Samba 4.8

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
74d15c9b by Aaron Haslett at 2019-05-29T04:41:24Z
downgradedatabase: blackbox test

This test confirms that running downgradedatabase causes all GUID keys to be
replaced with DN keys at the KV level

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
6005c8cb by Aaron Haslett at 2019-05-29T04:41:24Z
ldb: only used a->syntax->index_format_fn if GUID indexing is enabled

Only enable ORDERED_INTEGER and index_format_fn functionality if GUID
indexing is enabled.  This is in line with the rest of ldb_kv which binds
the new ORDERED_INTEGER to GUID indexed databases, and allows a practical
way to create the old index format (by disabling the GUID index).

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

- - - - -
08b9d204 by Aaron Haslett at 2019-05-29T04:41:24Z
ldb: binding ordered indexes to GUID indexing

To reduce the number of potential combinations of database features in
ldb, we want to link all new database features since 4.7. GUID indexing,
ordered integers, and pack format changes will all upgrade together.
This patch makes ordered integers only function if GUID indexing is
enabled. If GUID indexing is disabled, ORDERED_INTEGER will not be
written to @ATTRIBUTES and a syntax's index_format_fn will never be
used.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
d6ded22c by Aaron Haslett at 2019-05-29T04:41:24Z
downgradedatabase: blackbox: check ordered integer removed

Test that when we undo GUID indexing on a TDB-backed database with
downgradedatabase, ORDERED_INTEGER is removed from @ATTRIBUTES

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
73763acf by Aaron Haslett at 2019-05-29T04:41:24Z
ldb: repack old format database if GUID indexing enabled

VERY IMPORTANT PATCH
Now that we have a new packing format, we need to enable it by repacking
the database. We've decided to link all new database features together,
so once GUID indexing is enabled, the database will be repacked with
version 2 format. Repacking is done following the same iterate pattern as
reindexing.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
8db1312b by Aaron Haslett at 2019-05-29T04:41:24Z
ldb: python test for repack

Python test to confirm that after enabling or disabling GUID indexing,
the database is repacked on the next transaction with V1 if GUID
indexing was disabled, or V2 if it was enabled.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
68d99187 by Aaron Haslett at 2019-05-29T04:41:24Z
downgradedatabase: blackbox: database repacked

Now that the database is repacked when GUID indexing is toggled on TDB,
test that downgradedatabase repacks a TDB-backed database with V2 pack
format database with V1.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
6b4abb99 by Aaron Haslett at 2019-05-29T04:41:25Z
ldb: pack_format_override option

For TDB databases, toggling GUID indexing mode will also toggle
pack format version 2. This provides a convenient downgrade path for
Samba databases, but the process doesn't work for MDB databases because
GUID indexing cannot be disabled when the MDB backend is used. This patch
addresses that corner case by providing support for a pack_format_override
option which will force the database to use pack format version 2.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

- - - - -
4eee09a2 by Aaron Haslett at 2019-05-29T04:41:25Z
dsdb: disable ORDERED_INTEGER with MDB pack format v1

For TDB databases, the new ORDERED_INTEGER type is disabled along with
repacking at format version 1 if GUID indexing is disabled, so all the new
database features are toggled together. This scheme doesn't work with
MDB because GUID indexing is mandatory when using MDB. However, a
downgrade path is still required so in a previous commit we added
a pack_format_override option which allows a downgrade script to force
the database to use an earlier packing format. But, the new
ORDERED_INTEGER type would still be present in MDB databases so this
patch reads the pack_format_override opaque and converts ORDERED_INTEGER
types in @ATTRIBUTES to INTEGER and doesn't write any indexes of that
type to @INDEXLIST. The @INDEXLIST will be refreshed later, on the first
transaction.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

- - - - -
0942a65b by Aaron Haslett at 2019-05-29T04:41:25Z
downgradedatabase: adding special case for MDB

Though this script was initially written for undoing GUID indexing on
TDB databases, we're repurposing it to do a full downgrade of any
database. MDB databases can't be DN indexed, but they can have pack
format version 2 and ORDERED_INTEGER data types, which must be removed
during a downgrade.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

- - - - -
4a95410a by Aaron Haslett at 2019-05-29T04:41:25Z
downgradedatabase: blackbox: MDB backend

When Samba uses TDB as a backend store, all new database features are
toggled on/off when GUID indexing is toggled. But, GUID indexing can't
be disabled on MDB, so the other features are toggled separately.
Consequently, the downgradedatabase script behaves differently depending
on the database backend. This patch adds testing for the MDB behaviour.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

- - - - -
8831b06d by Aaron Haslett at 2019-05-29T05:56:59Z
ldb: Release ldb 2.0.3

* Default pack format changed to version 2 for GUID Indexed databases
  (essentially Samba's sam.ldb). This means faster unpacking for records
  with lots of attributes.

* Enforce link between all new database features, following toggling of
  GUID indexing. If user toggles GUID indexing on/off, target pack format
  is changed. Likewise the special ORDERED_INTEGER index format is used
  (when GUID indexing on) or behaves like INTEGER (when GUID indexing off).

* Database repacked if packing format not as expected.

* In the case of MDB, since GUID indexing is mandatory, feature toggling
  provided by pack_format_override LDB option.

* Check for errors from ldb_unpack_data() in ldb_tdb

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May 29 05:56:59 UTC 2019 on sn-devel-184

- - - - -
fd3f37af by Noel Power at 2019-05-29T10:10:23Z
lib/util: Fix cppcheck null pointer dereference warning

lib/util/talloc_report.c:58: warning: nullPointer: Possible null pointer dereference: start <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f5af3cb2 by Noel Power at 2019-05-29T10:10:23Z
s3/libads: cppcheck fix error: shiftTooManyBitsSigned: error

Squash 'Shifting signed 32-bit value by 31 bits is undefined behaviour'
error

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
75afaeb7 by Noel Power at 2019-05-29T10:10:23Z
s3/lib/netapi: Fix 'Possible null pointer dereference' warning

source3/lib/netapi/localgroup.c:1103: warning: nullPointer: Possible null pointer dereference: r <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
5477b83d by Noel Power at 2019-05-29T10:10:23Z
s3/lib: don't write to buffer (which might be NULL) if bufsize <=0

Some code depends that tdb_pack[va] will return the bytes it would
write to 'buf' if the bufsize passed in is <=0, writing to the
buffer is protected by with lines like
   if (bufsize && bufsize >= len) {
      /* write to 'buf' */
   }

however in these instances the local pointer to the buffer is still
modified
   buf += len;

It's quite probable if bufsize == 0 that buf itself is NULL,
in this case we should protect against performing pointer arithmetic.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
02017d35 by Noel Power at 2019-05-29T10:10:23Z
s3/printing: cppcheck avoid 'nullPointerArithmetic:' error

source3/printing/notify.c:94: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
/home/samba/samba-pidl/source3/printing/notify.c:96: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
/home/samba/samba-pidl/source3/printing/notify.c:103: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]

flatten_message function depends on behaviour of tdb_pack which will
return the bytes that would be written (without actually writing to the
buffer) if the bufsize passed is <=0. What we need to avoid here is the
default modification of buf (when it is initially NULL)

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
6555fa9d by Noel Power at 2019-05-29T10:10:23Z
s3/smbd: cppcheck: Fix ctunullpointer error

Fixes:

source3/smbd/files.c:783: error: ctunullpointer: Null pointer dereference: buf <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
32b282d5 by Douglas Bagnall at 2019-05-29T10:10:23Z
tests/samba-tool: test dns serverinfo/zoneinfo

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
0ae585db by Douglas Bagnall at 2019-05-29T11:29:17Z
samba-tool dns: use bytes for inet_ntop

>From Python's point of view, array.AddrArray is a list of byte-valued
integers. In Python 3 we can convert directly using the likes of

         bytes(array.AddrArray[i].MaxSa[8:24])

but in 4.10 we need to support both, so we use struct.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Wed May 29 11:29:17 UTC 2019 on sn-devel-184

- - - - -
7f48fbcf by Michael Hanselmann at 2019-05-30T07:12:11Z
ldb: Avoid read beyond buffer

Calling the "ldb_parse_tree" function with a filter consisting of
exactly a single space (" ") would trigger a read beyond the input
buffer. A unittest is included.

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

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
e1a4fb52 by Gary Lockyer at 2019-05-30T07:12:11Z
s4 lib rpc pyrpc: Fix error message

Fix the error message returned when unable to initialise an event context.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5e000a84 by Björn Baumbach at 2019-05-30T07:12:11Z
s4:torture:fsmo.py: test role transfers of dns partitions

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

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

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4793f8ed by Stefan Metzmacher at 2019-05-30T07:12:11Z
samba-tool: fix replication after dns partition fsmo role transfer

The new role owner need to replicate from the old role owner.

Before we told the old role owner to replicate from itself.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0fbb013b by Björn Baumbach at 2019-05-30T07:12:11Z
s4:torture:fsmo.py: remove unused 'net_cmd' variable

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

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6a2e3a15 by Stefan Metzmacher at 2019-05-30T07:12:11Z
samba-tool: use only one LDAP modify for dns partition fsmo role transfer

We should not risk that we end with no role owner.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
320a5c54 by Björn Baumbach at 2019-05-30T08:27:24Z
samba-tool: add 'import samba.drs_utils' to fsmo.py

On some systems we're seeing this:

 ERROR(<type 'exceptions.AttributeError'>): uncaught exception - 'module' object has no attribute 'drs_utils'
   File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 185, in _run
     return self.run(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/samba/netcmd/fsmo.py", line 533, in run
     transfer_dns_role(self.outf, sambaopts, credopts, role, samdb)
   File "/usr/lib/python2.7/dist-packages/samba/netcmd/fsmo.py", line 136, in transfer_dns_role
     except samba.drs_utils.drsException as e:

E.g. it happens on debian stretch (9.9) with python 2.7.13 (on 4.10.4)

While it doesn't happen on ubuntu 18.04 with python 2.7.15rc1 or
with python 3.6.7.

There were also some reports on the mailing lists, see:
https://lists.samba.org/archive/samba-technical/2019-May/133624.html

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

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

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu May 30 08:27:24 UTC 2019 on sn-devel-184

- - - - -
585d4d49 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_fset()

On the course of removing ad_handle from struct adouble, step 1.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c78ba30a by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_set()

On the course of removing ad_handle from struct adouble, step 2.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d0abf945 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_read()

On the course of removing ad_handle from struct adouble, step 3.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
f8df0915 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_read_meta()

On the course of removing ad_handle from struct adouble, step 4.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
47721d8d by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: indentation fix

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
30ca328c by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: use proper VFS function in ad_read_meta()

Continuing to ignore a possible error for now, this is in an error codepath
anyway.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
661dfa4a by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_read_rsrc() and all the way down

On the course of removing ad_handle from struct adouble, step 5.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
400b3c2f by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: indentation fix

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
fd2f4cf8 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_convert_xattr()

On the course of removing ad_handle from struct adouble, step 7.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
adc7ac38 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_convert_blank_rfork()

On the course of removing ad_handle from struct adouble, step 8.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
50874c15 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_convert_finderinfo()

On the course of removing ad_handle from struct adouble, step 9.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
5f4d16b4 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: pass handle to ad_convert_delete_adfile()

On the course of removing ad_handle from struct adouble, step 10.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e266daae by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: finally, remove ad_handle from struct adouble

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ad70c947 by Ralph Boehme at 2019-05-30T20:19:26Z
vfs_fruit: add and use is_adouble_file()

This adds a helper function that checks whether the last component of a path is
an AppleDouble sidecar file with "._" name prefix.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
44d85680 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: add a missing else

Luckily the missing else has the same control flow due to the previous if and
else blocks calling return.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
797dc649 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: ignore AppleDouble files in fruit_unlink()

Otherwise, if SMB_VFS_UNLINK() is called for an AppleDouble path "._file", we
try to delete "._._file" which doesn't make sense. AppleDouble files don't have
AppleDouble themselves.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
83179a74 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: use correct case FRUIT_RSRC_STREAM in readdir_attr_rfork_size()

This is a genuine bug, but luckily this would only impact configs which nobody
uses:

  fruit:metadata = netatalk
  fruit:resource = stream

With the above configuration the switch in readdir_attr_rfork_size() would hit
the default case and so always report resource forks as 0 bytes in size.

All deployment that I've seen that use fruit:resource=stream also use
fruit:metadata=stream, so the switch takes FRUIT_META_STREAM case which runs the
correct code readdir_attr_rfork_size_stream().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a23bcc19 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: use stream code for resource fork size calculation in readdir_attr_rfork_size()

This works as well, using an fstat() on the filehandle to get the size. This is
tested by the torture test "vfs.fruit.SMB2/CREATE context AAPL".

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
cb9dffa1 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: remove now unused AppleDouble code for resource fork in xattr

This was only needed to get the resourcefork size via the ad_* AppleDouble
function. This is now done with a fstat on the low level xattr fd (remember,
this is Solaris only code...), so we can remove the xattr special casing from
the AppleDouble functions.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e3cb1cb2 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: remove xattr code from the AppleDouble subsystem

The subsystem consumers have been reworked in the previous commits, so this is
not used anymore. ad_init() doesn't need a handle argument anymore due to this,
remove it as well.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3919ea04 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: pass VFS handle to ad_convert_move_reso()

Not used for now, that comes next.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
97d485ff by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: remove a layer of indirection

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
f5f7d1e9 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: only do cross protocol locking on non-internal opens

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
29418c72 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: convert ad_open_rsrc() to open a proper fsp with SMB_VFS_CREATE_FILE()

A first step in converting all raw syscalls to use proper VFS functions. All
existing users of the raw system filedescriptor continue to use the fd from
fsp->fh for now.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
0041855a by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: remove use of mmap() from ad_convert_move_reso()

We now have an fsp that we can use, so we can get rid of mmap() and
sys_pread()/sys_pwrite().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4ff7ea0e by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: use fsp and remove mmap in ad_convert_xattr()

No need to mmap() anyway, the xattr data is already available in ad->ad_data.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
4e44b1da by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: add VFS handle to ad_convert_truncate()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3739ad90 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: use VFS function in ad_convert_truncate()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
70c4a8f0 by Ralph Boehme at 2019-05-30T20:19:27Z
vfs_fruit: use fsp and remove syscalls from ad_convert_blank_rfork()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
9fe84a63 by Ralph Boehme at 2019-05-30T20:19:28Z
vfs_fruit: use VFS functions in ad_read_rsrc_adouble()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
9a2c9834 by Ralph Boehme at 2019-05-30T22:12:50Z
vfs_fruit: remove a now unnecessary include

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May 30 22:12:50 UTC 2019 on sn-devel-184

- - - - -
8e3bc591 by Tim Beale at 2019-05-31T05:18:20Z
selftest: Allow for wider range of terminals (besides xterm)

Allow developers to override the default @term_args, as well as the
terminal itself.

Currently, due to the nature of the args we pass to xterm (i.e. 'echo -e
"blah.." && bash'), it doesn't make it very flexible for use with other
terminals. By dropping these additional @term_args, it makes it much
easier to slot in an alternative terminal.

For example, these commands now work (more or less).

TERMINAL="terminator" TERMINAL_ARGS="-x bash" \
 SELFTEST_TESTENV=ad_dc make testenv

TERMINAL="bash" TERMINAL_ARGS="" \
 SELFTEST_TESTENV=nt4_dc make testenv

TERMINAL="bash" TERMINAL_ARGS="--norc" \
 SELFTEST_TESTENV=none make testenv

bash is usable, but a little weird because its output is still being
piped. Also bash with ad_dc is a little weird because we're using tee
for the DC's stdout. (I'd also recommend --norc, as it makes it easier
to differentiate between the testenv shell).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5635a7ce by Tim Beale at 2019-05-31T05:18:20Z
selftest: Add helper scripts to run selftest in namespaces

This adds the underlying scripts, but they are not actually hooked up to
the selftest code yet, and so are not actually used.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c9e62513 by Tim Beale at 2019-05-31T05:18:20Z
selftest: Add TESTENV_DIR "env" variable

We store the testenv directory path for the 'ctx' hashmap, but not for
the testenv-vars hashmap (and that can be really annoying sometimes).
Add it into the second hashmap that selftest actually keeps track of.
Currently it's only stored in the hashmap, not actually exported as an
environment variable (but we could easily do that if a test-case need
this info).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
067b4fc0 by Tim Beale at 2019-05-31T05:18:20Z
selftest: Add linux namespace support (USE_NAMESPACES=1)

This hooks up the selftest/ns/* scripts added earlier with the selftest
system, so developers can optionally run a testenv or test using linux
namespaces instead of socket-wrapper.

The idea is this is experimental functionality that we can extend
further in future, in order to make testing Samba more versatile.

+ The top-level WAF script now does an 'unshare' to create a new
top-level 'selftest' namespace in which to create the testenv(s).
+ selftest.pl creates a common 'selftest0' bridge to connect together
the individual DCs.
+ Update Samba.pm so it can use real IPs instead of loopback addresses.
In fork_and_exec(), we add a couple of hooks so that the binary gets
started in a different namespace (using unshare/start_in_ns.sh), and
the parent process connects the new child namespace up to the common
selftest0 bridge (using add_bridge_iface.sh).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c68537d5 by Tim Beale at 2019-05-31T05:18:20Z
selftest: Add helper scripts for accessing the testenv namespace

This patch adds some helper scripts that make talking to a given
testenv's namespace slightly easier.

One of the really cool things about namespaces is you can run multiple
different programs that can all talk to the testenv DC. However, the
command to do this is a bit unweildly, it's based on PID so it changes
everytime you start up a testenv, and you loose all the environment
variables that selftest normally sets up.

This patch adds a couple of helper scripts:
- nsenter-helper.sh: this takes the variables defined in an exports_file
  and exports them all. It prints some basic help and then starts a new
  shell session (this whole script gets run in the new namespace).
  Essentially this achieves something similar to the legacy
  selftest-vars.sh script (except this one actually works).
- mk_nsenter.sh: this generates a simple wrapper script that'll run
  nsenter and then call nsenter-helper.sh. A separate wrapper script
  gets created for each testenv. E.g. to run it, just go:
    ./st/ad_dc/nsenter.sh

  This is a wrapper for a more complicated command underneath like:
    nsenter -t 437353 --net --user --preserve-credentials \
      /home/timbeale/code/samba/selftest/ns/nsenter-helper.sh \
      /home/timbeale/code/samba/st/ad_dc/exports.sh

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
900af92e by Tim Beale at 2019-05-31T05:18:21Z
selftest: Add more notes on using selftest with namespaces

In particular, document how to hook up a testenv to a Windows VM
(ideally there should be a helper script to do this, but in the
meantime some instructions are better than nothing).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f2f0ebb0 by Tim Beale at 2019-05-31T05:18:21Z
provision: Fallback to assumption root-UID==zero

Which is not a terrible assumption to make. The super-user on linux will
always have UID of zero, however, the super-user will not necessarily be
called "root".

This makes the provision/join commands work better when run in a
container. (And while deploying Samba in a container is perhaps not the
smartest move, this gives us some versatility when testing Samba).

This is needed to get the provision commands working in the domain_backup
tests when run with USE_NAMESPACES=1.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6defc1f1 by Tim Beale at 2019-05-31T05:18:21Z
selftest: Add check customdc has valid realm/domain

If we couldn't determine the realm/domain from the backup file, it's a
lot nicer to fail early with a clear error message (rather than failing
later on with a really obscure message).

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b23d005c by Tim Beale at 2019-05-31T06:34:36Z
selftest: Don't use global dirs when parsing customdc realm

When creating the customdc, testparm would default to using
/usr/local/samba sub-directories for creating sockets and lock files.
Instead, pass in the tmpdir we just created as an option to the command.

Normally this didn't cause a noticeable problem, however, if we run the
command with UID-wrapper but without socket-wrapper (i.e.
USE_NAMESPACES=1), then it fails completely.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri May 31 06:34:36 UTC 2019 on sn-devel-184

- - - - -
b5bf1b66 by Joe Guo at 2019-05-31T09:48:37Z
.gitlab-ci.yml: avoid using != to compare variables to support old versions

`!=` was only introduced after 11.11, according to doc at:

https://docs.gitlab.com/ee/ci/variables/README.html#environment-variables-expressions

For private gitlab instance, the version may not be new enough.
Use `==` to make it backward compatible.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Fri May 31 09:48:37 UTC 2019 on sn-devel-184

- - - - -
eb2e29c3 by Anoop C S at 2019-05-31T20:38:09Z
s3-smbcontrol: Replace && with || to declare variables in do_sleep()

--enable-developer internally use --enable-selftest alongside. But when
configured only with --enable-selftest the following code block becomes
invalid:

 #if defined(DEVELOPER) && defined(ENABLE_SELFTEST)
        unsigned int seconds;
        long input;
        const long MAX_SLEEP = 60 * 60; /* One hour maximum sleep */
 #endif

making those variables undeclared for further use. Therefore replace &&
with || to have those variables declared with --enable-selftest
configure option.

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Fri May 31 20:38:09 UTC 2019 on sn-devel-184

- - - - -
ead9b93c by Stefan Metzmacher at 2019-06-04T22:13:07Z
s4:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()

The domain join with VMWare Horizon Quickprep seems to use
netr_ServerAuthenticate3() with just the NEG_STRONG_KEYS
(and in addition the NEG_SUPPORTS_AES) just to verify a password.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13464 (maybe)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13949

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
fa5215ce by Stefan Metzmacher at 2019-06-04T22:13:07Z
s3:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()

The domain join with VMWare Horizon Quickprep seems to use
netr_ServerAuthenticate3() with just the NEG_STRONG_KEYS
(and in addition the NEG_SUPPORTS_AES) just to verify a password.

Note: NETLOGON_NEG_SCHANNEL is an alias to NEG_AUTHENTICATED_RPC.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13464 (maybe)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13949

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
0b6e37c9 by Stefan Metzmacher at 2019-06-04T22:13:07Z
s3:rpc_server:netlogon: simplify AUTH_TYPE_SCHANNEL check in netr_creds_server_step_check()

The gensec schannel module already asserts that at least
AUTH_LEVEL_INTEGRITY is used.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
05d0806e by Noel Power at 2019-06-04T22:13:07Z
s4/ntvfs/cifs: cppcheck: squash nullPointer: Possible null pointer dereference

Fix the following cppcheck warnings

/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:604: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]
/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:605: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]
/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:648: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]
/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:649: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2bed937e by Noel Power at 2019-06-04T22:13:07Z
s4/rpc_server/dnsserver: cppcheck: Fix Uninitialized variable error.

source4/rpc_server/dnsserver/dcerpc_dnsserver.c:715: error: uninitvar: Uninitialized variable: answer_integer <--[cppcheck]

This error is benign and somewhat false because the code pointed to does
not run (due to a different check) if answer_integer is not actually
initialsed. It is easy to squash it though by just initialising the var.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
bcc6b8c2 by Noel Power at 2019-06-04T22:13:07Z
s4/rpc_server/dnsserver: clang: fix Value stored to 'status' is never read

Fix the following warnings

source4/rpc_server/dnsserver/dcerpc_dnsserver.c:1021: error: uninitvar: Uninitialized variable: answer_integer <--[cppcheck]
source4/rpc_server/dnsserver/dcerpc_dnsserver.c:1723:4: warning: Value stored to 'status' is never read <--[clang]
                        status = dns_fill_records_array(tmp_ctx, NULL, DNS_TYPE_A,
                        ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
source4/rpc_server/dnsserver/dcerpc_dnsserver.c:1881:4: warning: Value stored to 'status' is never read <--[clang]
                        status = dns_fill_records_array(tmp_ctx, NULL, DNS_TYPE_A,

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
8c49cf70 by Noel Power at 2019-06-04T22:13:07Z
s4/smb_server/smb: cppcheck: Fix uninitvar & uninitStructMember errors

Fixes the following errors (note: existing code is safe the way it is
currently all accesses to the structure are 'after' it is assigned)

source4/smb_server/smb/negprot.c:447: error: uninitvar: Uninitialized variable: blob <--[cppcheck]
source4/smb_server/smb/negprot.c:453: error: uninitStructMember: Uninitialized struct member: blob.data <--[cppcheck]
source4/smb_server/smb/negprot.c:447: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]
source4/smb_server/smb/negprot.c:453: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]
source4/smb_server/smb/negprot.c:454: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]
source4/smb_server/smb/negprot.c:455: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
9c7113a4 by Noel Power at 2019-06-04T22:13:07Z
s4/smdb: cppcheck: fix nullPointer: Possible null pointer dereference warning.

Insert unreachable return to satisfy the following warnings

source4/smbd/server.c:692: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:694: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:699: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:758: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:789: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:849: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:866: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f3f79a26 by Noel Power at 2019-06-04T22:13:07Z
nsswitch: cppcheck: Fix memleakOnRealloc errors

Fixes the following errors

nsswitch/nsstest.c:192: error: memleakOnRealloc: Common realloc mistake: 'buf' nulled but not freed upon failure <--[cppcheck]
nsswitch/nsstest.c:230: error: memleakOnRealloc: Common realloc mistake: 'buf' nulled but not freed upon failure <--[cppcheck]
nsswitch/nsstest.c:269: error: memleakOnRealloc: Common realloc mistake: 'buf' nulled but not freed upon failure <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
bb00a7e0 by Noel Power at 2019-06-04T22:13:07Z
s4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error

Fix

source4/torture/raw/notify.c:831: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:838: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:849: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:861: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:869: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:882: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:892: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:903: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:914: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:929: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:941: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:951: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:961: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:972: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:982: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
90a82a41 by Noel Power at 2019-06-04T22:13:07Z
s4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error

Fix

source4/torture/raw/open.c:1009: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/open.c:1048: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c8cdc016 by Noel Power at 2019-06-04T22:13:07Z
s4/torture/smb2: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source4/torture/smb2/create.c:197: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/create.c:234: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/create.c:265: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
43500e41 by Noel Power at 2019-06-04T22:13:07Z
s4/torture/smb2: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source4/torture/smb2/notify.c:974: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:994: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1002: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1011: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1025: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1040: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1048: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1062: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1081: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1096: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1112: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1125: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
a497fa9b by Noel Power at 2019-06-04T22:13:07Z
s4/torture/unix: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source4/torture/unix/unix_info2.c:300: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
e2ee3f89 by Noel Power at 2019-06-04T22:13:07Z
s3/rpcclient: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source3/rpcclient/cmd_srvsvc.c:44: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
4d095bd0 by Noel Power at 2019-06-04T22:13:07Z
lib/pthreadpool: cppcheck: Fix Memory leak

Fixes

lib/pthreadpool/tests.c:63: error: memleak: Memory leak: finished <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
52cf237b by Noel Power at 2019-06-04T22:13:07Z
s3/modules: cppcheck: Fix ctunullpointer error

Fixes

source3/modules/vfs_syncops.c:117: error: ctunullpointer: Null pointer dereference: smb_fname <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
edbef9e0 by Noel Power at 2019-06-04T22:13:07Z
s3/winbdind: cppcheck: fix nullPointerArithmetic error

Fixes

source3/winbindd/winbindd_cache.c:4386: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
source3/winbindd/winbindd_cache.c:4400: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
source3/winbindd/winbindd_cache.c:1569:24: warning: Dereference of null pointer <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
71e7b5d1 by Noel Power at 2019-06-04T22:13:07Z
ctdb/server: cppcheck: fix shiftTooManyBitsSigned error

Fixes

ctdb/server/ipalloc_lcp2.c:61: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
a0ccec62 by Noel Power at 2019-06-04T22:13:07Z
lib/util/tests: clang fix Value stored to 'lines' is never read warning

Fixes

lib/util/tests/file.c:153:2: warning: Value stored to 'lines' is never read <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
dc82866d by Noel Power at 2019-06-04T22:13:07Z
nsswitch: cppcheck: Fix ctunullpointer error

Fixes

nsswitch/pam_winbind.c:1379: error: ctunullpointer: Null pointer dereference: info <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
046de055 by Andreas Schneider at 2019-06-04T22:13:07Z
s3:modules: Put debug msg into the if clause checking the strings exists

error: '%s' directive argument is null [-Werror=format-overflow=]

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
dbf3e81f by Andrew Bartlett at 2019-06-04T22:13:07Z
docs: Improve documentation of "lanman auth" and "ntlm auth" connection

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3ce9069a by Stefan Metzmacher at 2019-06-04T22:13:07Z
ctdb:protocol_util: remove 'const' from allocated strings

The caller should be able to call TALLOC_FREE() on the returned
strings.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
b9b3acf2 by Stefan Metzmacher at 2019-06-04T22:13:07Z
ctdb:takeover: add better debugging when a client connects to a non public address

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>

- - - - -
843fbb12 by Rafael David Tinoco via samba-technical at 2019-06-04T23:31:24Z
ctdb-scripts: Fix tcp_tw_recycle existence check

net.ipv4.tcp_tw_recycle has been removed from Linux 4.12 but, still,
makes sense to check its existence. Unfortunately, current check does
not test for the procfs file existence. This commit fixes the issue.

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

Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Jun  4 23:31:24 UTC 2019 on sn-devel-184

- - - - -
2558f96d by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-tools: Fix signed/unsigned comparisons by declaring as unsigned

These are the simple cases where a variable (usually a loop variable)
needs to be declared as an unsigned type (usually unsigned int or
size_t) instead of an int.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
865f127e by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-tools: Fix signed/unsigned comparisons by declaring extra variable

This needs an extra variable because variable i has been used in both
signed and unsigned contexts.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
4a8ca519 by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-tools: Fix signed/unsigned comparisons by casting

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
201066d2 by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-tools: Fix signed/unsigned comparison by declaring as unsigned

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
282221b0 by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-tools: Fix signed/unsigned comparison by declaring as int

There's no point using unsigned here.  tdb_traverse() returns an int
for the number of records traversed and the number of empty records
can't exceed this value.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
9869ac1f by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-tools: Fix signed/unsigned conversion by declaring as size_t

All the top-level callers pass size_t.

Drop the ternary operator.  The value of hsize is always positive
because it is unsigned.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
938df1db by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-tools: Fix potentially uninitialised data

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
5b9456b7 by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-common: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where a variable (usually a loop variable) needs to be
declared as an unsigned type (unsigned int or size_t) instead of an
int.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
2b3150db by Martin Schwenke at 2019-06-05T10:25:49Z
ctdb-common: Fix signed/unsigned comparisons by casting

In one case, given triviality of change, add missing braces and fix
whitespace.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
cf9199f4 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-common: Use #ifdef to avoid TEST_RB_TREE not defined

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
94e41a84 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-common: Avoid warning for potentially uninitialised pointers

s_list generates a warning, but initialise them both.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
887dc174 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-common: Avoid unused value warning

The incremented value of argc is indeed never used.  Leave it as a
comment to warn anyone cutting and pasting the code.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
2be15d3c by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-client: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where a variables and function parameters need to be
declared as an unsigned type instead of an int.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
2c76a957 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-client: Fix potentially uninitialised data

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
7fa6c120 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-tests: Fix signed/unsigned comparison by using constant

Variable reqid is unsigned, so don't compare with -1.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
fa7bd35b by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where variables need to be declared as an unsigned type
instead of an int.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
978c7dbd by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-recovery: Fix signed/unsigned comparison by casting

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
35368d87 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-recovery: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
90622ab9 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where variables and function parameters need to be
declared as an unsigned type instead of an int.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
0bd87d75 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-utils: Avoid warning about unused value

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
18b4a3a0 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-tests: Avoid potentially uninitialised data

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
86666d65 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-ipalloc: Fix signed/unsigned comparisons by declaring as unsigned

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
7df15b24 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-ipalloc: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead

This fixes warnings about signed versus unsigned comparisons.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
2db0e71d by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-ipalloc: Fix warning about unused value assigned to srcimbl

To make this much clearer, move the declaration into the scope where
it is used.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
aa602a8c by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-cluster: CID 1435726: NULL pointer dereference

Also found by csbuild.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
b1d83fb3 by Martin Schwenke at 2019-06-05T10:25:50Z
ctdb-daemon: Attempt to silence CID 1357985 (Unchecked return value)

Yes, the other callers check the return value of ctdb_lockdb_mark().
However, this is called in a void function and ctdb_lockdb_mark() has
already printed any error message.  All we can do is explicitly ignore
the return value.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
952437b1 by Martin Schwenke at 2019-06-05T12:09:56Z
ctdb-utils: Fix CID 1125558 (Unchecked return value from library)

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Wed Jun  5 12:09:56 UTC 2019 on sn-devel-184

- - - - -
aabdcc91 by Andreas Schneider at 2019-06-05T15:40:23Z
third_party: Update waf to version 2.0.17

This fixes building Samba, libtalloc, libtevent, libtdb and libldb with
Python 3.8.

     wget https://waf.io/waf-2.0.17.tar.bz2
     tar -xf waf-2.0.17.tar.bz2
     git rm third_party/waf/waflib/ -r
     mkdir third_party/waf -p
     rsync -a waf-2.0.17/waflib/ third_party/waf/waflib/
     git add third_party/waf/waflib/

(Then update version number in buildtools/bin/waf and
buildtools/wafsamba/wafsamba.py)

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
96843452 by Gary Lockyer at 2019-06-05T15:40:23Z
tests auth log winbind: Fix flapping test

Fix flapping auth_log_winbind tests, were seeing failures like

UNEXPECTED(failure):
samba.tests.auth_log_winbind.samba.tests.auth_log_winbind.AuthLogTestsWinbind.
test_wbinfo(ad_member:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "bin/python/samba/tests/auth_log_winbind.py", line 328, in
  test_wbinfo
      self.assertEquals(logon_id, msg["Authentication"]["logonId"])
      AssertionError: '812b7158bff1660e' != '2cfc1fed76ff8865'
      - 812b7158bff1660e
      + 2cfc1fed76ff8865

Test had a race condition with other SamLogon events on the domain
server. The tests can now handle multiple SamLogon messages and filter
out the SamLogon messages for other logons.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8096cc7e by Ralph Boehme at 2019-06-05T15:40:23Z
s3:auth: add reinit_guest_session_info()

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f4e340a4 by Ralph Boehme at 2019-06-05T15:40:23Z
s3:smbd: call reinit_guest_session_info() in the conf updated handler

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ac2167eb by Ralph Boehme at 2019-06-05T15:40:24Z
selftest: allow guest login in the ad_member_idmap_rid env

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0e88f988 by Ralph Boehme at 2019-06-05T15:40:24Z
tests: add a test for guest authentication

This verifies that smbd always adds BUILTIN\Guests to the guest token which is
required for guest authentication.

Currently the guest token depends on the on-disk configured group mappings. If
there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
a member, the final guest token won't contain BUILTIN\Guests.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a66af4c9 by Ralph Boehme at 2019-06-05T16:55:26Z
s3:auth: explicitly add BUILTIN\Guests to the guest token

This changes ensures that smbd always adds BUILTIN\Guests to the guest token
which is required for guest authentication.

Currently the guest token depends on the on-disk configured group mappings. If
there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
a member, the final guest token won't contain BUILTIN\Guests.

For SMB2 the flag SMB2_SESSION_FLAG_IS_GUEST will not be set in the final SMB2
SESSION_SETUP response, because smbd sets it based on the token containing the
BUILTIN\Guests SID S-1-5-32-546.

At the same time, the packet is not signed which causes Windows clients and
smbclient to reject the unsigned SMB2 SESSION_SETUP response.

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

Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Jun  5 16:55:26 UTC 2019 on sn-devel-184

- - - - -
0e771f0e by Gary Lockyer at 2019-06-06T03:30:18Z
tests blackbox ndrdump: Add test for struct printing

Add test for the dumping of a public structure with ndrdump.  This
removes the need to define decode_* functions in the idl.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5d67e87d by Gary Lockyer at 2019-06-06T03:30:18Z
pidl: Allow ndrdump to print public structures

Generate code to allow ndrdump to operate on public structures.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

- - - - -
3bf05fbf by Gary Lockyer at 2019-06-06T03:30:18Z
ndrdump: print public structures

Add a struct option to ndrdump that will allow it to print public
structures.
  i.e. binn/ndrdump dns dns_name_packet struct data.file

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
41afed11 by Gary Lockyer at 2019-06-06T03:30:18Z
drsblobs.idl: remove decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0195e8d4 by Gary Lockyer at 2019-06-06T03:30:18Z
ntlmssp.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
52cb4f11 by Gary Lockyer at 2019-06-06T03:30:18Z
dnsp.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1d89808d by Gary Lockyer at 2019-06-06T03:30:18Z
cab.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
66218cf1 by Gary Lockyer at 2019-06-06T03:30:18Z
krb5pac.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f5cf33fa by Gary Lockyer at 2019-06-06T03:30:18Z
nbt.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
939d72df by Gary Lockyer at 2019-06-06T03:30:18Z
negoex.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c89cfbd1 by Gary Lockyer at 2019-06-06T03:30:18Z
preg.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
dc786894 by Gary Lockyer at 2019-06-06T03:30:18Z
security.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
883f2fa3 by Gary Lockyer at 2019-06-06T03:30:18Z
ntp_signd.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2254d0e4 by Gary Lockyer at 2019-06-06T03:30:18Z
sasl_helpers.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
92d37950 by Gary Lockyer at 2019-06-06T03:30:18Z
winsrepl.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
532ba5a0 by Gary Lockyer at 2019-06-06T03:30:18Z
ntprinting.idl: remove decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7680010e by Gary Lockyer at 2019-06-06T04:58:17Z
tests blackbox ndrdump: Clean up pep8 warnings

Clean up the test code and remove the pep8 warnings

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Jun  6 04:58:18 UTC 2019 on sn-devel-184

- - - - -
0b81dca2 by Andrew Bartlett at 2019-06-06T12:14:24Z
py3: Remove Python2 side of py3compat.h

This is unused as we do not support building python modules (etc) under py2.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6a8c7adc by Andrew Bartlett at 2019-06-06T12:14:24Z
py3: Remove unused IS_PY3 macro from py3compat.h

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cff26b47 by Andrew Bartlett at 2019-06-06T12:14:24Z
py3: Remove unused PyStr_CheckExact macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
00718304 by Andrew Bartlett at 2019-06-06T12:14:24Z
py3: Remove unused PyStr_Concat macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e191788c by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyStr_Format macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e6da3fcf by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyStr_InternInPlace macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1c92e7bd by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyStr_InternFromString macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a5b04db6 by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyStr_Decode macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5c15e68b by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyStr_AsUTF8String macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2dfcf652 by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PY_DESC_PY3_STRING macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
09fecb67 by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyInt_CheckExact macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7bd3d0f7 by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyInt_FromString macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f3523991 by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyInt_FromSsize_t macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
03cb50cf by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyInt_FromSize_t macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6e2e80a4 by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyInt_AS_LONG macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
88d62288 by Andrew Bartlett at 2019-06-06T12:14:25Z
py3: Remove unused PyInt_AsUnsignedLongLongMask macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0d4738ee by Andrew Bartlett at 2019-06-06T13:26:05Z
py3: Remove unused PyInt_AsSsize_t macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Jun  6 13:26:05 UTC 2019 on sn-devel-184

- - - - -
ab376a97 by Andrew Bartlett at 2019-06-07T19:50:11Z
selftest: Specifically remove files generated by provision

This allows the changes in 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45 to
be reverted, and aligns this test with others that use TestCaseInTempDir.

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
56400153 by Andrew Bartlett at 2019-06-07T21:08:12Z
Revert TestCaseInSubDir parts of "downgradedatabase: blackbox test"

This reverts part of commit 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45.

TestCaseInSubDir should not have been modified in this way, instead
the downgradedatabase test should have removed the files it created
specifically (this is part of the test, it shows the right files were
created).

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jun  7 21:08:12 UTC 2019 on sn-devel-184

- - - - -
ff4a5f64 by Gary Lockyer at 2019-06-10T06:13:27Z
WHATSNEW.txt: reindex performance, Bind9 logging

Add entries for:
  Reindex performance improvements
  Bind9 logging
  LDAP referrals

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

Autobuild-User(master): Tim Beale <timbeale at samba.org>
Autobuild-Date(master): Mon Jun 10 06:13:27 UTC 2019 on sn-devel-184

- - - - -
1ea533bd by Günther Deschner at 2019-06-10T23:14:10Z
Revert "s3/vfs_glusterfs: Dynamically determine NAME_MAX"

This reverts commit 8e3a042eb9e502821b147f1bbb2d98d59f17a095.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
01a569be by Günther Deschner at 2019-06-10T23:14:10Z
Revert "s3/vfs_glusterfs_fuse: Dynamically determine NAME_MAX"

This reverts commit e28d172b00cadf492c22bd892e2dda3bf2fe2d70.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
e85bb585 by Günther Deschner at 2019-06-10T23:14:11Z
s3/vfs_glusterfs: Avoid using NAME_MAX directly

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
7cc9e3fe by Günther Deschner at 2019-06-11T00:29:19Z
s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Tue Jun 11 00:29:19 UTC 2019 on sn-devel-184

- - - - -
1c6db152 by Noel Power at 2019-06-11T12:10:17Z
s4/torture/rpc: cppcheck: Fix ctunullpointer error

Fixes

source4/torture/rpc/netlogon.c:307: error: ctunullpointer: Null pointer dereference: p <--[cppcheck]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
8f422ada by Noel Power at 2019-06-11T12:10:17Z
lib/tevent: clang:

Fixes:

lib/tevent/tevent_wrapper.c:213:6: warning: Access to field 'destroyed' results in a dereference of a null pointer (loaded from variable 'glue') <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
f7b816e2 by Noel Power at 2019-06-11T12:10:17Z
DLIST_REMOVE: clang: Fix dereference of a null pointer warning

Fixes:

lib/tevent/tevent_wrapper.c:295:3: warning: Access to field 'next' results in a dereference of a null pointer (loaded from field 'prev') <--[clang]

Additionally fix similar instance of the same macro

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
c8293d84 by Noel Power at 2019-06-11T12:10:17Z
lib/util: clang: Fix 'Null pointer passed as an argument...' warning

Fixes:

lib/util/debug.c:705:7: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
add47e28 by Noel Power at 2019-06-11T12:10:17Z
lib/util/charset: clang: Fix Value stored to 'reason' is never read warning

Fixes:

lib/util/charset/convert_string.c:301:5: warning: Value stored to 'reason' is never read <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
acd65542 by Noel Power at 2019-06-11T12:10:17Z
lib/util: clang: Fix a dereference of a null pointer warning(s)

Fixes:

lib/util/ms_fnmatch.c:75:8: warning: Access to field 'predot' results in a dereference of a null pointer (loaded from variable 'max_n') <--[clang]
                        if (max_n->predot && max_n->predot <= n) {
                            ^
lib/util/ms_fnmatch.c:91:8: warning: Access to field 'predot' results in a dereference of a null pointer (loaded from variable 'max_n') <--[clang]
                        if (max_n->predot && max_n->predot <= n) {

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
e104c018 by Noel Power at 2019-06-11T12:10:17Z
lib/util: clang: Fix dereference of a null pointer warning

Fixes:

lib/util/rbtree.c:170:8: warning: Access to field 'rb_parent_color' results in a dereference of a null pointer (loaded from variable 'other') <--[clang]

We could avoid accessing the NULL pointer but previously the code would
have crashed here. Given this is a rbtree probably better to preserve the
fatal nature of encountering a NULL pointer here while satisfying the static
checker.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
01529258 by Noel Power at 2019-06-11T12:10:17Z
librpc/ndr: clang: Fix Assigned value is garbage or undefined warning

Fixes:

librpc/ndr/ndr_basic.c:170:5: warning: Assigned value is garbage or undefined <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

- - - - -
49e2d369 by Noel Power at 2019-06-11T13:31:01Z
lib/tdb/common: clang: Fix 'Value stored to 'last_ptr' is never read'

Fixes

lib/tdb/common/freelistcheck.c:96:3: warning: Value stored to 'last_ptr' is never read <--[clang]
                last_ptr = rec_ptr;
                ^          ~~~~~~~

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Tue Jun 11 13:31:01 UTC 2019 on sn-devel-184

- - - - -
4646698f by Samuel Cabrero at 2019-06-11T14:01:20Z
s3: net: Consider unprocessed in input buffer

If there is unprocessed data in the input buffer (ilen > 0), place new
data read after the unprocessed one.

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
1817db96 by Andreas Schneider at 2019-06-11T14:01:20Z
libcli:smb: Fix signing with multichannel

Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
08750166 by Stefan Metzmacher at 2019-06-11T15:25:56Z
libcli/smb: add missing struct smb2_signing_key allocation in smb2cli_session_set_channel_key()

This was missing in commit 17e22e020fcb84fb9ddda350915369dc9ea28ef1
and causes all multi-channel tests to segfault.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Jun 11 15:25:56 UTC 2019 on sn-devel-184

- - - - -
824db296 by Stefan Metzmacher at 2019-06-12T12:42:26Z
Revert "libcli/smb: add missing struct smb2_signing_key allocation in smb2cli_session_set_channel_key()"

This reverts commit 08750166542f46644038d1ff9d839b270436addf.

This was pushed to fast, the corrected commit follows.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
2ad02acf by Stefan Metzmacher at 2019-06-12T12:42:26Z
Revert "libcli:smb: Fix signing with multichannel"

This reverts commit 1817db965dc0caf55e4308fa4d9203ab4381dc90.

This was pushed to fast, the corrected commit follows.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
7b1eab10 by Stefan Metzmacher at 2019-06-12T12:42:26Z
libcli/smb: make sure the session->{smb2->,smb2_channel.}signing_key is never NULL!

Before commit 17e22e020fcb84fb9ddda350915369dc9ea28ef1 they we not a
pointer and always be present.

We used the local pointer variable 'signing_key = NULL' and logic like
this:

    if (state->smb2.should_sign) {
        signing_key = state->session->smb2_channel.signing_key;
    }

    if (signing_key != NULL ...

In order to keep this we need to nake sure
state->session->smb2_channel.signing_key is never NULL!

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
1b46a10c by Andreas Schneider at 2019-06-12T12:42:26Z
libcli/smb: only fallback to the global smb2 signing key if we should sign

We should only sign if we're asked for it. The signing keys are
always generated, so we were always using global signing key
and signed with it when signing was not asked for.

By luck this was the correct signing key for the 1st channel.

But multi channel connections where broken is the server nor the client
require/desire signing. It seems the tests only ever run against
Windows domain controllers, which always require signing.

Note that the following code in smb2cli_req_create() makes
sure that we always sign session binds:

  if (cmd == SMB2_OP_SESSSETUP &&
      !smb2_signing_key_valid(session->smb2_channel.signing_key) &&
      smb2_signing_key_valid(session->smb2->signing_key))
  {
          /*
           * a session bind needs to be signed
           */
          state->smb2.should_sign = true;
  }

This removed a logic changed introduced in commit
17e22e020fcb84fb9ddda350915369dc9ea28ef1. As

  if (!smb2_signing_key_valid(signing_key)) {

is not the same as:

  if (signing_key && signing_key->length == 0) {

it's the same as:

  if (signing_key == NULL || signing_key->length == 0) {

so we need:

  if (signing_key != NULL && !smb2_signing_key_valid(signing_key)) {

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>

- - - - -
4d81e48a by Stefan Metzmacher at 2019-06-12T12:42:26Z
s4:torture: force signing in the smb2.session.bind1 test

This test is supposed to test which signing keys are used on
each of the channels, so it's important to require signing.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
317054f6 by Stefan Metzmacher at 2019-06-12T12:42:26Z
libcli/smb: s/smbXcli_session_copy/smbXcli_session_shallow_copy

We should make clear that this is a function for testing only,
with possible strange side effects.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
b336d09b by Stefan Metzmacher at 2019-06-12T13:56:19Z
libcli/smb: harden smbXcli_session_shallow_copy against nonce reusage

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Wed Jun 12 13:56:19 UTC 2019 on sn-devel-184

- - - - -
bf6620c5 by Christof Schmitt at 2019-06-12T20:02:26Z
torture: Use two connections in SMB2 sharemode tests

This allows using the unclist option to specify multiple targets, e.g.
for testing against multiple nodes in a clustered Samba environment.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jun 12 20:02:26 UTC 2019 on sn-devel-184

- - - - -
ae4461dc by Gary Lockyer at 2019-06-13T07:16:22Z
auth auth_log: csbuild unused parm unix_username

Fixes csbuild errors

Error: COMPILER_WARNING:
auth/auth_log.c: scope_hint: In function ‘log_authentication_event_json’
auth/auth_log.c:146:14: warning: unused parameter ‘unix_username’
[-Wunused-parameter]

Error: COMPILER_WARNING:
auth/auth_log.c: scope_hint: In function
‘log_authentication_event_human_readable’
auth/auth_log.c:586:14: warning: unused parameter ‘unix_username’
[-Wunused-parameter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
ea7c4ac9 by Gary Lockyer at 2019-06-13T07:16:22Z
auth auth_log: csbuild unused parm transport_protection

Fixes csbuild errors.

Error: COMPILER_WARNING:
auth/auth_log.c: scope_hint: In function
‘log_successful_authz_event_human_readable’
auth/auth_log.c:728:14: warning: unused parameter ‘transport_protection’
[-Wunused-param
eter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
357bac20 by Gary Lockyer at 2019-06-13T07:16:22Z
lib audit_logging tests: csbuild unused parms

Fixes csbuild unused parameter error:
   warning: unused parameter ‘state’
   warning: unused parameter ‘argc’
   warning: unused parameter ‘argv’

By adding _UNUSED_ to paramter declaration.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
883c7385 by Gary Lockyer at 2019-06-13T07:16:22Z
lib ldb ldb_key_value: csbuild unused parm module

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv.c: scope_hint: In function ‘ldb_kv_key_dn’
lib/ldb/ldb_key_value/ldb_kv.c:109:49: warning: unused parameter
‘module’ [-Wunused-para
meter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
8d2cfd45 by Gary Lockyer at 2019-06-13T07:16:22Z
lib ldb ldb_key_value: csbuild unused parm module

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv.c: scope_hint: In function
‘ldb_kv_guid_to_key’
lib/ldb/ldb_key_value/ldb_kv.c:157:43: warning: unused parameter
‘module’ [-Wunused-parameter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
1593f776 by Gary Lockyer at 2019-06-13T07:16:22Z
lib ldb ldb_key_value: csbuild unused parm ldb_kv

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv.c:158:33: warning: unused parameter
‘ldb_kv’ [-Wunused-parameter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
b78597e1 by Gary Lockyer at 2019-06-13T07:16:22Z
lib ldb: csbuild add lib/util/attr.h to dist

Add lib/util/attr.h to the ldb distribution, to make the _UNUSED_ macro
available.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
9284cc19 by Gary Lockyer at 2019-06-13T07:16:22Z
lib ldb ldb_key_value: csbuild unused parm ldb_kv_timeout

Fixes csbuild errors.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv.c: scope_hint: In function ‘ldb_kv_timeout’
lib/ldb/ldb_key_value/ldb_kv.c:1675:51: warning: unused parameter ‘ev’
[-Wunused-parameter]

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv.c:1676:28: warning: unused parameter ‘te’
[-Wunused-parameter]

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv.c:1677:22: warning: unused parameter ‘t’
[-Wunused-parameter]

Tag the unused variables in ldb_kv_timeout with _UNUSED_

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
5081d146 by Gary Lockyer at 2019-06-13T07:16:22Z
lib ldb ldb_key_value: csbuild fix integer comparison

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function
‘ldb_kv_key_dn_from_idx’
lib/ldb/ldb_key_value/ldb_kv_index.c:545:15: warning: comparison of
integer expressions of different signedness: ‘int’ and ‘unsigned int’
[-Wsign-compare]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
bf13c17f by Gary Lockyer at 2019-06-13T07:16:23Z
lib ldb ldb_key_value: csbuild unused parm tdb

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function
‘ldb_kv_index_traverse_store’
lib/ldb/ldb_key_value/ldb_kv_index.c:779:60: warning: unused parameter
‘tdb’ [-Wunused-parameter]

By tagging the tdb_context parameter in ldb_kv_index_traverse_store as
_UNUSED_

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
c20ca0de by Gary Lockyer at 2019-06-13T07:16:23Z
lib ldb ldb_key_value: csbuild unused parm ldb

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function
‘list_intersect’
lib/ldb/ldb_key_value/ldb_kv_index.c:1275:48: warning: unused parameter
‘ldb’ [-Wunused-parameter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
d6a596d9 by Gary Lockyer at 2019-06-13T07:16:23Z
lib ldb ldb_key_value: csbuild ldb_kv_index_dn_not unused parms

Fixes csbuild errors.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function
‘ldb_kv_index_dn_not’
lib/ldb/ldb_key_value/ldb_kv_index.c:1503:51: warning: unused parameter
‘module’ [-Wunus ed-parameter]

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c:1504:34: warning: unused parameter
‘ldb_kv’ [-Wunused-parameter]

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c:1505:40: warning: unused parameter
‘tree’ [-Wunused-parameter]

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c:1506:27: warning: unused parameter
‘list’ [-Wunused-parameter]

Tag unused parameters in ldb_kv_index_dn_not with _UNUSED_

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
a538c31a by Gary Lockyer at 2019-06-13T07:16:23Z
lib ldb ldb_key_value: csbuild unused parms ldb_kv, key

Fixes csbuild errors.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function
‘traverse_range_index’
lib/ldb/ldb_key_value/ldb_kv_index.c:1653:56: warning: unused parameter
‘ldb_kv’ [-Wunused-parameter]

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c:1654:20: warning: unused parameter
‘key’ [-Wunused-parameter]

Tags unused parameters in the callback function traverse_range_index with
_UNUSED_

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
566ca194 by Gary Lockyer at 2019-06-13T07:16:23Z
lib ldb ldb_key_value: csbuild fix signed unsigned compare

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function
‘ldb_kv_index_add1’
lib/ldb/ldb_key_value/ldb_kv_index.c:2601:15: warning: comparison of
integer expressions of different signedness: ‘int’ and ‘unsigned int’
[-Wsign-compare]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
96442401 by Gary Lockyer at 2019-06-13T07:16:23Z
lib ldb ldb_key_value: csbuild fix unused parm data

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function
‘delete_index’
lib/ldb/ldb_key_value/ldb_kv_index.c:3221:19: warning: unused parameter
‘data’ [-Wunused-parameter]

Tags unused parameters in callback delete_index with _UNUSED_

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
dc348f41 by Gary Lockyer at 2019-06-13T07:16:23Z
lib ldb_key_value: csbuild unused parm key

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_index.c: scope_hint: In function ‘re_pack’
lib/ldb/ldb_key_value/ldb_kv_index.c:3416:21: warning: unused parameter
‘key’ [-Wunused-parameter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
fef8ec20 by Gary Lockyer at 2019-06-13T08:27:12Z
lib ldb ldb_key_value: csbuild unused parm ldb_kv

Fixes csbuild error.

Error: COMPILER_WARNING:
lib/ldb/ldb_key_value/ldb_kv_search.c: scope_hint: In
function ‘search_func’ lib/ldb/ldb_key_value/ldb_kv_search.c:308:47:
warning: unused parameter ‘ldb_kv’ [-Wunused-parameter]

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Jun 13 08:27:12 UTC 2019 on sn-devel-184

- - - - -
a402c1e1 by Karolin Seeger at 2019-06-13T09:14:56Z
VERSION: Bump version up to 4.9.9.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
(cherry picked from commit a9f7f1f7433b1f1c18ebf0d88fc57ae270f2711f)

- - - - -
a26bed6d by Karolin Seeger at 2019-06-13T09:16:26Z
VERSION: Re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
09818693 by Douglas Bagnall at 2019-06-13T09:26:43Z
CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation

We still want to return DOES_NOT_EXIST when request_filter is not 0.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c2423655 by Douglas Bagnall at 2019-06-13T09:26:43Z
CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation2

We still want to return DOES_NOT_EXIST when request_filter is not 0.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c0712976 by Karolin Seeger at 2019-06-13T09:57:35Z
WHATSNEW: Add release notes for Samba 4.9.9

CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13922

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
e6e7c8ca by Karolin Seeger at 2019-06-13T09:59:07Z
VERSION: Disable GIT_SNAPSHOT for the 4.9.9 release

CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13922

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
57923ced by Stefan Metzmacher at 2019-06-13T10:21:57Z
drsuapi.idl: add DRSUAPI_ATTID_schemaInfo

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 140a6733a458d0afa20237a09ef4ee2546a83a8f)

- - - - -
54d9a475 by Stefan Metzmacher at 2019-06-13T10:21:57Z
ldapcmp: ignore 'schemaInfo' if two domains are compared

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit b5b572d5f71e2b9783ddb25c21ac32904fbfd661)

- - - - -
cea29740 by Stefan Metzmacher at 2019-06-13T10:21:58Z
s4:provision: split out provision_self_join_modify_schema.ldif

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 5ea84af2d69e0b3a2a801ea0cc3f4ffc66bf1764)

- - - - -
2434353a by Stefan Metzmacher at 2019-06-13T10:21:58Z
python/provision: use provision and relax controls for schema provision

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 7652439fa1aab92945f5540a43fc49568d446917)

- - - - -
5a96c91d by Aaron Haslett at 2019-06-13T10:21:59Z
dsdb:samdb: schemainfo update with relax control

Currently schema info's revision field isn't incremented if relax
control is present.  This is so that no increment is done during
provision, but we need the relax control in other situations where
the increment is desired, so we should use the provision control instead
to disable schema info update.

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

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit b7c1752754da1e8a83a53670cf4a410ec6e9d7b7)

- - - - -
77de9567 by Stefan Metzmacher at 2019-06-13T10:21:59Z
python/ntacls: we only need security.SEC_STD_READ_CONTROL in order to get the ACL

We should avoid security.SEC_FLAG_MAXIMUM_ALLOWED otherwise
we may get NT_STATUS_SHARING_VIOLATION when we run
'samba-tool domain backup online' against a Windows DC.
Windows DCs have hidden folders for the NtFrs or Dfsr services,
which are locked by the running service.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 15032ec6df1abbb53f1b1d5377aab369f83ae707)

- - - - -
72e89a5d by Andrew Bartlett at 2019-06-13T10:21:59Z
s4 dsdb/repl_meta_data: allocate new extended DNs during ADD on a better context

Lower down in this function new_values is assigned over el->values and is
filled in with the values of all the parsed DNs.  Therefore it is the natural
talloc parent.

This will allow el->values to be allocated on tmp_ctx in the next commit for
a working area during the function call.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
(cherry picked from commit 4aa9924310287ff3b36618496fa6c707c615ad4c)

- - - - -
429a0c69 by Gary Lockyer at 2019-06-13T10:22:00Z
s4 dsdb/repl_meta_data: fix use after free in dsdb_audit_add_ldb_value

Fix use after free detected by AddressSanitizer

AddressSanitizer: heap-use-after-free on address 0x61400026a4a0
                  at pc 0x7fd555c52f12 bp 0x7ffed7231180 sp 0x7ffed7231170
                  READ of size 1 at 0x61400026a4a0 thread T0
    #0 0x7fd555c52f11 in ldb_should_b64_encode
       ../../lib/ldb/common/ldb_ldif.c:197
    #1 0x7fd539dc9417 in dsdb_audit_add_ldb_value
       ../../source4/dsdb/samdb/ldb_modules/audit_util.c:491
    #2 0x7fd539dc9417 in dsdb_audit_attributes_json
       ../../source4/dsdb/samdb/ldb_modules/audit_util.c:651
    #3 0x7fd539dc6a7e in operation_json
       ../../source4/dsdb/samdb/ldb_modules/audit_log.c:305

The problem is that at the successful end of these functions
el->values is overwritten with new_values.  However get_parsed_dns()
points p->v at the supplied el and it effectively gets used
as a working area by replmd_build_la_val().  So we must duplicate it
because our caller only called ldb_msg_copy_shallow().

The reason this matters is that the audit_log module is
above repl_meta_data in the stack, and tries to log the
ldb_message it saw after the reply (to include the error code).
If that ldb_message is changed it is not only misleading,
it can point to memory that has since gone away.

In this case the memory for the full extended DN in the
member attribute ended up on 'ac', a context lost by
the time repl_meta_data has finished processing.

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed May 15 05:35:47 UTC 2019 on sn-devel-184

(cherry picked from commit 0daa0ff921b270df9b794f02acbaa391c95cd89b)

- - - - -
fcf4e66b by Shyamsunder Rathi at 2019-06-13T10:22:00Z
s3:loadparm: Ensure to truncate FS Volume Label at multibyte boundary

For FS_VOLUME_INFO/FS_INFO operation, a maximum of 32 characters are
sent back. However, since Samba chops off any share name with >32
bytes at 32, it is possible that a multi-byte share name can get chopped
off between a full character. This causes the string decoding for unicode
failure which sends back NT_STATUS_ILLEGAL_CHARACTER (EILSEQ) to the client
applications.

On Windows, Notepad doesn't like it, and refuses to open a file in this
case and fails with the following error:

  Invalid character. For multibyte character sets, only the leading byte is
  included without the trailing byte. For Unicode character sets, include
  the characters 0xFFFF and 0xFFFE.

Proposed fix:
- Find the last starting point of a multibyte codepoint if the character
  at 32nd byte is a subsequent byte of a MB codepoint.

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

Signed-off-by: Shyamsunder Rathi <shyam.rathi at nutanix.com>
Reviewed-by: Hemanth Thummala <hemanth.thummala at nutanix.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 0fa490e8476a2a5020ff2c253167b8a9454e8b97)

- - - - -
bb00dd66 by Jeremy Allison at 2019-06-13T10:22:01Z
s3: winbind: Fix crash when invoking winbind idmap scripts.

Previously the private context was caching a pointer to
a string returned from lp_XXX(). This string can change
on config file reload. Ensure the string is talloc_strup'ed
onto the owning context instead.

Reported by Heinrich Mislik <Heinrich.Mislik at univie.ac.at>

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit a1f95ba5db6fc017fad35377fbf76c048f2dd8ab)

- - - - -
2b04a3c3 by Volker Lendecke at 2019-06-13T10:22:01Z
smbd: Enable "smbd:suicide mode" for smb2

The next commit needs an smbd to just exit and leave data behind in the
locking.tdb file. Don't make it harder to eventually phase out SMB1: Do
the test in SMB2.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
42f881dd by Volker Lendecke at 2019-06-13T10:22:02Z
smbtorture: Add a test to make smbd panic

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
bd511655 by Volker Lendecke at 2019-06-13T10:22:02Z
smbd: Fix a panic

Opening a file with a stale (smbd died) LEVEL_II oplock makes

vfs_set_filelen-> ... ->contend_level2_oplocks_begin_default

trigger the immediate leading to do_break_to_none. This goes through
because fsp->oplock_type is not initialized yet, thus 0. Also,
file_has_read_oplocks is still valid, because the smbd that has died
could not clean up the brlock.tdb entry.

Later in the code the exclusive oplock is granted, which is then found
by do_break_to_none, making it panic.

This patch just runs the direct FTRUNCATE instead of vfs_set_filelen.
This means the contend_level2_oplock code is skipped.

The relevant break (LEVEL_II to NONE) is now done in delay_for_oplock()
with the nice effect of removing a comment that was very confusing to
me.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed May 22 20:09:29 UTC 2019 on sn-devel-184

- - - - -
fefd2496 by Aliaksei Karaliou at 2019-06-13T10:22:03Z
s3:util: Move popen wrappers to lib/util

When linked into Samba3 libraries, sys_popen()/sys_pclose()
cannot be used in lower level libraries because of circular
dependencies.

This patch moves them into common samba-util library.

Extra fix needed to enable easy back-port of code for:

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

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 65ea3f2a461c0eeca7d14c4258eea52e19f0ed06)

- - - - -
ecd28164 by Aliaksei Karaliou at 2019-06-13T10:22:03Z
s3:util: Move static file_pload() function to lib/util

file_pload() is static private function in Samba3 library, however it
does not have any special dependencies and might be widely used as
common function, so moving it into common samba-util library.

Extra fix needed to enable easy back-port of code for:

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

Signed-off-by: Aliaksei Karaliou <akaraliou at panasas.com>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit d21fc7d8b86b0cddc619ffe528d9cd93eeedbb0b)

- - - - -
1ea4976a by Jeremy Allison at 2019-06-13T10:22:04Z
lib: popen: Prepare to remove sys_popen().

Add sys_popenv(char * const argl[]) that uses a NULL
terminated vector array of args. Change sys_popen() to
split up its command string and call sys_popenv().

Once all callers are converted to sys_popenv() we
can remove sys_popen().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f20538de041eed1cadbabe2149b2b7cfcb779cb5)

- - - - -
ce85a7b6 by Jeremy Allison at 2019-06-13T10:22:04Z
lib: util: Add file_ploadv().

Not yet used.

Duplicate code to file_pload() except uses vectored
argument list. file_pload() will be removed once all
callers are converted.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 5c34fa0b85e4d9a3c5fd4fa0b39af4772ec023db)

- - - - -
f8655271 by Jeremy Allison at 2019-06-13T10:22:05Z
s3: lib: util: Add file_lines_ploadv().

Not yet used.

Duplicate code to file_lines_pload() except uses vectored
argument list. file_lines_pload() will be removed once all
callers are converted.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 3b19412baedfffb7adc2a79471f5b17990259c31)

- - - - -
0fc087b8 by Jeremy Allison at 2019-06-13T10:22:05Z
s3: smbd: Convert dfree code to use file_lines_ploadv().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit d6453e1ffd92c7754862389a933a9fd9089ce518)

- - - - -
7115964b by Jeremy Allison at 2019-06-13T10:22:06Z
s3: smbd: Convert print_svid code to use file_lines_ploadv().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f9ccf1cc3df13138a1a4b645c8190238ce011f04)

- - - - -
e6e29b35 by Jeremy Allison at 2019-06-13T10:22:06Z
s3: smbd: Convert sysquotas.c code to use file_lines_ploadv().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 4a63e3b9659c8715d436c66dee8bf420e2ea89fb)

- - - - -
cda1eaa2 by Jeremy Allison at 2019-06-13T10:22:07Z
s3: lib: Remove file_lines_pload().

No longer used.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 02bc0ce9d22117b464bae47c5d09c45b4f7c2272)

- - - - -
54085531 by Jeremy Allison at 2019-06-13T10:22:07Z
lib: util: Remove file_pload()

No longer used.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit c5729ae44219ec81008040d4d50f0f5fdf254201)

- - - - -
19583f44 by Jeremy Allison at 2019-06-13T10:22:08Z
s3: lib: Add file_ploadv_send().

Not yet used. Preparing to remove file_pload_send()
with this safer alternative.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 61054e53f53e5884902b566b1f9b454a3ff4741f)

- - - - -
0dfd513f by Jeremy Allison at 2019-06-13T10:22:08Z
s3: winbind: Convert idmap to use file_ploadv_send().

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 449d49946b295f574e1fed83b5a5ffbf1c1b1e30)

- - - - -
5887de47 by Jeremy Allison at 2019-06-13T10:22:09Z
s3: lib: Remove file_pload_send().

No longer used.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit d5c363d65d771c792523f2f3e526c90514212fc2)

- - - - -
eb7091a2 by Ralph Boehme at 2019-06-13T10:22:09Z
s3: lib: Rename all uses of file_pload_XXX -> file_ploadv_XXX.

Keep naming consistent across all usage.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit dbfa3cd186428c02589aa9093e868554b4c695d5)

- - - - -
fce8502f by Jeremy Allison at 2019-06-13T10:22:10Z
lib: util: Finally remove possibilities of using sys_popen() unsafely.

All code now uses sys_popenv() which is much
harder to use incorrectly.

Remove the extract_args() function that was the
cause of possible issues.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 9fa95d5b45369acfdd38923e8618e94e5d04b07e)

- - - - -
dada63cc by Jeremy Allison at 2019-06-13T10:22:11Z
docs: dfree command. Correct usage of dfree scripts.

Add quotes to the sample scripts to prevent incorrect
parameter usage.

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

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri May 24 20:12:02 UTC 2019 on sn-devel-184

(cherry picked from commit 77eabd74e9a28b1e6decf0890a9ef4c83fa002d4)

- - - - -
341fcacf by Ralph Boehme at 2019-06-13T10:22:11Z
registry: add a missing include

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13840

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Karolin Seeger <kseeger at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Mon May 27 14:29:36 UTC 2019 on sn-devel-184

(cherry picked from commit e09053faf457f69ad9b5e6a34be43c947503575f)

- - - - -
22170e79 by Ralph Boehme at 2019-06-13T10:22:12Z
s4:torture/vfs/fruit: ensure test_adouble_conversion() uses a non-emtpy resourcefork

This ensures the resource fork is not deleted as part of the AppleDouble file
conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.

This is currently not a problem in selftest, as we don't enable the option, but
a subsequent commit will run all vfs.fruit tests against a share with this
option enabled.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit c3d28d49be3c7536d1ccfe8d00553ce72843f369)

- - - - -
45de537d by Ralph Boehme at 2019-06-13T10:22:12Z
s4:torture/vfs/fruit: ensure test_adouble_conversion_wo_xattr() uses a non-emtpy resourcefork

This ensures the resource fork is not deleted as part of the AppleDouble file
conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.

This is currently not a problem in selftest, as we don't enable the option, but
a subsequent commit will run all vfs.fruit tests against a share with this
option enabled.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit bb5a457f2872a383b58d62981dade322fca9b283)

- - - - -
77655c65 by Ralph Boehme at 2019-06-13T10:22:13Z
selftest: run vfs.fruit test against a share that deletes empty resource forks

This reveals a bug in the AppleDouble conversion code: the conversion code that
unlinks an empty resource fork AppleDouble sidecar file ("._file") gets
triggered as part of open_file_ntcreate(..., "file:AFP_AfpResource", ...):

after SMB_VFS_OPEN() has been called with O_CREAT, what created the file, we
call SMB_VFS_FSTAT() on the just created filehandle. This ends up in
ad_convert(), finds the resource fork empty and thus deletes the file.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 8ed9b6b457923d2353d1d18838f4a278db48c6b9)

- - - - -
267e70cb by Ralph Boehme at 2019-06-13T10:22:13Z
vfs_fruit: add a forward declaration for ad_get()

Will be needed in the next commit.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4777d1163a7c18c89ce9be955903427a18134415)

- - - - -
8b1dfd9b by Ralph Boehme at 2019-06-13T14:25:17Z
vfs_fruit: change trigger points of AppleDouble conversion

This moves the trigger points where AppleDouble file conversion is run by
ad_convert() from deep down the callchain in ad_read_rsrc_adouble() to high
level VFS entry points.

Currently ad_convert() will be triggered as part of open_file_ntcreate(...,
"file:AFP_AfpResource", ...): after SMB_VFS_OPEN() has been called with O_CREAT,
what created the file, we call SMB_VFS_FSTAT() on the just created
filehandle. This ends up in ad_convert(), finds the resource fork empty and thus
deletes the file.

This commit moves calling of the conversion funtion to the high level VFS entry
points where the converted metadata is needed:

o for directory enumerations SMB_VFS_READDIR_ATTR() is called to fill in the
  repurposed fields in the directory entry metadata

o obviously for SMB_VFS_CREATE_FILE() on an macOS stream

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 78a4639b2d06cc69788861618d2e91945e142d2b)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Thu Jun 13 14:25:17 UTC 2019 on sn-devel-144

- - - - -
7c9eb428 by Volker Lendecke at 2019-06-18T05:34:07Z
autobuild: Fix autobuild for python3

"keys()" in python3 returns an unmodifiable view object. Two lines
down we might want to modify it, which python3 does not allow.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Noel Power <npower at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
3a0fd53f by Andrew Bartlett at 2019-06-18T06:47:05Z
lib/replace: Remove #undef TCP_NODELAY

A duplicate define warning is better than not defining this at all.

Similar to a patch Torsten Werner submitted to the Samba Bugzilla in
2005.

Not tested on HP-UX

reverts fc84e916f628b4fb6f6667ad45d0ced0e9134b23 that was still present in
the new copy of nis.h created in c29d087e1ea4c92717ef86e372fe80f410580fdc

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Jun 18 06:47:05 UTC 2019 on sn-devel-184

- - - - -
c9a7754c by Volker Lendecke at 2019-06-18T12:53:58Z
smbd: Avoid a "?true:false" in smbd_do_locking

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
52096b49 by Volker Lendecke at 2019-06-18T12:53:58Z
libsmb: Align integer types

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
aec8b4a2 by Volker Lendecke at 2019-06-18T12:53:59Z
libsmb: Remove unused cli_[un]lock64()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
888bff50 by Volker Lendecke at 2019-06-18T12:53:59Z
smbd: Use smb1cli_is_andx_req()

We have two implementations of this -- use the one from common libs

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
a8301bfb by Volker Lendecke at 2019-06-18T12:53:59Z
libsmb: Remove unused is_andx_req

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
cc69f49c by Volker Lendecke at 2019-06-18T12:53:59Z
libsmb: Add async cli_lockingx()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
25c7b92f by Volker Lendecke at 2019-06-18T12:53:59Z
libsmb: Use cli_lockingx() in cli_oplock_ack()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
5211f6af by Volker Lendecke at 2019-06-18T12:54:00Z
libsmb: Use cli_lockingx() in cli_locktype()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
22aeb005 by Volker Lendecke at 2019-06-18T12:54:00Z
libsmb: Use cli_lockingx() in cli_unlock()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
ebe2ceb3 by Volker Lendecke at 2019-06-18T12:54:00Z
smbd: Slightly simplify reply_lockingX()

Don't do an "else" after an early return

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
8e2b40ba by Volker Lendecke at 2019-06-18T12:54:00Z
smbd: Slightly simplify reply_lockingX()

The brltype only depends upon the central locktype, don't calculate it
every time in the loop parsing the lock requests

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
fbe9ec63 by Volker Lendecke at 2019-06-18T12:54:00Z
smbd: Slightly simplify reply_lockingX()

Make the data dependencies more obvious. "locks" and "ulocks" are used
only for short time spans. Any sane compiler will coalesce them to
just one stack variable.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
e335b875 by Volker Lendecke at 2019-06-18T12:54:00Z
smbd: Simplify smbd_do_locking()

LOCKING_ANDX_CANCEL_LOCK only is used in SMB1. Move its handling out
of the shared smb1/smb2 code.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
8cfb3701 by Volker Lendecke at 2019-06-18T12:54:00Z
smbd: smbd_do_locking() does not use the "type" param anymore

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
70e77acb by Volker Lendecke at 2019-06-18T12:54:01Z
smbd: Fix a typo

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
beeb9d51 by Volker Lendecke at 2019-06-18T12:54:01Z
smbtorture: Match comment with test

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
d8c75ec7 by Volker Lendecke at 2019-06-18T12:54:01Z
smbd: Avoid casts

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
a5b18973 by Volker Lendecke at 2019-06-18T12:54:01Z
smbd: Align integer types in reply_lockingX

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
8d4f7e56 by Volker Lendecke at 2019-06-18T12:54:01Z
smbd: Add a explanation for num_aio_requests

We could have used talloc_array_length()

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
7dce1d3e by Volker Lendecke at 2019-06-18T12:54:01Z
smbd: Slightly simplify smb_set_posix_lock()

Avoid indentation by an early return;

Best viewed with git show -b

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
80f648b1 by Volker Lendecke at 2019-06-18T14:47:08Z
smbd: Deprecate "blocking locks" parameter

This parameter adds complexity to our brlock implementation that I don't think
is justified. Not a lot of complexity, but if we would want to really support
it we'd need tests. Instead of doing those, I think removing the parameter is
the better choice.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Jun 18 14:47:08 UTC 2019 on sn-devel-184

- - - - -
1b0184a9 by Björn Baumbach at 2019-06-18T14:48:18Z
selftest: add test for samba-tool ntacl get/set --use-ntvfs --xattr-backend=tdb

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
670a12df by Björn Baumbach at 2019-06-18T14:48:18Z
python/ntacls: use correct "state directory" smb.conf option instead of "state dir"

samba-tool ntacl get testfile --xattr-backend=tdb --use-ntvfs
Fixes: Unknown parameter encountered: "state dir"

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
0eee621c by Björn Baumbach at 2019-06-18T14:48:18Z
samba-tool ntacl: consolidate code for getting the local domain sid

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
6554cfa8 by Björn Baumbach at 2019-06-18T14:48:18Z
samba-tool: add ntacl changedomsid command

This tool is meant to locally change all entries in acl_xattr when the
machine's SID has accidentially changed or the data set has been copied
to another box either via backup/restore or rsync.

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
d4b72821 by Björn Baumbach at 2019-06-18T16:54:22Z
selftest: add tests for samba-tool ntacl changedomsid

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Björn Baumbach <bb at sernet.de>
Autobuild-Date(master): Tue Jun 18 16:54:22 UTC 2019 on sn-devel-184

- - - - -
dc27ff44 by Lukas Slebodnik at 2019-06-18T16:55:20Z
wafsamba: Use native waf timer

  __main__:1: DeprecationWarning: time.clock has been deprecated in Python 3.3
  and will be removed from Python 3.8: use time.perf_counter
  or time.process_time instead

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

Signed-off-by: Lukas Slebodnik <lslebodn at fedoraproject.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>

- - - - -
f04260ce by Andreas Schneider at 2019-06-18T18:10:40Z
s3:client: Link smbspool_krb5_wrapper against krb5samba

Heimdal doesn't provide krb5_free_unparsed_name(), so we need to use the
function we provide in krb5samba.

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

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Jun 18 18:10:40 UTC 2019 on sn-devel-184

- - - - -
7ea74d55 by Douglas Bagnall at 2019-06-19T07:01:12Z
CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation

We still want to return DOES_NOT_EXIST when request_filter is not 0.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1cac79dd by Douglas Bagnall at 2019-06-19T07:01:12Z
CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation2

We still want to return DOES_NOT_EXIST when request_filter is not 0.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
01f22365 by Karolin Seeger at 2019-06-19T07:07:05Z
Merge tag 'samba-4.9.9' into v4-9-test

samba: tag release samba-4.9.9

- - - - -
414261f3 by Karolin Seeger at 2019-06-19T07:07:50Z
VERSION: Bump version up to 4.9.10.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
6aa5d1f6 by Douglas Bagnall at 2019-06-19T08:16:39Z
CVE-2019-12436 dsdb/paged_results: ignore successful results without messages

So that we don't dereference result->msgs[0] when it doesn't exist.
This can happen when the object has changed in such a way that it no
longer matches the original search query.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(master): Wed Jun 19 08:16:39 UTC 2019 on sn-devel-184

- - - - -
a3d20ae6 by Mathieu Parent at 2019-06-20T05:51:21Z
Add missing Breaks+Replace found by piuparts (Closes: #929217)

Thanks Andreas Beckmann!

- - - - -
fe8ceb8f by Douglas Bagnall at 2019-06-20T05:51:22Z
CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation

We still want to return DOES_NOT_EXIST when request_filter is not 0.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
fda0327e by Douglas Bagnall at 2019-06-20T05:51:22Z
CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in DnssrvOperation2

We still want to return DOES_NOT_EXIST when request_filter is not 0.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
08fc5a8b by Mathieu Parent at 2019-06-20T05:51:48Z
Add patch for CVE-2019-12435

- - - - -
e0780386 by Mathieu Parent at 2019-06-20T05:53:29Z
Release 2:4.9.5+dfsg-5

- - - - -
83859668 by Björn Baumbach at 2019-06-20T15:34:28Z
docs: add documentation for the samba-tool ntacl changedomsid command

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
7f70e216 by Björn Baumbach at 2019-06-20T17:14:50Z
docs: fix typo in "ntlm auth" doc in smb.conf man page

Thanks to Amit Kumar <amitkuma at redhat.com>

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

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Björn Baumbach <bb at sernet.de>
Autobuild-Date(master): Thu Jun 20 17:14:50 UTC 2019 on sn-devel-184

- - - - -
c00c7bfb by Volker Lendecke at 2019-06-20T17:18:16Z
smbd: Only remove locks by mid if necessary

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

- - - - -
7fa0be8f by Volker Lendecke at 2019-06-20T17:18:16Z
tevent: Fix a typo

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

- - - - -
a371d22f by Volker Lendecke at 2019-06-20T17:18:16Z
smbd: Fix a typo

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

- - - - -
7fe67a47 by Volker Lendecke at 2019-06-20T17:18:17Z
lib: Fix a typo

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

- - - - -
041608cb by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Avoid casts in reply_unlock()

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

- - - - -
1736f7c5 by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Use NT_STATUS_IS_OK() in reply_unlock()

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

- - - - -
10ba4aa6 by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Avoid casts in smb_set_posix_lock()

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

- - - - -
4d6152b1 by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Simplify smb_set_posix_lock()

Instead of reading twice from pdata, use a switch statement

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

- - - - -
b3d533aa by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Add "lock_flav" to smbd_do_unlocking()

The next commits will pass all direct "do_unlock" calls through
smbd_do_unlocking(). Why? Unlocking will later on require that we take
the share mode lock for the file in question while the unlock is
happening, and this should be in one central place.

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

- - - - -
865c86bd by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Use smbd_do_unlocking() in smb_set_posix_lock()

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

- - - - -
00b11867 by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Use smbd_do_unlocking() in reply_writeunlock()

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

- - - - -
ff992d1c by Volker Lendecke at 2019-06-20T17:18:17Z
smbd: Use smbd_do_unlocking() in reply_unlock()

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

- - - - -
7dec53ed by Volker Lendecke at 2019-06-20T17:18:17Z
torture3: Add a test to block a locking&read

Right now we fail this with smbd, we return LOCK_NOT_GRANTED instead
of FILE_LOCK_CONFLICT. This will change with later commits.

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

- - - - -
2f1a459b by Volker Lendecke at 2019-06-20T17:18:18Z
torture3: Test LOCKINGX_CANCEL without locks

Tested against W2012R2

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

- - - - -
b20231a1 by Volker Lendecke at 2019-06-20T17:18:18Z
torture3: Test blocking posix locks

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

- - - - -
3f6ed6e3 by Volker Lendecke at 2019-06-20T17:18:18Z
torture3: Run a blocking lock&x call with a subsequent read

Samba aborts the read&x after a blocked, but eventually successful
locking&x call. Both Windows and source4/ntvfs do the read properly,
source3/smbd does not. With later code, this will become possible much
easier. Lets see if it's worth it given that we've got away with this
forever.

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

- - - - -
56521c5f by Volker Lendecke at 2019-06-20T17:18:18Z
libsmb: Make cli_lockingx cancellable

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

- - - - -
b752e242 by Volker Lendecke at 2019-06-20T17:18:18Z
torture3: Test cancelling locking&x with ntcancel

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

- - - - -
4adbeb97 by Volker Lendecke at 2019-06-20T17:18:18Z
smbd: Add "blocker_pid" to brl_lock()

Soon we will wait on a conflicting lock to become free via
dbwrap_watched_watch_send. That routine can take a server_id that
blocks us, watching it to go away. To use that, we need to know which
PID it is that blocks us.

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

- - - - -
ca73ba85 by Volker Lendecke at 2019-06-20T17:18:18Z
smbd: Add some paranoia against NULL dereference

Quite a few callers set "psmblctx" to NULL, and I could not really
follow 100% that brl_lock only assigns that in the blocking lock
case. Too many layers :-)

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

- - - - -
67f89bb3 by Volker Lendecke at 2019-06-20T17:18:18Z
smbd: Return "blocker_pid" from do_lock()

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

- - - - -
f0a9459e by Volker Lendecke at 2019-06-20T17:18:18Z
smbd: Slightly simplify smbd_smb2_lock_send()

For unlocking we don't need the error mapping, do an early return

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

- - - - -
fbbf6843 by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Add smbd_smb1_do_locks_send/recv()

This contains the SMB1-specific brlock logic. Right now our core
brlock code has specialized code to deal with pending locks. For
dealing with pending requests waiting for something nowadays we
recommend to use tevent_req. This code also provides the basis to
remove the SMB1 special case handling from the core logic, isolating
protocol features specific to SMB1 and not exposed in SMB2 in
SMB1-specific code.

The core brlock code will not see blocking locks anymore. Instead, the
code in this patch will always immediately fail and take care of the
retries and timeouts.

Retries are implemented by a dbwrap_watch_record_send on the
corresponding locking.tdb entry. A later commit will make unlocks
trigger wakeups there. I chose locking.tdb and not brlock itself to
simplify the implementation. We already have oplock break watchers on
locking.tdb, this will only add one more. This might lead to spurious
wakeups, but they are taken care of by careful retries. An advantage
of doing that is the implicit handling of a killed blocker PID through
dbwrap_watch, obsoleting brl_revalidate.

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

- - - - -
2d746d13 by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Ping dbwrap_watch on locking.tdb for in smbd_do_unlocking()

smbd_smb1_do_locks_send() watches the file's locking.tdb record for
changes, like the oplock code does. Unlocking a byte range thus must
trigger a retry.

With the share mode cache get_existing_share_mode_lock() is pretty
cheap. We have to write out the share mode record with the current
code, but an obvious optimization will be a share_mode_do_locked doing
all this without actually unmarshalling the locking.tdb entry. And --
there's precedence for this pattern in downgrade_lease()...

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

- - - - -
ab149a61 by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Remove SMB1 special case handling from brlock.c

This is now handled in smbd_smb1_do_locks_send/recv.

>From here on for a few commits we won't survive make test.

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

- - - - -
1967bb85 by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Use smbd_smb1_do_locks_send() in reply_lockread()

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

- - - - -
c4649b3a by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Use smbd_smb1_do_locks_send() in reply_lock()

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

- - - - -
4c1d574e by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Use smbd_smb1_do_locks_send() in reply_lockingX()

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

- - - - -
6f204de7 by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Use smbd_smb1_do_locks_send() in smb_set_posix_lock()

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

- - - - -
b091c19c by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Base smb2_lock.c on tevent_req

smb2 locking is a lot more regular than reply_lockingX. So this is a
much smaller change.

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

- - - - -
d60a35bd by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Don't call cancel_pending_lock_requests_by_fid on close

We don't use that queue anymore

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

- - - - -
f37c14dd by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Add a clarifying comment on triggering waiters

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

- - - - -
b3284bef by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Cancel smbd_smb1_do_locks requests in reply_ntcancel

Last link to the specialized brlock queue

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

- - - - -
871bb756 by Volker Lendecke at 2019-06-20T17:18:19Z
smbd: Remove unused brlock code

No PENDING locks in brlock.tdb anymore.

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

- - - - -
4bbe291e by Volker Lendecke at 2019-06-20T18:34:20Z
vfs: Remove SMB_VFS_BRL_CANCEL_WINDOWS

This is not called anymore, bump the VFS version number in a separate
commit

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Jun 20 18:34:20 UTC 2019 on sn-devel-184

- - - - -
d4ace83b by Volker Lendecke at 2019-06-20T23:39:34Z
smbd: Remove struct blocking_lock_record

Forgot that one in the last patches

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Jun 20 23:39:34 UTC 2019 on sn-devel-184

- - - - -
b201dd33 by Michael Hanselmann at 2019-06-20T23:40:16Z
regfio: Return instead of assert for short blocks

Assertions should only be used when there's absolutely no recovery or to
verify data structure invariants. In this case the supplied registry
hive file may have a malformed block with a size of zero. Such a block
should not terminate the whole program.

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
33cc2692 by Andreas Schneider at 2019-06-20T23:40:16Z
gitlab-ci: Add Fedora 30

Fedora 30 ships with gcc9.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
41d93a6d by Joe Guo at 2019-06-20T23:40:16Z
script/autobuild.py: fix tasks indent

Indent tasks at same level, make it easier to copy/move lines arround.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1b70d43e by Joe Guo at 2019-06-20T23:40:16Z
script/autobuild.py: rm unused mime type text/plain in tasks

The mime type `text/plain` is repeated everywhere but not used any more.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0383747d by Joe Guo at 2019-06-20T23:40:16Z
script/autobuild.py: replace random-sleep.sh with python function

The random-sleep.sh script is tricky, and there is no need to rely on another
script just for random sleep.

Using the python function, the random number generation will happen when
load autobuild.py other than execute cmd, but shouldn't affect the
result.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0daeb604 by Joe Guo at 2019-06-20T23:40:16Z
script/autobuild.py: add helper functions to simplify make test cmd

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6fc3eb89 by Joe Guo at 2019-06-20T23:40:16Z
script/autobuild.py: improve run_cmd with check_output

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
04a6967b by Joe Guo at 2019-06-20T23:40:16Z
script/autobuild.py: define cwd for builder and avoid chdir

We can pass cwd in Popen, no need to chdir for each cmd.

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ae90e526 by Joe Guo at 2019-06-20T23:40:16Z
script/autobuild.py: rm redundant empty str in options

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
fb12a252 by Joe Guo at 2019-06-20T23:40:17Z
script/autobuild.py: avoid nested try except block

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8de56ddc by Joe Guo at 2019-06-20T23:40:17Z
script/autobuild.py: make code more pythonic

Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7ee65597 by Björn Jacke at 2019-06-20T23:40:17Z
README: fix samba mailman list address

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e121c144 by Andrew Bartlett at 2019-06-21T00:52:19Z
provision: Suggest "minimal-responses yes;" by default

This improves Samba AD DC performance as a DNS server dramatically, because NS records do not
need to be looked up and there is less risk the response will have to fall back
to TCP, doubling the cost again.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jun 21 00:52:19 UTC 2019 on sn-devel-184

- - - - -
c3aed689 by Gary Lockyer at 2019-06-21T04:27:12Z
lib ldb tests: Test nested transactions

Add a test to document that ldb does not currently support nested
transactions.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d73bbf0b by Gary Lockyer at 2019-06-21T04:27:12Z
lib ldb tests: remove deprecation warning from api.py

Remove the "DeprecationWarning: Please use assertEqual instead."
warnings from api.py

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d7dc4fde by Gary Lockyer at 2019-06-21T04:27:12Z
lib ldb key value backends: Add nested txn support

Add limited nested transaction support to the back ends to make the key value
operations atomic (for those back ends that support nested transactions).

Note: that only the lmdb backend currently supports nested transactions.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
565341ba by Gary Lockyer at 2019-06-21T04:27:12Z
lib ldb key value: add nested transaction support.

Use the nested transaction support added to the key value back ends to
make key value operations atomic. This will ensure that rename
operation failures, which delete the original record and add a new
record, leave the database in a consistent state.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
201684e5 by Gary Lockyer at 2019-06-21T04:27:12Z
lib ldb ldb_key_value tests: Add tests for wrapped operations

Add test exercising the sub/nested transactions wrapping the key value
operations.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1a52b03b by Gary Lockyer at 2019-06-21T04:27:12Z
lib ldb key value: Remove check_parent from ldb_kv_index_idxptr()

The callers will soon have two possible parents for this pointer, so
we need to remove this check, which was added out of caution given
the rather strange pattern of putting an active memory pointer into a
TDB (as a hash map).

That is, the only callers that did call this with "true" would
have to call this with "false", so just remove the complexity.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b6b5b5fe by Gary Lockyer at 2019-06-21T04:27:13Z
lib ldb key value: fix index buffering

As a performance enhancement the key value layer maintains a cache of
the index records, which is written to disk as part of a prepare commit.
This patch adds an extra cache at the operation layer to ensure that the
cached indexes remain consistent in the event of an operation failing.

Add test to test for index corruption in a failed modify.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
feb96ee8 by Gary Lockyer at 2019-06-21T05:45:02Z
lib ldb key value: use TALLOC_FREE() per README.Coding

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jun 21 05:45:02 UTC 2019 on sn-devel-184

- - - - -
2a7e6eb8 by Stefan Metzmacher at 2019-06-21T07:56:16Z
dsdb/repl: we need to replicate the whole schema before we can apply it

Otherwise we may not be able to construct a working schema that's
required to apply the changes.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 661dc4574110b0f13c127c8aa6ed0c385292b77c)

- - - - -
3b1ccbfc by Günther Deschner at 2019-06-21T07:56:16Z
Revert "s3/vfs_glusterfs: Dynamically determine NAME_MAX"

This reverts commit 8e3a042eb9e502821b147f1bbb2d98d59f17a095.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
dba38ed3 by Günther Deschner at 2019-06-21T07:56:16Z
Revert "s3/vfs_glusterfs_fuse: Dynamically determine NAME_MAX"

This reverts commit e28d172b00cadf492c22bd892e2dda3bf2fe2d70.

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
3136b31e by Günther Deschner at 2019-06-21T07:56:16Z
s3/vfs_glusterfs: Avoid using NAME_MAX directly

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

- - - - -
936a71bf by Günther Deschner at 2019-06-21T07:56:16Z
s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly

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

Guenther

Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Tue Jun 11 00:29:19 UTC 2019 on sn-devel-184

- - - - -
2cde1306 by Gary Lockyer at 2019-06-21T07:56:17Z
s4 dsdb: fix use after free in samldb_rename_search_base_callback

Fix use after free detected by AddressSanitizer

AddressSanitizer: heap-use-after-free on address 0x60f0002b2738
                  at pc 0x7f89b1a213b5 bp 0x7ffce9528810 sp 0x7ffce9528800
                  READ of size 8 at 0x60f0002b2738 thread T0
    #0 0x7f89b1a213b4 in samldb_rename_search_base_callback
        ../../source4/dsdb/samdb/ldb_modules/samldb.c:4203
    #1 0x7f89d3a0db4a in ldb_module_send_entry
        ../../lib/ldb/common/ldb_modules.c:793
    #2 0x7f89b6f27356 in es_callback
        ../../source4/dsdb/samdb/ldb_modules/encrypted_secrets.c:1418

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13942

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit b0cc6d217485c317b2138347216fac5d74684328)

- - - - -
670b864e by Gary Lockyer at 2019-06-21T07:56:17Z
ldap tests: test scheme for referrals

Ensure that the referrals returned in a search request use the same
scheme as the request, i.e. referrals recieved via ldap are prefixed
with "ldap://" and those over ldaps are prefixed with "ldaps://"

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 6ccf74cf878c295903673e3a1d1ed924a5e87547)

- - - - -
11b1f405 by Gary Lockyer at 2019-06-21T07:56:17Z
ldap server: generate correct referral schemes

Ensure that the referrals returned in a search request use the same
scheme as the request, i.e. referrals recieved via ldap are prefixed
with "ldap://" and those over ldaps are prefixed with "ldaps://"

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

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri May 24 05:12:14 UTC 2019 on sn-devel-184

(cherry picked from commit 1958cd8a7fb81ec51b81944ecf4dd0fb5c4208fa)

- - - - -
29e402f5 by Stefan Metzmacher at 2019-06-21T07:56:17Z
dsdb:audit_log: avoid printing "... remote host [Unknown] SID [(NULL SID)] ..."

We better print "... remote host [Unknown] SID [S-1-5-18] ..."
in 'dsdb_audit' message, this matches what we print for
'dsdb_json_audit'.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 706aba5bf62e674ae12786f6ab275752b8714464)

- - - - -
71c33811 by Ralph Boehme at 2019-06-21T07:56:17Z
s3:auth: add reinit_guest_session_info()

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 8096cc7eb2b36b074ff17a52dc3540be4ecff6bb)

- - - - -
1cc8068e by Ralph Boehme at 2019-06-21T07:56:17Z
s3:smbd: call reinit_guest_session_info() in the conf updated handler

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit f4e340a48b6f059a1daa66deb9c26da9e8fcd5e7)

- - - - -
36641f70 by Ralph Boehme at 2019-06-21T07:56:17Z
selftest: allow guest login in the ad_member_idmap_rid env

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(backported from commit ac2167eb2349dc1c453e14a65692f16c8ba6532e)

- - - - -
15fa6919 by Ralph Boehme at 2019-06-21T07:56:17Z
tests: add a test for guest authentication

This verifies that smbd always adds BUILTIN\Guests to the guest token which is
required for guest authentication.

Currently the guest token depends on the on-disk configured group mappings. If
there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
a member, the final guest token won't contain BUILTIN\Guests.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 0e88f98855e24cfddb55bef65c5910b8e662c630)

- - - - -
79beb172 by Ralph Boehme at 2019-06-21T07:56:17Z
s3:auth: explicitly add BUILTIN\Guests to the guest token

This changes ensures that smbd always adds BUILTIN\Guests to the guest token
which is required for guest authentication.

Currently the guest token depends on the on-disk configured group mappings. If
there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
a member, the final guest token won't contain BUILTIN\Guests.

For SMB2 the flag SMB2_SESSION_FLAG_IS_GUEST will not be set in the final SMB2
SESSION_SETUP response, because smbd sets it based on the token containing the
BUILTIN\Guests SID S-1-5-32-546.

At the same time, the packet is not signed which causes Windows clients and
smbclient to reject the unsigned SMB2 SESSION_SETUP response.

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

Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Jun  5 16:55:26 UTC 2019 on sn-devel-184

(cherry picked from commit a66af4c96accba4ee64eeb1958458b69f3ccec1d)

- - - - -
f94d0095 by Ralph Boehme at 2019-06-21T07:56:17Z
vfs_fruit: pass handle to ad_fset()

On the course of removing ad_handle from struct adouble, step 1.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 585d4d49770b4ddc3f7d9dcbb3e322f072767781)

- - - - -
7ece2664 by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: pass handle to ad_set()

On the course of removing ad_handle from struct adouble, step 2.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit c78ba30ac4534b7037b979ac96b77b834b2eb2fe)

- - - - -
c99c7f2a by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: pass handle to ad_read()

On the course of removing ad_handle from struct adouble, step 3.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit d0abf945e683766029d28915541a4baf9f3879ab)

- - - - -
b4c6efa3 by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: pass handle to ad_read_meta()

On the course of removing ad_handle from struct adouble, step 4.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit f8df09157f31b53dbe73eaf4349fc071bfcc1b90)

- - - - -
9ae195e4 by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: indentation fix

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 47721d8d359ef78b8dd4f77f92c30c2caf2c4a80)

- - - - -
5975a4a8 by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: use proper VFS function in ad_read_meta()

Continuing to ignore a possible error for now, this is in an error codepath
anyway.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 30ca328c698c2e035e240359bda7c9dcbeb646df)

- - - - -
f3021917 by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: pass handle to ad_read_rsrc() and all the way down

On the course of removing ad_handle from struct adouble, step 5.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 661dfa4a19673fdb30d5bf36279cdf867454b947)

- - - - -
b5275f40 by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: indentation fix

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 400b3c2f8c82b1defe1e321e0cdae486b930344f)

- - - - -
1efc046c by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: pass handle to ad_convert_xattr()

On the course of removing ad_handle from struct adouble, step 7.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit fd2f4cf828ee4c31e3b5a27a79d3a0ee12a5877a)

- - - - -
b50f2ad9 by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: pass handle to ad_convert_blank_rfork()

On the course of removing ad_handle from struct adouble, step 8.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit adc7ac38b849b4dce4a85fd6442c8d4b9da57686)

- - - - -
fbc0501b by Ralph Boehme at 2019-06-21T07:56:18Z
vfs_fruit: pass handle to ad_convert_finderinfo()

On the course of removing ad_handle from struct adouble, step 9.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 50874c1548d62ab0ddaaa6dd4124279ee5029fcf)

- - - - -
20e66673 by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: pass handle to ad_convert_delete_adfile()

On the course of removing ad_handle from struct adouble, step 10.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 5f4d16b40e07acf8d27fee62f1a56de175663a1d)

- - - - -
c3676d8d by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: finally, remove ad_handle from struct adouble

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit e266daaed149561b746dbb8d5e9523862f0057b5)

- - - - -
18c45bb3 by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: add and use is_adouble_file()

This adds a helper function that checks whether the last component of a path is
an AppleDouble sidecar file with "._" name prefix.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit ad70c947c759aa0965ee57f973fb8dc1909e0e39)

- - - - -
1542bb05 by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: add a missing else

Luckily the missing else has the same control flow due to the previous if and
else blocks calling return.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 44d8568001c87d28962dfc4e3fde6d0f7f409997)

- - - - -
c2c6377e by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: ignore AppleDouble files in fruit_unlink()

Otherwise, if SMB_VFS_UNLINK() is called for an AppleDouble path "._file", we
try to delete "._._file" which doesn't make sense. AppleDouble files don't have
AppleDouble themselves.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 797dc649456f39add4af8b54b60db0268ad4e90e)

- - - - -
561d52f8 by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: use correct case FRUIT_RSRC_STREAM in readdir_attr_rfork_size()

This is a genuine bug, but luckily this would only impact configs which nobody
uses:

  fruit:metadata = netatalk
  fruit:resource = stream

With the above configuration the switch in readdir_attr_rfork_size() would hit
the default case and so always report resource forks as 0 bytes in size.

All deployment that I've seen that use fruit:resource=stream also use
fruit:metadata=stream, so the switch takes FRUIT_META_STREAM case which runs the
correct code readdir_attr_rfork_size_stream().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 83179a74119de84d20f796c241aae6bccb83a68b)

- - - - -
b24bac64 by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: use stream code for resource fork size calculation in readdir_attr_rfork_size()

This works as well, using an fstat() on the filehandle to get the size. This is
tested by the torture test "vfs.fruit.SMB2/CREATE context AAPL".

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit a23bcc1916a49bf3e0edece190e5434e39862d2c)

- - - - -
76074dde by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: remove now unused AppleDouble code for resource fork in xattr

This was only needed to get the resourcefork size via the ad_* AppleDouble
function. This is now done with a fstat on the low level xattr fd (remember,
this is Solaris only code...), so we can remove the xattr special casing from
the AppleDouble functions.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit cb9dffa1c66294b6eed85e7576aa99c642d0b541)

- - - - -
e8cecc86 by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: remove xattr code from the AppleDouble subsystem

The subsystem consumers have been reworked in the previous commits, so this is
not used anymore. ad_init() doesn't need a handle argument anymore due to this,
remove it as well.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit e3cb1cb24f2a31d7fd03f3bdf417f4704fb4ac7c)

- - - - -
06bd7891 by Ralph Boehme at 2019-06-21T07:56:19Z
vfs_fruit: pass VFS handle to ad_convert_move_reso()

Not used for now, that comes next.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 3919ea048fe3b763657e14cdfb5920184a900d27)

- - - - -
645836ff by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: remove a layer of indirection

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 97d485ff2cda85edeba163ea01b6abfa705db20f)

- - - - -
b10eabed by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: only do cross protocol locking on non-internal opens

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit f5f7d1e9bf7e39933ccf7c874e682f9df80a6fec)

- - - - -
e21d8806 by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: convert ad_open_rsrc() to open a proper fsp with SMB_VFS_CREATE_FILE()

A first step in converting all raw syscalls to use proper VFS functions. All
existing users of the raw system filedescriptor continue to use the fd from
fsp->fh for now.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 29418c726be74feb1d8c3ac9f7b8c983901a2aab)

- - - - -
42e6d4d4 by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: remove use of mmap() from ad_convert_move_reso()

We now have an fsp that we can use, so we can get rid of mmap() and
sys_pread()/sys_pwrite().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 0041855af0b05d6c47558880d6eebd1970179272)

- - - - -
015586a4 by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: use fsp and remove mmap in ad_convert_xattr()

No need to mmap() anyway, the xattr data is already available in ad->ad_data.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4ff7ea0e0312c737aefd350f7b8fbed4c8602325)

- - - - -
14048aaf by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: add VFS handle to ad_convert_truncate()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4e44b1da9357120f0ad74e24c650bc6386085c47)

- - - - -
afc88153 by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: use VFS function in ad_convert_truncate()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 3739ad90cf2bbaa2094a34197c894363d2e24a5a)

- - - - -
1a8dffce by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: use fsp and remove syscalls from ad_convert_blank_rfork()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 70c4a8f0ac307009c26e857523192c95b42a92f5)

- - - - -
7ae1667b by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: use VFS functions in ad_read_rsrc_adouble()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 9fe84a6345bf5d9fdb1df87a853db3380e6fb0f7)

- - - - -
684d772e by Ralph Boehme at 2019-06-21T07:56:20Z
vfs_fruit: remove a now unnecessary include

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu May 30 22:12:50 UTC 2019 on sn-devel-184

(cherry picked from commit 9a2c9834cb1b77547b8b932c35870301afb9fc25)

- - - - -
575739df by Andrew Bartlett at 2019-06-21T07:56:21Z
docs: Improve documentation of "lanman auth" and "ntlm auth" connection

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

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit dbf3e81f7f0b28c69dca004b32ea3a7344b0cad3)

- - - - -
44b51688 by Rafael David Tinoco via samba-technical at 2019-06-21T07:56:21Z
ctdb-scripts: Fix tcp_tw_recycle existence check

net.ipv4.tcp_tw_recycle has been removed from Linux 4.12 but, still,
makes sense to check its existence. Unfortunately, current check does
not test for the procfs file existence. This commit fixes the issue.

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

Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Jun  4 23:31:24 UTC 2019 on sn-devel-184

(cherry picked from commit 843fbb1207ee7ac84f3282974b66b9290d8da0ac)

- - - - -
9a0c3a47 by Stefan Metzmacher at 2019-06-21T08:49:18Z
s4:torture: add local.ndr.dnsp tests

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
6d958af0 by Stefan Metzmacher at 2019-06-21T08:49:19Z
dnsp.idl: fix dnsp_ip4_array definition

In future we should use ipv4address, but that would result in a much
larger change.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
6fc7cc15 by Stefan Metzmacher at 2019-06-21T08:49:19Z
dnsp.idl: fix the dnsp_dns_addr_array definition

The endian changes are needed in order to get the following result
from the blobs Windows generated (see the torture test):

  AddrArray: ARRAY(3)
      AddrArray: struct dnsp_dns_addr
          family                   : 0x0002 (2)
          port                     : 0x0035 (53)
          ipv4                     : 172.31.99.33
          ipv6                     : 0000:0000:0000:0000:0000:0000:0000:0000

[MS-DNSP] states that the port is supposed to be ignored, but it's still
good to decode it as port '53' (0x0035) instead of '13568' (0x3500).

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
aa2a3d95 by Stefan Metzmacher at 2019-06-21T11:02:21Z
dnsp.idl: fix payload for DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jun 21 11:02:21 UTC 2019 on sn-devel-184

- - - - -
3cd46420 by Ralph Boehme at 2019-06-21T11:49:59Z
s3:mdssvc: fix flex compilation error

[4440/4495] Compiling bin/default/source3/rpc_server/mdssvc/sparql_lexer.lex.c
../../source3/rpc_server/mdssvc/sparql_lexer.l:26: error: "yyalloc" redefined [-Werror]
26 | #define yyalloc SMB_MALLOC

Looks like the dirty redefine trick doesn't work anymore with newer flex
versions. According to the flex manual the right thing to do is to provide own
functions for yyalloc and yyrealloc when passing the options "noyyalloc
noyyrealloc".

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue May 28 11:49:06 UTC 2019 on sn-devel-184

(cherry picked from commit 9053391f86a529e0a7dbcd23fa3a555d85c2207c)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Fri Jun 21 11:49:59 UTC 2019 on sn-devel-144

- - - - -
f54dfd97 by Andreas Schneider at 2019-06-24T06:11:16Z
libcli:util: Add gnutls_error

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
1f4bd1c3 by Andreas Schneider at 2019-06-24T06:11:16Z
s4:libcli: Use gnutls_error_to_ntstatus() or singing

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d61601d4 by Andreas Schneider at 2019-06-24T06:11:16Z
libcli:smb: Return NSTATUS for smb2_signing_check_pdu()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bbdae277 by Andreas Schneider at 2019-06-24T06:11:16Z
libcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_sign_pdu()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e24a238a by Andreas Schneider at 2019-06-24T06:11:16Z
libcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_check_pdu()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
232c3b6f by Andreas Schneider at 2019-06-24T06:11:16Z
auth:gensec: Use gnutls_error_to_ntstatus() in schannel

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
68d495ca by Andreas Schneider at 2019-06-24T06:11:17Z
libcli:smb: Use gnutls_error_to_ntstatus() in smbXcli_base.c

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
929e10b5 by Andreas Schneider at 2019-06-24T06:11:17Z
s3:smbd: Use gnutls_error_to_ntstatus() in smb2_server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c7cea1d4 by Andreas Schneider at 2019-06-24T06:11:17Z
s3:smbd: Use gnutls_error_to_ntstatus() in smb2_sesssetup

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
702ae158 by Andreas Schneider at 2019-06-24T06:11:17Z
libcli:auth: Use gnutls_error_to_ntstatus() in credentials

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
226895ba by Andreas Schneider at 2019-06-24T06:11:17Z
libcli:smb: Use gnutls_error_to_ntstatus() in smb_signing

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
35573821 by Andreas Schneider at 2019-06-24T06:11:17Z
auth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_client

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d9a6cbd9 by Andreas Schneider at 2019-06-24T06:11:17Z
auth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
aaf41bf9 by Andreas Schneider at 2019-06-24T06:11:17Z
auth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_sign

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b21af2f1 by Andreas Schneider at 2019-06-24T06:11:17Z
auth:creds: Use gnutls_error_to_ntstatus() in credentials_ntlm

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5823dc54 by Andreas Schneider at 2019-06-24T06:11:17Z
s3:libnet: Use gnutls_error_to_ntstatus() in libnet_passwd

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4bcf72aa by Andreas Schneider at 2019-06-24T06:11:17Z
s4:rpc_server: Use gnutls_error_to_ntstatus() in samr_password

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5ae17679 by Andreas Schneider at 2019-06-24T07:27:21Z
s4:ntp_signd: Use gnutls_error_to_ntstatus() in ntp_signd

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Jun 24 07:27:21 UTC 2019 on sn-devel-184

- - - - -
559dd2d2 by Andrew Bartlett at 2019-06-24T17:24:26Z
py3: Remove PyStr_Type() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
f498c819 by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_Check() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
34f9a089 by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_FromString() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
3fa00d43 by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_FromStringAndSize() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
75d87b29 by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_FromFormat() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
d9d9463f by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_FromFormatV() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
f178daa8 by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_AsString() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
7566268f by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_AsUTF8() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
f32779b1 by Andrew Bartlett at 2019-06-24T17:24:27Z
py3: Remove PyStr_AsUTF8AndSize() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

- - - - -
4f32983e by Andrew Bartlett at 2019-06-24T18:48:53Z
py3: Remove duplicated PyUnicode_Check() after the py3 compat macros were removed

This came about because in py2 we had to check for strings and unicode.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Noel Power <noel.power at suse.com>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Mon Jun 24 18:48:53 UTC 2019 on sn-devel-184

- - - - -
56c9ad12 by Jeremy Allison at 2019-06-24T18:49:08Z
s3: smbd: Ensure open for security descriptor access actually opens an fd.

Change test to check two things:
1) Open a symlink for SD read or write access should fail.
2) Request attribute open. Getsd/Setsd on this handle should
fail.

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

- - - - -
2da9e1ce by Jeremy Allison at 2019-06-24T18:49:08Z
s3: torture: Fix a debug typo.

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

- - - - -
4afdc25e by Jeremy Allison at 2019-06-24T18:49:08Z
s3: smbd: Update smb_set_posix_acl() to modern coding standards.

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

- - - - -
21eaeafe by Jeremy Allison at 2019-06-24T18:49:08Z
s3: smbd: Update smb_set_posix_acl() argument list to prepare for handle open.

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

- - - - -
419debdf by Jeremy Allison at 2019-06-24T18:49:08Z
s3: smbd: Update smb_set_posix_acl() to have only one exit path.

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

- - - - -
0adbbb8e by Jeremy Allison at 2019-06-24T18:49:08Z
s3: smbd: Add correct wrap checks to smb_set_posix_acl().

Use unsigned for wrap checks.

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

- - - - -
42712ccb by Jeremy Allison at 2019-06-24T18:49:08Z
s3: smbd: Make data offset use clearer in smb_set_posix_acl()

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

- - - - -
d6b46c03 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Clarify logic with helper variables in smb_set_posix_acl()

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

- - - - -
df7cec42 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Add get_posix_fsp() utility function. Not yet used.

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

- - - - -
bf743b01 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Update smb_set_posix_acl() to always use an open file handle.

Uses get_posix_fsp() added in the previous commit.

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

- - - - -
72605195 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Now we always have a handle in smb_set_posix_acl(), use it instead of smb_fname.

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

- - - - -
4772377b by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Factor out code into a separate function smb_query_posix_acl().

Will clean up coding standards next.

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

- - - - -
c9f55b78 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Fix smb_query_posix_acl() to use modern coding standards.

Add wrap protection.

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

- - - - -
7c57544b by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Plumb through struct smb_request *req parameter so it can be used by smb_query_posix_acl().

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

- - - - -
18c95f04 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Fix smb_query_posix_acl() to always use fsp handle.

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

- - - - -
59de4528 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Cleanup - make remove_posix_acl() use modern coding standards.

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

- - - - -
5210ff66 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Cleanup - make set_unix_posix_acl() use modern coding standards.

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

- - - - -
e626cb70 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Cleanup - make remove_posix_acl() return NTSTATUS.

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

- - - - -
0b496fd9 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Make set_unix_posix_acl() return NTSTATUS.

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

- - - - -
763b52d2 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Cleanup - make set_unix_posix_default_acl() use modern coding standards.

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

- - - - -
681f0f23 by Jeremy Allison at 2019-06-24T18:49:09Z
s3: smbd: Change set_unix_posix_default_acl() to return NTSTATUS.

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

- - - - -
caa4024a by Jeremy Allison at 2019-06-24T18:49:10Z
s3: smbd: Only pass fsp to set_unix_posix_acl(). No longer uses smb_fname.

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

- - - - -
503e1243 by Jeremy Allison at 2019-06-24T18:49:10Z
s3: smbd: Only pass fsp to remove_posix_acl(). No longer uses smb_fname.

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

- - - - -
77454ecf by Jeremy Allison at 2019-06-24T18:49:10Z
s3: smbd: Add default ACLS can only be set on directory check to smb_set_posix_acl().

This was already being checked in the lower layer,
so no change in behavior, just an efficiency and
clarity change.

Just move an extra check here so we refuse the
set if a default ACL is sent on a file object
before we go into the lower layers.

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

- - - - -
147ce70e by Jeremy Allison at 2019-06-24T18:49:10Z
s3: smbd: Make set_unix_posix_default_acl() take an fsp argument, not smb_fname.

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

- - - - -
bd203e98 by Jeremy Allison at 2019-06-24T18:49:10Z
s3: smbd: If smbd_do_qfilepathinfo() causes an oplock or lease break, we must check for deferred open here.

Note this isn't an issue in SMB2, as no SMB2 info level requests
called by smbd_do_qfilepathinfo()/smbd_do_setfilepathinfo() from
SMB2 can cause a oplock or lease break.

The SMB1 trans2.c: calling of smbd_do_setfilepathinfo()
correctly copes with this, this was just missed in the
SMB1 call of smbd_do_qfilepathinfo().

Needed for the following POSIX ACL query interacting
with Windows oplock file test to follow.

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

- - - - -
644ab10b by Jeremy Allison at 2019-06-24T18:49:10Z
s3: modules: Fruit. Now we know we have a handle, always use VFS_FCHMOD instead of VFS_CHMOD.

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

- - - - -
78bdbfbf by Jeremy Allison at 2019-06-24T18:49:10Z
s3: smbd: Posix ACLs. Now we know we have a handle, always use VFS_FCHMOD instead of VFS_CHMOD.

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

- - - - -
05667d36 by Jeremy Allison at 2019-06-24T20:05:34Z
s3: torture: Add POSIX-ACL-OPLOCK test to check interaction of posix ACL operations with an oplocked Windows handle.

(Spoiler alert, it breaks the oplock :-).

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Jun 24 20:05:34 UTC 2019 on sn-devel-184

- - - - -
2436496e by David Disseldorp at 2019-06-25T10:55:45Z
client: enable allinfo and altname tab completion

Should tab-complete a single remote path.

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Tue Jun 25 10:55:45 UTC 2019 on sn-devel-184

- - - - -
039558fe by Karolin Seeger at 2019-06-25T12:09:39Z
packaging: Update READMEs to reflect current status.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
Reviewed-by: Björn Baumbach <bb at sernet.de>

Autobuild-User(master): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(master): Tue Jun 25 12:09:39 UTC 2019 on sn-devel-184

- - - - -
6f81fe15 by Andrew Bartlett at 2019-06-26T04:12:32Z
ntvfs: Remove now unused functions

These likely became unused once other untested parts of the NTVFS file server were
removed in 2017e291a2da3d63741df82b480f32ee57f6a165,
ee8b48df0f995611e0c8f8d6766e4882c5f4f4cd,
679227d6063074aabb986d78fab42b856db265e3,
31de52ed2efe598e7fab72d90a742d4f9e03c97e

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
69361a43 by Andrew Bartlett at 2019-06-26T04:12:32Z
lib/tls: Remove unused header definitions from source4/lib/tls/tls.h (tls socket wrapper)

These were removed in eb15acdd35600878aba3319e070199200d9a1357 but the
header declarations were not removed.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
ecd5fa29 by Andrew Bartlett at 2019-06-26T04:12:32Z
s4-torture: Remove unused #include of librpc/gen_ndr/ndr_dcerpc_c.h

We only need librpc/rpc/rpc_common.h

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
dbff6cac by Andrew Bartlett at 2019-06-26T04:12:32Z
librpc: Do not generate client code for dbgidl.idl

We only want to record the GUID and function table names, we do not need
to generate uncalled stubs.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
518227b6 by Andrew Bartlett at 2019-06-26T04:12:32Z
librpc: Remove unused RPC_NDR_NTLMSSP

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
27ad784b by Andrew Bartlett at 2019-06-26T04:12:32Z
librpc: Remove unused RPC_NDR_DRSBLOBS

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
8e83667f by Andrew Bartlett at 2019-06-26T04:12:32Z
librpc: Remove unused RPC_NDR_XATTR

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
0af3a613 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_IDMAP

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
48f65c85 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_SMB_ACL

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
4bfd001d by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_AUDIOSRV

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
05318934 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_EFS

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
c6f9ff9c by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_POLICYAGENT

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
f4f0db0c by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_WINSIF

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
57ed8db7 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_DSBACKUP

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
34206deb by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_NBT

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
21eec4cf by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_SERVER_ID

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
a162d68f by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_MSGSVC

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
bee87eec by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_WZCSVC

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
634b44c2 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_SCERPC

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
2555692f by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_TRKWKS

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
ba222585 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_KEYSVC

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
9c7e8f3a by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove unused RPC_NDR_MDSSVC

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
6f9176e6 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Remove frsblobs.idl

We can now dump public structures using ndrdump, so helper dump functions
are not required any more.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
88bb8fe4 by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: Do not generate extra unused client or python bindings with PIDL

This sorts out the idl list into the parts that actually need --python and --client specified
and so speeds up the compile and clarifies the code behaviour.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
46bf62dd by Andrew Bartlett at 2019-06-26T04:12:33Z
librpc: No longer generate or build unused client bindings for frsrpc

We retain the IDL and NDR parsers for ndrdump.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
5df815cf by Andrew Bartlett at 2019-06-26T04:12:33Z
pidl: Remove the need to always specify --client with --python

This allows us to avoid generating client code for NDR-only protocols that do
not go over DCE/RPC

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
295bf73e by Tim Beale at 2019-06-26T04:12:33Z
dsdb: Handle DB corner-case where PSO container doesn't exist

A 2003 AD DB with functional level set to >= 2008 was non-functional
due to the PSO checks.

We already check the functional level is >= 2008 before checking for the
PSO container. However, users could change their functional level
without ensuring their DB conforms to the corresponding base schema.

The objectclass DSDB module should prevent the PSO container from ever
being deleted. So the only way we should be able to hit this case is
through upgrading the functional level (but not the underlying schema
objects). If so, log a low-priority message and continue without errors.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14008
RN: Previously, AD operations such as user authentication could fail
completely with the message 'Error 32 determining PSOs in system' logged
on the samba server. This problem would only affect a domain that was
created using a pre-2008 AD base schema and then had its functional
level manually raised to 2008 or greater. This issue has now been
resolved.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
fc9845da by Aaron Haslett at 2019-06-26T04:12:33Z
selftest: specifying 2008_R2 base schema for tests that need it

We're going to change the default base schema so this patch changes all
tests and testenvs requiring the current default (2008_R2) to specify it
in all provision commands using --base-schema.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cb16395a by Aaron Haslett at 2019-06-26T04:12:34Z
schema: changing default base schema to 2012_R2

Changing default base schema from 2008_R2 to 2012_R2

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e28365c5 by Aaron Haslett at 2019-06-26T05:31:03Z
selftest: schema version check in provision test

Modifying blackbox provision test to check schema version.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Jun 26 05:31:03 UTC 2019 on sn-devel-184

- - - - -
da0d67b2 by Andreas Schneider at 2019-06-26T07:35:20Z
docs: Document DCEPRC binding string for rpcclient

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Feb  4 02:03:56 CET 2019 on sn-devel-144

(cherry picked from commit cca48c1a1029685672e1c25e39e8be2be947238f)

- - - - -
7987e4af by Noel Power at 2019-06-26T10:30:23Z
lib/tdb: clang: Fix warning: Dereference of null pointer

Fixes:

lib/tdb/common/lock.c:933:6: warning: Dereference of null pointer <--[clang]
        if (tdb->allrecord_lock.count) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
cf43f1d0 by Noel Power at 2019-06-26T10:30:23Z
clang: Fix Null pointer passed as argument warning

Fixes:
lib/tdb/common/transaction.c:354:2: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
        memcpy(tdb->transaction->blocks[blk] + off, buf, len);
&

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
1d00bd9f by Noel Power at 2019-06-26T10:30:23Z
lib/util: clang: Fix Value stored during its initialization is never read

Fixes:

lib/util/util_tdb.c:385:11: warning: Value stored to 'result' during its initialization is never read <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
37add5c8 by Noel Power at 2019-06-26T10:30:23Z
lib/dbwrap: clang: Fix 'all argument is an uninitialized value'

Fixes:

lib/dbwrap/dbwrap.c:533:4: warning: 2nd function call argument is an uninitialized value <--[clang]
                        dbwrap_lock_order_unlock(db, lockptr);
                        ^

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
fd17d50f by Noel Power at 2019-06-26T10:30:23Z
lib/dwrap: Fix 'Null pointer passed as an argument to a 'nonnull' parameter '

Fixes:

lib/dbwrap/dbwrap.c:645:4: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
                        memcpy(p, dbufs[i].dptr, thislen);

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
9c586845 by Noel Power at 2019-06-26T10:30:23Z
librpc/ndr: clang: Fix warning 'Value stored to 'towernum' is never read'

Fixes:

librpc/ndr/ndr_orpc.c:140:2: warning: Value stored to 'towernum' is never read <--[clang]
        towernum = 0;
        ^          ~
1 warning generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
38d6dd6a by Björn Baumbach at 2019-06-26T11:40:27Z
python/ntacls: use correct "state directory" smb.conf option instead of "state dir"

samba-tool ntacl get testfile --xattr-backend=tdb --use-ntvfs
Fixes: Unknown parameter encountered: "state dir"

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 670a12df52df63a067b638d37bec71341bf18bdd)

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

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Wed Jun 26 11:40:27 UTC 2019 on sn-devel-144

- - - - -
164570fc by Noel Power at 2019-06-26T11:53:08Z
lib/param: clang: Fix 'dereference of a null pointer' warning

Fixes:

lib/param/loadparm.c:3325:36: warning: Access to field 'szService' results in a dereference of a null pointer (loaded from variable 'service') <--[clang]
        return lpcfg_string((const char *)service->szService)

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Wed Jun 26 11:53:08 UTC 2019 on sn-devel-184

- - - - -
61777349 by Jeremy Allison at 2019-06-26T18:14:23Z
s3: smbd: We also need to open a real directory fd when modifying security.

Makes the logic identical to file open.

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

- - - - -
29ee235c by Jeremy Allison at 2019-06-26T19:31:28Z
s3: torture: Ensure we can always get a POSIX ACL on a directory handle.

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jun 26 19:31:28 UTC 2019 on sn-devel-184

- - - - -
8f4c30f7 by Andrew Bartlett at 2019-06-27T12:54:22Z
lib/crypto: move gnutls error wrapper to own subsystem

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
d1641f3e by Andreas Schneider at 2019-06-27T12:54:22Z
libcli:util: Add gnutls_error_to_werror()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d4494648 by Andreas Schneider at 2019-06-27T12:54:22Z
libcli:auth: Use gnutls_error_to_werror() in smbencrypt

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
46231a53 by Andreas Schneider at 2019-06-27T12:54:22Z
libcli:drsuapi: Use gnutls_error_to_werror() in repl_decrypt

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
56fb3ce0 by Andrew Bartlett at 2019-06-27T12:54:22Z
libcli/drsuapi: Make drsuapi_decrypt_attribute_value() static

The last external user was removed in 0980a3471ed8fcc3a37296857285dc0235e0e0d2 in 2010

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
4aa217bb by Andrew Bartlett at 2019-06-27T12:54:22Z
libcli/drsuapi: Add const to *in parameters to drsuapi_{en,de}crypt_attribute_value()

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
850e9ffe by Andrew Bartlett at 2019-06-27T12:54:22Z
libcli/drsuapi: Add expected value unit tests for drsuapi_{en,de}crypt_attribute_value()

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
52c87fa1 by Andrew Bartlett at 2019-06-27T12:54:23Z
libcli/drsuapi: Correct comment in drsuapi_decrypt_attribute_value()

This is not a copy, it is just a pointer assignment.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
31bac316 by Andrew Bartlett at 2019-06-27T12:54:23Z
lib/crypto: Add GnuTLS helper function samba_gnutls_arcfour_confounded_md5()

This will avoid duplicated code as we convert arcfour_crypt_blob() into
direct GnuTLS calls

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
d5856b99 by Andrew Bartlett at 2019-06-27T12:54:23Z
liblic/drsupai: use samba_gnutls_arcfour_confounded_md5() wrapper

This common code will reduce duplication, particularly when we move
arcfour_encrypt_buffer() calls to GnuTLS

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
ad450562 by Andrew Bartlett at 2019-06-27T12:54:23Z
lib/crypto: Use GnuTLS RC4 for samba_gnutls_arcfour_confounded_md5()

This allows Samba to use GnuTLS for drsuapi_{en,de}crypt_attribute_value()

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
f825fa6d by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Use GnuTLS RC4 for netlogon credentials

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
00dd1a8b by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Return NTSTATUS for netlogon_creds_encrypt_samlogon_validation()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2e6fe27b by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Return NTSTATUS for netlogon_creds_decrypt_samlogon_validation()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
8c9cf56f by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Return NTSTATUS for netlogon_creds_server_step_check()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
31f11031 by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Return NTSTATUS for netlogon_creds_encrypt_samlogon_logon()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cad3adb0 by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Return NTSTATUS for netlogon_creds_decrypt_samlogon_logon()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
99d250a3 by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Return NTSTATUS for netlogon_creds_crypt_samlogon_logon()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
67e6a9af by Andreas Schneider at 2019-06-27T12:54:23Z
libcli:auth: Return NTSTATUS for netlogon_creds_arcfour_crypt()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d5ca7ff4 by Andreas Schneider at 2019-06-27T12:54:23Z
auth:gensec: Use GnuTLS RC4 in netsec_do_seq_num()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6148cd9c by Andreas Schneider at 2019-06-27T12:54:23Z
auth:gensec: Use GnuTLS RC4 in netsec_do_seal()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ba96534e by Andreas Schneider at 2019-06-27T12:54:23Z
auth:gensec: Return NTSTATUS for netsec_do_seal()

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0a8a1c9c by Andreas Schneider at 2019-06-27T12:54:24Z
auth:ntlmssp: Use GnuTLS RC4 in ntlmssp server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
80b6ad51 by Andreas Schneider at 2019-06-27T12:54:24Z
s3:rpc_client: Use C99 inititializer in dcerpc_samr_chgpasswd_user()

This also cleans up after using them.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
acf605f5 by Andreas Schneider at 2019-06-27T12:54:24Z
s4:rpc_server: Use GnuTLS RC4 in lsa endpoint

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cd1f4184 by Andreas Schneider at 2019-06-27T12:54:24Z
s3:utils: Use GnuTLS RC4 in npc_rpc_trust

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6eb38daa by Andreas Schneider at 2019-06-27T12:54:24Z
s4:rpc_server: Use GnuTLS RC4 in lsa server

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4f306a2f by Andreas Schneider at 2019-06-27T12:54:24Z
nsswitch: Use GnuTLS RC4 in wbclient test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9767013b by Andreas Schneider at 2019-06-27T12:54:24Z
s4:tortue: Use GnuTLS RC4 in rpc lsa test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9920aefd by Andreas Schneider at 2019-06-27T14:11:39Z
s4:torture: Use GnuTLS RC4 in rpc forest_trust test

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Jun 27 14:11:39 UTC 2019 on sn-devel-184

- - - - -
6e5bff80 by Shyamsunder Rathi at 2019-06-27T17:57:12Z
s3:notifyd: Handle sigup in notifyd to reparse smb.conf

At present, SIGHUP is blocked on notifyd. So, if parent smbd
is started with "log level" 10 in smb.conf, and later changed
to 0, the SIGHUP will not change the log level to 0 in notify
smbd process and it will keep printing verbose logs in the
corresponding log files.

Proposed fix is to write a SIGHUP handler for notifyd and set
it to reload services.

Reviewed-by: Hemanth Thummala <hemanth.thummala at nutanix.com>
Signed-off-by: Shyamsunder Rathi <shyam.rathi at nutanix.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by:Volker Lendecke <vl at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Jun 27 17:57:12 UTC 2019 on sn-devel-184

- - - - -
8899eb21 by Michael Adam at 2019-06-28T11:37:24Z
vfs:glusterfs: treat ENOATTR as ENOENT

The original implementation of the virtual xattr get_real_filename
in gluster was misusing the ENOENT errno as the authoritative anwer
that the file/dir that we were asking the real filename for does not
exist. But since the getxattr call is done on the parent directory,
this is a violation of the getxattr API which uses ENOENT for the
case that the file/dir that the getxattr call is done against does
not exist.

Now after a recent regression for fuse-mount re-exports due to
gluster mapping ENOENT to ESTALE in the fuse-bridge, the gluster
implementation is changed to more correctly return ENOATTR if the
requested file does not exist.

This patch changes the glusterfs vfs module to treat ENOATTR as ENOENT
to be fully functional again with latest gluster.

- Without this patch, samba against a new gluster will work correctly,
  but the get_real_filename optimization for a non-existing entry
  is lost.

- With this patch, Samba will not work correctly any more against
  very old gluster servers: Those (correctly) returned ENOATTR
  always, which Samba originally interpreted as EOPNOTSUPP, triggering
  the expensive directory scan. With this patch, ENOATTR is
  interpreted as ENOENT, the authoritative answer that the requested
  entry does not exist, which is wrong unless it really does not exist.

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

- - - - -
fee8cf32 by Michael Adam at 2019-06-28T12:52:03Z
vfs:glusterfs_fuse: treat ENOATTR as ENOENT

The original implementation of the virtual xattr get_real_filename
in gluster was misusing the ENOENT errno as the authoritative anwer
that the file/dir that we were asking the real filename for does not
exist. But since the getxattr call is done on the parent directory,
this is a violation of the getxattr API which uses ENOENT for the
case that the file/dir that the getxattr call is done against does
not exist.

Now after a recent regression for fuse-mount re-exports due to
gluster mapping ENOENT to ESTALE in the fuse-bridge, the gluster
implementation is changed to more correctly return ENOATTR if the
requested file does not exist.

This patch changes the glusterfs_fuse vfs module to treat ENOATTR as
ENOENT to be fully functional again with latest gluster.

- Without this patch, samba against a new gluster will work correctly,
  but the get_real_filename optimization for a non-existing entry
  is lost.

- With this patch, Samba will not work correctly any more against
  very old gluster servers: Those (correctly) returned ENOATTR
  always, which Samba originally interpreted as EOPNOTSUPP, triggering
  the expensive directory scan. With this patch, ENOATTR is
  interpreted as ENOENT, the authoritative answer that the requested
  entry does not exist, which is wrong unless it really does not exist.

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Fri Jun 28 12:52:03 UTC 2019 on sn-devel-184

- - - - -
c88240e0 by Volker Lendecke at 2019-06-28T15:02:21Z
smbd: Fix broken brlock for clustering

This should have been in f11c5887f4fb4b766, sorry. We now always need
TDB_SEQNUM on brlock.tdb.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>

- - - - -
6bc70dcd by Volker Lendecke at 2019-06-28T15:02:21Z
vfs_preopen: Fix for O_NOFOLLOW

Since 4301505d977449d core smbd code passes O_NOFOLLOW together with
[O_RDONLY|O_RDWR] as flags. This breaks activating vfs_preopen, we
need to look at *just* the access mode.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>

- - - - -
c26e42cb by Volker Lendecke at 2019-06-28T15:02:21Z
vfs_preopen: Fix an uninitialized variable read

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>

- - - - -
0b556e78 by Volker Lendecke at 2019-06-28T16:42:42Z
vfs_preopen: TALLOC_FREE(fde) before closing the underlying fd

Without that we might get wrong stuff out of epoll

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>

Autobuild-User(master): Michael Adam <obnox at samba.org>
Autobuild-Date(master): Fri Jun 28 16:42:42 UTC 2019 on sn-devel-184

- - - - -
98e34c29 by Andrew Bartlett at 2019-06-28T18:48:49Z
.gitlab-ci.yml: Increase resources for samba-ad-dc-backup job

This job seems to need more resources, possibly after
b6b5b5fe355fee2a4096e9214831cb88c7a2a4c6 and
565341baf537c9b3145a882d6a23ad4f155c0036

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Jun 28 18:48:49 UTC 2019 on sn-devel-184

- - - - -
cd66614a by Jeremy Allison at 2019-06-30T11:32:17Z
s3: smbd: Make open_directory() always open a fd.

As we never use kernel oplocks on directory handles,
there is no reason not to always open file descriptors (no
more "stat" opens on directories).

Preparing to have SMB1search use real directory
opens.

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
c878fbce by Swen Schillig at 2019-06-30T11:32:17Z
tests-util: Adding strtoul(l)_err() test leaving errno untouched

The wrapper functions strtoul_err() and strtoull_err() trigger
other functions/routines which modify errno.
However, callers of those wrapper functions expect errno to be unchanged.
This test verifies the expectation.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
9af0614b by Swen Schillig at 2019-06-30T11:32:17Z
tests-util: Adding test to verify negative "number" detection

Verify that a string representing a negative number is throwing an error.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
ba021e3c by Swen Schillig at 2019-06-30T11:32:18Z
tests-util: Adding test to verify "no-conversion" detection

The standard string to integer conversion routines return zero
if a string was to be converted which did not reflect a number.
It is not flag'ed as an error.
The wrapper functions strtoul_err() and strtoull_err() are expected
to exactly do this.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
7fd0cd02 by Swen Schillig at 2019-06-30T11:32:18Z
lib: Add flag definitions to control the internal string to int conversion routines

The following flags are defined intially

    SMB_STR_STANDARD # raise error if negative or non-numeric
    SMB_STR_ALLOW_NEGATIVE # allow strings with a leading "-"
    SMB_STR_FULL_STR_CONV # entire string must be converted
    SMB_STR_ALLOW_NO_CONVERSION # allow empty strings or non-numeric
    SMB_STR_GLIBC_STANDARD # act exactly as the standard glibc strtoul

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
f2997ad6 by Swen Schillig at 2019-06-30T11:32:18Z
lib: Prepare for strtoul_err(), strtoull_err() API change

In order to still be bisectable when changing the API for the wrappers
strtoul_err() and strtoull_err() some preparations need to be performed.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
f0d1339e by Swen Schillig at 2019-06-30T11:32:18Z
lib: Add check for full string consumption when converting string to int

Some callers want to have the entire string being used for a
string to integer conversion, otherwise flag an error.
This is possible by providing the SAMBA_STR_FULL_STR_CONV flag.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
b1c2f168 by Swen Schillig at 2019-06-30T11:32:18Z
lib: Add capability to enable standard glibc behaviour for string to int conversion

Adding two addtl. flags SAMBA_STR_ALLOW_NO_CONVERSION and SAMBA_STR_GLIBC_STANDARD
for the wrappers strtoul_err() and strtoull_err() providing the possibility
to get standard glibc behaviour for string to integer conversion.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
73640b8a by Swen Schillig at 2019-06-30T11:32:18Z
ctdb: Update all consumers of strtoul_err(), strtoull_err() to new API

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
a8bbd60f by Swen Schillig at 2019-06-30T11:32:18Z
lib: Update all consumers of strtoul_err(), strtoull_err() to new API

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
39a518b6 by Swen Schillig at 2019-06-30T11:32:18Z
libcli: Update all consumers of strtoul_err(), strtoull_err() to new API

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
bf020a8c by Swen Schillig at 2019-06-30T11:32:18Z
nsswitch: Update all consumers of strtoul_err(), strtoull_err() to new API

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
a75727f1 by Swen Schillig at 2019-06-30T11:32:18Z
source3: Update all consumers of strtoul_err(), strtoull_err() to new API

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
3bc973c6 by Swen Schillig at 2019-06-30T11:32:18Z
source4: Update all consumers of strtoul_err(), strtoull_err() to new API

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
1756cea9 by Swen Schillig at 2019-06-30T11:32:18Z
util: cleanup API change for strtoul(l) wrappers

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
ed533deb by Swen Schillig at 2019-06-30T11:32:18Z
tests-util: Adding test to verify "allow-negative" flag

The standard string to integer conversion routines allow strings
with a leading "-" to indicate a negative number.
However, the returned value is always an unsigned value representing
the bit-pattern of this negative value.
Typically, this behaviour is NOT wanted and therefore the standard
behavior of the internal smb_strtoul(l) return an erros in such situations.
It can be enabled though by using the flag SMB_STR_ALLOW_NEGATIVE.
This test verifies the correct processing.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
dac981a3 by Swen Schillig at 2019-06-30T11:32:19Z
tests-util: Adding test to verify "full-string-conversion" flag

The standard string to integer conversion routines stop at the first
character which cannot be converted to a number.
However, if such a character is found, it is not considered an error.
With the flag "SMB_STR_FULL_STR_CONV" enabled, an error will be returned
if the string could not be converted entirely.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
d5383297 by Swen Schillig at 2019-06-30T12:47:24Z
tests-util: Adding test to verify "allow no conversion" flag

The internal string conversion routines smb_strtoul(l) return
an error if the provided string could not be converted to an integer.
This can be the case if the string is empty or if it starts with non-numeric
characters which cannot be converted.
The standard C library, however, does allow this and simply returns 0 as the
converted value.
If this behaviour is wanted, it can be enabled by using
the "SMB_STR_ALLOW_NO_CONVERSION" flag.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Sun Jun 30 12:47:24 UTC 2019 on sn-devel-184

- - - - -
abea597b by Martin Schwenke at 2019-07-01T06:44:13Z
util: Fix signed/unsigned comparisons by declaring as size_t

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
115353a0 by Martin Schwenke at 2019-07-01T06:44:13Z
util: Fix signed/unsigned comparisons by declaring as size_t

I may be missing something subtle but I can't see a reason for
declaring these as ssize_t.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
043334f2 by Martin Schwenke at 2019-07-01T08:00:29Z
util: Fix signed/unsigned comparisons by casting

One case needs a variable declared, so it can be compared to -1 and
then cast to size_t for comparison.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Jul  1 08:00:29 UTC 2019 on sn-devel-184

- - - - -
dcaaf9ff by Noel Power at 2019-07-01T13:34:10Z
lib/util: Fix Value stored to 'ret' is never read warning

Fixes:

lib/util/tfork.c:260:3: warning: Value stored to 'ret' is never read <--[clang]

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
848290d3 by Noel Power at 2019-07-01T13:34:10Z
lib/tdb/common: Fix warning: Null pointer passed as argument to param

Fixes:

lib/tdb/common/rescue.c:299:2: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
        qsort(found.arr, found.num, sizeof(found.arr[0]), cmp_key);
        ^     ~~~~~~~~~

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
9e78f7b5 by Noel Power at 2019-07-01T13:34:10Z
lib/tdb/common: Fix Array access results in a null pointer dereference

Fixes;

lib/tdb/common/transaction.c:613:7: warning: Array access (via field 'blocks') results in a null pointer dereference <--[clang]
                if (tdb->transaction->blocks[i] != NULL) {
                    ^
1 warning generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
3b43daac by Noel Power at 2019-07-01T13:34:11Z
lib/ldb/common: clang: Fix Value stored to 'ret' is never read warning

Fixes:

lib/ldb/common/ldb.c:1091:3: warning: Value stored to 'ret' is never read <--[clang]
                ret = 0;
                ^     ~
1 warning generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
7bddd6ae by Noel Power at 2019-07-01T13:34:11Z
lib/util: clang: Fix warning: Value stored to 'ret' is never read warning

Fixes:

lib/util/server_id_db.c:181:3: warning: Value stored to 'ret' is never read <--[clang]
                ret = tdb_store(tdb, key, talloc_tdb_data(ids), TDB_MODIFY);
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
8b925399 by Noel Power at 2019-07-01T13:34:11Z
lib/krb5_wrap: clang: Fix warning: Call to function 'mktemp' is insecure

Fixes:

lib/krb5_wrap/krb5_samba.c:2012:2: warning: Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file.  Use 'mkstemp' instead <--[clang]
        mktemp(tmp_name);
        ^~~~~~

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
2b7236ff by Noel Power at 2019-07-01T13:34:11Z
lib/krb5_wrap: clang: Fix warning: Null pointer passed as an argument

Fixes:

lib/krb5_wrap/krb5_samba.c:3241:3: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
                memcpy(gss_cksum + 28, in_data->data, orig_length);
                ^

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
a77fda0c by Gary Lockyer at 2019-07-01T14:50:53Z
lib tdb: memcmp ubsan warning

Fix the ubsan warning

lib/tdb/common/tdb.c:184:9: runtime error: null pointer passed as
argument 2, which is declared to never be null"

memcmp call now guarded by a length check.

memcmp returns zero when called with a zero length parameter.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Mon Jul  1 14:50:54 UTC 2019 on sn-devel-184

- - - - -
163c0cc8 by Andreas Schneider at 2019-07-01T19:22:02Z
s3:winbind: Add support for storing KRB5 credential in KCM

This can store crentiials in the Kerberos Credential Manager e.g.
provided by sssd.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Jul  1 19:22:02 UTC 2019 on sn-devel-184

- - - - -
ae6dd485 by Ralph Boehme at 2019-07-01T21:43:23Z
vfs_catia: pass stat info to synthetic_smb_fname()

This doesn't cause visible damage in vanilla Samba, but would affect downstream
consumers that add additional fields to struct smb_filename.

For the same reason there's no test.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14015
RN: Ensure vfs_catia passes stat info to stacked VFS modules

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
3e005fb8 by Ralph Boehme at 2019-07-01T21:43:23Z
idl: add xattr_DosInfo4 to xattr_DosInfo in xattr.idl

Adding itime, removing unused ea_size, size, alloc_size and change_time.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a5f4e33f by Ralph Boehme at 2019-07-01T21:43:23Z
s3: remove unused st_ex_mask from struct stat_ex

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d18bdc1c by Ralph Boehme at 2019-07-01T21:43:23Z
s3: convert struct stat_ex st_ex_calculated_birthtime bool to flags

Subsequent commits will add more flags, this paves the way.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
df4a380d by Ralph Boehme at 2019-07-01T21:43:23Z
s3: add st_ex_itime to struct stat_ex

st_ex_itime is an immutable original birth time aka instantiation time. Set when
a file is created, never changes thereafter. May not be set by the client.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
30b7f9ae by Ralph Boehme at 2019-07-01T21:43:23Z
s3: add st_ex_file_id to struct stat_ex

st_ex_file_id is an immutable, never reused numeric identifier for objects in a
filesystem.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
506ef276 by Ralph Boehme at 2019-07-01T21:43:23Z
s3/lib: add update_stat_ex_itime()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
295d3501 by Ralph Boehme at 2019-07-01T21:43:23Z
s3/lib: add update_stat_ex_file_id()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a5a2ce95 by Ralph Boehme at 2019-07-01T21:43:24Z
s3/lib: add make_file_index_from_itime()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
c03094cc by Ralph Boehme at 2019-07-01T21:43:24Z
s3:smbd: mark itime non-calculated if we created a file or dir

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d54424a7 by Ralph Boehme at 2019-07-01T21:43:24Z
s3:smbd: parse xattr_DosInfo4 in parse_dos_attribute_blob()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
ebe7b8c5 by Ralph Boehme at 2019-07-01T21:43:24Z
s3:smbd: use xattr_DosInfo4 in set_ea_dos_attribute()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
e6cdd486 by Ralph Boehme at 2019-07-01T21:43:24Z
s3:smbd: return inode number, not FileIndex for UNIX query info level

get_FileIndex() returns a stable and unique numerical identifier when "store dos
attributes" is enabled. It is NOT the same as a file's inode number which used
as the key for locking.tdb.

For POSIX clients we should return the inode numbers in the POSIX query info
level and the FileIndex in the corresponding SMB protocol fields (eg SMB2 QFID
create context).

This fix lets test "smbtorture_s3.plain.CLEANUP3" test work with get_FileIndex()
returning something different then the file's inode number.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
d2bac65e by Ralph Boehme at 2019-07-01T21:43:24Z
s3:smbd: rename get_FileIndex() to get_fs_file_id()

Also rename all variable used to store the result of the renamed
get_fs_file_id() in the callers.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
71996fef by Ralph Boehme at 2019-07-01T21:43:24Z
s3:vfs: add SMB_VFS_FS_FILE_ID()

Not yet used, that comes next.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
df5752ec by Ralph Boehme at 2019-07-01T21:43:24Z
s3:vfs: move get_fs_file_id to vfs_default

This makes get_fs_file_id() the default implementation of
SMB_VFS_FS_FILE_ID(). No change in behaviour.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
a3caf414 by Ralph Boehme at 2019-07-01T21:43:24Z
s3:smbd: use stored file_id in SMB_VFS_FS_FILE_ID()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
36d100e4 by Ralph Boehme at 2019-07-01T21:43:24Z
s3:smbd: set file_id in fetch_dos_mode_done()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
076f26dd by Ralph Boehme at 2019-07-01T21:43:24Z
vfs_fruit: move zero file-id to vfs_fruit

Now that this stuff goes through the VFS, let's do it right. :)

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
eb986786 by Ralph Boehme at 2019-07-01T21:43:24Z
vfs_fruit: make "fruit:zero_file_id" a per share option

Now that File-ID calculation goes through the VFS, we can nicely make a
per-share option out of it.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
03690ec2 by Ralph Boehme at 2019-07-01T21:43:24Z
vfs_fruit: change default for "fruit:zero_file_id" to false

Now that we have reliable File-IDs, change the default for the option
"zero_file_id" to false.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

- - - - -
6e65c283 by Ralph Boehme at 2019-07-01T23:21:07Z
selftest: add a test that itime is not set when setting DOS attrs

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Jul  1 23:21:07 UTC 2019 on sn-devel-184

- - - - -
b27817d4 by Gary Lockyer at 2019-07-02T02:23:08Z
provision tests: Add --backend-store-size option.

Tests for the new "samba-tool domain provision" option
"backend-store-size".  This allows the lmdb map size to be set during a
provision, instead of hard-wiring it to 8Gb

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b8446c08 by Gary Lockyer at 2019-07-02T02:23:08Z
python getopt: Add bytes option type

Add a new option type to the python command line options.
  Option("--size", type="bytes", metavar="SIZE")
To allow the input of file and memory sizes using unit suffixes i.e.
2Gb, 4KiB ...

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4644416a by Gary Lockyer at 2019-07-02T02:23:08Z
samba-tool: Make the 'bytes' option type avaiable

Allow samba tool to use the custom bytes option type.
  Option("--size", type="bytes", metavar="SIZE")
To allow the input of file and memory sizes using unit suffixes i.e.  2Gb,
4KiB ...

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5cbe76e3 by Gary Lockyer at 2019-07-02T02:23:09Z
samba-tool domain provision: add lmdb database size option

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b281fc62 by Andrew Bartlett at 2019-07-02T02:23:09Z
provision: If --targetdir has been specified then we must always reset posix:eadb and xattr_tdb:file

This is required because otherwise this may have been set previously by another
part of selftest thanks to the global loadparm and the running of multiple
samba-tool tests within the same python process.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
3b52ca59 by Gary Lockyer at 2019-07-02T02:23:09Z
lib ldb: save a copy of the options on the context

Copy the options supplied to to ldb_connect, and place them on the
ldb_context. This allows backend options i.e. lmbd map size to be passed
cleanly from the callers.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e46d5bb6 by Gary Lockyer at 2019-07-02T02:23:09Z
ldb: Release ldb 2.0.4

* copy the ldb_options passed to ldb_connect onto the ldb_context,
  making them more generally available.

* fix index buffering.
  As a performance enhancement the indexes are cached in memory during a
  transaction, and written to disk as part of the prepare commit. The
  indexes could become corrupt in the event of a failed operation.

* fix read beyond buffer
  Calling the "ldb_parse_tree" function with a filter consisting of
  exactly a single space (" ") would trigger a read beyond the input
  buffer.
  BUG: https://bugzilla.samba.org/show_bug.cgi?id=13900

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bbc20000 by Gary Lockyer at 2019-07-02T02:23:09Z
lib ldb ldb_mdb: Pass the lmdb map size as an ldb option

Allow the lmdb map size to be specified in the ldb option
"lmdb_env_size".

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
236f5f6a by Gary Lockyer at 2019-07-02T02:23:09Z
provision: Add --backend-store-size option

Add a new "samba-tool domain provision" option "backend-store-size".
This allows the lmdb map size to be set during a provision, instead of
hard-wiring it to 8Gb

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f93cb76a by Gary Lockyer at 2019-07-02T02:23:09Z
domain join tests: Add --backend-store-size option.

Tests for the new "samba-tool domain join" option
"backend-store-size". This allows the lmdb map size to be set during a
provision, instead of hard-wiring it to 8Gb.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ddfc1ddd by Gary Lockyer at 2019-07-02T02:23:09Z
samba-tool domain join: Add --backend-store-size option

Add a new "samba-tool domain join" option "backend-store-size".
This allows the lmdb map size to be set during a provision, instead of
hard-wiring it to 8Gb.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
0ee3b066 by Gary Lockyer at 2019-07-02T02:23:09Z
clone-dc-database tests: Add --backend-store-size option

Add a new "samba-tool drs clone-dc-database" option "backend-store-size".
This allows the lmdb map size to be set during a clone, instead of
hard-wiring it to 8Gb.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>'
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
97bc3db6 by Gary Lockyer at 2019-07-02T02:23:09Z
samba-tool clone-dc-database: Add --backend-store-size option

Add a new "samba-tool drs clone-dc-database" option "backend-store-size".
This allows the lmdb map size to be set during a clone, instead of
hard-wiring it to 8Gb.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>'
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
bdd72acd by Gary Lockyer at 2019-07-02T02:23:09Z
samba-tool dcpromo tests: add --backend-store-size option

Add a new "samba-tool domain dcpromo" option "backend-store-size".
This allows the lmdb map size to be set during a promotion, instead of
hard-wiring it to 8Gb.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2face299 by Gary Lockyer at 2019-07-02T02:23:09Z
samba-tool domain dcpromo: add --backend-store-size option

Add a new "samba-tool domain dcpromo" option "backend-store-size".
This allows the lmdb map size to be set during a promotion, instead of
hard-wiring it to 8Gb.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
54fbac97 by Gary Lockyer at 2019-07-02T02:23:09Z
join subdomain: changes for --backend-store-size

Pass the 'backend_store_size' parameter through to DCJoinContext.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5583208a by Gary Lockyer at 2019-07-02T02:23:10Z
samba-tool domain join: remove the subdomain option

Remove the sub domain option from join, as it currently does not work.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
92f9f836 by Gary Lockyer at 2019-07-02T04:19:29Z
WHATSNEW.txt: samba-tool --backend-size-parameter

Document the --backend-store-size option added to the samba-tool sub
commands:
 * domain provision
 * domain join
 * domain dcpromo
 * drs clone-dc-database

And the removal os the join subdomain option.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Tue Jul  2 04:19:29 UTC 2019 on sn-devel-184

- - - - -
dba9987b by Tim Beale at 2019-07-02T04:21:36Z
tests: Add getncchanges test for cross-partition links + TGT

This adds a test-case to highlight a bug in the client side GetNCChanges
handling.

These tests mostly exercise the server-side behaviour of sending the
GetNCChanges, however, there's a bug in the client-side code when we try
to handle a missing cross-partition link target *in combination* with
the GET_TGT flag already having been set.

The test is exercising the client-side code by using the 'samba-tool drs
replicate' command. By adding a one-way link to a deleted target object,
we force the client code to retry with the GET_TGT flag set.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
98848142 by Tim Beale at 2019-07-02T04:21:36Z
repl_md: Avoid dropping cross-partition links

Cross-partition links could still be dropped if GET_TGT was already
previously set for the replication.

This was due to a slight error in the order of logic. We never want to
ignore cross-partition links (regardless of whether the TARGETS_UPTODATE
/GET_TGT flag is set). We should only be returning early in the
GET_TGT case if the objects are both in the same partition.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14022
RN: When the AD domain contained a linked attribute that spanned
partitions, DRS replication could drop the link. This dropped link could
then result in subtle differences in behaviour between DCs, as some DCs
would have the link and others wouldn't. When this issue occurred, the
dropped link would be logged in a warning message:
 "<target-dn> is Unknown but up to date. Ignoring link from <source-dn>"
This issue would not always occur - it depended a lot on the database
contents. Typically, it would only potentially occur when joining a new
DC to the domain (doing an ldapcmp after the join would also highlight
the problem, if it occurred). This issue has now been resolved.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e406b6d7 by Douglas Bagnall at 2019-07-02T04:21:36Z
s4/scripting/autoidl: another py3 incompatible except

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5331f913 by Douglas Bagnall at 2019-07-02T04:21:36Z
script/bisect-test: fix for py3

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6972b53f by Douglas Bagnall at 2019-07-02T04:21:36Z
wintest: py3 telnet.sendline() doesn't like string with ^Z

Try using bytes instead.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ae147283 by Douglas Bagnall at 2019-07-02T04:21:36Z
s4/script/rodcdns: str type doesn't need decoding

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
a4cea294 by Douglas Bagnall at 2019-07-02T04:21:36Z
s4/tests/dsdb_schema: not usefully executable as script

You could run the script, but it wouldn't do anything.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9c630b4b by Douglas Bagnall at 2019-07-02T04:21:36Z
pytests/subunitrun: not usefully executable

it only defines classes and fiddles with signals.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
66620567 by Douglas Bagnall at 2019-07-02T04:21:36Z
s4/scripting/smbstatus: approach py3 compatibility

It is still unused and untested, probably not working.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
dfe32af9 by Douglas Bagnall at 2019-07-02T04:21:36Z
net idmap check: correct spelling of --force

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9c9f8875 by Douglas Bagnall at 2019-07-02T04:21:36Z
man net: include --json option

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
731f0b7b by Douglas Bagnall at 2019-07-02T04:21:36Z
docs/smbclient: document -Tcn

BUG:https://bugzilla.samba.org/show_bug.cgi?id=2352
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
82f327fc by Gary Lockyer at 2019-07-02T05:49:43Z
kcc: default to logging to DBGLVL_WARNING

If the "-d" debug level parameter is not supplied, default to DBGLVL_WARNING.
Overiding the "log level" set in smb.conf.

When samba runs the kcc command stderr output is logged at DBGLVL_ERR,
the default log destination is stderr.  As a result any log messages
generated by the kcc command, are effectively logged at DBGLVL_ERR.
This causes issues if auth or audit logging are enabled in smb.conf.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Pair-programmed-with: Tim Beale <timbeale at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Jul  2 05:49:43 UTC 2019 on sn-devel-184

- - - - -
75872ddd by Karolin Seeger at 2019-07-02T07:51:39Z
WHATSNEW: Add release notes for Samba 4.9.10.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
4cea44ba by Karolin Seeger at 2019-07-02T07:52:09Z
VERSION: Disable GIT_SNAPSHOT for the 4.9.10 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
98cef2ad by Karolin Seeger at 2019-07-02T07:52:46Z
VERSION: Bump version up to 4.9.11...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
ee9527f5 by Volker Lendecke at 2019-07-02T14:52:17Z
librpc/idl: fix build with --enable-spotlight

Fix regression introduced by 88bb8fe43ad30247a78d088fad9c840a7a63bd97.

Pair-programmed-with: Volker Lendecke <vl at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue Jul  2 14:52:17 UTC 2019 on sn-devel-184

- - - - -
e36398d9 by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Ensure initialized vars in do_lock

brl_lock does not initialize these variables in all cases

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

- - - - -
b0d4939d by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Avoid casts in do_lock()

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

- - - - -
b70d855e by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Make do_lock() return NTSTATUS

This routine did a NO-GO: It returned something on talloc_tos(), for
later consumption by push_blocking_lock_request. This is now gone, no
caller uses the "struct byte_range_lock" returned anymore.

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

- - - - -
5a012a0f by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: do_lock() never sees blocking locks anymore

This is now all handled in protocol-specific layers

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

- - - - -
37c9c4c3 by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: brl_lock() never sees blocking locks anymore

This is now all handled in protocol-specific layers

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

- - - - -
f83775d8 by Volker Lendecke at 2019-07-02T17:01:27Z
vfs: Remove "blocking_lock" from SMB_VFS_BRL_LOCK_WINDOWS

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

- - - - -
a045b9b1 by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Remove unused "blocking_lock" from brl_lock_windows_default()

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

- - - - -
5a89031c by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Remove unused "msg_ctx" from brl_lock_posix

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

- - - - -
b809e68c by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Remove unused "msg_ctx" from brl_lock()

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

- - - - -
4d75c0aa by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Remove unused "msg_ctx" from do_lock()

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

- - - - -
3a93c638 by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Remove unused "msg_ctx" from brl_unlock_posix()

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

- - - - -
39f14da9 by Volker Lendecke at 2019-07-02T17:01:27Z
vfs: Remove unused "msg_ctx" from SMB_VFS_BRL_UNLOCK_WINDOWS

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

- - - - -
c2292a85 by Volker Lendecke at 2019-07-02T17:01:27Z
smbd: Remove unused "msg_ctx" from brl_unlock()

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

- - - - -
31636580 by Volker Lendecke at 2019-07-02T17:01:28Z
smbd: Remove unused "msg_ctx" from brl_close_fnum()

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

- - - - -
06586267 by Volker Lendecke at 2019-07-02T17:01:28Z
smbd: Remove unused "msg_ctx" from do_unlock()

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

- - - - -
45d2720a by Volker Lendecke at 2019-07-02T17:01:28Z
smbd: Remove unused "msg_ctx" from locking_close_file()

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

- - - - -
f952967e by Volker Lendecke at 2019-07-02T17:01:28Z
smbd: Remove unused "msg_ctx" from smbd_do_locks_try()

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

- - - - -
ce3666fb by Volker Lendecke at 2019-07-02T17:01:28Z
smbd: Remove unused "msg_ctx" from smbd_smb1_do_locks_send()

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

- - - - -
9b017ab0 by Volker Lendecke at 2019-07-02T18:17:39Z
smbd: Simplify filename_convert_internal()

Use a direct struct assignment

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

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Jul  2 18:17:39 UTC 2019 on sn-devel-184

- - - - -
c3bad08e by Noel Power at 2019-07-03T08:55:23Z
lib/krb5_wrap: Fix leaking using mkstemp

commit: 8b92539997a9df8e0d217790fd82fc8f59ea50cc introduced a leak
by replacing mktemp with mkstemp (mkstemp returns an open fd)

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andreas Schneider <asn at samba.org>

- - - - -
4ef5a42c by Volker Lendecke at 2019-07-03T08:55:23Z
tdb: Adapt tdb_rescue() to README.Coding

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
f4430086 by Volker Lendecke at 2019-07-03T08:55:23Z
tdb: Adapt _tdb_transaction_cancel() to README.Coding

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

- - - - -
78b72857 by Stefan Metzmacher at 2019-07-03T10:22:13Z
ldb: Release ldb 1.4.7

Compared to 1.4.6:

 * LDAP_REFERRAL_SCHEME_OPAQUE was added
   to ldb_module.h in order to fix bug #12478.
   It means that Samba >= 4.9.11 is no longer able to
   build with ldb 1.4.6.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
fa2d5b3d by Volker Lendecke at 2019-07-03T10:51:32Z
lib: Fix return of server_id_db_prune_name()

The tdb routines return 0/-1 and return the specific error via
tdb_error(). server_id_db_prune_name() is expected to return an errno,
not 0/-1.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Noel Power <npower at samba.org>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Wed Jul  3 10:51:32 UTC 2019 on sn-devel-184

- - - - -
cf0442bf by Andreas Schneider at 2019-07-03T11:19:20Z
s3:modules: Add hash_inode() function based on SHA1

This should use SHA1 as modern CPUs have SHA NI instruction support.

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
855540a8 by Andreas Schneider at 2019-07-03T11:19:20Z
s3:modules: Allow SHA1 usage for file IDs in FIPS mode

This is non-cryptographic use!

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
10f82862 by Andreas Schneider at 2019-07-03T11:19:20Z
s3:modules: Use hash_inode() in vfs_fruit

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
09aecc7e by Karolin Seeger at 2019-07-03T11:42:02Z
WHATSNEW: Add release notes for Samba 4.9.11.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
f9055cbf by Karolin Seeger at 2019-07-03T11:42:54Z
VERSION: Disable GIT_SNAPSHOT for the 4.9.11 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
63547807 by Karolin Seeger at 2019-07-03T11:44:04Z
VERSION: Bump version up to 4.9.12...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
9d5044fe by Andreas Schneider at 2019-07-03T12:37:11Z
s3:modules: Use hash_inode() in vfs_streams_xattr

Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Jul  3 12:37:12 UTC 2019 on sn-devel-184

- - - - -
60afe949 by Isaac Boukris at 2019-07-03T12:38:13Z
selftest: remote_pac: s/s2u4self/s4u2self/g

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
37009984 by Isaac Boukris at 2019-07-03T12:38:13Z
selftest: check for PrimaryGroupId in DC returned group array

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
2ae75184 by Isaac Boukris at 2019-07-03T13:52:55Z
Add PrimaryGroupId to group array in DC response

This is a simplified version of the original patch by:
Felix Botner <botner at univention.de>

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

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

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Wed Jul  3 13:52:55 UTC 2019 on sn-devel-184

- - - - -
4992c9bb by Amit Kumar at 2019-07-03T15:12:50Z
docs: Correct 'net ads dns unregister --help' description

This change corrects the content of 'net ads dns unregister --help'
command. Updated output would be:
Usage:
net ads dns unregister [hostname]
    Remove all IP Address entires for a given
    hostname from the Active Directory server.

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

Signed-off-by: Amit Kumar <amitkuma at redhat.com>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Jul  3 15:12:50 UTC 2019 on sn-devel-184

- - - - -
1b39c563 by Ralf Habacker at 2019-07-03T19:24:52Z
winbind: fix crash in fill_domain_username_talloc() if specified username is NULL

Signed-off-by: Ralf Habacker <ralf.habacker at freenet.de>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jul  3 19:24:52 UTC 2019 on sn-devel-184

- - - - -
9d40b08a by Samuel Cabrero at 2019-07-04T02:07:19Z
bootstrap: Add OpenSUSE 15.1 image

Signed-off-by: Samuel Cabrero <scabrero at suse.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
aa9dbee2 by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool: fix format of command description (help messages)

Need to quote the backslash '\'.

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f17482e4 by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool tests: rename "user edit" test from edit.sh to user_edit.sh

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4c8660dc by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool tests: remove probably outdated comment

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7fd509a0 by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool user edit test: use testit instead of subunit_start_test, pass/failed

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
89d95fb7 by Björn Baumbach at 2019-07-04T02:07:20Z
ldb/ldb_ldif: add copy_raw_bytes helper variable to ldb_ldif_write_trace()

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
894ddafc by Björn Baumbach at 2019-07-04T02:07:20Z
ldb/ldb_ldif: add LDB_FLAG_FORCE_NO_BASE64_LDIF flag

Flag is used to enforce binary encoded attribute values per attribute.

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
824c98ac by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool tests: add additional tests for "samba-tool user edit" command

Especially test handling of base64 encoded attribute values here.

Add selftest/knownfail.d/samba_tool.user_edit.
Tests fail, because:
 - can not work with ldif without a trailing new line
 - can not handle base64 strings

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

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
64e37e38 by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool user edit: use ldb methods to create ldif to modify user

Remove tests from knownfail:
  samba.tests.samba_tool.user_edit.add_attribute_base64
  samba.tests.samba_tool.user_edit.add_attribute_base64_control
  samba.tests.samba_tool.user_edit.change_attribute_base64_control

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

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4954118b by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool user edit: simplify code

Use "None"-changetype here, instead of "Add". This avoids the need to
remove the changetype line afterwards.

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
33fe4817 by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool tests: add test for 'samba-tool user edit', using LDB_FLAG_FORCE_NO_BASE64_LDIF

Test to edit a user: Change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
08742d1d by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool user edit: avoid base64 encoded strings in editable ldif if possible

Use clear text arguments strings if possible. Makes it more comfortable
for users to edit the user objects attributes.

Remove test from knownfail:
  samba.tests.samba_tool.user_edit.change_attribute_force_no_base64

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
2c64a25f by Björn Baumbach at 2019-07-04T02:07:20Z
samba-tool computer: add 'edit' command to edit an AD computer object

Similar to the samba-tool user edit command.

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
153abd61 by Björn Baumbach at 2019-07-04T02:07:20Z
doc: add samba-tool computer command to samba-tool man page

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6c26abd9 by Björn Baumbach at 2019-07-04T02:07:21Z
samba-tool tests: add test for 'samba-tool computer edit' command

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b2fb0258 by Björn Baumbach at 2019-07-04T02:07:21Z
samba-tool group: add 'edit' command to edit an AD group object

Same like the samba-tool user edit command.

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3a97122f by Björn Baumbach at 2019-07-04T02:07:21Z
samba-tool tests: add test for 'samba-tool group edit' command

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
d103db07 by Björn Baumbach at 2019-07-04T02:07:21Z
doc: add samba-tool group command to samba-tool man page

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3f10c8f2 by Björn Baumbach at 2019-07-04T02:07:21Z
samba-tool: implement contact management commands

Usage: samba-tool contact <subcommand>

Contact management.

Available subcommands:
  create  - Create a new contact.
  delete  - Delete a contact.
  edit    - Modify a contact.
  list    - List all contacts.
  move    - Move a contact object to an organizational unit or container.
  show    - Display a contact.

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
78e78a40 by Björn Baumbach at 2019-07-04T02:07:21Z
samba-tool tests: add tests for contact management

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
cbf074d7 by Björn Baumbach at 2019-07-04T02:07:21Z
doc: add documentation for "samba-tool" contact management

Signed-off-by: Björn Baumbach <bb at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f8fbd9cf by Andrew Bartlett at 2019-07-04T02:07:21Z
pyldb: Apply flags specified by ldb.Ldb(flags=...) even if the URL is not set

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
bc48b4b1 by Andrew Bartlett at 2019-07-04T02:07:21Z
ldb: Add tests for Ldb.write_ldif() including the FLG_SHOW_BINARY and FLAG_FORCE_NO_BASE64_LDIF

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
e513bab9 by Andrew Bartlett at 2019-07-04T03:51:58Z
ldb: Try to explain the confusing overload of the LDB_FLG_MOD_* enumeration and other flags

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Jul  4 03:51:58 UTC 2019 on sn-devel-184

- - - - -
f5832457 by Andrew Bartlett at 2019-07-04T10:02:23Z
ldb: Fix dependency on ldb_key_value_sub_txn_{mdb_}test

ldb_tdb can be a module, but the test is actually looking for ltdb_err_map() in
ldb_tdb_err_map.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
32f2e390 by Gary Lockyer at 2019-07-04T10:02:23Z
ldb: Add new internal helper function ldb_options_get()

This is needed for modules to access the ldb->options array, as this in in ldb_private.h

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7d17dbd1 by Gary Lockyer at 2019-07-04T10:02:23Z
s4 samdb: pass ldb options to ldb_module_connect_backend

Pass the ldb options into ldb_module_connect_backend, to ensure ldb
options such as "batch mode" and "transaction index cache size" get passed
through to the backend modules.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
65225876 by Gary Lockyer at 2019-07-04T10:02:23Z
ldb key_value: Add batch_mode option

When performing a join the overhead of the sub transactions protecting
key value operations becomes significant.  This commit adds a new
"batch_mode" option that disables the sub transactions around key value
operations.

The operation level index cache is also disabled, which means the
overall transaction level index cache can become inconsistent if an
operation fails. To protect against this and other possible on disk
inconsistencies, if any operation fails during a batch_mode
transaction the commit will fail and transaction will be rolled back.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f87472c9 by Gary Lockyer at 2019-07-04T10:02:23Z
ldb ldb_key_value: test ldb batch

Test the the ldb "batch_mode" option sets batch mode operation.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
6226ab3b by Gary Lockyer at 2019-07-04T10:02:23Z
ldb: Rework index_transaction_cache_size to allow caller to specify a larger size

The previous code would override the caller with the DB size
estimate rather than allowing the caller to force the bigger size.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
86d480ad by Gary Lockyer at 2019-07-04T10:02:23Z
ldb: Release ldb 2.0.5

* add ldb_options_get
  add a function to get the options passed in ldb connect.

* add "batch_mode" option.
  This options stops sub transactions being started for key value
  operations.  It is intended to improve the performance in batch
  operations.  As it bypasses the protections on operations if an
  operation fails, the entire transaction will be aborted by a commit.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
4335f4b4 by Gary Lockyer at 2019-07-04T10:02:23Z
domain join: enable ldb batch mode

Enable ldb "batch_mode" transactions duting a join to improve
performance.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
7a0a2fab by Gary Lockyer at 2019-07-04T10:02:23Z
domain join: set ldb "transaction_index_cache_size" option

Set the "transaction_index_cache_size" on a join to improve
performance. These setting reduced a join to a 100k user domain from
105 minutes to 44 minutes.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
f837cd02 by Gary Lockyer at 2019-07-04T10:02:23Z
WHATSNEW: ldb_batch mode and join performance

Document the join performance improvement, and the ldb "batch_mode"
option.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ad127bce by Andrew Bartlett at 2019-07-04T10:02:23Z
WHATSNEW: add news about Samba AD at 100,000 scale

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

- - - - -
eaebd875 by Andrew Bartlett at 2019-07-04T11:25:07Z
WHATSNEW: add news the sad passing of python2 support

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Jul  4 11:25:07 UTC 2019 on sn-devel-184

- - - - -
1920ebfd by Volker Lendecke at 2019-07-04T14:03:28Z
dbwrap: Rename dbwrap_watched_wakeup()

In the next step I want to make dbwrap_watched_wakeup() publically
available under that canonical name.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
3b7b979e by Volker Lendecke at 2019-07-04T14:03:28Z
dbwrap: Add publically available dbwrap_watch_wakeup()

Without this, to notify watchers you need to actually store data. This
might be a waste of resources. locking.tdb waiters might actually wait
for leases.tdb or brlock.tdb changes, and locking.tdb records can be
large.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
aabc97eb by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Simplify share_mode_lock.c

Do explicit refcounting instead of talloc_reference(). A later patch
will introduce a share_mode_do_locked() routine that can be nested
arbitrarily with get_share_mode_lock(). To do sanity checks for proper
nesting, share_mode_do_locked needs to be aware of the reference
counts for "static_share_mode_lock".

Why is share_mode_memcache_delete() gone? In parse_share_modes() we
already move the data out of the cache, share_mode_lock_destructor()
we don't even bother re-adding the share_mode_data to the cache if
it does not have share entries, because the next opener will invent a
new seqnum anyway.

Also: Less talloc_reference(), less lines of code.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
0be81cda by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Introduce static_share_mode_record

The next commit will introduce share_mode_do_locked(), which allocates
a share mode record on the stack. We have to expect nested
get_share_mode_lock() calls from within share_mode_do_locked() for
which we need to share a db_record.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
44a77e6a by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Add share_mode_do_locked()

This is made for efficient locking of share mode records in
locking.tdb. Right now we already need that when accessing leases.tdb,
and soon it will be required for brlock.tdb as well. It does not give
direct access to the parsed share mode entry, but the record is
available for dbwrap_watched_wakeup() within downgrade_lease().

It can be freely nested with get_share_mode_lock calls, the record
will be shared and proper nesting should be checked.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
c5659f7b by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Send do_lock() through share_mode_do_locked()

We need to maintain the locking hierarchy locking.tdb->brlock.tdb at
all times. vfs_fruit directly calls do_lock(), which might fail to
maintain the locking hierarchy: In brlock.c we call
contend_level2_oplocks_begin(), which will soon look at the
locking.tdb record.

For the SMB1 and SMB2 callers we already have the share mode locked,
we might want to watch that record for unlocks. For those callers
share_mode_do_locked() is practically free to call, we share the
underlying db_record.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
01428c55 by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Add flags to the beginning of share_mode_data

They are put at the beginning for easy parsing without reading the
full struct. First step to remove the number of read oplocks/leases
from brlock.tdb, where it does not belong.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
0d4c4e04 by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Add file_has_read_lease()

This caches share_mode_data->flags in the fsp, cache flush happening
on tdb_seqnum change.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
ffd098d8 by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Set SHARE_MODE_HAS_READ_LEASE when granting a read lease

Lazy update of the flag: Whenever we add a read lease, we have to set
the flag. Nobody except contend_level2_oplocks_begin will remove that
flag again, as this would mean a full lease traverse when removing
one. And contend_level2_oplocks_begin traverses the leases anyway

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
0e34096c by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Set SHARE_MODE_HAS_READ_LEASE when downgrading an oplock

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
2d7efba0 by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Use share_mode's flags in contend_level2_oplocks

Here we traverse the oplocks and leases when breaking read leases. We
find out here whether any of those are still left.

As it's the receivers of the messages that downgrade the database
entries, we might do that more than once. Possible future
optimization?

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
8bae5d82 by Volker Lendecke at 2019-07-04T14:03:29Z
smbd: Don't store num_read_oplocks in brlock.tdb

This removes a kludgy implementation that worked around a locking
hierarchy problem: Setting a byte range lock had to contend the level2
oplocks, which are stored in locking.tdb/leases.tdb. We could not
access locking.tdb in the brlock.tdb code, as brlock.tdb might have
been locked first without locking.tdb, violating the locking hierarchy
locking.tdb->brlock.tdb. Now that that problem is gone (see the commit
wrapping do_lock() in share_mode_do_locked()), we can remove this
kludge.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
173923c4 by Bjoern Jacke at 2019-07-04T14:03:29Z
vfs_nfs4acl_xattr: fix setting of permissions via NFS

via NFS root may not be priviledged user, so we should not call become_root()
here. The normal NFS4 permissions already handle permission modify right, no
need to do more magic things for Samba here.

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
522fe236 by Jeremy Allison at 2019-07-04T14:03:29Z
s3: smbd: SMB1 add range checks to reply_search().

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
4a9d46da by Jeremy Allison at 2019-07-04T15:40:31Z
s3: smbd: SMB1 add range checks to reply_fclose().

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Thu Jul  4 15:40:31 UTC 2019 on sn-devel-184

- - - - -
b3a2508f by Tim Beale at 2019-07-04T22:49:23Z
s4/libnet: Fix joining a Windows pre-2008R2 DC

>From v4.8 onwards, Samba may not be able join a DC older than 2008R2
because the Windows DC doesn't support GET_TGT.

If the dsdb repl_md code can't resolve a link target it returns an
error, and the calling code (e.g. drs_util.py) should retry with
GET_TGT. However, GET_TGT is only supported on Windows 2008R2 and later,
so if you try to join an earlier Windows DC, the join will throw an
error that you can't work-around.

We can avoid this problem by setting the same DSDB flag that GET_TGT
sets to indicate that the link targets are as up-to-date as possible,
and so there's no point retrying. Missing targets are still logged, so
this at least allows the admin to fix up any problems after the join
completed.

I've only done this for the join case (problems during periodic
replication are probably still worth escalating to an error).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14021
RN: From Samba v4.8 onwards, joining a Windows 2003 or 2008 (non-R2) AD
DC may not have worked. When this problem occurred, the following
message would be displayed:
 'Failed to commit objects: DOS code 0x000021bf'
This particular issue has now been resolved. Note that there may still
be other potential problems that occur when joining an older Windows DC.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
eb8f74f2 by Andrew Bartlett at 2019-07-05T00:05:15Z
WHATSNEW: entries for gnutls and samba-tool

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jul  5 00:05:15 UTC 2019 on sn-devel-184

- - - - -
538ffe19 by Douglas Bagnall at 2019-07-05T01:05:19Z
tests: ensure that most python scripts have usage text

When a script is run with the wrong arguments, it should at least say
something like this:

    Usage: samba-foo [OPTIONS]

For many samba scripts, especially without a server environment, having
no arguments is the wrong arguments.

Here we look for every executable file with '#![...]python[3]' on the
first line, and exclude certain files and directories that have excuses
to fail the test. For example, many selftest scripts are stream-oriented
and will hang forever waiting for stdin, which is not an error. Some
test modules are designed so they can be optionally run from the command
line, but this option is typically only used by the developer who is
writing them.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
77d69ab8 by Douglas Bagnall at 2019-07-05T01:05:20Z
dns_hub: print usage with too few args

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
96148436 by Douglas Bagnall at 2019-07-05T01:05:20Z
script/compare_cc_results: print usage on too few args

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e5e4c113 by Douglas Bagnall at 2019-07-05T01:05:20Z
s4/scripting/get-descriptors: print usage with insufficient arguments

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
ffdb0ca8 by Douglas Bagnall at 2019-07-05T01:05:20Z
s4/scripting/mymachinepw: print usage with bad arguments

Also, use sys.exit() function, not exit(), because sys.exit() reliably
exists.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c78eef68 by Douglas Bagnall at 2019-07-05T01:05:20Z
s4/scripting/demodirsync: print usage if no host named

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
075bf608 by Douglas Bagnall at 2019-07-05T01:05:20Z
s4/scripting/samba_dnsupdate: print usage with no arguments

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
854e554c by Douglas Bagnall at 2019-07-05T01:05:20Z
tests/usage: python scripts --help should be helpful

We want to be sure it says *something* and returns success.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
08903462 by Douglas Bagnall at 2019-07-05T01:05:20Z
tests/usage: generalise to cover non-python scripts

It is not as simple as running everything executable, because for example
.so library files are marked as executable.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
027d35bd by Douglas Bagnall at 2019-07-05T01:05:20Z
python/tests: helper function for checking --help consistency

Check that --help output doesn't contradict itself by assigning the same
option string to different meanings (which *does* happen in the ldb tools).

This will be used in the samba-tool help tests and the usage tests.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
272a6c3c by Douglas Bagnall at 2019-07-05T01:05:20Z
tests/samba-tool: test --help consistency

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9fc8e2a6 by Douglas Bagnall at 2019-07-05T01:05:20Z
tests/usage: test for --help consistency

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
3822a41f by Douglas Bagnall at 2019-07-05T01:05:20Z
s4/scripting/autoidl: remove it

What does it even do? Possibly nothing, not least because nobody ever
runs it.

It was introduced as source4/scripting/bin/autoidl.py in
a2446e5f8550582c0d4353bb85874dea17cf1d98 ("initial work for script
that uses probing to figure out IDL"). Since then it has only had
superficial patches, generally aimed at Python 3.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
c6bb0497 by Douglas Bagnall at 2019-07-05T01:05:20Z
s4/torture: remove autoidl

This has been turned off by default for 10 years
(since 26e114b83ce1de7515bfbf365), and is only interesting for
nostalgia purposes.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
31345376 by Douglas Bagnall at 2019-07-05T01:05:21Z
s4/scripting/smbstatus: begone

Untested and unused.

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
5f7d82a8 by Martin Schwenke at 2019-07-05T01:05:21Z
util: Avoid localised underflow

Avoid parenthesising an unsigned subtraction that can be negative and,
therefore, underflow.  There is no need for the parentheses and
removing them results in an expression that is evaluated left-to-right
and can not underflow.

It isn't clear that the underflow matters.  lp <= ls, so if (li - lp)
underflows then ls + (li - lp) will always overflow.  This should
produce the correct answer.  However, depending on this seems wrong.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
9d90ac35 by Martin Schwenke at 2019-07-05T02:24:52Z
util: Fix off-by-one error in message about overflow

len includes space for the NUL character, so the calculation needs to
take the NUL character into account.

While touching this, drop unnecessary casts by updating format string
and update to modern debug macro.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jul  5 02:24:52 UTC 2019 on sn-devel-184

- - - - -
17d267e9 by Karl Lenz at 2019-07-05T03:33:19Z
winexe: Fix translation of the winexesvc binaries to C

Two small Windows binaries that winexe uses to execute commands on a
remote system, winexesvc32.exe and winexesvc64.exe, are compiled then
translated into a C byte array as hex so that they can be embedded into
the winexe binary. Although the winexesvc binaries were built properly,
the Python method that does the translation to C tried to open them in
text mode, which would have worked in Python 2 before the concept of
bytearrays was introduced, but instead raises an exception in Python 3.
The exception was unfortunately suppressed, so the build didn't stop,
and the winexe binary that was produced was effectively useless because
it didn't contain either winexesvc binary as expected. After winexe
successfully authenticated with a Windows host, it showed the error
message below rather than executing the given command on the remote
system.

$ ./bin/winexe -U karl%password1 -d 2 //192.168.56.3 cmd
winexe_svc_install: dcerpc_svcctl_StartServiceW failed: WERR_BAD_EXE_FORMAT
main: winexe_svc_install failed: NT_STATUS_BAD_INITIAL_PC

This commit fixes that problem by opening the winexesvc binaries in
binary mode rather than text mode when the winexe build script reads
them to translate them to C. Furthermore it adds an additional
sanity check that will cause the winexesvc binary generator commands to
fail if the winexesvc binaries cannot be opened or read correctly to
guarantee that the build does not silently "succeed" if something like
this ever happens again.

Signed-off-by: Karl Lenz <xorangekiller at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
f31333d4 by Karl Lenz at 2019-07-05T03:33:19Z
s4 heimdal_build: Fix static heimdal builds with replacement closefrom()

If Samba was configured with "--nonshared-binary=winexe" to build
winexe as a static binary, and the replacement closefrom() function
was used (which is default on most GNU/Linux systems without the libbsd
development package installed), then winexe would fail to link with the
error message shown below.

[2631/3059] Linking bin/default/examples/winexe/winexe
source4/heimdal/lib/roken/closefrom.c.1.o: In function `rep_closefrom':
closefrom.c:(.text+0x0): multiple definition of `rep_closefrom'
lib/replace/closefrom.c.2.o:closefrom.c:(.text+0x292): first defined here
collect2: error: ld returned 1 exit status

The real problem here was not with the winexe build itself - that was
merely the application that I was attempting to build statically when I
encountered it. As Andrew Bartlett very helpfully pointed out to me, this
regression was introduced when "lib/replace/closefrom.c" was added in
commit 55529d0f and, more to the point, when the heimdal build started
using it in commit 3a7ebd0e. From that point on, any time that Samba's
embedded copy of heimdal was statically linked into an application, it
would fail to link because heimdal's own rep_closefrom() function in its
"roken" library would conflict with the rep_closefrom() function in the
"replace" library used elsewhere in Samba - a library which the "roken"
library itself depends on. To further compound the problem, heimdal's
own "roken" library is also compiled for the host (a necessary
distinction for cross-compiled builds) and linked into a small number of
utility applications used during the heimdal build. However, they can't
link directly against the "replace" library, unlike the main "roken"
library build which carries that dependency, because the "replace"
library is _not_ built for the host.

I solved this problem by eliminating heimdal's version of rep_closefrom()
and making it use the one from "lib/replace" everywhere. That wasn't a
problem for the main heimdal library that is built for the target because
it was already linking in "lib/replace" (that's what caused this problem
in the first place!), but to solve the aforementioned issue with
"lib/replace" not being built for the host, I added
"lib/replace/closefrom.c" to the list of "source4/heimdal/lib/roken"
sources to be built for the host to satisfy heimdal's host utilities.
Everyone wins, I think.

Signed-off-by: Karl Lenz <xorangekiller at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
7425a8fb by Karl Lenz at 2019-07-05T03:33:19Z
winexe: Add support for connecting to a host on an alternate port

This commit allows an optional port number to be specified after the
hostname on the winexe command line. If no port is given, it defaults
to port 445, just like it used before. Although this is probably a
pretty uncommon use-case, it allows port-forwarding the service through
a firewall to an alternate port, which can occassionally be helpful.

$ ./bin/winexe -U karl%password1 //127.0.0.1:5445 cmd.exe
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>

Signed-off-by: Karl Lenz <xorangekiller at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
aa199696 by Christof Schmitt at 2019-07-05T03:33:19Z
smbtorture: Add smb2.ioctl.sparse_set_sparse

This allows for manual testing of changing the sparse setting on a file
and verifying the flag in the file system.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
e1bb3d34 by Christof Schmitt at 2019-07-05T03:33:19Z
smbtorture: Add smb2.ioctl.zero_data

Allow to manually issue the FSCTL_ZERO_DATA call and verify the
state of the file in the file system.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
b1fc6e43 by Christof Schmitt at 2019-07-05T05:02:12Z
s3:tests: Add test for manual smbtorture zero-data

Ensure that these tests keep working.

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jul  5 05:02:12 UTC 2019 on sn-devel-184

- - - - -
90de5e05 by Martin Schwenke at 2019-07-05T05:03:22Z
ctdb-tools: Drop onnode -o option

I don't think anyone uses this and it causes complications.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
f3feb4df by Martin Schwenke at 2019-07-05T05:03:22Z
ctdb-tools: Drop no-op stdout-filter from non-parallel case

This filter no longer does anything useful in this context.  By
default it adds a pipeline with trailing cat process.  In many
contexts, stdout of the process being run is still open so the cat
process will stay around and will stop onnode from exiting.

The filters should all go away because they are simply an example of
code that is trying to be too clever while causing unfortunate corner
cases.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
6478d65a by Martin Schwenke at 2019-07-05T05:03:22Z
ctdb-tools: Drop separate parallel+verbose stdout/stderr filtering

This has been broken for 10 years since commit
9616959bd6938e4c5c3713fe986c1e17cbdc574c, which introduced the
separate filtering.  This commit was missing a redirect of the output
of stderr_filter() to stderr.

Since nobody depends on the separate filtering (i.e. nobody reported a
bug), just return to combining stdout and stderr, and filtering them
together.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
65563479 by Martin Schwenke at 2019-07-05T05:03:22Z
ctdb-daemon: Make old list_of_nodes() function static

The next commit will change the type of this function, which is only
used in this file.  So, make it static to isolate the change.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
3ccce53e by Martin Schwenke at 2019-07-05T05:03:22Z
ctdb-daemon: Make type of list_of_nodes() consistent with callers

Instead of taking exclude_pnn as a parameter, calculate it from an
include_self_parameter, which is passed through from the 2 calling
functions.

While doing this, fix a signed/unsigned comparison issue by declaring
the new exclude_pnn local variable as an unsigned type.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
1e47a1b3 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-daemon: Fix signed/unsigned comparisons by declaring as unsigned

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
76e930d7 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-daemon: Fix signed/unsigned comparisons by casting

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
c39441f6 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-daemon: Fix signed/unsigned comparisons by using constant

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
9c75ad68 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-daemon: Drop unused values assigned to variable

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
4c24d434 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-cluster-mutex: Ensure that the configured command is not empty

... and does not just contain whitespace.

Otherwise NULL can be passed as the first argument to execv().

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
914e6b21 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Fix signed/unsigned comparison by declaring as unsigned

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
6053bf4b by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Declare variable for return value of write(2) as ssize_t

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
f749356d by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Add a local variable for repeated calculation

This improves readability.  Also, the asserts involving this
expression get more complicated in the next commit, so this will keep
those asserts within a single line.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
c172e0ef by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Fix signed/unsigned comparisons by casting

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
68a4588a by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Fix signed/unsigned comparisons by declaring as unsigned

Change declarations of variable and parameters, usually loop variables
and limits, from int to unsigned int, size_t or uint32_t.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
5d8531b0 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Fix signed/unsigned comparisons by casting

These are all cases comparing a number of bytes written (int or
ssize_t) with a size_t, so casting to size_t is appropriate.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
d855dc2a by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Don't compare an unsigned value with -1

The dummy reader should never be called, so contains an assert on the
buffer length that should always trigger.  Just abort() instead.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
75747c61 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tests: Avoid warning about NULL dereference

Static analysis finds that earlier in the call path, ctdb_string_len()
checks for NULL, so complains that a NULL value can be passed to
strlen() here.  Avoid this by adding an assert().

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
888ecc74 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-tcp: Fix signed/unsigned comparisons by declaring as unsigned

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
010c1d77 by Martin Schwenke at 2019-07-05T05:03:23Z
ctdb-daemon: Replace function ctdb_ip_to_nodeid() with ctdb_ip_to_pnn()

Node ID is a poorly defined concept, indicating the slot in the node
map where the IP address was found.  This signed value also ends up
compared to num_nodes, which is unsigned, producing unwanted warnings.

Just return the PNN because this what both callers really want.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
75a808fd by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-daemon: Don't index by PNN when initialising node flags

Indexing by PNN is wrong.

This also removes a signed/unsigned comparison because the PNN is not
compared to -1 anymore.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
4f84aafa by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-protocol: Do not ignore return value of ctdb_g_lock_pull()

clang reports:

  ctdb/protocol/protocol_types.c:5191:3: warning: Value stored to 'ret' is never read

Found by csbuild.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
248d585a by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-protocol: Fix signed/unsigned comparison by declaring as unsigned

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
3f388076 by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-protocol: Variable for return value of strlcpy() should be size_t

This avoids an unnecessary signed/unsigned comparison issue.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
2a933859 by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-protocol: Avoid signed/unsigned comparison by casting

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
79a7cc3f by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-daemon: Drop unused function ctdb_vfork_with_logging()

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
0ab5d5ce by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-common: Fix signed/unsigned comparisons by casting

One case needs an extra variable declared.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
271d96e4 by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-common: Fix error handling

According to the documentation, sendto() should either send the packet
as given or return with an error.  However, given that it can return
the number of bytes sent, treat the theoretical error of a short
packet send separately, since errno would not be set in this case.

Similarly, treat a short packet recv() separately from an error where
errno is set.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
d424d219 by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-common: Fix signed/unsigned comparisons by declaring as unsigned

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
e7b586f7 by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-event: Assign missing return value

Otherwise ret == 0 is returned from successful call to
ctdb_int32_pull().

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
5527f392 by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-database: Fix signed/unsigned comparison by casting

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
ba95cb2a by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-event: Fix signed/unsigned comparisons by casting

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
e5a946cb by Martin Schwenke at 2019-07-05T05:03:24Z
ctdb-common: Mark ctdb_fatal() and ctdb_die() as _NORETURN_

This avoids static analysers continuing analysis after calls to these
functions and producing incorrect warnings.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
755a9e65 by Martin Schwenke at 2019-07-05T05:03:25Z
ctdb-daemon: Don't check if lock_ctx->ctdb_db is NULL

This can never be NULL.  It could probably be NULL in the past when
"all database" locks existed.

There are paths where is is checked for NULL and then later
dereferenced, causing static analysers to produce spurious warnings.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
e0b33c55 by Martin Schwenke at 2019-07-05T05:03:25Z
ctdb-build: Tweak hacking of rpcgen output

csbuild doesn't like the hack where variable buf is initialised to
itself to avoid an unused variable warning.  buf is unused so remove
it instead.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
a0561c7e by Martin Schwenke at 2019-07-05T06:19:11Z
ctdb-tests: Rename local-daemon.sh dump-logs to print-log

This makes it consistent with print-socket.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Fri Jul  5 06:19:11 UTC 2019 on sn-devel-184

- - - - -
c5803507 by Rafael David Tinoco at 2019-07-05T06:49:16Z
ctdb-config: depend on /etc/ctdb/nodes file

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

CTDB should start as a disabled unit (systemd) in most of the
distributions and, when trying to enable it for the first time, user
should get an unconfigured, or similar, error.

Depending on /etc/ctdb/nodes file will give a clear direction to final
user on what is needed in order to get cluster up and running. It should
work like previous ENABLED=NO variables in SySV like initialization
scripts.

Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
753874b3 by Martin Schwenke at 2019-07-05T06:49:16Z
ctdb-tools: CID 1449530 - Negative loop bound

Regression introduced by commit
2558f96da1f9be8034f26736c8050bb38a1f82a8.  count should be signed
because list_of_connected_nodes() returns -1 on failure.  Variable i
is used in both signed and unsigned contexts, so add new signed
variable j for use in signed context.

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
cd0df26b by Martin Schwenke at 2019-07-05T08:05:00Z
WHATSNEW: Add CTDB updates for 4.11

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Fri Jul  5 08:05:00 UTC 2019 on sn-devel-184

- - - - -
8bad427e by Mathieu Parent at 2019-07-07T06:22:19Z
New upstream version 4.9.11+dfsg
- - - - -
12672ed7 by Mathieu Parent at 2019-07-07T06:23:33Z
Merge tag 'upstream/4.9.11+dfsg'

Upstream version 4.9.11+dfsg

- - - - -
bda546da by Mathieu Parent at 2019-07-07T06:30:45Z
Bump ldb Build-Depends to 2:1.5.1+really1.4.7

- - - - -
e8f8cbc0 by Mathieu Parent at 2019-07-07T06:42:00Z
Changelog for previous commits

- - - - -
56d10061 by Rafael David Tinoco at 2019-07-07T06:44:00Z
  * debian/rules: Make DEB_HOST_ARCH_CPU initialized through
    dpkg-architecture (Closes: #931138)

- - - - -
4e877694 by Rafael David Tinoco at 2019-07-07T07:32:56Z
* d/p/fix-nfs-service-name-to-nfs-kernel-server.patch: change nfs service name from nfs to nfs-kernel-server (LP: #722201)

Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>

- - - - -
626da08b by Mathieu Parent at 2019-07-07T07:32:56Z
Adapt fix-nfs-service-name-to-nfs-kernel-server.patch to samba 4.9

- - - - -
60b20e3c by Rafael David Tinoco at 2019-07-07T07:32:56Z
ctdb-config: depend on /etc/ctdb/nodes file

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

CTDB should start as a disabled unit (systemd) in most of the
distributions and, when trying to enable it for the first time, user
should get an unconfigured, or similar, error.

Depending on /etc/ctdb/nodes file will give a clear direction to final
user on what is needed in order to get cluster up and running. It should
work like previous ENABLED=NO variables in SySV like initialization
scripts.

Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
4bf9a312 by Rafael David Tinoco at 2019-07-07T07:34:24Z
  * d/ctdb.install, d/rules: create ctdb run directory into tmpfiles.d
    to allow pid file to exist (Closes: #929931)

- - - - -
ddde5416 by Rafael David Tinoco at 2019-07-07T07:34:24Z
  * Allow proper ctdb initalization (Closes: #929931):
    - d/ctdb.dirs: added /var/lib/ctdb/* directories
    - d/ctdb.postrm: remove leftovers from:
      /var/lib/ctdb/{state,persistent,volatile,scripts}

- - - - -
699f459e by Rafael David Tinoco at 2019-07-07T07:34:24Z
  * d/rules: installing provided config examples and helper scripts
  * Examples of NFS HA CTDB config files + helper script:
    - d/ctdb.example.enable.nfs.sh
    - d/ctdb.example.nfs-common
    - d/ctdb.example.nfs-kernel-server
    - d/ctdb.example.services
    - d/ctdb.example.sysctl-nfs-static-ports.conf
    (Closes: #929931)

- - - - -
fa5ae722 by Mathieu Parent at 2019-07-07T08:20:03Z
Changelog for previous commits

- - - - -
247316b0 by Mathieu Parent at 2019-07-07T16:54:21Z
Enable vfs_nfs4acl_xattr (Closes: #930540)

- - - - -
97a96d01 by Mathieu Parent at 2019-07-07T16:56:50Z
Drop security patches, merged upstream

- - - - -
538f804c by Mathieu Parent at 2019-07-07T17:29:31Z
Ensure fix-nfs-service-name-to-nfs-kernel-server.patch applies with git-am

- - - - -
e1650a00 by Rafael David Tinoco at 2019-07-07T17:29:31Z
fix nfs service name to nfs-kernel-server

Upstream code used to comment in/out service script names related to a specific
distribution. Recently, they've changed this to a method of detecting on which
distribution ctdb is running, and then setting the systemd unit file name, for
example.

Because of this new detection mechanism, it is impossible to suggest upstream a
change like this patch and, at the same time, backporting this new code could
bring more problems. Instead, this patch should be kept until a new merge with
upstream is done.

This temporary patch fixes the NFS service name for Debian & Ubuntu.

Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>

Bug-Debian: https://bugs.debian.org/929931
Bug-Ubuntu: https://bugs.launchpad.net/bugs/722201
Last-Update: 2018-06-26

- - - - -
4a37b99a by Rafael David Tinoco at 2019-07-07T17:29:31Z
ctdb-config: depend on /etc/ctdb/nodes file

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

CTDB should start as a disabled unit (systemd) in most of the
distributions and, when trying to enable it for the first time, user
should get an unconfigured, or similar, error.

Depending on /etc/ctdb/nodes file will give a clear direction to final
user on what is needed in order to get cluster up and running. It should
work like previous ENABLED=NO variables in SySV like initialization
scripts.

Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

- - - - -
a372596e by Mathieu Parent at 2019-07-07T17:29:31Z
Changelog for previous commits

- - - - -
37b3c637 by Björn Jacke at 2019-07-07T21:32:25Z
torture: fix durable open/alloc-size test

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
d6b8cbc8 by Björn Jacke at 2019-07-07T21:32:25Z
param: change default of "allocation roundup size" to 0

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

- - - - -
0751047f by Björn Jacke at 2019-07-07T23:21:55Z
docs-xml: deprecate allocation roundup size parameter

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>

Autobuild-User(master): Björn Jacke <bjacke at samba.org>
Autobuild-Date(master): Sun Jul  7 23:21:55 UTC 2019 on sn-devel-184

- - - - -
6f817a90 by Mathieu Parent at 2019-07-08T06:30:50Z
libsamba-passdb.so bumped to 0.27.2

See https://bugzilla.samba.org/show_bug.cgi?id=13813 for context

- - - - -
175d0945 by Mathieu Parent at 2019-07-08T07:57:26Z
Release 2:4.9.11+dfsg-1

- - - - -
f3e4a0d9 by Björn Jacke at 2019-07-08T09:29:33Z
WHATSNEW: changed default/deprecation of allocation roundup size

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
Reviewed-by: Karolin Seeger <kseeger at samba.org>

Autobuild-User(master): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(master): Mon Jul  8 09:29:33 UTC 2019 on sn-devel-184

- - - - -
d759f4aa by Noel Power at 2019-07-08T09:30:09Z
lib/util: clang: Fix 'Null pointer passed as an argument'

Fixes lib/util/iov_buf.c:50:4: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
                        memcpy(p, iov[i].iov_base, thislen);
                        ^
1 warning generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
17ce70d6 by Noel Power at 2019-07-08T09:30:09Z
lib/param: clang: Fix Value stored is never read

Fixes:
lib/param/loadparm.c:2164:2: warning: Value stored to 'bRetval' is never read <--[clang]
        bRetval = false;
        ^         ~~~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
96e00a52 by Noel Power at 2019-07-08T09:30:10Z
s3/lib: Fix Access to field results in dereference of NULL pointer

Fixes:

ource3/lib/messages_dgm.c:176:29: warning: Access to field 'queue' results in a dereference of a null pointer (loaded from variable 'out') <--[clang]
        qlen = tevent_queue_length(out->queue);

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
109b4381 by Noel Power at 2019-07-08T09:30:10Z
s4/dsdb/schema: Fix Access to field results in deference of null pointer

Fixes:

source4/dsdb/schema/schema_info_attr.c:207:38: warning: Access to field 'revision' results in a dereference of a null pointer (loaded from variable 'schema_info') <--[clang]
        if (schema->schema_info->revision > schema_info->revision) {
                                            ^~~~~~~~~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
50a22849 by Noel Power at 2019-07-08T09:30:10Z
s4/dsdb/schema: Fix 'Value stored to 'ret' is never read'

Fixes:

source4/dsdb/schema/schema_set.c:274:3: warning: Value stored to 'ret' is never read <--[clang]
                ret = LDB_SUCCESS;
                ^     ~~~~~~~~~~~
source4/dsdb/schema/schema_set.c:327:3: warning: Value stored to 'ret' is never read <--[clang]
                ret = LDB_SUCCESS;
                ^     ~~~~~~~~~~~

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
d54f9aaf by Noel Power at 2019-07-08T09:30:10Z
s4/dsdb/schema: clang: Fix Array access results in null pointer deref

Fixes:
source4/dsdb/schema/schema_query.c:223:15: warning: Array access (from variable 'attr_list') results in a null pointer dereference <--[clang]
        attr_list[i] = NULL;
        ~~~~~~~~~    ^
1 warning generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

- - - - -
6b96ae83 by Noel Power at 2019-07-08T11:04:15Z
auth/kerberos: clang: Fix same instances of 'Value stored is never read'

Fixes:

auth/kerberos/gssapi_pac.c:136:3: warning: Value stored to 'gss_maj' is never read <--[clang]
                gss_maj = gss_release_buffer(&gss_min, &pac_buffer);
                ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
auth/kerberos/gssapi_pac.c:137:3: warning: Value stored to 'gss_maj' is never read <--[clang]
                gss_maj = gss_release_buffer(&gss_min, &pac_display_buffer);
                ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
auth/kerberos/gssapi_pac.c:265:4: warning: Value stored to 'gss_maj' is never read <--[clang]
                        gss_maj = gss_release_buffer_set(&gss_min, &set);
                        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
auth/kerberos/gssapi_pac.c:273:4: warning: Value stored to 'gss_maj' is never read <--[clang]
                        gss_maj = gss_release_buffer_set(&gss_min, &set);
                        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
auth/kerberos/gssapi_pac.c:279:4: warning: Value stored to 'gss_maj' is never read <--[clang]
                        gss_maj = gss_release_buffer_set(&gss_min, &set);
                        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
auth/kerberos/gssapi_pac.c:285:5: warning: Value stored to 'gss_maj' is never read <--[clang]
                                gss_maj = gss_release_buffer_set(&gss_min, &set);
                                ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
auth/kerberos/gssapi_pac.c:291:2: warning: Value stored to 'gss_maj' is never read <--[clang]
        gss_maj = gss_release_buffer_set(&gss_min, &set);
        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 warnings generated.

Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Mon Jul  8 11:04:15 UTC 2019 on sn-devel-184

- - - - -
88a60f59 by Karolin Seeger at 2019-07-08T11:43:57Z
WHATSNEW: Fix typo.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
3bcaef67 by Stefan Metzmacher at 2019-07-08T11:43:57Z
s4:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()

The domain join with VMWare Horizon Quickprep seems to use
netr_ServerAuthenticate3() with just the NEG_STRONG_KEYS
(and in addition the NEG_SUPPORTS_AES) just to verify a password.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13464 (maybe)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13949

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit ead9b93ce5c2c67bbdb778232805d6d9e70112fc)

- - - - -
a47fd552 by Stefan Metzmacher at 2019-07-08T11:43:57Z
s3:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()

The domain join with VMWare Horizon Quickprep seems to use
netr_ServerAuthenticate3() with just the NEG_STRONG_KEYS
(and in addition the NEG_SUPPORTS_AES) just to verify a password.

Note: NETLOGON_NEG_SCHANNEL is an alias to NEG_AUTHENTICATED_RPC.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13464 (maybe)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13949

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit fa5215ce5b93fb032df341e718d7011e619f0916)

- - - - -
948b60d2 by Stefan Metzmacher at 2019-07-08T11:43:57Z
s3:rpc_server:netlogon: simplify AUTH_TYPE_SCHANNEL check in netr_creds_server_step_check()

The gensec schannel module already asserts that at least
AUTH_LEVEL_INTEGRITY is used.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 0b6e37c9e801435e094194dd60d9213b4868c3de)

- - - - -
00dbe9ff by Tim Beale at 2019-07-08T11:43:58Z
dsdb: Handle DB corner-case where PSO container doesn't exist

A 2003 AD DB with functional level set to >= 2008 was non-functional
due to the PSO checks.

We already check the functional level is >= 2008 before checking for the
PSO container. However, users could change their functional level
without ensuring their DB conforms to the corresponding base schema.

The objectclass DSDB module should prevent the PSO container from ever
being deleted. So the only way we should be able to hit this case is
through upgrading the functional level (but not the underlying schema
objects). If so, log a low-priority message and continue without errors.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14008
RN: Previously, AD operations such as user authentication could fail
completely with the message 'Error 32 determining PSOs in system' logged
on the samba server. This problem would only affect a domain that was
created using a pre-2008 AD base schema and then had its functional
level manually raised to 2008 or greater. This issue has now been
resolved.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 295bf73e9b24b1f2b4594320a6501dc7410d4b43)

- - - - -
e126fdaa by Michael Adam at 2019-07-08T11:43:58Z
vfs:glusterfs: treat ENOATTR as ENOENT

The original implementation of the virtual xattr get_real_filename
in gluster was misusing the ENOENT errno as the authoritative anwer
that the file/dir that we were asking the real filename for does not
exist. But since the getxattr call is done on the parent directory,
this is a violation of the getxattr API which uses ENOENT for the
case that the file/dir that the getxattr call is done against does
not exist.

Now after a recent regression for fuse-mount re-exports due to
gluster mapping ENOENT to ESTALE in the fuse-bridge, the gluster
implementation is changed to more correctly return ENOATTR if the
requested file does not exist.

This patch changes the glusterfs vfs module to treat ENOATTR as ENOENT
to be fully functional again with latest gluster.

- Without this patch, samba against a new gluster will work correctly,
  but the get_real_filename optimization for a non-existing entry
  is lost.

- With this patch, Samba will not work correctly any more against
  very old gluster servers: Those (correctly) returned ENOATTR
  always, which Samba originally interpreted as EOPNOTSUPP, triggering
  the expensive directory scan. With this patch, ENOATTR is
  interpreted as ENOENT, the authoritative answer that the requested
  entry does not exist, which is wrong unless it really does not exist.

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

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
(cherry picked from commit 8899eb21d48b7077328ae560490f9fb9715a6b83)

- - - - -
ea481544 by Michael Adam at 2019-07-08T11:43:58Z
vfs:glusterfs_fuse: treat ENOATTR as ENOENT

The original implementation of the virtual xattr get_real_filename
in gluster was misusing the ENOENT errno as the authoritative anwer
that the file/dir that we were asking the real filename for does not
exist. But since the getxattr call is done on the parent directory,
this is a violation of the getxattr API which uses ENOENT for the
case that the file/dir that the getxattr call is done against does
not exist.

Now after a recent regression for fuse-mount re-exports due to
gluster mapping ENOENT to ESTALE in the fuse-bridge, the gluster
implementation is changed to more correctly return ENOATTR if the
requested file does not exist.

This patch changes the glusterfs_fuse vfs module to treat ENOATTR as
ENOENT to be fully functional again with latest gluster.

- Without this patch, samba against a new gluster will work correctly,
  but the get_real_filename optimization for a non-existing entry
  is lost.

- With this patch, Samba will not work correctly any more against
  very old gluster servers: Those (correctly) returned ENOATTR
  always, which Samba originally interpreted as EOPNOTSUPP, triggering
  the expensive directory scan. With this patch, ENOATTR is
  interpreted as ENOENT, the authoritative answer that the requested
  entry does not exist, which is wrong unless it really does not exist.

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

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Fri Jun 28 12:52:03 UTC 2019 on sn-devel-184

(cherry picked from commit fee8cf326bfe240d3a8720569eab43f474349aff)

- - - - -
9f0820f9 by Volker Lendecke at 2019-07-08T16:22:37Z
smbd: Make find_share_mode_entry() static to locking.c

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
81011f5e by Volker Lendecke at 2019-07-08T16:22:37Z
smbd: Make get_relative_fid_filename() static to open.c

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
cb2e6226 by Volker Lendecke at 2019-07-08T16:22:37Z
smbd: Simplify smbd_smb2_setinfo_send()

Avoid an "else" branch

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
aab429c1 by Volker Lendecke at 2019-07-08T16:22:37Z
smbd: Slightly simplify fsp_lease_update()

We have already dereferenced fsp->lease

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
9c81d7ec by Volker Lendecke at 2019-07-08T16:22:37Z
vfs_fruit: Fix a typo

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
b16f7113 by Volker Lendecke at 2019-07-08T16:22:37Z
smbd: Slightly simplify open_mode_check()

If there are no share modes, we'll just not enter the loop.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
32766db2 by Volker Lendecke at 2019-07-08T16:22:37Z
smbd: Move fcb_or_dos_open() out of open_file_ntcreate()

This is SMB1-only and pre-ntcreate with only 3 callers that look at
NTCREATEX_OPTIONS_PRIVATE_DENY_[DOS|FCB]. It is a bit less efficient
if it kicks in (we have to recreate the fsp), but SMB1 is less and
less popular, and this particular share mode combination from the
open&x family of calls might not be worth optimizing for.

This adds smb1_utils.[ch] as a kitchen sink for functions that can go
away once we drop SMB1.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
c163ef20 by Stefan Metzmacher at 2019-07-08T16:22:37Z
selftest: explicitly set "server min protocol = LANMAN1"

This is the current default and what 'make test' assumes currently.

The next commit will change the default to disable SMB1.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
840b8501 by Stefan Metzmacher at 2019-07-08T16:22:37Z
docs-xml: change "server min protocol" to SMB2_02

SMB2_02 was available with Windows Vista.
It's time to turn SMB1 off by default.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
d216db5c by Stefan Metzmacher at 2019-07-08T16:22:38Z
selftest: explicitly set "client min protocol = CORE"

This is the current default and what 'make test' assumes currently.

The next commit will change the default to disable SMB1.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
3264b1f3 by Stefan Metzmacher at 2019-07-08T16:22:38Z
docs-xml: change "client min protocol" to SMB2_02

It's time to disable SMB1 by default...

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
ad385bf2 by Stefan Metzmacher at 2019-07-08T16:22:38Z
WHATSNEW.txt: disable SMB1 by default!

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
5806affe by Ralph Boehme at 2019-07-08T16:22:38Z
selftest: explicitly set "mangled names = yes"

This is the current default and what 'make test' assumes currently.

The next commit will change the default to "illegal".

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
bf5d5fd1 by Ralph Boehme at 2019-07-08T16:22:38Z
docs/xml: change default for "mangled names" to "illegal"

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
f7a5adf0 by Tim Beale at 2019-07-08T16:24:31Z
s4/libnet: Fix joining a Windows pre-2008R2 DC

>From v4.8 onwards, Samba may not be able join a DC older than 2008R2
because the Windows DC doesn't support GET_TGT.

If the dsdb repl_md code can't resolve a link target it returns an
error, and the calling code (e.g. drs_util.py) should retry with
GET_TGT. However, GET_TGT is only supported on Windows 2008R2 and later,
so if you try to join an earlier Windows DC, the join will throw an
error that you can't work-around.

We can avoid this problem by setting the same DSDB flag that GET_TGT
sets to indicate that the link targets are as up-to-date as possible,
and so there's no point retrying. Missing targets are still logged, so
this at least allows the admin to fix up any problems after the join
completed.

I've only done this for the join case (problems during periodic
replication are probably still worth escalating to an error).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14021
RN: From Samba v4.8 onwards, joining a Windows 2003 or 2008 (non-R2) AD
DC may not have worked. When this problem occurred, the following
message would be displayed:
 'Failed to commit objects: DOS code 0x000021bf'
This particular issue has now been resolved. Note that there may still
be other potential problems that occur when joining an older Windows DC.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit b3a2508f2ad79e2f1007464da7dbe918933038a0)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Mon Jul  8 16:24:32 UTC 2019 on sn-devel-144

- - - - -
59cca4c5 by Ralph Boehme at 2019-07-08T17:56:50Z
WHATSNEW.txt: change "mangled names" default to "illegal"

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Mon Jul  8 17:56:50 UTC 2019 on sn-devel-184

- - - - -
063809bc by Gary Lockyer at 2019-07-09T03:03:25Z
dsdb repl_meta_data: Don't print ldif on error

Don't call ldb_ldif_message_redacted_string when linked_attr_modify
fails.  When joining a large domain this takes way to much time, in excess of 3
hours for a join on a 200k domain.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Tue Jul  9 03:03:25 UTC 2019 on sn-devel-184

- - - - -
5130dfe0 by Garming Sam at 2019-07-09T07:06:04Z
WHATSNEW: Add link for >= and <= indexing

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale at catalyst.net.nz>

Autobuild-User(master): Garming Sam <garming at samba.org>
Autobuild-Date(master): Tue Jul  9 07:06:04 UTC 2019 on sn-devel-184

- - - - -
8460e86e by Karolin Seeger at 2019-07-09T09:49:13Z
WHATSNEW: Fix typo.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
2da29404 by Karolin Seeger at 2019-07-09T09:49:13Z
VERSION: Disable GIT_SNAPSHOT for the 4.11.0rc1 release...

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
ac9740a0 by Stefan Metzmacher at 2019-07-09T10:03:38Z
VERSION: Bump version up to 4.11.0rc2...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
1c64a2e3 by Karolin Seeger at 2019-07-09T10:22:33Z
WHATSNEW: preview release -> release candidate

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
f91f25c9 by Mathieu Parent at 2019-07-13T07:25:48Z
ctdb: enable ceph and etcd recovery lock

- - - - -
8dc796a4 by Mathieu Parent at 2019-07-14T06:44:56Z
Downgrade ctdb_mutex_ceph_rados_helper shlibdeps to recommends

- - - - -
b6a4229d by Mathieu Parent at 2019-07-14T06:44:56Z
Changelog for previous commits

- - - - -
a7f1bc07 by Mathieu Parent at 2019-07-15T21:48:04Z
Merge branch 'ctdb_reclock' into 'master'

ceph and etcd recovery lock

See merge request samba-team/samba!26
- - - - -
41cffa04 by Mathieu Parent at 2019-07-31T05:50:19Z
Add gitlabracadabra.yml

See https://gitlab.com/gitlabracadabra/gitlabracadabra

- - - - -
7f628589 by Mathieu Parent at 2019-07-31T05:50:19Z
Use debian/salsa-ci.yml as ci_config_path

- - - - -
e86ec047 by Mathieu Parent at 2019-07-31T05:51:55Z
Update salsa-ci.yml

- - - - -
70ef0bea by Mathieu Parent at 2019-07-31T17:21:08Z
Allow failure for reprotest job

Until #912340 is fixed

- - - - -
a91ba8bf by Mathieu Parent at 2019-07-31T22:27:33Z
Allow failure for blhc job

Until #929503 is fixed

- - - - -
80b7bf90 by Mathieu Parent at 2019-08-01T00:09:06Z
Merge branch 'ci' into 'master'

Update salsa-ci.yml

See merge request samba-team/samba!28
- - - - -
6877eabe by Aaron Haslett at 2019-08-07T10:57:33Z
partition: correcting lock ordering

A schema reading bug was traced to a lock ordering issue in partition.c.
This patch fixes the problem by:
1. Releasing locks/transactions in the order they were acquired.
2. Always lock/start_trans on metadata.tdb first, before any other
databases, and release it last, after all others. This is so that we are
never exposed to MDB's lock semantics, which we don't support.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 7f4bc0ea81f2b34607849911f1271b030be8ca02)

- - - - -
29fa37b7 by Aaron Haslett at 2019-08-07T10:57:33Z
partition: reversing partition unlocking

Unlock partition databases in the reverse order from which they were
acquired. This is separated from the previous commit for future
bisecting purposes, since the last commit was made to fix specific CI
failures, while this one is a speculative fix made based on code
inspection.

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 6c691bf84e41b1edd3228c219f7a94e108795d28)

- - - - -
f2c40f4d by Garming Sam at 2019-08-07T10:57:33Z
gp_inf: Read/write files with a UTF-16LE BOM in GptTmpl.inf

Regression caused by 16596842a62bec0a9d974c48d64000e3c079254e

[MS-GPSB] 2.2 Message Syntax says that you have to write a BOM which I
didn't do up until this patch. UTF-16 as input encoding was marked much
higher up in the inheritance tree, which got overriden with the Python 3
fixes. I've now marked the encoding much more obviously for this file.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Fri Jul 19 02:20:47 UTC 2019 on sn-devel-184

(cherry picked from commit 0bcfc550b1a902e3a6a766b06603ac9285d0ff63)

- - - - -
98051741 by David Disseldorp at 2019-08-07T10:57:33Z
WHATSNEW: add CephFS Snapshot Integration section

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14039

Signed-off-by: David Disseldorp <ddiss at samba.org>
Reviewed-by: Aurelien Aptel <aaptel at suse.com>

- - - - -
122d7afb by Aurelien Aptel at 2019-08-07T10:57:33Z
WHATSNEW: document new debug encryption smb.conf param

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14039

Signed-off-by: Aurelien Aptel <aaptel at suse.com>
Reviewed-by: David Disseldorp <ddiss at samba.org>

- - - - -
b95186a5 by Garming Sam at 2019-08-07T10:57:33Z
ldap_server: Regression in 0559430ab6e5c48d6e853fda0d8b63f2e149015c

Extended DN requests seem to have been incorrectly handled.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Thu Jul 11 05:25:26 UTC 2019 on sn-devel-184

(cherry picked from commit 9f6b87d3f6cc9930d75c1f8d38ad4f5a37da34ab)

- - - - -
dd36cafd by Garming Sam at 2019-08-07T10:57:33Z
tldap: Make memcpy of no controls safe

Static analyzers sometimes complain about this case.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029
(cherry picked from commit e5452a37425484a95f90604a3e58e8a731460793)

- - - - -
23f8a8ee by Garming Sam at 2019-08-07T10:57:33Z
tldap: Paged searches fail when they get to the end

The normal case hit the goto label, and should have just returned.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029
(cherry picked from commit bff466943e01540b4d3210392e0fd5b1c882c0b9)

- - - - -
a1d0ce44 by Garming Sam at 2019-08-07T10:57:33Z
tests/tldap: Actually check the paging return code

The test never worked correctly because the code was overlooked. It was
also the case that the connection was never authenticated, and so an
LDAP BIND call has now been added.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029
(cherry picked from commit 85a7b594c56f7729bdfa194fee9299a08f6b4785)

- - - - -
636f7ded by Garming Sam at 2019-08-07T10:57:33Z
tests/ldap: Use TLDAP to check the extended DN return

Tests commit 9f6b87d3f6cc9930d75c1f8d38ad4f5a37da34ab

To run: make test TESTS="samba3.smbtorture_s3.plain.TLDAP"

Reverting the above commit makes this test fail:

'GUID format in control (no hyphens) doesn't match output
tldap_search with extended dn (no val) failed: LDAP error 0 (TLDAP_SUCCESS),
TEST TLDAP FAILED!'

This behaviour couldn't be tested via LDB libraries because they never
deal with the underlying DN string.

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Aug  1 06:20:28 UTC 2019 on sn-devel-184

(adapted from commit 464fef34d1d047d73be347cd446b74e0f5eb2370)

- - - - -
816053b7 by Tim Beale at 2019-08-07T10:57:33Z
join: Use a specific attribute order for the DsAddEntry nTDSDSA object

Joining a Windows domain can throw an error if the HasMasterNCs
attribute occurs before msDS-HasMasterNCs. This patch changes the
attribute order so that msDS-HasMasterNCs is always first.

Previously on python2, the dictionary hash order was arbitrary but
constant. By luck, msDS-HasMasterNCs was always before HasMasterNCs, so
we never noticed any problem. With python3, the dictionary hash order
now changes everytime you run the command, so the order is
unpredictable.

To enforce a order, we can change to use an OrderedDict, which will
return the keys in the order they're added.

I've asked Microsoft to clarify the protocol requirement here WRT
attribute order. However, in the meantime we may as well fix the problem
for users.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14046
RN: When trying to join a Windows domain (with functional level 2008R2)
as an AD domain controller, the 'samba-tool domain join' command could
throw a python exception: 'RuntimeError ("DsAddEntry failed")'. When
this problem occurred, you would also see the message "DsAddEntry failed
with status WERR_ACCESS_DENIED info (8363, 'WERR_DS_NO_CROSSREF_FOR_NC')"
in the command output. This issue has now been resolved. Note that this
problem would only occur on Samba v4.10 when using the Python3 packages.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Jul 24 04:18:21 UTC 2019 on sn-devel-184

(cherry picked from commit 256684c7a86301d26d6cf7298fb70e647bf45cf5)

- - - - -
8a09ea3c by Garming Sam at 2019-08-07T10:57:33Z
netcmd: Allow drs replicate --local to create partitions

Currently, neither the offline (--local) or online (normal replica sync)
methods allow partition creation post-join. This overrides the Python
default to not create the DB, which allows TDB + MDB to work.

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit d90ccce59754bc833027c06683afac25f7a8d474)

- - - - -
c7a5694f by Garming Sam at 2019-08-07T10:57:33Z
tests: Add samba_upgradedns to the list of possible cmds

This will be used to test the replication scenario with no DNS partitions

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

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 7d2875bd70cf727730be8dc705bfd01eacaaaa6f)

- - - - -
97a742fe by Garming Sam at 2019-08-07T10:57:33Z
tests/drs_no_dns: Check dbcheck and ldapcmp pass

When joining a DC without DNS partitions, make sure that the alternate
flow of creating them afterwards results in a database with everything
that is necessary.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14051
RN: Allow a DC join without DNS partitions, to add them later

Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 35c54007e6183829d9d85a24b3bd95f469739ad3)

- - - - -
02352ebb by Tim Beale at 2019-08-07T10:57:33Z
WHATSNEW: Make it clearer how the AD database changes will affect users

The release notes currently just have a brief mention of a new LDB pack
format. They don't really cover how this change will actually affect AD
users when upgrading (or more specifically downgrading) with v4.11.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
6b4c51d0 by Tim Beale at 2019-08-07T10:57:33Z
WHATSNEW: Add link to 2012 Windows compatibility wiki page

There's now a lot more info on the wiki on Windows 2012 compatibility,
and how the schema is just a small part of overall compatibility.
Link to this wiki page from the WHATSNEW, so users can read more about
this.

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

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>

- - - - -
62e65124 by Volker Lendecke at 2019-08-07T12:53:51Z
smbd: Fix use-after-free from exit_server_common()

We need to keep the smbXsrv_connection structures around until all
pending requests have had their chance to clean up behind them. If you
look at srv_send_smb(), it's exactly prepared already to just drop
anything on the floor when the transport has been declared dead:

	if (!NT_STATUS_IS_OK(xconn->transport.status)) {
		/*
		 * we're not supposed to do any io
		 */
		return true;
	}

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14064

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Thu Aug  1 15:39:13 UTC 2019 on sn-devel-184

(cherry picked from commit c226dc6e8a18343031829c35552e557903593daf)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Wed Aug  7 12:53:51 UTC 2019 on sn-devel-184

- - - - -
bdc11a6b by Stefan Metzmacher at 2019-08-08T07:32:20Z
lib/util: fix call to dbghdrclass() for DEBUGC()

dbghdrclass() sets the global 'current_msg_class' and for that
DEBUGC() should pass the given dbgc_class instead of the per file
DBGC_CLASS.

This is important with the new per class logfile with:

 log level = 1 dsdb_audit:10@/var/log/samba/log.dsdb_audit

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(similar to commit bb0ffbf38cb1955c9e400003add680eabcf706a6)

- - - - -
9af7a1cc by Stefan Metzmacher at 2019-08-08T07:32:20Z
lib/util: remove unused prototypes in debug.h

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit d98a971247450d494c581c5454e6c270ad1b6880)

- - - - -
4fd604b1 by Stefan Metzmacher at 2019-08-08T07:32:20Z
dbcheck: fallback to the default tombstoneLifetime of 180 days

If a domain was provisioned by Windows 2000 this value is missing in the
database.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue May 28 08:32:10 UTC 2019 on sn-devel-184

(cherry picked from commit 2ef79a4c1d695a3e498b142810a1317d85b9b6da)

- - - - -
d9b747c0 by Stefan Metzmacher at 2019-08-08T07:32:20Z
s4:torture: add local.ndr.dnsp tests

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 9a0c3a475f29138c0c49e0d22cf52ab45178d16b)

- - - - -
b5956912 by Stefan Metzmacher at 2019-08-08T07:32:20Z
dnsp.idl: fix dnsp_ip4_array definition

In future we should use ipv4address, but that would result in a much
larger change.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 6d958af0b4cb6fd45cfda0298243859b3b043c6f)

- - - - -
8ce25bdb by Stefan Metzmacher at 2019-08-08T07:32:21Z
dnsp.idl: fix the dnsp_dns_addr_array definition

The endian changes are needed in order to get the following result
from the blobs Windows generated (see the torture test):

  AddrArray: ARRAY(3)
      AddrArray: struct dnsp_dns_addr
          family                   : 0x0002 (2)
          port                     : 0x0035 (53)
          ipv4                     : 172.31.99.33
          ipv6                     : 0000:0000:0000:0000:0000:0000:0000:0000

[MS-DNSP] states that the port is supposed to be ignored, but it's still
good to decode it as port '53' (0x0035) instead of '13568' (0x3500).

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 6fc7cc15048673d109042d7b40684ed63eb4ff9e)

- - - - -
043675f3 by Stefan Metzmacher at 2019-08-08T07:32:21Z
dnsp.idl: fix payload for DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Jun 21 11:02:21 UTC 2019 on sn-devel-184

(cherry picked from commit aa2a3d95098231f48d7c308881bf66418164111e)

- - - - -
cf5002e0 by Björn Baumbach at 2019-08-08T07:32:21Z
s4:torture:fsmo.py: test role transfers of dns partitions

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

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

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 5e000a8487d788dd196980b77ec7299c8be74abf)

- - - - -
6b9d7481 by Stefan Metzmacher at 2019-08-08T07:32:21Z
samba-tool: fix replication after dns partition fsmo role transfer

The new role owner need to replicate from the old role owner.

Before we told the old role owner to replicate from itself.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 4793f8ed584a4e6d8a26b06b691ec636e77d8f2a)

- - - - -
8fb77c2d by Björn Baumbach at 2019-08-08T07:32:21Z
s4:torture:fsmo.py: remove unused 'net_cmd' variable

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

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 0fbb013bef886e425602fdbbef14a4029719818f)

- - - - -
f1eeb8e6 by Stefan Metzmacher at 2019-08-08T07:32:21Z
samba-tool: use only one LDAP modify for dns partition fsmo role transfer

We should not risk that we end with no role owner.

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

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(similar to commit 6a2e3a15585086bcceb18283216978a2fcb30da3)

- - - - -
db44860c by Björn Baumbach at 2019-08-08T07:32:21Z
samba-tool: add 'import samba.drs_utils' to fsmo.py

On some systems we're seeing this:

 ERROR(<type 'exceptions.AttributeError'>): uncaught exception - 'module' object has no attribute 'drs_utils'
   File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 185, in _run
     return self.run(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/samba/netcmd/fsmo.py", line 533, in run
     transfer_dns_role(self.outf, sambaopts, credopts, role, samdb)
   File "/usr/lib/python2.7/dist-packages/samba/netcmd/fsmo.py", line 136, in transfer_dns_role
     except samba.drs_utils.drsException as e:

E.g. it happens on debian stretch (9.9) with python 2.7.13 (on 4.10.4)

While it doesn't happen on ubuntu 18.04 with python 2.7.15rc1 or
with python 3.6.7.

There were also some reports on the mailing lists, see:
https://lists.samba.org/archive/samba-technical/2019-May/133624.html

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

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

Signed-off-by: Björn Baumbach <bbaumbach at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu May 30 08:27:24 UTC 2019 on sn-devel-184

(cherry picked from commit 320a5c5425e6ced18b1a9bf19b4f361ee16821ed)

- - - - -
97727eef by Ralph Boehme at 2019-08-08T07:32:21Z
vfs_catia: pass stat info to synthetic_smb_fname()

This doesn't cause visible damage in vanilla Samba, but would affect downstream
consumers that add additional fields to struct smb_filename.

For the same reason there's no test.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14015
RN: Ensure vfs_catia passes stat info to stacked VFS modules

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit ae6dd4853e3e651f6e56ce735bcb0a2264857385)

- - - - -
de909ff8 by Rafael David Tinoco at 2019-08-08T07:32:21Z
ctdb-config: depend on /etc/ctdb/nodes file

CTDB should start as a disabled unit (systemd) in most of the
distributions and, when trying to enable it for the first time, user
should get an unconfigured, or similar, error.

Depending on /etc/ctdb/nodes file will give a clear direction to final
user on what is needed in order to get cluster up and running. It should
work like previous ENABLED=NO variables in SySV like initialization
scripts.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14017
RN: ctdb.service should only start if /etc/ctdb/nodes is not empty
Signed-off-by: Rafael David Tinoco <rafaeldtinoco at ubuntu.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit c5803507df7def388edcd5b6cbfee30cd217b536)

- - - - -
9daacf18 by Ralph Boehme at 2019-08-08T07:32:21Z
Revert "s4:messaging: make sure only imessaging_client_init() can be used with a wrapper tevent_context wrapper"

This reverts commit e186d6a06b1b300256a2cb4138f0532d518d0597.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 0bd10a48e4c08d1eb3a20e79d952b3c0f12be46a)

- - - - -
116c4a79 by Ralph Boehme at 2019-08-08T07:32:21Z
Revert "s3:messages: allow messaging_filtered_read_send() to use wrapper tevent_context"

This reverts commit 2b05f1098187e00166649c8ea7c63e6901b9d242.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit e2a5272ac6831b407a0c51bb8615252ec68be6a8)

- - - - -
a4ad9d6e by Ralph Boehme at 2019-08-08T07:32:22Z
Revert "s3:messages: allow messaging_dgm_ref() to use wrapper tevent_context"

This reverts commit 9dc332060cf5f249ea887dbc60ec7a39b6f91120.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 26107832cd9d200fb171ef1f991d7ef5478cac18)

- - - - -
5a3fa183 by Ralph Boehme at 2019-08-08T07:32:22Z
Revert "s3:messages: allow messaging_{dgm,ctdb}_register_tevent_context() to use wrapper tevent_context"

This reverts commit 660cf86639753edaa7a7a21a5b5ae207ae7d4260.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 1c3676f3aa9c1564eb140a24ced5ee72b859b87f)

- - - - -
2627724e by Ralph Boehme at 2019-08-08T11:20:26Z
Revert "s3:messages: protect against usage of wrapper tevent_context objects for messaging"

This reverts commit 7f2afc20e1b6397c364a98d1be006377c95e4665.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

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

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 2a62a98f5c7107f2f83c0bfc2892243d83e2c88a)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Thu Aug  8 11:20:26 UTC 2019 on sn-devel-144

- - - - -
4fd7914e by Alexander Bokovoy at 2019-08-16T09:47:28Z
torture/rpc/lsa: allow testing different lookup levels

Convert torture/rpc/lsa LookupNames/LookupSids code to allow testing
different LSA_LOOKUP_NAMES_* levels. Keep existing level 1
(LSA_LOOKUP_NAMES_ALL) for the current set of tests.

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

Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

(cherry picked from commit 317bc6a7342edfa2c503f5932142bf5883485cc9)

- - - - -
d89fc30d by Alexander Bokovoy at 2019-08-16T09:47:28Z
lookup_name: allow own domain lookup when flags == 0

In 2007, we've added support for multiple lookup levels for LSA
LookupNames family of calls. However, forest-wide lookups, as described
in MS-LSAT 2.2.16, never worked because flags passed to lookup_name()
were always set to zero, expecting at least default lookup on a DC to
apply. lookup_name() was instead treating zero flags as 'skip all
checks'.

Allow at least own domain lookup in case domain name is the same.
This should allow FreeIPA DC to respond to LSA LookupNames3 calls from a
trusted AD DC side.

For the reference, below is a request Windows Server 2016 domain
controller sends to FreeIPA domain controller when attempting to look up
a user from a trusted forest root domain that attemps to login to the
domain controller. Notice the level in the lsa_LookupNames3 call and
resulting flags in lookup_name().

[2019/08/03 07:14:24.156065,  1, pid=23639, effective(967001000, 967001000), real(967001000, 0), class=rpc_parse] ../../librpc/ndr/ndr.c:471(ndr_print_function_debug)
       lsa_LookupNames3: struct lsa_LookupNames3
          in: struct lsa_LookupNames3
              handle                   : *
                  handle: struct policy_handle
                      handle_type              : 0x00000000 (0)
                      uuid                     : 0000004c-0000-0000-455d-3018575c0000
              num_names                : 0x00000001 (1)
              names: ARRAY(1)
                  names: struct lsa_String
                      length                   : 0x000a (10)
                      size                     : 0x000c (12)
                      string                   : *
                          string                   : 'XS\ab'
              sids                     : *
                  sids: struct lsa_TransSidArray3
                      count                    : 0x00000000 (0)
                      sids                     : NULL
              level                    : LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 (6)
              count                    : *
                  count                    : 0x00000000 (0)
              lookup_options           : LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES (0)
              client_revision          : LSA_CLIENT_REVISION_2 (2)
[2019/08/03 07:14:24.156189,  6, pid=23639, effective(967001000, 967001000), real(967001000, 0), class=rpc_srv] ../../source3/rpc_server/rpc_handles.c:339(find_policy_by_hnd_internal)
  Found policy hnd[0] [0000] 00 00 00 00 4C 00 00 00   00 00 00 00 45 5D 30 18   ....L... ....E]0.
  [0010] 57 5C 00 00                                        W\..
[2019/08/03 07:14:24.156228,  4, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/smbd/sec_ctx.c:215(push_sec_ctx)
  push_sec_ctx(967001000, 967001000) : sec_ctx_stack_ndx = 2
[2019/08/03 07:14:24.156246,  4, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/smbd/uid.c:552(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2019/08/03 07:14:24.156259,  4, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/smbd/sec_ctx.c:319(set_sec_ctx_internal)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 2
[2019/08/03 07:14:24.156273,  5, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../libcli/security/security_token.c:53(security_token_debug)
  Security token: (NULL)
[2019/08/03 07:14:24.156285,  5, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/auth/token_util.c:865(debug_unix_user_token)
  UNIX token of user 0
  Primary group is 0 and contains 0 supplementary groups
[2019/08/03 07:14:24.156311,  5, pid=23639, effective(0, 0), real(0, 0), class=rpc_srv] ../../source3/rpc_server/lsa/srv_lsa_nt.c:244(lookup_lsa_sids)
  lookup_lsa_sids: looking up name XS\ab
[2019/08/03 07:14:24.156327, 10, pid=23639, effective(0, 0), real(0, 0)] ../../source3/passdb/lookup_sid.c:112(lookup_name)
  lookup_name: XS\ab => domain=[XS], name=[ab]
[2019/08/03 07:14:24.156340, 10, pid=23639, effective(0, 0), real(0, 0)] ../../source3/passdb/lookup_sid.c:114(lookup_name)
  lookup_name: flags = 0x00

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

Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

(cherry picked from commit 685bb03de6ab733590831d1df4f5fd60d2ac427d)

- - - - -
bf5ac945 by Alexander Bokovoy at 2019-08-16T14:18:35Z
smbtorture: extend rpc.lsa to lookup machine over forest-wide LookupNames

Add a simple test to resolve DOMAIN\MACHINE$ via LSA LookupNames3
using LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 level. This level would pass
zero lookup flags to lookup_name().

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

Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
Autobuild-Date(master): Wed Aug 14 13:07:42 UTC 2019 on sn-devel-184

(cherry picked from commit 4d276a93fc624dc04d880f5b4157f272d3555be6)

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Fri Aug 16 14:18:35 UTC 2019 on sn-devel-144

- - - - -
428ecb5f by Karolin Seeger at 2019-08-19T11:20:15Z
WHATSNEW: Fix some minor formatting issues.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
8dfa63d9 by Alexander Bokovoy at 2019-08-19T11:20:15Z
torture/rpc/lsa: allow testing different lookup levels

Convert torture/rpc/lsa LookupNames/LookupSids code to allow testing
different LSA_LOOKUP_NAMES_* levels. Keep existing level 1
(LSA_LOOKUP_NAMES_ALL) for the current set of tests.

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

Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

(cherry picked from commit 317bc6a7342edfa2c503f5932142bf5883485cc9)

- - - - -
60d22232 by Alexander Bokovoy at 2019-08-19T11:20:15Z
lookup_name: allow own domain lookup when flags == 0

In 2007, we've added support for multiple lookup levels for LSA
LookupNames family of calls. However, forest-wide lookups, as described
in MS-LSAT 2.2.16, never worked because flags passed to lookup_name()
were always set to zero, expecting at least default lookup on a DC to
apply. lookup_name() was instead treating zero flags as 'skip all
checks'.

Allow at least own domain lookup in case domain name is the same.
This should allow FreeIPA DC to respond to LSA LookupNames3 calls from a
trusted AD DC side.

For the reference, below is a request Windows Server 2016 domain
controller sends to FreeIPA domain controller when attempting to look up
a user from a trusted forest root domain that attemps to login to the
domain controller. Notice the level in the lsa_LookupNames3 call and
resulting flags in lookup_name().

[2019/08/03 07:14:24.156065,  1, pid=23639, effective(967001000, 967001000), real(967001000, 0), class=rpc_parse] ../../librpc/ndr/ndr.c:471(ndr_print_function_debug)
       lsa_LookupNames3: struct lsa_LookupNames3
          in: struct lsa_LookupNames3
              handle                   : *
                  handle: struct policy_handle
                      handle_type              : 0x00000000 (0)
                      uuid                     : 0000004c-0000-0000-455d-3018575c0000
              num_names                : 0x00000001 (1)
              names: ARRAY(1)
                  names: struct lsa_String
                      length                   : 0x000a (10)
                      size                     : 0x000c (12)
                      string                   : *
                          string                   : 'XS\ab'
              sids                     : *
                  sids: struct lsa_TransSidArray3
                      count                    : 0x00000000 (0)
                      sids                     : NULL
              level                    : LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 (6)
              count                    : *
                  count                    : 0x00000000 (0)
              lookup_options           : LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES (0)
              client_revision          : LSA_CLIENT_REVISION_2 (2)
[2019/08/03 07:14:24.156189,  6, pid=23639, effective(967001000, 967001000), real(967001000, 0), class=rpc_srv] ../../source3/rpc_server/rpc_handles.c:339(find_policy_by_hnd_internal)
  Found policy hnd[0] [0000] 00 00 00 00 4C 00 00 00   00 00 00 00 45 5D 30 18   ....L... ....E]0.
  [0010] 57 5C 00 00                                        W\..
[2019/08/03 07:14:24.156228,  4, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/smbd/sec_ctx.c:215(push_sec_ctx)
  push_sec_ctx(967001000, 967001000) : sec_ctx_stack_ndx = 2
[2019/08/03 07:14:24.156246,  4, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/smbd/uid.c:552(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2019/08/03 07:14:24.156259,  4, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/smbd/sec_ctx.c:319(set_sec_ctx_internal)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 2
[2019/08/03 07:14:24.156273,  5, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../libcli/security/security_token.c:53(security_token_debug)
  Security token: (NULL)
[2019/08/03 07:14:24.156285,  5, pid=23639, effective(967001000, 967001000), real(967001000, 0)] ../../source3/auth/token_util.c:865(debug_unix_user_token)
  UNIX token of user 0
  Primary group is 0 and contains 0 supplementary groups
[2019/08/03 07:14:24.156311,  5, pid=23639, effective(0, 0), real(0, 0), class=rpc_srv] ../../source3/rpc_server/lsa/srv_lsa_nt.c:244(lookup_lsa_sids)
  lookup_lsa_sids: looking up name XS\ab
[2019/08/03 07:14:24.156327, 10, pid=23639, effective(0, 0), real(0, 0)] ../../source3/passdb/lookup_sid.c:112(lookup_name)
  lookup_name: XS\ab => domain=[XS], name=[ab]
[2019/08/03 07:14:24.156340, 10, pid=23639, effective(0, 0), real(0, 0)] ../../source3/passdb/lookup_sid.c:114(lookup_name)
  lookup_name: flags = 0x00

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

Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

(cherry picked from commit 685bb03de6ab733590831d1df4f5fd60d2ac427d)

- - - - -
38876ad4 by Alexander Bokovoy at 2019-08-19T12:36:22Z
smbtorture: extend rpc.lsa to lookup machine over forest-wide LookupNames

Add a simple test to resolve DOMAIN\MACHINE$ via LSA LookupNames3
using LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 level. This level would pass
zero lookup flags to lookup_name().

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

Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
Autobuild-Date(master): Wed Aug 14 13:07:42 UTC 2019 on sn-devel-184

(cherry picked from commit 4d276a93fc624dc04d880f5b4157f272d3555be6)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Mon Aug 19 12:36:22 UTC 2019 on sn-devel-184

- - - - -
fab20658 by Volker Lendecke at 2019-08-21T08:40:16Z
tdb: Rename tdb_oob() to tdb_notrans_oob()

tdb_oob() will become a public function encapsulating the pointer
dereferences.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 885ba572efaac6c20388b8e119315c837e8f5236)

- - - - -
6312223d by Volker Lendecke at 2019-08-21T08:40:16Z
tdb: Introduce tdb_oob()

Initially just encapsulate the pointer dereferences

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 5a388453e0cb038fa3ed5fb46f972470f7793566)

- - - - -
3325a4d4 by Volker Lendecke at 2019-08-21T08:40:16Z
tdb: Speed up tdb_oob()

This is common between both implementations of tdb_oob(). It's
faster if we don't have to dereference function pointers.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 897bffa8166f643eb9063a848bb0c02455663317)

- - - - -
afd6b77b by Volker Lendecke at 2019-08-21T08:40:16Z
tdb: Inline the common part of tdb_oob

When you set

in tdbtorture.c to make it more similar to locking.tdb use,

bin/tdbtorture -m -n 1 -l 100000 -s

becomes twice as fast. This is a pretty extreme case, but all other
tests that I did improve significantly as well.

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit f5735e2c666a5a494131c1d25f7ba5c7fbeae923)

- - - - -
c1442725 by Stefan Metzmacher at 2019-08-21T09:57:08Z
tdb: Release tdb 1.4.2

* Build fixes
* Improve the performance by inlining the tdb_oob() checks

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue Aug 20 14:45:41 UTC 2019 on sn-devel-184

(cherry picked from commit 60cba7b3a17104da1543d59609f50c6638880dd1)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Wed Aug 21 09:57:08 UTC 2019 on sn-devel-184

- - - - -
521240aa by Karolin Seeger at 2019-08-21T10:34:58Z
VERSION: Disable GIT_SNAPSHOT for the 4.11.0rc2 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
ea385961 by Karolin Seeger at 2019-08-21T10:36:23Z
VERSION: Bump version up to 4.11.0rc3...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
72d79334 by Christof Schmitt at 2019-08-26T07:06:16Z
Revert "nfs4acl: Fix owner mapping with ID_TYPE_BOTH"

This reverts commit 5d4f7bfda579cecb123cfb1d7130688f1d1c98b7.

That patch broke the case with ID_TYPE_BOTH where a file is owned by a
group (e.g. using autorid and having a file owned by
BUILTIN\Administrators). In this case, the ACE entry for the group gets
mapped a to a user ACL entry and the group no longer has access (as in
the user's token the group is not mapped to a uid).

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 42bd3a72a2525aa8a918f4bf7067b30ce8e0e197)

- - - - -
9e82d8ae by Christof Schmitt at 2019-08-26T07:06:16Z
nfs4_acls: Remove fsp from smbacl4_win2nfs4

Only the information whether the ACL is for a file or a directory is
required. Replacing the fsp with a flag is clearer and allows for unit
testing of the mapping functions.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit a06486bb110d04a90b66a0bca4b1b600ef3c0ebf)

- - - - -
88b0461c by Christof Schmitt at 2019-08-26T07:06:16Z
selftest: Start implementing unit test for nfs4_acls

Existing smbtorture tests set and query ACLs through SMB, only working
with the DACLs in the Security Descriptors, but never check the NFSv4
ACL representation. This patch introduces a unit test to verify the
mapping between between Security Descriptors and NFSv4 ACLs. As the
mapping code queries id mappings, the id mapping cache is first primed
with the mappings used by the tests and those mappings are removed again
during teardown.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 8fb906a1860452a320c79ac87917a97303729c19)

- - - - -
526da3f2 by Christof Schmitt at 2019-08-26T07:06:16Z
test_nfs4_acls: Add tests for mapping of empty ACLs

This is a fairly simple test that ensures the mapping of empty ACLs
(without any ACL entries) is always done the same way.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 00f494b25f4e1d1aecf6191523e30f20a90b1e4f)

- - - - -
4120b8dc by Christof Schmitt at 2019-08-26T07:06:16Z
test_nfs4_acls: Add tests for mapping of ACL types

Add testcases for mapping the type field (ALLOW or DENY) between NFSv4
ACLs and security descriptors.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit dd5934797526ebb4c6f3027a809401dad3abf701)

- - - - -
c1eb8ec5 by Christof Schmitt at 2019-08-26T07:06:16Z
test_nfs4_acls: Add test for flags mapping from NFS4 ACL to DACL

Add testcase for the mapping of inheritance flags when mapping from a
NFSv4 ACL to a DACL in the security descriptor. The mapping is different
between files and directories, as some inheritance flags should never be
present for files. Some defined flags like SUCCESSFUL_ACCESS are also
not mapped at this point, also verify this behavior.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 16eb61a900c6749c2554d635ce2dd903f5de1704)

- - - - -
ec532e3e by Christof Schmitt at 2019-08-26T07:06:16Z
test_nfs4_acls: Add test for flags mapping from DACL to NFS4 ACL

Add testcase for the mapping of inheritance flags from the DACL in the
security descriptor to the NFSv4 ACL. The mapping is different for files
and directories as some inheritance flags should not be present for
files. Also other flags are not mapped at all, verify this behavior.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit bccd2612761e26ee2514935d56927b2c0c000859)

- - - - -
014ae431 by Christof Schmitt at 2019-08-26T07:06:16Z
test_nfs4_acls: Add test for mapping permissions from NFS4 ACL to DACL

Add testcase for mapping permissions from the NFSv4 ACL to DACL in the
security descriptor. The mapping is simple as each permission bit exists
on both sides.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 1767027b44a9e4ebd865022e3f8abb0c72bf15c6)

- - - - -
368c370d by Christof Schmitt at 2019-08-26T07:06:16Z
test_nfs4_acls: Add test for mapping permissions from DACL to NFS4 ACL

Add testcase for mapping the permission flags from the DACL in the
Security Descriptor to a NFSv4 ACL. The mapping is straight-forward as
the same permission bits exist for Security Descriptors and NFSv4 ACLs.
In addition, the code also maps from the generic DACL permissions to a
set of NFSv4 permissions, also verify this mapping.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit e4840e680744bd860beedeb5123704c3c0d6a4d7)

- - - - -
dda9e525 by Christof Schmitt at 2019-08-26T07:06:16Z
test_nfs4_acls: Add test for mapping of special NFS4 ACL entries to DACL entries

In addition to entries for users and groups, NFSv4 ACLs have the concept
of entries for "special" entries. Only the "owner", "group" and
"everyone" entries are currently used in the ACL mapping.

Add a testcase that verifies the mapping from NFSv4 "special" entries to
the DACL in the security descriptor. Verify that only "owner", "group"
and "everyone" are mapped and all other "special" entries are ignored.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f86148948c7f89307a34e31f6ddede6923149d34)

- - - - -
aa466a01 by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for mapping from DACL to special NFS4 ACL entries

Add testcase for mapping from entries in the DACL security descriptor to
"special" entries in the NFSv4 ACL. Verify that the WORLD well-known SID
maps to "everyone" in the NFSv4 ACL. Verify that the "Unix NFS" SID is
ignored, as there is no meaningful mapping for this entry. Verify that
SID entries matching the owner or group are mapped to "special owner"
or "special group", but only if no inheritance flags are used. "special
owner" and "special group" with inheritance flags have the meaning of
CREATOR OWNER and CREATOR GROUP and will be tested in another testcase.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 1f1fa5bde2c76636c1beec39c21067b252ea10be)

- - - - -
4e46dbc7 by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for mapping CREATOR entries to NFS4 ACL entries

Add testcase for mapping DACL entries CREATOR OWNER and CREATOR GROUP
with inheritance flag in the security descriptor to NFSv4 "special
owner" and "special group" entries. This is the correct mapping for
these entries as inheriting "special owner" and "special group" grants
permissions to the actual owner and owning group of the new file or
directory, similar to what CREATOR entries do.

The other side is that CREATOR entries without any inheritance flags do
not make sense, so these are not mapped to NFSv4 ACL entries.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit bfcc19b705f83bdd5cf665fd4daf43e7eae997a9)

- - - - -
61002278 by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for mapping from NFS4 to DACL CREATOR entries

Add testcase for mapping from NFSv4 ACL entries for "special owner" and
"special group" to DACL entries in the security descriptor. Each NFSv4
entry here with INHERIT_ONLY maps directly to a CREATOR OWNER or CREATOR
GROUP entry in the DACL. Entries without INHERIT_ONLY map to the CREATOR
entry and an additional explicit entry granting permission on the
current object.

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

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 3c9cda0f6d80258ef0c2a80d6e24dfb650fea1b1)

- - - - -
31d60e8c by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for 'map full control' option

"map full control" when enabled adds the DELETE_CHILD permission, when
all other permissions are present. This allows Windows clients to
display the "FULL CONTROL" permissions.

Add a testcase that verifies this mapping when mapping from NFSv4 ACL to
the DACL in the security descriptor. Also verify that switching the
option off disables this behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 30677df4dac4ebfcf4e3198db33f14be37948197)

- - - - -
490d1355 by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for acedup settings

The NFSv4 ACL mapping code has a setting nfs4:acedup. Depending on the
setting, when mapping from DACLs to NFSv4 ACLs, duplicate ACL entries
are either merged, ignored or rejected. Add a testcase that has
duplicate ACL entries and verify the expected behavior for all possible
settings of the nfs4:acedup option.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 9671bf2b9f055012057620207624aa2f4ea6833e)

- - - - -
4022997f by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for matching DACL entries for acedup

The NFSv4 mapping code has a config option nfs4:acedup for the mapping
path from DACLs to NFSv4 ACLs. Part of this codepath is detecting
duplicate ACL entries. Add a testcase with different ACL entries and
verify that only exactly matching entries are detected as duplicates and
treated accordingly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f55cdf42a14f314102f2e13cb06d4db48c08ad4b)

- - - - -
d3a9648e by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for mapping from DACL to NFS4 ACL with config special

The mapping code between NFSv4 ACLs and security descriptors still has
the deprecated config setting "nfs4:mode = special". This should not be
used as it has security problems: All entries matching owner or group
are mapped to "special owner" or "special group", which can change its
meaning when being inherited to a new file or directory with different
owner and owning group.

This mode should eventually be removed, but as long as it still exists
add testcases to verify the expected behavior. This patch adds the
testcase for "nfs4:mode = special" when mapping from the DACL in the
security descriptor to the NFSv4 ACL.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 7ae06d96eb59722154d30e21949f9dba4f2f0bc6)

- - - - -
2de4919e by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for mapping from NFS4 to DACL in config mode special

The mapping code between NFSv4 ACLs and security descriptors still has
the deprecated config setting "nfs4:mode = special". This should not be
used as it has security problems: All entries matching owner or group
are mapped to "special owner" or "special group", which can change its
meaning when being inherited to a new file or directory with different
owner and owning group.

This mode should eventually be removed, but as long as it still exists
add testcases to verify the expected behavior. This patch adds the
testcase for "nfs4:mode = special" when mapping from the NFS4 ACL to the
DACL in the security descriptor.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 829c5ea99685c0629fd67ed0528897534ff35b36)

- - - - -
7d73c37a by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for mapping from NFS4 ACL to DACL with IDMAP_TYPE_BOTH

When id mappings use IDMAP_TYPE_BOTH, the NFSv4 ACL mapping code is not
aware whether a particular entry is for a user or a group. The
underlying assumption then is that is should not matter, as both the ACL
mapping maps everything to NFSv4 ACL group entries and the user's token
will contain gid entries for the groups.

Add a testcase to verify that when mapping from NFSv4 ACL entries to
DACLs with IDMAP_TYPE_BOTH, all entries are mapped as expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 86480410aec1d2331c65826a13f909492165a291)

- - - - -
0313f155 by Christof Schmitt at 2019-08-26T07:06:17Z
test_nfs4_acls: Add test for mapping from DACL to NFS4 ACL with IDMAP_TYPE_BOTH

When id mappings use IDMAP_TYPE_BOTH, the NFSv4 ACL mapping code is not
aware whether a particular entry is for a user or a group. The
underlying assumption then is that is should not matter, as both the ACL
mapping maps everything to NFSv4 ACL group entries and the user's token
will contain gid entries for the groups.

Add a testcase to verify that when mapping from DACLS to NFSv4 ACL
entries with IDMAP_TYPE_BOTH, all entries are mapped as expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 38331b00521ef764893a74add01758f14567d901)

- - - - -
6d88ab39 by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Use sids_to_unixids to lookup uid or gid

This is the newer API to lookup id mappings and will make it easier to
add to the IDMAP_TYPE_BOTH case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit d9a2ff559e1ad953141b1118a9e370496f1f61fa)

- - - - -
b1b8e378 by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Use switch/case for checking idmap type

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f198a0867e71f248d4887ab0b6f2832123b16d11)

- - - - -
e08f9b24 by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Use correct type when checking ownerGID

uid and gid are members of the same union so this makes no difference,
but for type correctness and readability use the gid to check for
ownerGID.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 3b3d722ce579c19c7b08d06a3adea275537545dc)

- - - - -
6661fecf by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Add helper function for checking INHERIT flags.

This avoids some code duplication. Do not make this static, as it will
be used in a later patch.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmit <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 336e8668c1cc3682cb3c198eb6dc49baf522a79a)

- - - - -
d5965e3a by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Add missing braces in smbacl4_win2nfs4

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit ba73d2363d93a376ba4947963c9de45a7e683f02)

- - - - -
428579d3 by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Remove i argument from smbacl4_MergeIgnoreReject

This is only used for logging of a rejected ACL, but does not provide
additional useful information. Remove it to simplify the function a bit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 44790721e4f2c6ee6f46de7ac88123ce1a9f6e39)

- - - - -
d806dba0 by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Move smbacl4_MergeIgnoreReject function

This static function will be called earlier in later patches.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 3499d97463110f042415d917160bc2743805a544)

- - - - -
693aa2db by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Move adding of NFS4 ACE to ACL to smbacl4_fill_ace4

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit abb58b17599bd3f9a06037e208dcc5033c7fdd8b)

- - - - -
b3aad342 by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Remove redundant logging from smbacl4_fill_ace4

Logging flags in case they do not match seems unnecessary. Other log
messages should show the flags as well.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 7ab0003ffc098247c3ee3962d7061f2af5a2d00e)

- - - - -
01e913ca by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Remove redundant pointer variable

The previous patch introduced a pointer to a local variable to reduce
the amount of lines changed. Remove that pointer and adjust all usage
accordingly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit aa4644193635d846c2e08e8c1e7b512e8009c2ef)

- - - - -
8ac9c1f7 by Christof Schmitt at 2019-08-26T07:06:17Z
nfs4_acls: Add additional owner entry when mapping to NFS4 ACL with IDMAP_TYPE_BOTH

With IDMAP_TYPE_BOTH, all entries have to be mapped to group entries.
In order to have the file system reflect the owner permissions in the
POSIX modebits, create a second entry for the user. This will be mapped
to the "special owner" entry.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit b796119e2df38d1935064556934dd10da6f3d339)

- - - - -
7d40b00b by Christof Schmitt at 2019-08-26T07:06:18Z
nfs4_acls: Rename smbacl4_fill_ace4 function

As this function now maps the ACE and also adds it to the NFSv4 ACE,
change the name to better describe its behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 169812943de23cf2752289c63331d786b0b063bd)

- - - - -
78d426fb by Christof Schmitt at 2019-08-26T07:06:18Z
nfs4_acls: Remove duplicate entries when mapping from NFS4 ACL to DACL

The previous patch added an additional entry for IDMAP_TYPE_BOTH. When
mapping back to a DACL, there should be no additional entry. Add a loop
that will check and remove entries that are exact duplicates.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 9c88602128592ddad537bf70cbe3c51f0b2cebe5)

- - - - -
77052fbc by Christof Schmitt at 2019-08-26T07:06:18Z
nfs4_acls: Add test for merging duplicates when mapping from NFS4 ACL to DACL

The previous patch introduced merging of duplicates on the mapping path
from NFS4 ACL entries to DACL entries. Add a testcase to verify the
expected behavior of this codepath.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 1a137a2f20c2f159c5feaef230a2b85bb9fb23b5)

- - - - -
d1866890 by Christof Schmitt at 2019-08-26T07:06:18Z
nfs4_acls: Use correct owner information for ACL after owner change

After a chown, the cached stat data is obviously no longer valid. The
code in smb_set_nt_acl_nfs4 checked the file correctly, but did only use
a local buffer for the stat data. So later checks of the stat buffer
under the fsp->fsp_name->st would still see the old information.

Fix this by removing the local stat buffer and always update the one
under fsp->fsp_name->st.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 86f7af84f04b06ed96b30f936ace92aa0937be06)

- - - - -
7c90ecdb by Christof Schmitt at 2019-08-26T07:06:18Z
vfs_gpfs: Remove merge_writeappend parameter

All supported GPFS versions now support setting WRITE and APPEND in the
ACLs independently. Remove this now unused parameter to simplify the
code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 0aca678fcf1788a76cf0ff11399211c795aa7d2f)

- - - - -
90ddc22e by Christof Schmitt at 2019-08-26T07:06:18Z
docs: Remove gpfs:merge_writeappend from vfs_gpfs manpage

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 8bd79ecc37376dbaa35606f9c2777653eb3d55e3)

- - - - -
39495b14 by Christof Schmitt at 2019-08-26T07:06:18Z
vfs_gpfs: Move mapping from generic NFSv ACL to GPFS ACL to separate function

This is not functional change. It cleans up the code a bit and makes
expanding this codepath in a later patch easier.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit fbf3a090a9ec94262b2924461cc1d6336af9919c)

- - - - -
d18896d1 by Christof Schmitt at 2019-08-26T07:06:18Z
vfs_gpfs: Implement special case for denying owner access to ACL

In GPFS, it is not possible to deny ACL or attribute access through a
SPECIAL_OWNER entry. The best that can be done is mapping this to a
named user entry, as this one can at least be stored in an ACL. The same
cannot be done for inheriting SPECIAL_OWNER entries, as these represent
CREATOR OWNER entries, and the limitation of not being able to deny
owner access to ACL or attributes remains.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit c1770ed96fd3137f45d584ba9328333d5505e3af)

- - - - -
be508cda by Aaron Haslett at 2019-08-26T07:06:18Z
downgradedatabase: comply with samba.tests.source

In next commit we'll install the script, samba.tests.source picked up the
lack of a copyright message and some whitespace errors, so this patch
fixes that stuff first.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit c4aebb15001c830a46d5a6ad8ea11a6f9ea4fd04)

- - - - -
7a8f68f6 by Tim Beale at 2019-08-26T07:06:18Z
tests: Avoid hardcoding relative filepath

If we move the test file, the test will break.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit a8cdbe0b824f57f73eee09143148f009a9c58582)

- - - - -
a1b3796b by Tim Beale at 2019-08-26T07:06:18Z
downgradedatabase: rename to samba_downgrade_db

Just so that it's slightly less of a mouthful for users.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit fdaaee8d3aac77d91642a7d75d4bcd15d4df8657)

- - - - -
309ec3b6 by Aaron Haslett at 2019-08-26T07:06:18Z
downgradedatabase: Add man-page documentation

A man-page is needed so that we can install this tool as part of the
Samba package.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit c89df3862b17fad9c4648b5d9c6805120d732df8)

- - - - -
b3987205 by Aaron Haslett at 2019-08-26T07:06:18Z
downgradedatabase: installing script

Installing downgrade script so people don't need the source tree for it.

Exception added in usage test because running the script without arguments
is valid. (This avoids the need to knownfail it).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 6dcf00ba0a470ba25aabae06b409ec95404c246f)

- - - - -
70726f2d by Tim Beale at 2019-08-26T07:06:18Z
ldb: Always log when the database pack format changes

LDB_DEBUG_WARNING gets logged by Samba as level 2, whereas the default
log level for Samba is 0. It's not really fair to the user to change the
format of their database on disk and potentially not tell them.

This patch adds a log with level zero (using a alias define, as this
technically isn't a fatal problem).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit a2b0fc7c00360f37ed6819f21380294b70d4a195)

- - - - -
b99fff86 by Tim Beale at 2019-08-26T07:06:18Z
ldb: Move where we update the pack format version

Store it on the repack context so that we can log a more informative
message "Repacking from format x to format y".

While this is not really a big deal currently, it could be worth
recording for potential future scenarios (i.e. supporting three or more
pack versions), where upgrades could potentially skip an intermediary
pack format version.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit d427bd6c775d8117504e76eed42cd2c383512e34)

- - - - -
6de3d8f7 by Tim Beale at 2019-08-26T07:06:18Z
ldb: Change pack format defines to enum

The main reason is so that any future pack formats will continue
incrementing this number in a sequential fashion.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 38e3e7cd328edac302e95ac8839e858c4a225485)

- - - - -
1c2f1bd0 by Tim Beale at 2019-08-26T07:06:18Z
ldb: Log pack format in user-friendly way

The "format 0x26011968" log confused me (and I'm a developer).
We can subtract the base offset from the pack format to get a more
user-friendly number, e.g. v0 (not actually used), v1, v2, etc.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 5fee9388422e259c2a56e4dccbf44d22ba426ca3)

- - - - -
18fb5fb9 by Tim Beale at 2019-08-26T07:06:18Z
ldb: Log the partition we're repacking

Firstly, with Samba AD this looks a little weird because we log the same
message 5 times (once for every partition). If we log that we're doing
this to records in different partitions, hopefully someone with a little
Samba knowledge can figure out what's going on.

Secondly, the info about what partitions are actually changing might be
useful. E.g. if we hit a fatal error repacking the 3rd partition, and
the transaction doesn't abort properly, then it would be useful to know
what partitions were repacked and which ones weren't.

There doesn't appear to be a useful name for the partition
(ldb_kv->kv_ops->name() doesn't seem any more intelligible to a user),
so just log the first record that we update. We can use that to infer
the partition database).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit ee6537c29e747206ee607493ce15d4532fb670c8)

- - - - -
d819a1c2 by Tim Beale at 2019-08-26T07:06:19Z
ldb: Free memory when repacking database

The msg for each database record is allocated on the module context, but
never freed. The module seems like it could be a long-running context (as
the database would normally get repacked by the samba executable).

Even if it's not a proper leak, it shouldn't hurt to cleanup the memory.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Garming Sam <garming at samba.org>
Autobuild-Date(master): Tue Aug 20 04:57:10 UTC 2019 on sn-devel-184

(cherry picked from commit b6516dbd24df8c78ed909c7ef9058b0844abb917)

- - - - -
80bd467a by Andrew Bartlett at 2019-08-26T07:06:19Z
ldb: Release ldb 2.0.6

 * log database repack so users know what is happening

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

- - - - -
756bea42 by Martin Schwenke at 2019-08-26T07:06:19Z
ctdb-tools: Drop 'o' option from getopts command

Commit 90de5e0594b9180226b9a13293afe31f18576b3d remove the processing
for this option but forgot to remove it from the getopts command.

Versions of ShellCheck >= 0.4.7 warn on this, so it is worth fixing.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14086
RN: Fix onnode test failure with ShellCheck >= 0.4.7
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 758962a0d435fa595e3917b860a8fd266d122550)

- - - - -
900cc33a by Ralph Boehme at 2019-08-26T07:06:19Z
vfs_default: use correct flag in vfswrap_fs_file_id

Luckily using the wrong flag ST_EX_IFLAG_CALCULATED_ITIME currently results in
the same semantics as using the correct ST_EX_IFLAG_CALCULATED_FILE_ID, as in
vfs_default the non-calculated file_id is based a non-calculated itime.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14089
RN: vfs_default: use correct flag in vfswrap_fs_file_id

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 442a7c9ad8b020b2e88e41fea8a911d244023cb9)

- - - - -
53f82896 by Ralph Boehme at 2019-08-26T07:06:19Z
vfs_glusterfs: initialize st_ex_file_id, st_ex_itime and st_ex_iflags

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14090
RN: vfs_glusterfs: initialize st_ex_file_id, st_ex_itime and st_ex_iflags

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Aug 16 01:07:23 UTC 2019 on sn-devel-184

(cherry picked from commit 3ee78cc9979a72ebbe65a16c60967a1735a0d208)

- - - - -
c6d784de by Anoop C S at 2019-08-26T08:51:55Z
vfs_glusterfs: Enable profiling for file system operations

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14093

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Aug 20 19:25:28 UTC 2019 on sn-devel-184

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Mon Aug 26 08:51:55 UTC 2019 on sn-devel-184

- - - - -
c7e98332 by Michael Adam at 2019-08-26T10:23:23Z
vfs:glusterfs_fuse: ensure fileids are constant across nodes

Instead of adding a new gluster-specific mode to the fileid module,
this patches provides a fileid algorithm as part of the glusterfs_fuse
vfs module. This can not be configured further, simply adding the
glusterfs_fuse vfs module to the vfs objects configuration will enable
the new fileid mode.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13972

Signed-off-by: Michael Adam <obnox at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Sat Jul 13 22:54:56 UTC 2019 on sn-devel-184

- - - - -
3aa131b5 by Michael Adam at 2019-08-26T10:23:23Z
vfs:glusterfs_fuse: build only if we have setmntent()

FreeBSD and other platforms that don't have setmntent() and friends can
not compile this module. This patch lets changes the build to only
compile this module if the setmntent() function is found.

This is the a follow-up fix to the actual fix for bug #13972.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13972

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Thu Aug  1 09:49:04 UTC 2019 on sn-devel-184

- - - - -
1c43f6b1 by Isaac Boukris at 2019-08-26T10:23:24Z
selftest: remote_pac: s/s2u4self/s4u2self/g

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11362

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 60afe949c3e664f81c9b0db9c54f701aa2874a5e)

- - - - -
c20f77fe by Isaac Boukris at 2019-08-26T10:23:24Z
selftest: check for PrimaryGroupId in DC returned group array

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11362

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 3700998419738caa1ca8672fbf5dbaccaaa498fa)

- - - - -
1784a664 by Isaac Boukris at 2019-08-26T10:23:24Z
Add PrimaryGroupId to group array in DC response

This is a simplified version of the original patch by:
Felix Botner <botner at univention.de>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11362

Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Wed Jul  3 13:52:55 UTC 2019 on sn-devel-184

(cherry picked from commit 2ae75184fcb5dc90602aeef113d4c13540073324)

- - - - -
d2b711ae by Volker Lendecke at 2019-08-26T10:23:24Z
vfs: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit 59f29acb2cd947d2f594a5af3d73d0cbe8298d92)

- - - - -
0af50d85 by Christof Schmitt at 2019-08-26T10:23:24Z
Revert "nfs4acl: Fix owner mapping with ID_TYPE_BOTH"

This reverts commit 5d4f7bfda579cecb123cfb1d7130688f1d1c98b7.

That patch broke the case with ID_TYPE_BOTH where a file is owned by a
group (e.g. using autorid and having a file owned by
BUILTIN\Administrators). In this case, the ACE entry for the group gets
mapped a to a user ACL entry and the group no longer has access (as in
the user's token the group is not mapped to a uid).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 42bd3a72a2525aa8a918f4bf7067b30ce8e0e197)

- - - - -
1db5a290 by Christof Schmitt at 2019-08-26T10:23:24Z
nfs4_acls: Remove fsp from smbacl4_win2nfs4

Only the information whether the ACL is for a file or a directory is
required. Replacing the fsp with a flag is clearer and allows for unit
testing of the mapping functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit a06486bb110d04a90b66a0bca4b1b600ef3c0ebf)

- - - - -
c84bdb31 by Christof Schmitt at 2019-08-26T10:23:24Z
selftest: Start implementing unit test for nfs4_acls

Existing smbtorture tests set and query ACLs through SMB, only working
with the DACLs in the Security Descriptors, but never check the NFSv4
ACL representation. This patch introduces a unit test to verify the
mapping between between Security Descriptors and NFSv4 ACLs. As the
mapping code queries id mappings, the id mapping cache is first primed
with the mappings used by the tests and those mappings are removed again
during teardown.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 8fb906a1860452a320c79ac87917a97303729c19)

- - - - -
ee47f743 by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add tests for mapping of empty ACLs

This is a fairly simple test that ensures the mapping of empty ACLs
(without any ACL entries) is always done the same way.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 00f494b25f4e1d1aecf6191523e30f20a90b1e4f)

- - - - -
7f1c567a by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add tests for mapping of ACL types

Add testcases for mapping the type field (ALLOW or DENY) between NFSv4
ACLs and security descriptors.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit dd5934797526ebb4c6f3027a809401dad3abf701)

- - - - -
d142e46a by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add test for flags mapping from NFS4 ACL to DACL

Add testcase for the mapping of inheritance flags when mapping from a
NFSv4 ACL to a DACL in the security descriptor. The mapping is different
between files and directories, as some inheritance flags should never be
present for files. Some defined flags like SUCCESSFUL_ACCESS are also
not mapped at this point, also verify this behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 16eb61a900c6749c2554d635ce2dd903f5de1704)

- - - - -
0aadba93 by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add test for flags mapping from DACL to NFS4 ACL

Add testcase for the mapping of inheritance flags from the DACL in the
security descriptor to the NFSv4 ACL. The mapping is different for files
and directories as some inheritance flags should not be present for
files. Also other flags are not mapped at all, verify this behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit bccd2612761e26ee2514935d56927b2c0c000859)

- - - - -
f431a1b7 by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add test for mapping permissions from NFS4 ACL to DACL

Add testcase for mapping permissions from the NFSv4 ACL to DACL in the
security descriptor. The mapping is simple as each permission bit exists
on both sides.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 1767027b44a9e4ebd865022e3f8abb0c72bf15c6)

- - - - -
c9650274 by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add test for mapping permissions from DACL to NFS4 ACL

Add testcase for mapping the permission flags from the DACL in the
Security Descriptor to a NFSv4 ACL. The mapping is straight-forward as
the same permission bits exist for Security Descriptors and NFSv4 ACLs.
In addition, the code also maps from the generic DACL permissions to a
set of NFSv4 permissions, also verify this mapping.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit e4840e680744bd860beedeb5123704c3c0d6a4d7)

- - - - -
f900a6e1 by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add test for mapping of special NFS4 ACL entries to DACL entries

In addition to entries for users and groups, NFSv4 ACLs have the concept
of entries for "special" entries. Only the "owner", "group" and
"everyone" entries are currently used in the ACL mapping.

Add a testcase that verifies the mapping from NFSv4 "special" entries to
the DACL in the security descriptor. Verify that only "owner", "group"
and "everyone" are mapped and all other "special" entries are ignored.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f86148948c7f89307a34e31f6ddede6923149d34)

- - - - -
f0581b94 by Christof Schmitt at 2019-08-26T10:23:25Z
test_nfs4_acls: Add test for mapping from DACL to special NFS4 ACL entries

Add testcase for mapping from entries in the DACL security descriptor to
"special" entries in the NFSv4 ACL. Verify that the WORLD well-known SID
maps to "everyone" in the NFSv4 ACL. Verify that the "Unix NFS" SID is
ignored, as there is no meaningful mapping for this entry. Verify that
SID entries matching the owner or group are mapped to "special owner"
or "special group", but only if no inheritance flags are used. "special
owner" and "special group" with inheritance flags have the meaning of
CREATOR OWNER and CREATOR GROUP and will be tested in another testcase.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 1f1fa5bde2c76636c1beec39c21067b252ea10be)

- - - - -
e8f8c4c8 by Christof Schmitt at 2019-08-26T10:23:26Z
test_nfs4_acls: Add test for mapping CREATOR entries to NFS4 ACL entries

Add testcase for mapping DACL entries CREATOR OWNER and CREATOR GROUP
with inheritance flag in the security descriptor to NFSv4 "special
owner" and "special group" entries. This is the correct mapping for
these entries as inheriting "special owner" and "special group" grants
permissions to the actual owner and owning group of the new file or
directory, similar to what CREATOR entries do.

The other side is that CREATOR entries without any inheritance flags do
not make sense, so these are not mapped to NFSv4 ACL entries.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit bfcc19b705f83bdd5cf665fd4daf43e7eae997a9)

- - - - -
79f9a501 by Christof Schmitt at 2019-08-26T10:23:26Z
test_nfs4_acls: Add test for mapping from NFS4 to DACL CREATOR entries

Add testcase for mapping from NFSv4 ACL entries for "special owner" and
"special group" to DACL entries in the security descriptor. Each NFSv4
entry here with INHERIT_ONLY maps directly to a CREATOR OWNER or CREATOR
GROUP entry in the DACL. Entries without INHERIT_ONLY map to the CREATOR
entry and an additional explicit entry granting permission on the
current object.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 3c9cda0f6d80258ef0c2a80d6e24dfb650fea1b1)

- - - - -
b21c3f38 by Christof Schmitt at 2019-08-26T10:23:26Z
test_nfs4_acls: Add test for 'map full control' option

"map full control" when enabled adds the DELETE_CHILD permission, when
all other permissions are present. This allows Windows clients to
display the "FULL CONTROL" permissions.

Add a testcase that verifies this mapping when mapping from NFSv4 ACL to
the DACL in the security descriptor. Also verify that switching the
option off disables this behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 30677df4dac4ebfcf4e3198db33f14be37948197)

- - - - -
5b130cc4 by Christof Schmitt at 2019-08-26T10:23:26Z
test_nfs4_acls: Add test for acedup settings

The NFSv4 ACL mapping code has a setting nfs4:acedup. Depending on the
setting, when mapping from DACLs to NFSv4 ACLs, duplicate ACL entries
are either merged, ignored or rejected. Add a testcase that has
duplicate ACL entries and verify the expected behavior for all possible
settings of the nfs4:acedup option.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 9671bf2b9f055012057620207624aa2f4ea6833e)

- - - - -
92d2e243 by Christof Schmitt at 2019-08-26T10:23:26Z
test_nfs4_acls: Add test for matching DACL entries for acedup

The NFSv4 mapping code has a config option nfs4:acedup for the mapping
path from DACLs to NFSv4 ACLs. Part of this codepath is detecting
duplicate ACL entries. Add a testcase with different ACL entries and
verify that only exactly matching entries are detected as duplicates and
treated accordingly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f55cdf42a14f314102f2e13cb06d4db48c08ad4b)

- - - - -
f6427639 by Christof Schmitt at 2019-08-26T10:23:26Z
test_nfs4_acls: Add test for mapping from DACL to NFS4 ACL with config special

The mapping code between NFSv4 ACLs and security descriptors still has
the deprecated config setting "nfs4:mode = special". This should not be
used as it has security problems: All entries matching owner or group
are mapped to "special owner" or "special group", which can change its
meaning when being inherited to a new file or directory with different
owner and owning group.

This mode should eventually be removed, but as long as it still exists
add testcases to verify the expected behavior. This patch adds the
testcase for "nfs4:mode = special" when mapping from the DACL in the
security descriptor to the NFSv4 ACL.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 7ae06d96eb59722154d30e21949f9dba4f2f0bc6)

- - - - -
c5da1d66 by Christof Schmitt at 2019-08-26T10:23:27Z
test_nfs4_acls: Add test for mapping from NFS4 to DACL in config mode special

The mapping code between NFSv4 ACLs and security descriptors still has
the deprecated config setting "nfs4:mode = special". This should not be
used as it has security problems: All entries matching owner or group
are mapped to "special owner" or "special group", which can change its
meaning when being inherited to a new file or directory with different
owner and owning group.

This mode should eventually be removed, but as long as it still exists
add testcases to verify the expected behavior. This patch adds the
testcase for "nfs4:mode = special" when mapping from the NFS4 ACL to the
DACL in the security descriptor.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 829c5ea99685c0629fd67ed0528897534ff35b36)

- - - - -
8ad87b9a by Christof Schmitt at 2019-08-26T10:23:27Z
test_nfs4_acls: Add test for mapping from NFS4 ACL to DACL with IDMAP_TYPE_BOTH

When id mappings use IDMAP_TYPE_BOTH, the NFSv4 ACL mapping code is not
aware whether a particular entry is for a user or a group. The
underlying assumption then is that is should not matter, as both the ACL
mapping maps everything to NFSv4 ACL group entries and the user's token
will contain gid entries for the groups.

Add a testcase to verify that when mapping from NFSv4 ACL entries to
DACLs with IDMAP_TYPE_BOTH, all entries are mapped as expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 86480410aec1d2331c65826a13f909492165a291)

- - - - -
9ba27632 by Christof Schmitt at 2019-08-26T10:23:27Z
test_nfs4_acls: Add test for mapping from DACL to NFS4 ACL with IDMAP_TYPE_BOTH

When id mappings use IDMAP_TYPE_BOTH, the NFSv4 ACL mapping code is not
aware whether a particular entry is for a user or a group. The
underlying assumption then is that is should not matter, as both the ACL
mapping maps everything to NFSv4 ACL group entries and the user's token
will contain gid entries for the groups.

Add a testcase to verify that when mapping from DACLS to NFSv4 ACL
entries with IDMAP_TYPE_BOTH, all entries are mapped as expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 38331b00521ef764893a74add01758f14567d901)

- - - - -
d50b5fc5 by Christof Schmitt at 2019-08-26T10:23:27Z
nfs4_acls: Use sids_to_unixids to lookup uid or gid

This is the newer API to lookup id mappings and will make it easier to
add to the IDMAP_TYPE_BOTH case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit d9a2ff559e1ad953141b1118a9e370496f1f61fa)

- - - - -
2493a9f8 by Christof Schmitt at 2019-08-26T10:23:27Z
nfs4_acls: Use switch/case for checking idmap type

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f198a0867e71f248d4887ab0b6f2832123b16d11)

- - - - -
10266805 by Christof Schmitt at 2019-08-26T10:23:27Z
nfs4_acls: Use correct type when checking ownerGID

uid and gid are members of the same union so this makes no difference,
but for type correctness and readability use the gid to check for
ownerGID.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 3b3d722ce579c19c7b08d06a3adea275537545dc)

- - - - -
ff1cee15 by Christof Schmitt at 2019-08-26T10:23:27Z
nfs4_acls: Add helper function for checking INHERIT flags.

This avoids some code duplication. Do not make this static, as it will
be used in a later patch.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmit <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 336e8668c1cc3682cb3c198eb6dc49baf522a79a)

- - - - -
966916da by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Add missing braces in smbacl4_win2nfs4

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit ba73d2363d93a376ba4947963c9de45a7e683f02)

- - - - -
8c8f09c3 by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Remove i argument from smbacl4_MergeIgnoreReject

This is only used for logging of a rejected ACL, but does not provide
additional useful information. Remove it to simplify the function a bit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 44790721e4f2c6ee6f46de7ac88123ce1a9f6e39)

- - - - -
02a5fbd0 by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Move smbacl4_MergeIgnoreReject function

This static function will be called earlier in later patches.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 3499d97463110f042415d917160bc2743805a544)

- - - - -
7555f121 by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Move adding of NFS4 ACE to ACL to smbacl4_fill_ace4

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit abb58b17599bd3f9a06037e208dcc5033c7fdd8b)

- - - - -
596a4e4d by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Remove redundant logging from smbacl4_fill_ace4

Logging flags in case they do not match seems unnecessary. Other log
messages should show the flags as well.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 7ab0003ffc098247c3ee3962d7061f2af5a2d00e)

- - - - -
d297f347 by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Remove redundant pointer variable

The previous patch introduced a pointer to a local variable to reduce
the amount of lines changed. Remove that pointer and adjust all usage
accordingly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit aa4644193635d846c2e08e8c1e7b512e8009c2ef)

- - - - -
657f79f8 by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Add additional owner entry when mapping to NFS4 ACL with IDMAP_TYPE_BOTH

With IDMAP_TYPE_BOTH, all entries have to be mapped to group entries.
In order to have the file system reflect the owner permissions in the
POSIX modebits, create a second entry for the user. This will be mapped
to the "special owner" entry.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit b796119e2df38d1935064556934dd10da6f3d339)

- - - - -
b4b61724 by Christof Schmitt at 2019-08-26T10:23:28Z
nfs4_acls: Rename smbacl4_fill_ace4 function

As this function now maps the ACE and also adds it to the NFSv4 ACE,
change the name to better describe its behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 169812943de23cf2752289c63331d786b0b063bd)

- - - - -
1f10af9f by Christof Schmitt at 2019-08-26T10:23:29Z
nfs4_acls: Remove duplicate entries when mapping from NFS4 ACL to DACL

The previous patch added an additional entry for IDMAP_TYPE_BOTH. When
mapping back to a DACL, there should be no additional entry. Add a loop
that will check and remove entries that are exact duplicates.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 9c88602128592ddad537bf70cbe3c51f0b2cebe5)

- - - - -
c5d46911 by Christof Schmitt at 2019-08-26T10:23:29Z
nfs4_acls: Add test for merging duplicates when mapping from NFS4 ACL to DACL

The previous patch introduced merging of duplicates on the mapping path
from NFS4 ACL entries to DACL entries. Add a testcase to verify the
expected behavior of this codepath.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 1a137a2f20c2f159c5feaef230a2b85bb9fb23b5)

- - - - -
548cc518 by Christof Schmitt at 2019-08-26T10:23:29Z
nfs4_acls: Use correct owner information for ACL after owner change

After a chown, the cached stat data is obviously no longer valid. The
code in smb_set_nt_acl_nfs4 checked the file correctly, but did only use
a local buffer for the stat data. So later checks of the stat buffer
under the fsp->fsp_name->st would still see the old information.

Fix this by removing the local stat buffer and always update the one
under fsp->fsp_name->st.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 86f7af84f04b06ed96b30f936ace92aa0937be06)

- - - - -
b3560baa by Christof Schmitt at 2019-08-26T10:23:29Z
vfs_gpfs: Remove merge_writeappend parameter

All supported GPFS versions now support setting WRITE and APPEND in the
ACLs independently. Remove this now unused parameter to simplify the
code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 0aca678fcf1788a76cf0ff11399211c795aa7d2f)

- - - - -
bba26e38 by Christof Schmitt at 2019-08-26T10:23:29Z
docs: Remove gpfs:merge_writeappend from vfs_gpfs manpage

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 8bd79ecc37376dbaa35606f9c2777653eb3d55e3)

- - - - -
fe990205 by Christof Schmitt at 2019-08-26T10:23:29Z
vfs_gpfs: Move mapping from generic NFSv ACL to GPFS ACL to separate function

This is not functional change. It cleans up the code a bit and makes
expanding this codepath in a later patch easier.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit fbf3a090a9ec94262b2924461cc1d6336af9919c)

- - - - -
0cb08a23 by Christof Schmitt at 2019-08-26T10:23:29Z
vfs_gpfs: Implement special case for denying owner access to ACL

In GPFS, it is not possible to deny ACL or attribute access through a
SPECIAL_OWNER entry. The best that can be done is mapping this to a
named user entry, as this one can at least be stored in an ACL. The same
cannot be done for inheriting SPECIAL_OWNER entries, as these represent
CREATOR OWNER entries, and the limitation of not being able to deny
owner access to ACL or attributes remains.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14032

Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit c1770ed96fd3137f45d584ba9328333d5505e3af)

- - - - -
dcff563d by Anoop C S at 2019-08-26T13:26:08Z
vfs_glusterfs: Enable profiling for file system operations

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14093

Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Aug 20 19:25:28 UTC 2019 on sn-devel-184

Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-9-test): Mon Aug 26 13:26:08 UTC 2019 on sn-devel-144

- - - - -
1205c5cb by Karolin Seeger at 2019-08-27T08:14:30Z
WHATSNEW: Add release notes for Samba 4.9.12.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
53d19bf5 by Karolin Seeger at 2019-08-27T08:14:50Z
VERSION: Diable GIT_SNAPSHOT for the 4.9.12 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
523f9f15 by Karolin Seeger at 2019-08-27T11:16:24Z
VERSION: Bump version up to 4.10.8...

and re-eanble GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>
(cherry picked from commit baafb6fc060c0b61f3e744c041be871303fa9c66)

- - - - -
cf67b48f by Jeremy Allison at 2019-08-27T11:16:24Z
CVE-2019-10197: smbd: separate out impersonation debug info into a new function.

Will be called on elsewhere on successful impersonation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
fd0d3986 by Stefan Metzmacher at 2019-08-27T11:16:24Z
CVE-2019-10197: smbd: make sure that change_to_user_internal() always resets current_user.done_chdir

We should not leave current_user.done_chdir as true if we didn't call
chdir_current_service() with success.

This caused problems in when calling vfs_ChDir() in pop_conn_ctx() when
chdir_current_service() worked once on one share but later failed on another
share.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
0af5d11c by Stefan Metzmacher at 2019-08-27T11:16:24Z
CVE-2019-10197: smbd: make sure we reset current_user.{need,done}_chdir in become_root()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
d1d48f20 by Stefan Metzmacher at 2019-08-27T11:16:24Z
CVE-2019-10197: selftest: make fsrvp_share its own independent subdirectory

The next patch will otherwise break the fsrvp related tests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
962d4a98 by Stefan Metzmacher at 2019-08-27T11:16:24Z
CVE-2019-10197: test_smbclient_s3.sh: add regression test for the no permission on share root problem

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
661a7cdb by Stefan Metzmacher at 2019-08-27T11:16:24Z
CVE-2019-10197: smbd: split change_to_user_impersonate() out of change_to_user_internal()

This makes sure we always call chdir_current_service() even
when we still impersonated the user. Which is important
in order to run the SMB* request within the correct working directory
and only if the user has permissions to enter that directory.

It makes sure we always update conn->lastused_count
in chdir_current_service() for each request.

Note that vfs_ChDir() (called from chdir_current_service())
maintains its own cache and avoids calling SMB_VFS_CHDIR()
if possible.

It means we still avoid syscalls if we get a multiple requests
for the same session/tcon tuple.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
3761e478 by Karolin Seeger at 2019-08-27T11:16:24Z
WHATSNEW: Add release notes for Samba 4.10.8.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035
CVE-2019-10197 [SECURITY][EMBARGOED] permissions check deny can allow user to
escape from the share.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
2d587a11 by Karolin Seeger at 2019-08-27T11:16:44Z
VERSION: Disable GIT_SNAPSHOT for the 4.10.8 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
674ef369 by Karolin Seeger at 2019-08-28T07:39:14Z
VERSION: Bump version up to 4.9.13...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
4772adbe by Jeremy Allison at 2019-08-28T07:39:46Z
CVE-2019-10197: smbd: separate out impersonation debug info into a new function.

Will be called on elsewhere on successful impersonation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
5604883d by Stefan Metzmacher at 2019-08-28T07:39:46Z
CVE-2019-10197: smbd: make sure that change_to_user_internal() always resets current_user.done_chdir

We should not leave current_user.done_chdir as true if we didn't call
chdir_current_service() with success.

This caused problems in when calling vfs_ChDir() in pop_conn_ctx() when
chdir_current_service() worked once on one share but later failed on another
share.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
104557f2 by Stefan Metzmacher at 2019-08-28T07:39:46Z
CVE-2019-10197: smbd: make sure we reset current_user.{need,done}_chdir in become_root()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
1305693d by Stefan Metzmacher at 2019-08-28T07:39:46Z
CVE-2019-10197: selftest: make fsrvp_share its own independent subdirectory

The next patch will otherwise break the fsrvp related tests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
c9852875 by Stefan Metzmacher at 2019-08-28T07:39:46Z
CVE-2019-10197: test_smbclient_s3.sh: add regression test for the no permission on share root problem

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
8e2c37bd by Stefan Metzmacher at 2019-08-28T07:39:46Z
CVE-2019-10197: smbd: split change_to_user_impersonate() out of change_to_user_internal()

This makes sure we always call chdir_current_service() even
when we still impersonated the user. Which is important
in order to run the SMB* request within the correct working directory
and only if the user has permissions to enter that directory.

It makes sure we always update conn->lastused_count
in chdir_current_service() for each request.

Note that vfs_ChDir() (called from chdir_current_service())
maintains its own cache and avoids calling SMB_VFS_CHDIR()
if possible.

It means we still avoid syscalls if we get a multiple requests
for the same session/tcon tuple.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
514743b2 by Karolin Seeger at 2019-08-28T07:44:22Z
WHATSNEW: Add release notes for Samba 4.9.13.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035
CVE-2019-10197 [SECURITY][EMBARGOED] permissions check deny can allow user to
escape from the share.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
1acf30ac by Karolin Seeger at 2019-08-28T07:45:38Z
VERSION: Disable GIT_SNAPSHOT for the 4.9.13 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
d8ba147d by Michael Adam at 2019-08-28T09:12:16Z
vfs:glusterfs_fuse: ensure fileids are constant across nodes

Instead of adding a new gluster-specific mode to the fileid module,
this patches provides a fileid algorithm as part of the glusterfs_fuse
vfs module. This can not be configured further, simply adding the
glusterfs_fuse vfs module to the vfs objects configuration will enable
the new fileid mode.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13972

Signed-off-by: Michael Adam <obnox at samba.org>
Signed-off-by: Guenther Deschner <gd at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Sat Jul 13 22:54:56 UTC 2019 on sn-devel-184

(cherry picked from commit 5522aa1a4c34ee1a1e81db73cf41594bb10bd989)

- - - - -
53b0fd22 by Michael Adam at 2019-08-28T09:12:16Z
vfs:glusterfs_fuse: build only if we have setmntent()

FreeBSD and other platforms that don't have setmntent() and friends can
not compile this module. This patch lets changes the build to only
compile this module if the setmntent() function is found.

This is the a follow-up fix to the actual fix for bug #13972.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13972

Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Thu Aug  1 09:49:04 UTC 2019 on sn-devel-184

(cherry picked from commit f258cfaa1d07af6ac6e996006f6e59955cfe34ce)

- - - - -
0b4a99c2 by Martin Schwenke at 2019-08-28T09:12:16Z
ctdb-daemon: Add function ctdb_ip_to_node()

This is the core logic from ctdb_ip_to_pnn(), so re-implement that
that function using ctdb_ip_to_node().

Something similar (ctdb_ip_to_nodeid()) was recently removed in commit
010c1d77cd7e192b1fff39b7b91fccbdbbf4a786 because it wasn't required.
Now there is a use case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 3acb8e9d1c854b577d6be282257269df83055d31)

- - - - -
4cf26ff2 by Martin Schwenke at 2019-08-28T09:12:16Z
ctdb-tcp: Rename fd -> out_fd

in_fd is coming soon.

Fix coding style violations in the affected and adjacent lines.
Modernise some debug macros and make them more consistent (e.g. drop
logging of errno when strerror(errno) is already logged.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit c06620169fc178ea6db2631f03edf008285d8cf2)

- - - - -
bf39d0cf by Martin Schwenke at 2019-08-28T09:12:16Z
ctdb-tcp: Move incoming fd and queue into struct ctdb_tcp_node

This makes it easy to track both incoming and outgoing connectivity
states.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit c68b6f96f26664459187ab2fbd56767fb31767e0)

- - - - -
1ef2ffba by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-tcp: Use TALLOC_FREE()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit d80d9edb4dc107b15a35a39e5c966a3eaed6453a)

- - - - -
6668733c by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-tcp: Create outbound queue when the connection becomes writable

Since commit ddd97553f0a8bfaada178ec4a7460d76fa21f079
ctdb_queue_send() doesn't queue a packet if the connection isn't yet
established (i.e. when fd == -1).  So, don't bother creating the
outbound queue during initialisation but create it when the connection
becomes writable.

Now the presence of the queue indicates that the outbound connection
is up.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 7f4854d9643a096a6d8a354fcd27b7c6ed24a75e)

- - - - -
adb19f17 by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-tcp: Only mark a node connected if both directions are up

Nodes are currently marked as up if the outgoing connection is
established.  However, if the incoming connection is not yet
established then this node could send a request where the replying
node can not queue its reply.  Wait until both directions are up
before marking a node as connected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 8c98c10f242bc722beffc711e85c0e4f2e74cd57)

- - - - -
240ad919 by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-tcp: Mark node as disconnected if incoming connection goes away

To make it easy to pass the node data to the upcall, the private data
for ctdb_tcp_read_cb() needs to be changed from tnode to node.

RN: Avoid marking a node as connected before it can receive packets
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Fri Aug 16 22:50:35 UTC 2019 on sn-devel-184

(cherry picked from commit 73c850eda4209b688a169aeeb20c453b738cbb35)

- - - - -
09397389 by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-daemon: Factor out new function ctdb_node_become_inactive()

This is a superset of ctdb_local_node_got_banned() so will replace
that function, and will also be used in the NODE_STOP control.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit a42bcaabb63722411bee52b80cbfc795593defbc)

- - - - -
a93c591a by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-daemon: Switch banning code to use ctdb_node_become_inactive()

There's no reason to avoid immediately setting recovery mode to active
and initiating freeze of databases.

This effectively reverts the following commits:

  d8f3b490bbb691c9916eed0df5b980c1aef23c85
  b4357a79d916b1f8ade8fa78563fbef0ce670aa9

The latter is now implemented using a control, resulting in looser
coupling.

See also the following commit:

  f8141e91a693912ea1107a49320e83702a80757a

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 0f5f7b7cf4e970f3f36c5e0b3d09e710fe90801a)

- - - - -
f454db8d by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-daemon: Drop unused function ctdb_local_node_got_banned()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 91ac4c13d8472955d1f04bd775ec4b3ff8bf1b61)

- - - - -
a9d0e0b7 by Martin Schwenke at 2019-08-28T09:12:17Z
ctdb-daemon: Make node inactive in the NODE_STOP control

Currently some of this is supported by a periodic check in the
recovery daemon's main_loop(), which notices the flag change, sets
recovery mode active and freezes databases.  If STOP_NODE returns
immediately then the associated recovery can complete and the node can
be continued before databases are actually frozen.

Instead, immediately do all of the things that make a node inactive.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087
RN: Stop "ctdb stop" from completing before freezing databases

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Tue Aug 20 08:32:27 UTC 2019 on sn-devel-184

(cherry picked from commit e9f2e205ee89f4f3d6302cc11b4d0eb2efaf0f53)

- - - - -
d61fac0c by Andrew Bartlett at 2019-08-28T09:12:17Z
docs: Deprecate "rndc command" for Samba 4.11

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14092

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 561e0986ac96c842239b4e8c6509e05c836707b7)

- - - - -
aa3ad5c4 by Andrew Bartlett at 2019-08-28T10:48:10Z
WHATSNEW: BIND9_FLATFILE / rndc command deprecated

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Wed Aug 28 10:48:10 UTC 2019 on sn-devel-184

- - - - -
bcfb7749 by Jeremy Allison at 2019-09-03T09:45:36Z
CVE-2019-10197: smbd: separate out impersonation debug info into a new function.

Will be called on elsewhere on successful impersonation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

- - - - -
ae9bdef5 by Stefan Metzmacher at 2019-09-03T09:45:36Z
CVE-2019-10197: smbd: make sure that change_to_user_internal() always resets current_user.done_chdir

We should not leave current_user.done_chdir as true if we didn't call
chdir_current_service() with success.

This caused problems in when calling vfs_ChDir() in pop_conn_ctx() when
chdir_current_service() worked once on one share but later failed on another
share.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
d690f6f3 by Stefan Metzmacher at 2019-09-03T09:45:36Z
CVE-2019-10197: smbd: make sure we reset current_user.{need,done}_chdir in become_root()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
7b39df0f by Stefan Metzmacher at 2019-09-03T09:45:36Z
CVE-2019-10197: selftest: make fsrvp_share its own independent subdirectory

The next patch will otherwise break the fsrvp related tests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
a6ff560a by Stefan Metzmacher at 2019-09-03T09:45:36Z
CVE-2019-10197: test_smbclient_s3.sh: add regression test for the no permission on share root problem

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>

- - - - -
efd6d670 by Stefan Metzmacher at 2019-09-03T09:45:36Z
CVE-2019-10197: smbd: split change_to_user_impersonate() out of change_to_user_internal()

This makes sure we always call chdir_current_service() even
when we still impersonated the user. Which is important
in order to run the SMB* request within the correct working directory
and only if the user has permissions to enter that directory.

It makes sure we always update conn->lastused_count
in chdir_current_service() for each request.

Note that vfs_ChDir() (called from chdir_current_service())
maintains its own cache and avoids calling SMB_VFS_CHDIR()
if possible.

It means we still avoid syscalls if we get a multiple requests
for the same session/tcon tuple.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>

- - - - -
f04985fe by Karolin Seeger at 2019-09-03T11:12:16Z
WHATSNEW: Add release notes for Samba 4.11.0rc3.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
c1d9e02d by Karolin Seeger at 2019-09-03T11:12:53Z
VERSION: Disable GIT_SNAPSHOT for the 4.11.0rc3 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
96961348 by Karolin Seeger at 2019-09-03T11:13:47Z
VERSION: Bump verison up to 4.11.0rc4...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
3c8ccf78 by Mathieu Parent at 2019-09-03T19:03:48Z
Changelog for previous commits

- - - - -
93257106 by Mathieu Parent at 2019-09-03T19:07:03Z
New upstream version 4.9.13+dfsg
- - - - -
796dd359 by Mathieu Parent at 2019-09-03T19:08:06Z
Merge tag 'upstream/4.9.13+dfsg'

Upstream version 4.9.13+dfsg

- - - - -
b34ece42 by Mathieu Parent at 2019-09-03T19:19:41Z
Drop ctdb-config-depend-on-etc-ctdb-nodes-file.patch, merged

- - - - -
1d7f77e7 by Mathieu Parent at 2019-09-03T19:26:33Z
Remove ctdb_etcd_lock as python-etcd was moved to python3

NB: experimental still has ctdb_etcd_lock, using python3

- - - - -
9632eb29 by Mathieu Parent at 2019-09-03T19:27:11Z
Release 2:4.9.13+dfsg-1

- - - - -
a279b888 by Martin Schwenke at 2019-09-04T08:31:22Z
ctdb-tests: Reformat node_has_status()

Re-indent and drop non-POSIX left-parenthesis from case labels.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 52227d19735a3305ad633672c70385f443f222f0)

- - - - -
6efb59af by Martin Schwenke at 2019-09-04T08:31:22Z
ctdb-tests: Drop unused node statuses frozen/unfrozen

Silently drop unused local variable mpat.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 9b09a87326af28877301ad27bcec5bb13744e2b6)

- - - - -
e876b1e8 by Martin Schwenke at 2019-09-04T08:31:22Z
ctdb-tests: Inline handling of recovered and notlmaster statuses

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit bb59073515ee5f7886b5d9a20d7b2805857c2708)

- - - - -
7e004230 by Martin Schwenke at 2019-09-04T08:31:22Z
ctdb-tests: Handle special cases first and return

All the other cases involve matching bits.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit bff1a3a548a2cace997b767d78bb824438664cb7)

- - - - -
4a5c5545 by Martin Schwenke at 2019-09-04T08:31:22Z
ctdb-tests: Don't retrieve the VNN map from target node for notlmaster

Use the VNN map from the node running node_has_status().

This means that

  wait_until_node_has_status 1 notlmaster 10 0

will run "ctdb status" on node 0 and check (for up to 10 seconds) if
node 1 is in the VNN map.

If the LMASTER capability has been dropped on node 1 then the above
will wait for the VNN map to be updated on node 0.  This will happen
as part of the recovery that is triggered by the change of LMASTER
capability.  The next command will then only be able to attach to
$TESTDB after the recovery is complete thus guaranteeing a sane state
for the test to continue.

This stops simple/79_volatile_db_traverse.sh from going into recovery
during the traverse or at some other inconvenient time.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 53daeb2f878af1634a26e05cb86d87e2faf20173)

- - - - -
a03443ef by Martin Schwenke at 2019-09-04T08:31:23Z
ctdb-recoverd: Only check for LMASTER nodes in the VNN map

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit 5d655ac6f2ff82f8f1c89b06870d600a1a3c7a8a)

- - - - -
9063f5dd by Martin Schwenke at 2019-09-04T08:31:23Z
ctdb-tests: Strengthen volatile DB traverse test

Check the record count more often, from multiple nodes.  Add a case
with multiple records.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
(cherry picked from commit ca4df06080709adf0cbebc95b0a70b4090dad5ba)

- - - - -
20c4d212 by Martin Schwenke at 2019-09-04T08:31:23Z
ctdb-tests: Clear deleted record via recovery instead of vacuuming

This test has been flapping because sometimes the record is not
vacuumed within the expected time period, perhaps even because the
check for the record can interfere with vacuuming.  However, instead
of waiting for vacuuming the record can be cleared by doing a
recovery.  This should be much more reliable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
RN: Fix flapping CTDB tests

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Wed Aug 21 13:06:57 UTC 2019 on sn-devel-184

(cherry picked from commit 71ad473ba805abe23bbe6c1a1290612e448e73f3)

- - - - -
8b680d30 by Martin Schwenke at 2019-09-04T08:31:23Z
ctdb-recoverd: Fix typo in previous fix

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Tue Aug 27 15:29:11 UTC 2019 on sn-devel-184

(cherry picked from commit 8190993d99284162bd8699780248bb2edfec2673)

- - - - -
0e96b2cb by Poornima G at 2019-09-04T08:31:23Z
vfs_glusterfs: Use pthreadpool for scheduling aio operations

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14098

Signed-off-by: Poornima G <pgurusid at redhat.com>
Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>

Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Aug 23 18:40:08 UTC 2019 on sn-devel-184

(cherry picked from commit d8863dd8cb74bb0534457ca930a71e77c367d994)

- - - - -
0358b3f9 by Douglas Bagnall at 2019-09-04T08:31:24Z
ldb: do not allow adding a DN as a base to itself

If you try to add a dn to itself, it expands as it goes. The resulting
loop cannot end well.

It looks like this in Python:

    dn = ldb.Dn(ldb.Ldb(), 'CN=y,DC=x')
    dn.add_base(dn)

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit 19a13cbe0681b3996c33f7449f69b0fb0dc5d640)

- - - - -
7cf6afba by Douglas Bagnall at 2019-09-04T08:31:24Z
ldb_dn: free dn components on explode failure

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Noel Power <npower at samba.org>
(cherry picked from commit b136f153b83d80a91ec9d5350fdf08412d881964)

- - - - -
57f00784 by Swen Schillig at 2019-09-04T08:31:24Z
ldb: Fix mem-leak if talloc_realloc fails

In case of a failing talloc_realloc(), the only reference
to the originally allocated memory is overwritten.
Instead use a temp var until success is verified.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 99b4791cfe423b19f1f21d5f9fb42157336019f1)

- - - - -
9c677a27 by Andrew Bartlett at 2019-09-04T08:31:24Z
ldb: Correct Pigeonhole principle validation in ldb_filter_attrs()

Thankfully this only fails if the DB is corrupt and has a duplicate record.

The test was at the wrong end of the loop, and was for the
wrong boundary condition.  A write after the end of the array would
occour before the condition was hit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13695

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit b1eec5b196e3d5a5716a5c74cf669ceaa5c0301f)

- - - - -
11427be1 by Andrew Bartlett at 2019-09-04T08:31:24Z
ldb: use TALLOC_FREE() over talloc_free() in ldb_filter_attrs()

This is a macro that sets the pointer to NULL after the talloc_free()
and is part of our standard coding practices.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit 2117789c35fbf6d0ed02f391f17593e11727ec3e)

- - - - -
61a039cc by Andrew Bartlett at 2019-09-04T08:31:24Z
ldb: Call TALLOC_FREE(filtered_msg->elements) on ldb_filter_attrs() failure

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Aug 27 01:16:33 UTC 2019 on sn-devel-184

(cherry picked from commit 1521a22f4366c86ec955cb9d32b7a758315d8ce0)

- - - - -
c71c51dd by Douglas Bagnall at 2019-09-04T08:31:24Z
ldb: don't try to save a value that isn't there

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit 54f30f2fe3f03c9640664f9a11260b093fc57a5b)

- - - - -
0f993c09 by Douglas Bagnall at 2019-09-04T08:31:25Z
ldb: add some dn explode tests

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049

Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit a097ddf65ce56dcd2e0b072b6dd78f512a77a9da)

- - - - -
1bc9476b by Andrew Bartlett at 2019-09-04T08:31:25Z
ldb: Rework all pointer NULL tests to use Samba's normal style

Also avoid if () without braces

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit 3f290e95c2c133eb2c983ecc984d3dff4809f3d3)

- - - - -
9b0c3051 by Andrew Bartlett at 2019-09-04T08:31:25Z
ldb: Add test with == true or false to boolean if statements in ldb_dn_explode()

This is beyond the normal level of clarity we expect in Samba, and is of course
rudundent, but this is a complex routine that has confusing tests, some of
pointers and some of boolean state values.

This tries to make the code as clear as possible pending a more comprehensive
rewrite.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit 52bd2dde5ae809ecc115f7087e367327f4771e73)

- - - - -
e019f3a6 by Andrew Bartlett at 2019-09-04T08:31:25Z
ldb: Do not read beyond the end of the extended DN component when printing

The print functions used in Samba NULL terminate, but do not assume they will

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit a8a3cef3a768aaff01227dd7b229fb7b3aef926f)

- - - - -
9392ee7d by Andrew Bartlett at 2019-09-04T08:31:25Z
ldb: Extend the ldb_dn_explode test matrix

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
(cherry picked from commit 10058bcfa16d5029e61252d64d142a8aab9ec296)

- - - - -
bc0d16c9 by Andrew Bartlett at 2019-09-04T10:24:55Z
ldb: Release ldb 2.0.7

* Robustness improvements against duplicate attributes in ldb_filter_attrs()
  (bug 13695)
* Robustness improvements against invalid string DN values (bug 14049)

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Wed Sep  4 10:24:56 UTC 2019 on sn-devel-184

- - - - -
116f8cfe by Andrew Bartlett at 2019-09-06T07:03:22Z
docs: Deprecate "lanman auth = yes"

This feature is only available for SMB1 and we need to warn users that this
is going away soon, and allow the removal in a future release under our rules
for parameter deprecation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14117

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Sep  5 04:04:18 UTC 2019 on sn-devel-184

(cherry picked from commit 1006f7abe8980d2c01c181db93225353ce494b3a)

- - - - -
f1d2b5eb by Andrew Bartlett at 2019-09-06T07:03:22Z
docs: Deprecate "encrypt passwords = no"

This feature is only available for SMB1 and we need to warn users that this
is going away soon, and allow the removal in a future release under our rules
for parameter deprecation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14117

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
(cherry picked from commit 8d0d99a4d78ba408bb45e2d693049025e60e277a)

- - - - -
04867f4c by Andrew Bartlett at 2019-09-06T07:03:22Z
WHATSNEW: Add entry for deprecation of "lanman auth" and "encrypt passwords = no"

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14117

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

- - - - -
11c2b21b by Ralph Boehme at 2019-09-06T08:19:43Z
ctdb: fix compilation on systems with glibc robust mutexes

On older systems like SLES 11 without POSIX robust mutexes, but with glib robust
mutexes where all the functions are available but have a "_np" suffix,
compilation fails in:

ctdb/tests/src/test_mutex_raw.c.239.o: In function `worker':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:129: undefined reference to `pthread_mutex_consistent'
ctdb/tests/src/test_mutex_raw.c.239.o: In function `main':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:285: undefined reference to `pthread_mutex_consistent'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:332: undefined reference to `pthread_mutexattr_setrobust'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:363: undefined reference to `pthread_mutex_consistent'
collect2: ld returned 1 exit status

This could be fixed by using libreplace system/threads.h instead of pthreads.h
directly, but as there has been a desire to keep test_mutex_raw.c standalone and
compilable without other external depenencies then libc and libpthread, make the
tool developer build only. This should get the average user over the cliff.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14038
RN: Fix compiling ctdb on older systems lacking POSIX robust mutexes

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
(cherry picked from commit f5388f97792ac2d7962950dad91aaf8ad49bceaa)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Fri Sep  6 08:19:44 UTC 2019 on sn-devel-184

- - - - -
bff4ee33 by Stefan Metzmacher at 2019-09-09T10:41:27Z
libcli/smb: add new COMPRESSION and NETNAME negotiate context ids

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Aurelien Aptel <aaptel at suse.com>
(cherry picked from commit e10b90f33bb812600886656a1124e2d434416563)

- - - - -
d01dbe68 by Stefan Metzmacher at 2019-09-09T12:03:54Z
libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID

Note: Unlike the current documentation, the utf16 string
is not null-terminated, that matches Windows Server 1903
as a client.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055
RN: Add the target server name of SMB 3.1.1 connections
as a hint to load balancers or servers with "multi-tenancy"
support.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Aurelien Aptel <aaptel at suse.com>
(cherry picked from commit 21f6cece543dd791e0f4636458bfe9819823420c)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Mon Sep  9 12:03:55 UTC 2019 on sn-devel-184

- - - - -
728e29d8 by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:blocking: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes

This is not strictly required as fd-based calls are used,
but it's more consistent to call SMB_VFS_BRL_LOCK_WINDOWS()
in the same environment on retry.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 28ac2cbaf92a8619f0380f024c5a220d9fdc4622)

- - - - -
80a04a4e by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:smb2_lock: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes

This is not strictly required as fd-based calls are used,
but it's more consistent to call SMB_VFS_BRL_LOCK_WINDOWS()
in the same environment on retry.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 8b565de1acb0fda121cb0bd4cff42d66ee027529)

- - - - -
244ad121 by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:locking: add/split out byte_range_{valid,overlap}() helper functions

They implement the logic from [MS-FSA].

The following commits will use these functions in other locations.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 0e5613e39d6c6bb892fed939c63b4f14b878803b)

- - - - -
f73b670b by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:locking: add share_mode_wakeup_waiters() helper function

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit bd8884e5722cbbb7783fb4ae53e4f35b31031b01)

- - - - -
75e07d48 by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:blocking: remove unused timeval_brl_min()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 3b788d97f9995e24e4005567f90a925957fb1e00)

- - - - -
0742879b by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:torture: fix the timeout alarm handling on LOCK9

smbXcli_conn_disconnect(alarm_cli->conn, NT_STATUS_OK)
means existing requests are not finished with an error,
but instead just keep dangling arround.

Pass NT_STATUS_LOCAL_DISCONNECT in order to fail the
cli_lock32() call after getting SIGALARM.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit e18c8ced8e7a872deb118191595425ef6b826bfa)

- - - - -
ffdb166e by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:torture: convert LOCK9 into LOCK9A and LOCK9B

LOCK9A is the original test (with a timeout of -1)
and LOCK9B is the same but with timeout of 10 seconds.

LOCK9B is needed to demonstrate a server bug in the next
commits.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit ac28eec3e4af710feab3be3d4b25bfbe38294431)

- - - - -
841fceae by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:blocking: demonstrate the posix lock retry fails

This is just a temporary commit that shows the bug and its
fix. It will be reverted once the problem is fixed.

The posix lock retry fails if the client specified timeout
is smaller than the hardcoded 1 second retry.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 2ec9e93a7aac2706b4a5931495d56a7b64f8d894)

- - - - -
b381f4b3 by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:blocking: split smbd_smb1_do_locks_retry() into _try() and _retry()

This will make it possible to have just one caller to
smbd_do_locks_try() later and use smbd_smb1_do_locks_try()
from within smbd_smb1_do_locks_send().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Reviewed-by: Volker Lendecke <vl at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit e79fcfaaf2ecfca6c3747f6fe4be51f332ebf10d)

- - - - -
6b23f24e by Stefan Metzmacher at 2019-09-09T16:04:28Z
s3:blocking: move from 'timeout' to 'smbd_smb1_do_locks_state->timeout'

This will make it possible to just use smbd_smb1_do_locks_try()
in a later commit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 8fe708acb43ea36d0cbf398713b125daba180a2d)

- - - - -
2c31c9d3 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:blocking: fix posix lock retry

We should evaluate the timeout condition after the very last
retry and not before.

Otherwise we'd fail to retry when waiting for posix locks.
The problem happens if the client provided timeout is smaller
than the 1 sec (for testing temporary 15 secs) retry.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit e8d719d31f885d7b6d5b317165f90ec40df169c9)

- - - - -
e91bae2b by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:blocking: Remove bug reproducer from a few commits ago

The problem is fixed, now we can revert the change that made it
easier to trigger.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 62ec58b06c38ee82bb3147c4d325413fd3a76499)

- - - - -
1fd0a52e by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:blocking: use dynamic posix lock wait intervals

We want to start with a short timeout (200ms) and
slow down to larger timeouts up to 2s for the default
value of "lock spin time".

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 15765644d2590d6549f8fcc01c39c56387eed654)

- - - - -
85b9b5f0 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s4:torture/raw: assert to get LOCK_NOT_GRANTED in torture_samba3_posixtimedlock()

There should not be a different if the blocker is a posix process
instead of another smbd.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 2a77025a1e16d897281e5840192c93fa03328681)

- - - - -
b56bb2ac by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:blocking: maintain state->deny_status

For Windows locks we start with LOCK_NOT_GRANTED and use
FILE_LOCK_CONFLICT if we retried after a timeout.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit aba0ee46258f3dd910421facb742fce3318a6946)

- - - - -
8b3a5060 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:brlock: always return LOCK_NOT_GRANTED instead of FILE_LOCK_CONFLICT

Returning NT_STATUS_FILE_LOCK_CONFLICT is a SMB1 only detail
for delayed brlock requests, which is handled in
smbd_smb1_do_locks*().

The brlock layer should be consistent even for posix locks.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit ad98eec6090430ba5296a5111dde2e53b9cd217a)

- - - - -
e5385142 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:smb2_lock: move from 'blocking' to 'state->blocking'

This will simplify the next commits.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit f13d13ae9da3072862a781bc926e7a06e8384337)

- - - - -
5e156be9 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:smb2_lock: split smbd_smb2_lock_retry() into _try() and _retry()

This makes it possible to reuse _try() in the _send() function in the
next commits.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit d096742da1a045357f52ccd5b28d499c30e96152)

- - - - -
c4ab0c85 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:smb2_lock: error out early in smbd_smb2_lock_send()

We no longer expect NT_STATUS_FILE_LOCK_CONFLICT from
the VFS layer and assert that in a future version.

This makes it easier to port the same logic to smbd_smb2_lock_try().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 39d514cdc358f175d0968f4a78f8f2f05a6c1707)

- - - - -
1fb82e04 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:smb2_lock: let smbd_smb2_lock_try() explicitly check for the retry condition

This makes it possible to reuse _try() in the _send() function in the
next commit.

We should not retry forever on a hard error.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 7f77e0b4e9878f1f3515206d052adc012e26aafb)

- - - - -
00fc5839 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:smb2_lock: make use of smbd_smb2_lock_try() in smbd_smb2_lock_send()

We only need the logic to call smbd_do_locks_try() and a possible
retry once in smbd_smb2_lock_try().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 359e9992be713bbecfdb19998d69e1d3f020c5e9)

- - - - -
061b6035 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s4:torture/smb2: add smb2.samba3misc.localposixlock1

This demonstrates that the SMB2 code path doesn't do
any retry for local posix locks.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 7155d3a2c5d7237f00cccb1802c1341cf295864e)

- - - - -
c4d7c186 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s3:smb2_lock: add retry for POSIX locks

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 8decf41bbb8be2b4ac463eb6ace16a8628276ab5)

- - - - -
da765a06 by Stefan Metzmacher at 2019-09-09T16:04:29Z
s4:torture/raw: improvements for multilock2

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 8a7039be530adcdda9e7e7621bdcf902f5ca1721)

- - - - -
6bd411aa by Stefan Metzmacher at 2019-09-09T16:04:30Z
s4:torture/raw: add multilock3 test

This demonstrates that unrelated lock ranges
are not blocked by other blocked requests on the same
fsp.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 297763c6b618c07148d788b46218a0798225bf79)

- - - - -
cc9afc3d by Stefan Metzmacher at 2019-09-09T16:04:30Z
s4:torture/raw: add multilock4 test

This is similar to multilock3, but uses read-only
(LOCKING_ANDX_SHARED_LOCK) locks for the blocked
requests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit d3e65ceb1ec25c7b62a7e908506126269011f30d)

- - - - -
a037ebbc by Stefan Metzmacher at 2019-09-09T16:04:30Z
s4:torture/raw: add multilock5 test

This is similar to multilock3, but uses a read-only
(LOCKING_ANDX_SHARED_LOCK) locks for the first lock
request.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 6d4296aca0c9a9287c0c78c8f8847a560bd2ea24)

- - - - -
d857b21d by Stefan Metzmacher at 2019-09-09T16:04:30Z
s4:torture/raw: add multilock6 test

This is similar to multilock3, but uses a read-only
(LOCKING_ANDX_SHARED_LOCK) locks for the 2nd lock
request.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit d3bc0199697fd7d6e04479321ca644a227bc4ede)

- - - - -
9f46f3b0 by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:blocking: use timeval_expired(&state->endtime) to stop processing

This is less racy than timeval_elapsed() > 0
as the current time is already expired and timeout = 0
will always work correct.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 5a841a43f9c4f862e2d7235429363b3066cf5850)

- - - - -
f479c7bc by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:blocking: split out smbd_smb1_do_locks_setup_timeout()

This function can be called multiple times, but only
the first time will setup the endtime. And the
endtime is relative to the request time and not
the current time.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 8da7c10a58292022ee57406db9a365de9ffaf5cf)

- - - - -
33302620 by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:blocking: do the timeout calculation before calling dbwrap_watched_watch_send()

This makes the next commits easier to understand.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 997548a5f1a14d82f1e80cce6d9ee55e85b5107c)

- - - - -
11e489b0 by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:blocking: fix the fsp->blocked_smb1_lock_reqs handling

A new request is first checks against all pending
requests before checking the already granted locks.

Before we retried the lock array of another request
(the first in the list), but then finished current request,
which is wrong.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 312327106271abafeb53e62dfb71a38bf93e2d41)

- - - - -
5e9d294a by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:blocking: call smbd_smb1_do_locks_setup_timeout() also in smbd_smb1_do_locks_try()

This is a noop if smbd_smb1_do_locks_setup_timeout() was called before.

But it allows us to use smbd_smb1_do_locks_try() in
smbd_smb1_do_locks_send() in a following commit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 6e30a89b3f00ad55391454fbaa1272074e1962f0)

- - - - -
c8086b88 by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:blocking: make use of smbd_smb1_do_locks_try() in smbd_smb1_do_locks_send()

We only need the logic to call smbd_smb1_do_locks_check() and a possible
retry once in smbd_smb1_do_locks_try().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 8975673e3c3f9f7dbdb7ba7562bb81a62cd24e2e)

- - - - -
a1117587 by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:blocking: handle NT_STATUS_RETRY from the VFS backend

This allows the VFS backends to implement async byte
range locking.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 7d1cd6f22e7e3d95aba04c45776057945c2a5e30)

- - - - -
74527a20 by Stefan Metzmacher at 2019-09-09T16:04:30Z
s3:smb2_lock: handle NT_STATUS_RETRY from the VFS backend

This allows the VFS backends to implement async byte
range locking.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 7471b0f63276e707784c98b832992ff08b1898ef)

- - - - -
ec21e689 by Stefan Metzmacher at 2019-09-09T16:04:31Z
s3:locking: add brl_req_guid() and brl_req_mem_ctx() helper functions

This allows the vfs backend to detect a retry and keep state between
the retries.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 66d92f37c3a643d97489a59bb6d1e75e91528c20)

- - - - -
9bf1c5c3 by Stefan Metzmacher at 2019-09-09T16:04:31Z
vfs_delay_inject: add support for brl_[un]lock_windows()

This demonstrates the two ways to handle the retry:
- smb layer retry => plock->context.smblctx = UINT64_MAX
- vfs backend retry => plock->context.smblctx = 0

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit c2503a5c68e967054ab84ca0d8ce693200c2e002)

- - - - -
be42cfaf by Stefan Metzmacher at 2019-09-09T17:19:11Z
s3:selftest: add delay_inject:brl_lock_windows testing

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>

Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Mon Sep  9 15:42:45 UTC 2019 on sn-devel-184

(cherry picked from commit 2b43ce6704ecf035e6734337a2dea3458153a4b2)

Autobuild-User(v4-11-test): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(v4-11-test): Mon Sep  9 17:19:11 UTC 2019 on sn-devel-184

- - - - -
02ccbe08 by Evgeny Sinelnikov at 2019-09-10T09:13:15Z
s3:ldap: Fix join with don't exists machine account

Add check for requested replies of existing machine object during join
machine to domain. This solves regression fail during join with error:
"None of the information to be translated has been translated."

https://bugzilla.samba.org/show_bug.cgi?id=14007

Reviewed-by: Guenther Deschner <gd at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Wed Sep  4 17:02:37 UTC 2019 on sn-devel-184

(cherry picked from commit ad4ef1657e9b2a088a3bfadcce196cfcceead1dc)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-11-test): Tue Sep 10 09:13:15 UTC 2019 on sn-devel-184

- - - - -
c21df2fd by Mathieu Parent at 2019-09-10T16:32:40Z
Merge branch 'experimental'

With pseudo "theirs" strategy

- - - - -
96c16ed9 by Mathieu Parent at 2019-09-10T16:39:31Z
New upstream version 4.10.8+dfsg
- - - - -
77dd5e0a by Mathieu Parent at 2019-09-10T16:40:33Z
Merge tag 'upstream/4.10.8+dfsg'

Upstream version 4.10.8+dfsg

- - - - -
c4371bfb by Mathieu Parent at 2019-09-10T16:47:12Z
Release 2:4.10.8+dfsg-1 to unstable

- - - - -
0318b686 by Ralph Boehme at 2019-09-10T21:13:09Z
s4:torture: add a file-id related test

Note I'm using the share vfs_fruit_xattr because I need a share with both a
streams and a acl_* VFS object.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 2ecab3c60abf9baa16a6a5e3eba0fc4720def840)

- - - - -
cca34da4 by Ralph Boehme at 2019-09-10T21:13:09Z
lib: add round_timespec_to_nttime()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 5403bb22e6cb39baf6dc1b91558744d41e9f6f64)

- - - - -
6dfeecf3 by Ralph Boehme at 2019-09-10T21:13:09Z
s3:lib: round itime to NTTIME resolution in make_file_id_from_itime()

The rounding is needed because when a file is created via eg an SMB2 CREATE
request, we need to calculate the correct File-ID for the QFID Create-Context or
for a subsequent GETINFO SMB request on the same file-handle.

Any later metadata request that received the File-ID will do so by going through
dos_mode() -> ... -> parse_dos_attribute_blob(), where the File-ID will be
calculated from the on-disk itime which has NTTIME resolution.

As long as that is the only available itime backend, I'm rounding itime inside
make_file_id_from_itime(), not in the callers.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 84abeaa60ffced276da2b28b8add6efaa6da5ca6)

- - - - -
d47f8ca1 by Ralph Boehme at 2019-09-10T21:13:09Z
s3:smbd: ensure to update the File-ID in struct smb_filename

Initialize the File-ID in fsp->fsp_name->st, any subsequent metadata fetch on
this file-handle needs this, eg QFID SMB2 Create-Context or GETINFO SMB
requests.

It would be nice if SMB_VFS_SET_DOS_ATTRIBUTE() would do this, unfortunately it
gets a const struct smb_filename.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 3483b75fed8985bd2968bbf8c85985107115fba8)

- - - - -
49309206 by Ralph Boehme at 2019-09-10T21:13:09Z
vfs_catia: stat info may have been updated, make sure to return changes

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 4e49999c97f53acc7006f1dc6b6812bb0e156db5)

- - - - -
cb091049 by Ralph Boehme at 2019-09-10T21:13:09Z
s3:lib: add update_stat_ex_from_saved_stat()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit ac18730f10ce96a607a3a07e1360b522ebf72f38)

- - - - -
b14dd975 by Ralph Boehme at 2019-09-10T21:13:09Z
s3: replace fsp_stat() with vfs_stat_fsp()

Both functions do the same, they differ just in the type of the returned result.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit ab03394969f8a4c748aea7d0d8ed37f9ced6cc30)

- - - - -
b4aaa612 by Ralph Boehme at 2019-09-10T21:13:09Z
s3:vfs: streamline vfs_stat_fsp()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit e00e78cfeda99bd5374eff8fb4ba84873e4e46b7)

- - - - -
d887047a by Ralph Boehme at 2019-09-10T22:29:08Z
vfs: restore stat fields in vfs_stat_fsp()

This ensures we preserve btime, itime and File-ID.

As the Durable Handles code calls vfs_stat_fsp() in the DH disconnect function,
previously the btime was lost and NOT stored in the cookie. With this change the
cookie will store the correct btime (and iflags), which requires us to call
dos_mode() in the reconnect function to ensure we pass
vfs_default_durable_reconnect_check_stat().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>

Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue Sep 10 20:22:21 UTC 2019 on sn-devel-184

(cherry picked from commit 95655fe683d499d93f3844ed72ad332ef64adb96)

Autobuild-User(v4-11-test): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(v4-11-test): Tue Sep 10 22:29:08 UTC 2019 on sn-devel-184

- - - - -
76eab3e6 by Karolin Seeger at 2019-09-11T06:41:52Z
WHATSNEW: Remove paragraph about rejoining DCs.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
70906342 by Karolin Seeger at 2019-09-11T06:41:52Z
WHATSNEW: Add release notes for Samba 4.11.0rc4.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
b788d502 by Karolin Seeger at 2019-09-11T06:41:52Z
VERSION: Disable GIT_SNAPSHOT for the 4.11.0rc4 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
4f2bbe2e by Karolin Seeger at 2019-09-11T06:41:52Z
VERSION: Bump version up to 4.11.0rc5...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
e0886709 by Karolin Seeger at 2019-09-17T08:00:54Z
WHATSNEW: Add release notes for Samba 4.11.0.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
d60cf580 by Karolin Seeger at 2019-09-17T08:02:02Z
VERSION: Bump version up to 4.11.0...

and disable GIT_SNAPSHOT for the 4.11.0 release.

Signed-off-by: Karolin Seeger <kseeger at samba.org>

- - - - -
a251a711 by Mathieu Parent at 2019-09-17T18:12:06Z
Update d/gbp.conf, d/watch and d/README.source for 4.11

- - - - -
1f07059a by Mathieu Parent at 2019-09-17T18:14:59Z
New upstream version 4.11.0+dfsg
- - - - -
64bfcdf1 by Mathieu Parent at 2019-09-17T18:16:16Z
Update upstream source from tag 'upstream/4.11.0+dfsg'

Update to upstream version '4.11.0+dfsg'
with Debian dir d25d36bad385e77952f57e2d265bf0b992a78968
- - - - -
072d25a7 by Jelmer Vernooij at 2019-09-17T18:22:07Z
Always specify rpath for private libraries

Last-Update: 2012-02-24
Applied-Upstream: no

- - - - -
1714d5fe by Christian Perrier at 2019-09-17T18:22:07Z
64 bit fix for libsmbclient

Bug-Debian: http://bugs.debian.org/221618
Forwarded: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=221618#27

- - - - -
dcc10469 by Christian Perrier at 2019-09-17T18:22:07Z
Mention smbldap-tools package in examples/LDAP/README

Bug-Debian: http://bugs.debian.org/341934
Forwarded: not-needed

- - - - -
c75f2e1b by Steve Langasek at 2019-09-17T18:22:07Z
Use the pager alternative as pager is PAGER is undefined

Bug-Debian: http://bugs.debian.org/135603
Forwarded: not-needed

- - - - -
5c15746a by mathiaz at ubuntu.com at 2019-09-17T18:22:08Z
Enable net usershares by default at build time

Enable net usershares by default at build time, with a limit of 100, and update
the corresponding documentation.

Bug-Debian: http://bugs.debian.org/443230
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/128548
Forwarded: not-needed

- - - - -
46d61460 by Eloy A. Paris at 2019-09-17T18:22:08Z
Add "Debian" as vendor suffix

Forwarded: not-needed

- - - - -
52d9ffb1 by Jeroen Dekkers at 2019-09-17T18:22:08Z
Add so version number to private libraries for dpkg-shlibdeps

We also want dpkg-shlibdeps to generate correct dependency information
for the private libraries in our binary packages, but dpkg-shlibdeps
only works when the library has a version number.

Origin: vendor
Forwarded: not-needed

- - - - -
5811f53b by Brian May at 2019-09-17T18:22:08Z
Patch in symbol table from rfc3454, for Heimdal scripts

Status: cherry-picked from heimdal package

- - - - -
92652d4d by Mathieu Parent at 2019-09-17T18:22:08Z
smbd.service: Run update-apparmor-samba-profile before start

Bug-Debian: https://bugs.debian.org/896080

- - - - -
35867281 by Mathieu Parent at 2019-09-17T18:36:39Z
Update fix-nfs-service-name-to-nfs-kernel-server.patch

- - - - -
598d5f1f by Rafael David Tinoco at 2019-09-17T18:37:19Z
fix nfs related service names

Upstream defines nfs related service names based on the Linux
distribution. This patch fixes the names for Debian and derivatives.

Bug-Debian: https://bugs.debian.org/929931
Bug-Ubuntu: https://bugs.launchpad.net/bugs/722201
Last-Update: 2018-08-05

- - - - -
963533a5 by Mathieu Parent at 2019-09-17T18:41:25Z
Bump build-depends talloc >= 2.2.0, tdb >= 1.4.2, tevent >= 0.10.0 and ldb >= 2:2.0.7

- - - - -
d5cc5f58 by Mathieu Parent at 2019-09-17T18:50:22Z
Changelog for previous commits

- - - - -
0d203e09 by Mathieu Parent at 2019-09-18T03:21:23Z
libsamba-passdb.so bumped to 0.28.0

See https://gitlab.com/samba-team/samba/commit/ccb645321460034d4f33674854877620810b83e0

- - - - -
48b0ecf1 by Mathieu Parent at 2019-09-18T03:21:37Z
libnon-posix-acls is now a subsystem

Since https://gitlab.com/samba-team/samba/commit/528d33963aceb137fb9fde5afa5dd5f4c4b1fac8

- - - - -
bedd0511 by Mathieu Parent at 2019-09-18T03:21:37Z
Drop libparse-pidl-perl package (Closes: #939419)

See also https://gitlab.com/samba-team/samba/commit/e24e344d0da58013fd5fa404529fe1d25ef403bf

- - - - -
93bbe259 by Mathieu Parent at 2019-09-18T03:21:37Z
Changelog for previous commits

- - - - -
f3b77f81 by Andrew Bartlett at 2019-09-18T03:26:46Z
build: Remove tests for getdents() and getdirentries()

These date back to 3a9beef2b7b25427ee4611cfc375e05cc82a1150 in 2003 and
829e72fe9c97feaa3d45b768984a4c47b906a23a in 1998 and appear to be related
to smbwrapper.

More of these should be removed but the getdirents() test caused a timeout
on an ARM builder in Debian.  It might just be a fluke but the tests are
pointless regardless.

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>

Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Sep 17 13:48:18 UTC 2019 on sn-devel-184

- - - - -
beb856b1 by Mathieu Parent at 2019-09-18T03:30:10Z
Add build-Remove-tests-for-getdents-and-getdirentries.patch, to fix FTBFS on armel, armhf

- - - - -
8ccc404d by Mathieu Parent at 2019-09-18T03:31:15Z
Changelog for previous commit

- - - - -
5e85c6df by Mathieu Parent at 2019-09-18T05:09:01Z
Add new files to d/*.install

- - - - -
1303ea2a by Mathieu Parent at 2019-09-18T06:30:10Z
Move libsamba-util.so.* to libwbclient0

To avoid circular dependency.

See also ea7231dcc0b50c535f913f0542d600d0b2119a21

- - - - -
b0690528 by Mathieu Parent at 2019-09-18T06:31:06Z
Changelog for previous commits

- - - - -
8c76b2d3 by John Paul Adrian Glaubitz at 2019-09-19T08:00:33Z
Disable cephfs support on architectures where it's not stable (Closes: #940697)

- - - - -
39ebffc6 by Louis van Belle at 2019-09-19T10:26:27Z
d/control, d/samba.install: added libtasn1-bin, libtasn1-6-dev to build dumpmscat

- - - - -
94cbebc7 by Louis van Belle at 2019-09-19T10:30:51Z
d/control, d/rules: Enable spotlight (TimeMachine)

- - - - -
dd751832 by Louis van Belle at 2019-09-19T11:28:58Z
d/control: Bump libtdb-dev (>= 2) in samba-dev deps

- - - - -
c4cfc4c7 by Mathieu Parent at 2019-09-19T11:37:48Z
Fixup for: Disable cephfs support on architectures where it's not stable (Closes: #940697)

- - - - -
a899d76d by Mathieu Parent at 2019-09-19T11:38:15Z
Keep building with ceph on armel, armhf, mipsel, s390x

- - - - -
19744073 by Louis van Belle at 2019-09-19T13:07:36Z
Update libwbclient0.symbols

- - - - -
099c06de by Mathieu Parent at 2019-09-19T13:08:39Z
Changelog for previous commits

- - - - -
07da5bb4 by Mathieu Parent at 2019-09-20T16:16:11Z
Move libsamba-util deps to libwbclient0

- - - - -
4258a546 by Mathieu Parent at 2019-09-20T16:16:11Z
Changelog for previous commit

- - - - -
4eb8803a by Louis van Belle at 2019-09-24T12:51:14Z
Update rules, we bumped libldb1 to libldb2 but forgot to adjust : LDB_DEPENDS = ..
- - - - -
6396ef74 by Mathieu Parent at 2019-09-25T05:40:39Z
Build on experimental

- - - - -


25 changed files:

- .gitlab-ci-private.yml
- .gitlab-ci.yml
- Makefile
- README.md
- VERSION
- WHATSNEW.txt
- auth/auth_log.c
- auth/auth_sam_reply.c
- auth/auth_util.h
- auth/common_auth.h
- auth/credentials/credentials.c
- auth/credentials/credentials_krb5.c
- auth/credentials/credentials_ntlm.c
- auth/credentials/pycredentials.c
- auth/credentials/tests/simple.c
- auth/credentials/wscript_build
- auth/gensec/schannel.c
- auth/gensec/wscript_build
- auth/kerberos/gssapi_pac.c
- auth/ntlmssp/ntlmssp_client.c
- auth/ntlmssp/ntlmssp_server.c
- auth/ntlmssp/ntlmssp_sign.c
- auth/ntlmssp/wscript_build
- + bootstrap/.gitlab-ci.yml
- + bootstrap/READMD.md


The diff was not included because it is too large.


View it on GitLab: https://salsa.debian.org/samba-team/samba/compare/c67d9a394bceff2c1a74436a9f240a078537e415...6396ef743e6bd7f22d2253007c3ac2edf9c3ac47

-- 
View it on GitLab: https://salsa.debian.org/samba-team/samba/compare/c67d9a394bceff2c1a74436a9f240a078537e415...6396ef743e6bd7f22d2253007c3ac2edf9c3ac47
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-samba-maint/attachments/20190925/3cbbc6c4/attachment-0001.html>


More information about the Pkg-samba-maint mailing list