metze/samba-autobuild/.git
4 years agobootstrap: Remove long-unsupported OS versions
Andrew Bartlett [Wed, 4 Mar 2020 00:58:48 +0000 (13:58 +1300)]
bootstrap: Remove long-unsupported OS versions

Samba has not built on these versions for quite some time due to
the need for Python 3.5 and GnuTLS 3.4.7

These were always marked as broken, but given the requirements
these are never likely to come back.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosmbd: reuse close_free_pending_aio() in close_directory()
Ralph Boehme [Mon, 9 Mar 2020 10:18:23 +0000 (11:18 +0100)]
smbd: reuse close_free_pending_aio() in close_directory()

A directory fsp can have outstanding aio requests as well.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Mar  9 19:34:27 UTC 2020 on sn-devel-184

4 years agosmbd: call tevent_req_nterror() for directories when cleaning up pending aio
Ralph Boehme [Mon, 9 Mar 2020 10:31:00 +0000 (11:31 +0100)]
smbd: call tevent_req_nterror() for directories when cleaning up pending aio

smbd_smb2_query_directory_recv() calls tevent_req_is_nterror() which requires a
NTSTATUS error code.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: move pending aio cleanup to a helper function
Ralph Boehme [Mon, 9 Mar 2020 10:16:37 +0000 (11:16 +0100)]
smbd: move pending aio cleanup to a helper function

We'll be reusing this from close_directory() in the next commit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: Protect vfs_getxattrat_done() from accessing a freed req pointer
Ralph Boehme [Mon, 9 Mar 2020 10:54:37 +0000 (11:54 +0100)]
vfs_default: Protect vfs_getxattrat_done() from accessing a freed req pointer

If the fsp is forced closed by a SHUTDOWN_CLOSE whilst the request is in
flight (share forced closed by smbcontrol), then we set state->req = NULL in the
state destructor.

The existing state destructor prevents the state memory from being freed, so
when the thread completes and calls vfs_getxattrat_done(), just throw away the result
if state->req == NULL.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_default: pass in state as the callback data to the subreq
Ralph Boehme [Mon, 9 Mar 2020 10:54:28 +0000 (11:54 +0100)]
vfs_default: pass in state as the callback data to the subreq

Find the req we're finishing off by looking inside the state.  In a shutdown
close the caller calls talloc_free(req), so we can't access it directly as
callback data.

The next commit will NULL out the state->req pointer when a caller calls
talloc_free(req), and the request is still in flight.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agowinexe: add configure option to control whether to build it (default: auto)
Günther Deschner [Wed, 4 Mar 2020 17:51:01 +0000 (18:51 +0100)]
winexe: add configure option to control whether to build it (default: auto)

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Mar  9 16:27:21 UTC 2020 on sn-devel-184

4 years agolibrpc: fix IDL for svcctl_ChangeServiceConfigW
Günther Deschner [Wed, 4 Mar 2020 14:23:43 +0000 (15:23 +0100)]
librpc: fix IDL for svcctl_ChangeServiceConfigW

Found while trying to run winexe against Windows Server 2019.

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4-torture: add ndr svcctl testsuite
Günther Deschner [Thu, 5 Mar 2020 19:42:21 +0000 (20:42 +0100)]
s4-torture: add ndr svcctl testsuite

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4-torture: add rpc test for ChangeServiceConfigW
Günther Deschner [Thu, 5 Mar 2020 21:45:48 +0000 (22:45 +0100)]
s4-torture: add rpc test for ChangeServiceConfigW

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agovfs_recycle: prevent flooding the log if we're called on non-existant paths
Ralph Boehme [Fri, 6 Mar 2020 11:22:25 +0000 (12:22 +0100)]
vfs_recycle: prevent flooding the log if we're called on non-existant paths

vfs_recycle is assuming that any path passed to unlink must exist, otherwise it
logs this error. Turn this into a DEBUG level message.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14316
See also: https://bugzilla.redhat.com/show_bug.cgi?id=1780802

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Mon Mar  9 14:15:06 UTC 2020 on sn-devel-184

4 years agoctdb-docs: Improve recovery lock documentation
Martin Schwenke [Tue, 18 Feb 2020 07:32:21 +0000 (18:32 +1100)]
ctdb-docs: Improve recovery lock documentation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Mar  9 02:27:18 UTC 2020 on sn-devel-184

4 years agos3: tests: Add samba3.blackbox.force-close-share
Jeremy Allison [Tue, 3 Mar 2020 21:31:18 +0000 (13:31 -0800)]
s3: tests: Add samba3.blackbox.force-close-share

Checks server stays up whilst writing to a force closed share.
Uses existing aio_delay_inject share to delay writes while
we force close the share.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Mar  8 19:34:14 UTC 2020 on sn-devel-184

4 years agos3: VFS: vfs_aio_pthread: Make aio opens safe against connection teardown.
Jeremy Allison [Thu, 5 Mar 2020 18:22:00 +0000 (10:22 -0800)]
s3: VFS: vfs_aio_pthread: Make aio opens safe against connection teardown.

Allocate state off fsp->conn, not NULL, and add a destructor
that catches deallocation of conn which happens
on connection shutdown or force close.

Note - We don't allocate off fsp as the passed in
fsp will get freed once we return EINPROGRESS/NT_STATUS_MORE_PROCESSING_REQUIRED.
A new fsp pointer gets allocated on every re-run of the
open code path.

The destructor allows us to NULL out the saved conn struct pointer
when conn is deallocated so we know not to access deallocated memory.
This matches the async teardown code changes for bug #14301
in pread/pwrite/fsync vfs_default.c and vfs_glusterfs.c

state is still correctly deallocated in all code
paths so no memory leaks.

This allows us to safely complete when the openat()
returns and then return the error NT_STATUS_NETWORK_NAME_DELETED
to the client open request.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_aio_pthread: Add a talloc context parameter to create_private_open_data().
Jeremy Allison [Fri, 6 Mar 2020 17:30:26 +0000 (09:30 -0800)]
s3: VFS: vfs_aio_pthread: Add a talloc context parameter to create_private_open_data().

Pass in NULL for now so no behavior change.
We will be changing this from NULL to fsp->conn in a later commit.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_aio_pthread. Move xconn into state struct (opd).
Jeremy Allison [Thu, 5 Mar 2020 00:39:39 +0000 (16:39 -0800)]
s3: VFS: vfs_aio_pthread. Move xconn into state struct (opd).

We will need this in future to cause a pending open to
be rescheduled after the connection struct we're using
has been shut down with an aio open in flight. This will
allow a correct error reply to an awaiting client.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_aio_pthread: Replace state destructor with explicitly called teardown...
Jeremy Allison [Wed, 4 Mar 2020 21:47:13 +0000 (13:47 -0800)]
s3: VFS: vfs_aio_pthread: Replace state destructor with explicitly called teardown function.

This will allow repurposing a real destructor to allow
connections structs to be freed whilst the aio open
request is in flight.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_aio_pthread. Fix leak of state struct on error.
Jeremy Allison [Wed, 4 Mar 2020 21:29:08 +0000 (13:29 -0800)]
s3: VFS: vfs_aio_pthread. Fix leak of state struct on error.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Make sure we correctly reply to outstanding aio requests with an error...
Jeremy Allison [Mon, 2 Mar 2020 21:11:06 +0000 (13:11 -0800)]
s3: smbd: Make sure we correctly reply to outstanding aio requests with an error on SHUTDOWN_CLOSE.

SHUTDOWN_CLOSE can be called when smbcontrol close-share
is used to terminate active connections.

Previously we just called talloc_free()
on the outstanding request, but this
caused crashes (before the async callback
functions were fixed not to reference req
directly) and also leaves the SMB2 request
outstanding on the processing queue.

Using tevent_req_error() instead
causes the outstanding SMB1/2/3 request to
return with NT_STATUS_INVALID_HANDLE
and removes it from the processing queue.

The callback function called from this
calls talloc_free(req). The destructor will remove
itself from the fsp and the aio_requests array.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs. Protect vfs_gluster_fsync_done() from accessing a freed req...
Jeremy Allison [Sat, 29 Feb 2020 00:01:11 +0000 (16:01 -0800)]
s3: VFS: vfs_glusterfs. Protect vfs_gluster_fsync_done() from accessing a freed req pointer.

If the fsp is forced closed by a SHUTDOWN_CLOSE whilst the
request is in flight (share forced closed by smbcontrol),
then we set state->req = NULL in the state destructor.

The existing state destructor prevents the state memory
from being freed, so when the thread completes and calls
vfs_gluster_fsync_done(), just throw away the result if
state->req == NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_fsync_state as the callback data...
Jeremy Allison [Fri, 28 Feb 2020 23:59:16 +0000 (15:59 -0800)]
s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_fsync_state as the callback data to the subreq.

Find the req we're finishing off by looking inside vfs_gluster_fsync_state.
In a shutdown close the caller calls talloc_free(req), so we can't
access it directly as callback data.

The next commit will NULL out the vfs_gluster_fsync_state->req pointer
when a caller calls talloc_free(req), and the request is still in
flight.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_fsync_s...
Jeremy Allison [Fri, 28 Feb 2020 23:57:20 +0000 (15:57 -0800)]
s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_fsync_state.

We will need this to detect when this request is outstanding but
has been destroyed in a SHUTDOWN_CLOSE on this file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs. Protect vfs_gluster_pwrite_done() from accessing a freed...
Jeremy Allison [Fri, 28 Feb 2020 23:55:36 +0000 (15:55 -0800)]
s3: VFS: vfs_glusterfs. Protect vfs_gluster_pwrite_done() from accessing a freed req pointer.

If the fsp is forced closed by a SHUTDOWN_CLOSE whilst the
request is in flight (share forced closed by smbcontrol),
then we set state->req = NULL in the state destructor.

The existing state destructor prevents the state memory
from being freed, so when the thread completes and calls
vfs_gluster_pwrite_done(), just throw away the result if
state->req == NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callback data...
Jeremy Allison [Fri, 28 Feb 2020 23:53:19 +0000 (15:53 -0800)]
s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callback data to the subreq.

Find the req we're finishing off by looking inside vfs_gluster_pwrite_state.
In a shutdown close the caller calls talloc_free(req), so we can't
access it directly as callback data.

The next commit will NULL out the vfs_gluster_pwrite_state->req pointer
when a caller calls talloc_free(req), and the request is still in
flight.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pwrite_...
Jeremy Allison [Fri, 28 Feb 2020 23:47:52 +0000 (15:47 -0800)]
s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pwrite_state.

We will need this to detect when this request is outstanding but
has been destroyed in a SHUTDOWN_CLOSE on this file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs. Protect vfs_gluster_pread_done() from accessing a freed req...
Jeremy Allison [Fri, 28 Feb 2020 23:38:04 +0000 (15:38 -0800)]
s3: VFS: vfs_glusterfs. Protect vfs_gluster_pread_done() from accessing a freed req pointer.

If the fsp is forced closed by a SHUTDOWN_CLOSE whilst the
request is in flight (share forced closed by smbcontrol),
then we set state->req = NULL in the state destructor.

The existing state destructor prevents the state memory
from being freed, so when the thread completes and calls
vfs_gluster_pread_done(), just throw away the result if
state->req == NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pread_state as the callback data...
Jeremy Allison [Fri, 28 Feb 2020 23:35:46 +0000 (15:35 -0800)]
s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pread_state as the callback data to the subreq.

Find the req we're finishing off by looking inside vfs_gluster_pread_state.
In a shutdown close the caller calls talloc_free(req), so we can't
access it directly as callback data.

The next commit will NULL out the vfs_gluster_pread_state->req pointer
when a caller calls talloc_free(req), and the request is still in
flight.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pread_s...
Jeremy Allison [Fri, 28 Feb 2020 23:33:35 +0000 (15:33 -0800)]
s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pread_state.

We will need this to detect when this request is outstanding but
has been destroyed in a SHUTDOWN_CLOSE on this file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default. Protect vfs_fsync_done() from accessing a freed req pointer.
Jeremy Allison [Fri, 28 Feb 2020 00:56:41 +0000 (16:56 -0800)]
s3: VFS: vfs_default. Protect vfs_fsync_done() from accessing a freed req pointer.

If the fsp is forced closed by a SHUTDOWN_CLOSE whilst the
request is in flight (share forced closed by smbcontrol),
then we set state->req = NULL in the state destructor.

The existing state destructor prevents the state memory
from being freed, so when the thread completes and calls
vfs_fsync_done(), just throw away the result if
state->req == NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default. Pass in struct vfswrap_fsync_state as the callback data to...
Jeremy Allison [Fri, 28 Feb 2020 00:54:47 +0000 (16:54 -0800)]
s3: VFS: vfs_default. Pass in struct vfswrap_fsync_state as the callback data to the subreq.

Find the req we're finishing off by looking inside vfswrap_fsync_state.
In a shutdown close the caller calls talloc_free(req), so we can't
access it directly as callback data.

The next commit will NULL out the vfswrap_fsync_state->req pointer
when a caller calls talloc_free(req), and the request is still in
flight.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_fsync_state.
Jeremy Allison [Fri, 28 Feb 2020 00:53:10 +0000 (16:53 -0800)]
s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_fsync_state.

We will need this to detect when this request is outstanding but
has been destroyed in a SHUTDOWN_CLOSE on this file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default. Protect vfs_pwrite_done() from accessing a freed req pointer.
Jeremy Allison [Fri, 28 Feb 2020 00:51:35 +0000 (16:51 -0800)]
s3: VFS: vfs_default. Protect vfs_pwrite_done() from accessing a freed req pointer.

If the fsp is forced closed by a SHUTDOWN_CLOSE whilst the
request is in flight (share forced closed by smbcontrol),
then we set state->req = NULL in the state destructor.

The existing state destructor prevents the state memory
from being freed, so when the thread completes and calls
vfs_pwrite_done(), just throw away the result if
state->req == NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default. Pass in struct vfswrap_pwrite_state as the callback data to...
Jeremy Allison [Fri, 28 Feb 2020 00:49:38 +0000 (16:49 -0800)]
s3: VFS: vfs_default. Pass in struct vfswrap_pwrite_state as the callback data to the subreq.

Find the req we're finishing off by looking inside vfswrap_pwrite_state.
In a shutdown close the caller calls talloc_free(req), so we can't
access it directly as callback data.

The next commit will NULL out the vfswrap_pwrite_state->req pointer
when a caller calls talloc_free(req), and the request is still in
flight.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pwrite_state.
Jeremy Allison [Fri, 28 Feb 2020 00:44:39 +0000 (16:44 -0800)]
s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pwrite_state.

We will need this to detect when this request is outstanding but
has been destroyed in a SHUTDOWN_CLOSE on this file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default. Protect vfs_pread_done() from accessing a freed req pointer.
Jeremy Allison [Fri, 28 Feb 2020 00:40:46 +0000 (16:40 -0800)]
s3: VFS: vfs_default. Protect vfs_pread_done() from accessing a freed req pointer.

If the fsp is forced closed by a SHUTDOWN_CLOSE whilst the
request is in flight (share forced closed by smbcontrol),
then we set state->req = NULL in the state destructor.

The existing state destructor prevents the state memory
from being freed, so when the thread completes and calls
vfs_pread_done(), just throw away the result if
state->req == NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default. Pass in struct vfswrap_pread_state as the callback data to...
Jeremy Allison [Fri, 28 Feb 2020 00:34:51 +0000 (16:34 -0800)]
s3: VFS: vfs_default. Pass in struct vfswrap_pread_state as the callback data to the subreq.

Find the req we're finishing off by looking inside vfswrap_pread_state.
In a shutdown close the caller calls talloc_free(req), so we can't
access it directly as callback data.

The next commit will NULL out the vfswrap_pread_state->req pointer
when a caller calls talloc_free(req), and the request is still in
flight.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pread_state.
Jeremy Allison [Fri, 28 Feb 2020 00:30:51 +0000 (16:30 -0800)]
s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pread_state.

We will need this to detect when this request is outstanding but
has been destroyed in a SHUTDOWN_CLOSE on this file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agoaudit_logging tests: Fix timezone validation
Gary Lockyer [Mon, 2 Mar 2020 21:44:47 +0000 (10:44 +1300)]
audit_logging tests: Fix timezone validation

test_audit_get_timestamp used the "%Z" format specifier in strptime,
this is non-portable.  Updated tests now explicitly set the time zone to
"UTC".

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Mar  7 06:37:09 UTC 2020 on sn-devel-184

4 years agondrdump tests: Make the tests less fragile
Gary Lockyer [Tue, 3 Mar 2020 03:59:19 +0000 (16:59 +1300)]
ndrdump tests: Make the tests less fragile

Remove the C source file and line number from the expected output to
make the tests less likely to break if ndr.c changes.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agovfs_fruit: tmsize prevent overflow Force the type during arithmetic in order to preve...
Art M. Gallagher [Tue, 3 Mar 2020 21:51:46 +0000 (21:51 +0000)]
vfs_fruit: tmsize prevent overflow Force the type during arithmetic in order to prevent overflow when summing the Time Machine folder size. Increase the precision to off_t (used for file sizes), leave the overflow error traps but with more precise wording.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13622
Signed-off-by: Art M. Gallagher <smblock@artmg.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Mar  7 01:37:31 UTC 2020 on sn-devel-184

4 years agoRemove unnecessary/incorrect talloc_steal() calls
Jonathon Reinhart [Wed, 5 Feb 2020 05:25:36 +0000 (00:25 -0500)]
Remove unnecessary/incorrect talloc_steal() calls

The talloc_steal() in dsdb_enum_group_mem() is unnecessary, because
members was already allocated from the same mem_ctx.

The talloc_steal() in pdb_samba_dsdb_enum_aliasmem() is also unnecessary
for the same reason, but also incorrect, because it should be
dereferencing pmembers:

    talloc_steal(mem_ctx, *pmembers);

Furthermore, we should only assign to *pnum_members on success; otherwise
num_members is used uninitialized.

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

Signed-off-by: Jonathon Reinhart <Jonathon.Reinhart@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Mar  5 18:40:16 UTC 2020 on sn-devel-184

4 years agopython: Fix userPrincipalName in GetPasswordCommand.get_account_attributes()
Jonathon Reinhart [Wed, 5 Feb 2020 05:32:02 +0000 (00:32 -0500)]
python: Fix userPrincipalName in GetPasswordCommand.get_account_attributes()

Signed-off-by: Jonathon Reinhart <Jonathon.Reinhart@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Mar  5 16:27:50 UTC 2020 on sn-devel-184

4 years agos3-libads: use dns name to open a ldap session
Björn Baumbach [Mon, 10 Feb 2020 18:19:44 +0000 (19:19 +0100)]
s3-libads: use dns name to open a ldap session

Required for working certificate verification.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13124
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Thu Mar  5 12:29:26 UTC 2020 on sn-devel-184

4 years ago[s4] possible memleak in torture vfs-fruit
Swen Schillig [Wed, 22 Jan 2020 10:55:46 +0000 (11:55 +0100)]
[s4] possible memleak in torture vfs-fruit

The allocated memory for "full_name" must be free'd
before returning to caller.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Mar  4 10:43:54 UTC 2020 on sn-devel-184

4 years agosmbd: ignore set NTACL requests which contain S-1-5-88 NFS ACEs
Ralph Boehme [Thu, 27 Feb 2020 16:01:10 +0000 (17:01 +0100)]
smbd: ignore set NTACL requests which contain S-1-5-88 NFS ACEs

We apply the same "ignore" logic already in the POSIX ACL code and in the
vfs_acl_xattr|tdb VFS modules to smb_set_nt_acl_nfs4() in the nfs4_acl helper
subsystem which is common to a bunch of VFS modules: GPFS, ZFS, NFS4_xattr and
aixacl2.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar  3 19:15:10 UTC 2020 on sn-devel-184

4 years agoselftest: Adapt libsmbclient.readdirplus2 to unix extensions
Volker Lendecke [Sun, 1 Mar 2020 17:41:15 +0000 (18:41 +0100)]
selftest: Adapt libsmbclient.readdirplus2 to unix extensions

A few lines above the mode check we created a file with mode
0666. With unix exensions we expect this back 1:1, without them the
server changes them on the fly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Inform smbtorture about running with unix extensions
Volker Lendecke [Sun, 1 Mar 2020 17:39:58 +0000 (18:39 +0100)]
selftest: Inform smbtorture about running with unix extensions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: run libsmbclient unix ext tests against "posix_share"
Volker Lendecke [Sun, 1 Mar 2020 15:47:27 +0000 (16:47 +0100)]
selftest: run libsmbclient unix ext tests against "posix_share"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Use posix open in SMBC_open_ctx
Volker Lendecke [Fri, 28 Feb 2020 10:18:00 +0000 (11:18 +0100)]
libsmb: Use posix open in SMBC_open_ctx

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Use posix result in SMBC_readdirplus2_ctx
Volker Lendecke [Fri, 28 Feb 2020 10:15:58 +0000 (11:15 +0100)]
libsmb: Use posix result in SMBC_readdirplus2_ctx

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Implement SMB_FIND_FILE_UNIX_INFO2 dir listing
Volker Lendecke [Fri, 28 Feb 2020 10:10:47 +0000 (11:10 +0100)]
libsmb: Implement SMB_FIND_FILE_UNIX_INFO2 dir listing

This keeps the original SMB_STRUCT_STAT coming from posix as part of
struct file_info. It is a slight waste of space, as the timestamps are
kept twice, but having a full SMB_STRUCT_STAT with the nlink!=0
validity check makes thinking about which mode/size/etc is the correct
one a no-brainer. We can save space later by referencing only one set
of time stamps for example.

This for the time fixes readdirplus2, but for the wrong reason: We don't yet
create files the "proper" way using posix create.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Introduce fetch_file_unix_basic_info2()
Volker Lendecke [Mon, 24 Feb 2020 11:41:13 +0000 (03:41 -0800)]
libsmb: Introduce fetch_file_unix_basic_info2()

Will be used in clilist.c for SMB_FIND_FILE_UNIX_INFO2

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Factor out fetch_file_unix_basic_info()
Volker Lendecke [Mon, 24 Feb 2020 11:41:13 +0000 (03:41 -0800)]
libsmb: Factor out fetch_file_unix_basic_info()

Will be used in clilist.c for SMB_FIND_FILE_UNIX_INFO2

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Run smbtorture3 SHORTNAME-TEST without unix extensions
Volker Lendecke [Mon, 2 Mar 2020 20:34:37 +0000 (21:34 +0100)]
selftest: Run smbtorture3 SHORTNAME-TEST without unix extensions

Soon cli_list() will change to SMB_FIND_FILE_UNIX_INFO2 which does not
provide a shortname. For now we lose that as an encrypted test, as for
now it's a SMB1 test which requires unix extensions for
encryption. Hopefully we don't forget to reenable this once the test
is converted to SMB2

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

4 years agoselftest: Fix usage check of test_smbtorture_s3.sh
Volker Lendecke [Mon, 2 Mar 2020 19:55:56 +0000 (20:55 +0100)]
selftest: Fix usage check of test_smbtorture_s3.sh

This needs at least 5 args

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Fix a typo
Volker Lendecke [Sun, 1 Mar 2020 17:11:52 +0000 (18:11 +0100)]
libsmb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agowinbindd: Align integer types
Volker Lendecke [Fri, 21 Feb 2020 07:03:57 +0000 (08:03 +0100)]
winbindd: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotest: Fix a copy&paste error
Volker Lendecke [Wed, 19 Feb 2020 14:17:15 +0000 (15:17 +0100)]
test: Fix a copy&paste error

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoctdb-tests: Use a local "ctdb shutdown" command to avoid a race
Martin Schwenke [Fri, 21 Feb 2020 09:35:24 +0000 (20:35 +1100)]
ctdb-tests: Use a local "ctdb shutdown" command to avoid a race

When "ctdb shutdown" is run with -n <N> it does not wait for the node
<N>'s ctdbd to go down but exits immediately.  This means that the
local_daemons.sh shutdown command can find the PID file still present
and then attempt the shutdown, but the daemon can have exited between
the check and the shutdown.  Although the test waits until the node is
disconnected, the transport is taken down just before the exit, so
this does not guarantee the daemon has exited.

A local shutdown command (no -n <N>) waits until the socket
disconnects and this happens *after* the PID file is gone, so this is
safe to use with the local_daemons.sh shutdown command.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Mar  2 10:39:28 UTC 2020 on sn-devel-184

4 years agodsdb: Add debugging for a contrived situation where a non-schema attribute is on...
Andrew Bartlett [Fri, 28 Feb 2020 20:30:15 +0000 (09:30 +1300)]
dsdb: Add debugging for a contrived situation where a non-schema attribute is on the record

I had to modify the backend DB to produce this error, but
I would like a clear error anyway.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Mar  2 04:14:22 UTC 2020 on sn-devel-184

4 years agodsdb: Add very verbose debugging if a delete fails in repl_meta_data
Andrew Bartlett [Fri, 28 Feb 2020 20:06:51 +0000 (09:06 +1300)]
dsdb: Add very verbose debugging if a delete fails in repl_meta_data

The modification into a tombstone should be a pretty reliable operation
so if it fails print lots of info for debugging.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb: ensure that ldbedit operates like ldbmodify: set DONT_CREATE_DB
Andrew Bartlett [Sat, 29 Feb 2020 03:03:00 +0000 (16:03 +1300)]
ldb: ensure that ldbedit operates like ldbmodify: set DONT_CREATE_DB

ldb* tools, when passed a raw filename assume tdb://

By default, ldb_tdb will call tdb with O_CREAT.

TDB, when passed O_CREAT and a not-tdb file, will wipe the file.

This means that if you run ldbedit <path to mdb-format-ldb file> the file
will be wiped, which is unexpected.  I noticed this while trying to
corrupt a sam.ldb backend file (for testing), but instead I wiped it!

Ideally tdb would not do that, but the behaviour has been this way for
decades.  Ideally ldb would have had a "create db" command, but this
has been the job of ldbadd for over a decade.

So this just blunts the knife for ldbedit.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoctdb-tests: Silence a ShellCheck warning
Martin Schwenke [Sat, 29 Feb 2020 09:53:28 +0000 (20:53 +1100)]
ctdb-tests: Silence a ShellCheck warning

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Feb 29 11:53:42 UTC 2020 on sn-devel-184

4 years agoctdb: add tail logs option to local_daemons.sh
Ralph Boehme [Fri, 28 Feb 2020 12:02:43 +0000 (13:02 +0100)]
ctdb: add tail logs option to local_daemons.sh

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Feb 29 08:02:50 UTC 2020 on sn-devel-184

4 years agodsdb: Rewrite comment to remove refernece to LDAP backends
Andrew Bartlett [Mon, 24 Feb 2020 03:57:35 +0000 (16:57 +1300)]
dsdb: Rewrite comment to remove refernece to LDAP backends

This is required despire the demise of the LDAP backend.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Feb 28 04:42:23 UTC 2020 on sn-devel-184

4 years agodsdb: Remove dead code in partition_prep_request()
Andrew Bartlett [Mon, 24 Feb 2020 03:43:44 +0000 (16:43 +1300)]
dsdb: Remove dead code in partition_prep_request()

The partition variable is never NULL.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb: Do not use ldb_save_controls() in partitions module for domain_scope
Andrew Bartlett [Mon, 24 Feb 2020 03:22:24 +0000 (16:22 +1300)]
dsdb: Do not use ldb_save_controls() in partitions module for domain_scope

The LDAP backend is long-removed so we do not need this workaround
for a confused server any longer.

This avoids references to old (but valid) memory after a new ldb_control array is
allocated in ldb_save_controls() and keeps the controls pointer as
constant as possible given the multiple ldb_request structures it
will appear in.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb: Improve clarity by adding a comment in replmd_delete_internals()
Andrew Bartlett [Sun, 23 Feb 2020 21:30:26 +0000 (10:30 +1300)]
dsdb: Improve clarity by adding a comment in replmd_delete_internals()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agodsdb: Simplifiy VANISH_LINKS handling: The variable "parent" is always non-NULL
Andrew Bartlett [Mon, 24 Feb 2020 00:28:56 +0000 (13:28 +1300)]
dsdb: Simplifiy VANISH_LINKS handling: The variable "parent" is always non-NULL

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoselftest: Confirm we can delete a user with a dangling backlink
Andrew Bartlett [Sun, 23 Feb 2020 22:58:48 +0000 (11:58 +1300)]
selftest: Confirm we can delete a user with a dangling backlink

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoprevent NULL reference from being used as '%s' argument.
Swen Schillig [Wed, 22 Jan 2020 10:28:28 +0000 (11:28 +0100)]
prevent NULL reference from being used as '%s' argument.

The two string arguments to torture_comment() can be NULL
as the succeeding checks suggest. This is not wanted because a compile
with --enable-developer throws an error of [-Werror=format-overflow=]
in those situations.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb: Add mem_ctx argument to ldb_kv_index_key()
Andrew Bartlett [Wed, 26 Feb 2020 22:30:00 +0000 (11:30 +1300)]
ldb: Add mem_ctx argument to ldb_kv_index_key()

This avoids using "ldb" as the memory context in most cases, and may avoid
a long-term memory leak if future changes cause dn_key not to be freed.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb: Improve coding style in ldb_kv_index_dn_simple()
Andrew Bartlett [Wed, 26 Feb 2020 22:27:17 +0000 (11:27 +1300)]
ldb: Improve coding style in ldb_kv_index_dn_simple()

We avoid bare if conditions in Samba.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoldb: Fix memory leak in ldb_kv_index_dn_ordered()
Andrew Bartlett [Wed, 26 Feb 2020 22:12:55 +0000 (11:12 +1300)]
ldb: Fix memory leak in ldb_kv_index_dn_ordered()

We need to ensure we TALLOC_FREE(tmp_ctx) in every error exit.

Reported by Alex Kolesnik, ABISoft Ltd., www.abisoft.biz.  Thanks!

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoRename macro argument s_addr due to it already being defined
Peter Eriksson [Thu, 27 Feb 2020 08:59:32 +0000 (09:59 +0100)]
Rename macro argument s_addr due to it already being defined

Signed-off-by: Peter Eriksson <pen@lysator.liu.se>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: test samba-tool group commands with groupnames with brackets and spaces
Björn Baumbach [Thu, 27 Feb 2020 10:06:34 +0000 (11:06 +0100)]
selftest: test samba-tool group commands with groupnames with brackets and spaces

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool group edit: use binary encoded group name
Björn Baumbach [Wed, 26 Feb 2020 12:56:14 +0000 (13:56 +0100)]
samba-tool group edit: use binary encoded group name

Allows to edit groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool group delete: use binary encoded group name
Björn Baumbach [Wed, 26 Feb 2020 12:55:01 +0000 (13:55 +0100)]
samba-tool group delete: use binary encoded group name

Allows to delete groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool group move: use binary encoded group name
Björn Baumbach [Wed, 26 Feb 2020 12:40:50 +0000 (13:40 +0100)]
samba-tool group move: use binary encoded group name

Allows to move groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool group listmembers: use binary encoded group names
Björn Baumbach [Wed, 26 Feb 2020 12:38:50 +0000 (13:38 +0100)]
samba-tool group listmembers: use binary encoded group names

Allows to find groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool group listmembers: find group members by groups SID
Björn Baumbach [Wed, 26 Feb 2020 12:39:44 +0000 (13:39 +0100)]
samba-tool group listmembers: find group members by groups SID

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool group listmembers: handle group-does-not-exist error
Björn Baumbach [Wed, 26 Feb 2020 12:08:43 +0000 (13:08 +0100)]
samba-tool group listmembers: handle group-does-not-exist error

Return a error with a proper message instead of just do nothing when
the target group does not exist.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool group listmembers: hide python backtracke on command error
Björn Baumbach [Wed, 26 Feb 2020 12:05:16 +0000 (13:05 +0100)]
samba-tool group listmembers: hide python backtracke on command error

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoUndef ARRAY_SIZE, if defined, before define to avoid compilation warnings
Peter Eriksson [Thu, 27 Feb 2020 19:54:52 +0000 (20:54 +0100)]
Undef ARRAY_SIZE, if defined, before define to avoid compilation warnings

Signed-off-by: Peter Eriksson <pen@lysator.liu.se>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Gary Lockyer <<gary@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 27 21:43:29 UTC 2020 on sn-devel-184

4 years agoselftest: Run libsmbclient with and without unix extensions
Volker Lendecke [Thu, 27 Feb 2020 08:52:30 +0000 (00:52 -0800)]
selftest: Run libsmbclient with and without unix extensions

The libsmbclient readdir tests are broken just for the unix extension
case. For example they assume our "map archive" behaviour. This will
have to be parameterized once unix extensions become better
implemented in libsmbclient

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 27 19:34:36 UTC 2020 on sn-devel-184

4 years agoselftest: Introduce planlibsmbclienttest()
Volker Lendecke [Wed, 26 Feb 2020 23:27:02 +0000 (15:27 -0800)]
selftest: Introduce planlibsmbclienttest()

Small refactoring

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Factor out smbtorture4testsuite_cmdarray()
Volker Lendecke [Wed, 26 Feb 2020 22:36:32 +0000 (14:36 -0800)]
selftest: Factor out smbtorture4testsuite_cmdarray()

This will be used in the libsmbclient tests soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Assemble smbtorture arguments as a list
Volker Lendecke [Wed, 26 Feb 2020 22:07:54 +0000 (14:07 -0800)]
selftest: Assemble smbtorture arguments as a list

I'm planning to mess with libsmbclient tests calling into
smbtorture4. For this it will be much more convenient to have the
arguments available as a higher-level data structure than just a
string.

Checked by "diff" on the testlist before and after -- no change.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Remove an unnecessary space character
Volker Lendecke [Wed, 26 Feb 2020 22:07:09 +0000 (14:07 -0800)]
selftest: Remove an unnecessary space character

The pattern "//%s/%s %s" already provides the space. Why this patch? It makes
checking the next patch trivial.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: Remove an obsolete knownfail entry
Volker Lendecke [Thu, 27 Feb 2020 08:29:16 +0000 (00:29 -0800)]
selftest: Remove an obsolete knownfail entry

Since ae76d218346 this is not run anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoctdb-docs: Move CTDB_SERVICE_NMB to new 48.netbios section
Anoop C S [Tue, 25 Feb 2020 12:38:35 +0000 (18:08 +0530)]
ctdb-docs: Move CTDB_SERVICE_NMB to new 48.netbios section

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Feb 27 07:34:53 UTC 2020 on sn-devel-184

4 years agoctdb-scripts: Change CTDB_SERVICE_NMB default value to 'nmb'
Anoop C S [Wed, 26 Feb 2020 05:40:46 +0000 (11:10 +0530)]
ctdb-scripts: Change CTDB_SERVICE_NMB default value to 'nmb'

Till now 50.samba script was based on RHEL versions <=6 where we didn't
have separate start up script for nmb and smbd used to start nmbd when
required. Now that nmbd has its own start up script named "nmb" it is
reasonable to have "nmb" as default value for CTDB_SERVICE_NMB inside
new 48.netbios ctdb script.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb-scripts: add new 48.netbios script for starting nmbd
Günther Deschner [Tue, 25 Feb 2020 14:04:41 +0000 (15:04 +0100)]
ctdb-scripts: add new 48.netbios script for starting nmbd

This change basically moves out nmbd references from 50.samba script to
a new 48.netbios script. Accordingly ctdb test scripts are tweaked to
cope with newly added script.

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agolib/util/fault.c: Unify printing of the stack trace with the INTERNAL ERROR string
Andrew Bartlett [Tue, 25 Feb 2020 23:02:36 +0000 (12:02 +1300)]
lib/util/fault.c: Unify printing of the stack trace with the INTERNAL ERROR string

We can diverged into the s3 and lib/fault panic action stuff once
we have printed the backtrace.

Our tests require we use the word PANIC, and some administrative scripts
might look for similar things, so keep those words.

The use of DEBUG(0, ... is deliberate to keep the output
of the PANIC line as consistent as possible with the historical smbd output.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 27 05:09:44 UTC 2020 on sn-devel-184

4 years agoMove INTERNAL ERROR... printout into smb_panic() and improve "why" string
Andrew Bartlett [Tue, 25 Feb 2020 22:58:48 +0000 (11:58 +1300)]
Move INTERNAL ERROR... printout into smb_panic() and improve "why" string

The "why" string is now eg "Signal 11: Segmentation fault" and
so more descriptive, and hopefully this will encourage the
Samba version to be included in more error reports.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolib/tfork: Improve process titles for the tfork waiter process
Andrew Bartlett [Fri, 21 Feb 2020 20:45:39 +0000 (09:45 +1300)]
lib/tfork: Improve process titles for the tfork waiter process

This makes it easier to understand the process graph as there is
not a duplicate (eg) ldap[master] process for each tfork waiter.
when useing "ps -ef -o pid,comm"

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos4-smbd: Make use of prctl_set_comment()
Andrew Bartlett [Fri, 21 Feb 2020 20:07:19 +0000 (09:07 +1300)]
s4-smbd: Make use of prctl_set_comment()

This makes it possible to tell different child tasks apart on linux systems
that have not compiled against libsetproctitle or libbsd-setproctitle.

Use "ps -ef -o pid,comm" to see the tree with these titles.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolib/util: Make prctl_set_comment take a printf format string
Andrew Bartlett [Fri, 21 Feb 2020 20:06:19 +0000 (09:06 +1300)]
lib/util: Make prctl_set_comment take a printf format string

This makes it easier to pass a small amount of variable information
into the buffer, to distinguish processes in the AD DC.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoidl: limit recurion on recursive elements
Gary Lockyer [Fri, 7 Feb 2020 02:18:45 +0000 (15:18 +1300)]
idl: limit recurion on recursive elements

Limit the max_recursion on self recursive definitions in the idl to
20,000. This value is hopefully large eneough to not impact normal
operation, but small eneough to prevent stack over flow issues.

Credit to OSS-Fuzz

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 27 02:29:21 UTC 2020 on sn-devel-184

4 years agofuzzing: ndr set global_max_recursion.
Gary Lockyer [Wed, 29 Jan 2020 19:53:10 +0000 (08:53 +1300)]
fuzzing: ndr set global_max_recursion.

Set global_max_recursion to 128, to ensure the fuzzer does not trip the
ASAN maximum stack depth which seems to be about 256?

Credit to OSS-Fuzz

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

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