iboukris/samba-autobuild/.git
3 years agotest: Add a first unit test for notifyd
Volker Lendecke [Thu, 22 Oct 2020 15:23:44 +0000 (17:23 +0200)]
test: Add a first unit test for notifyd

Use the notifyd "messaging" protocol to check if notifyd works at all

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonotifyd: Add fcn_wait_send()/recv()
Volker Lendecke [Thu, 22 Oct 2020 09:52:27 +0000 (11:52 +0200)]
notifyd: Add fcn_wait_send()/recv()

tevent_req based functions to listen for file change
notifications. Mainly right now for testing purposes, but it could be
used to also implement smbd's file change notify in a more tevent_req
based fashion than it is implemented now.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonotifyd: Factor out notify_walk() into its own file
Volker Lendecke [Wed, 21 Oct 2020 15:28:14 +0000 (17:28 +0200)]
notifyd: Factor out notify_walk() into its own file

To be used in smbtorture, avoid having to include almost all of smbd
just for this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonotifyd: Factor out notifyd_parse_entry() into its own file
Volker Lendecke [Wed, 21 Oct 2020 15:26:30 +0000 (17:26 +0200)]
notifyd: Factor out notifyd_parse_entry() into its own file

The next step will be to factor out notifyd_parse_db() and and
notify_walk() for consumption outside of smbd. notifyd_parse_db()
needs access to the internal representation of notifyd's database, so
move it into a commonly usable file.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonotifyd: Fix a typo
Volker Lendecke [Wed, 21 Oct 2020 14:10:25 +0000 (16:10 +0200)]
notifyd: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonotify: Remove an unused structure definition
Volker Lendecke [Wed, 21 Oct 2020 10:59:45 +0000 (12:59 +0200)]
notify: Remove an unused structure definition

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Fix includes for messages.h
Volker Lendecke [Thu, 22 Oct 2020 09:47:27 +0000 (11:47 +0200)]
lib: Fix includes for messages.h

It references struct tevent_context

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: add and use SMB2_FILE_ALL_INFORMATION
Ralph Boehme [Fri, 23 Oct 2020 14:25:06 +0000 (16:25 +0200)]
smbd: add and use SMB2_FILE_ALL_INFORMATION

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): Fri Oct 23 19:06:40 UTC 2020 on sn-devel-184

3 years agosmbd: add and use SMB2_FILE_FULL_EA_INFORMATION
Ralph Boehme [Fri, 23 Oct 2020 14:24:08 +0000 (16:24 +0200)]
smbd: add and use SMB2_FILE_FULL_EA_INFORMATION

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: add and use MS-FSCC Codes from 2.4 and 2.5
Ralph Boehme [Fri, 23 Oct 2020 14:21:16 +0000 (16:21 +0200)]
s3: add and use MS-FSCC Codes from 2.4 and 2.5

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmb: update comments on the NTCREATEX_FLAG_* flags
Ralph Boehme [Fri, 23 Oct 2020 11:10:36 +0000 (13:10 +0200)]
smb: update comments on the NTCREATEX_FLAG_* flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmb: rename NTCREATEX_OPTIONS_PRIVATE_STREAM_BASEOPEN to NTCREATEX_FLAG_STREAM_BASEOPEN
Ralph Boehme [Fri, 23 Oct 2020 11:08:50 +0000 (13:08 +0200)]
smb: rename NTCREATEX_OPTIONS_PRIVATE_STREAM_BASEOPEN to NTCREATEX_FLAG_STREAM_BASEOPEN

Just a shorter name, no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmb: rename NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE to NTCREATEX_FLAG_DELETE_ON_CLOSE
Ralph Boehme [Fri, 23 Oct 2020 15:45:59 +0000 (17:45 +0200)]
smb: rename NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE to NTCREATEX_FLAG_DELETE_ON_CLOSE

Just a shorter name, no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to NTCREATEX_FLAG_DENY_FCB
Ralph Boehme [Fri, 23 Oct 2020 15:42:28 +0000 (17:42 +0200)]
smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to NTCREATEX_FLAG_DENY_FCB

Just a shorter name, no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_DOS to NTCREATEX_FLAG_DENY_DOS
Ralph Boehme [Fri, 23 Oct 2020 15:41:33 +0000 (17:41 +0200)]
smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_DOS to NTCREATEX_FLAG_DENY_DOS

Just a shorter name, no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibrpc/dcesrv_core: let dcesrv_call_dispatch_local() call context->iface->reply()
Stefan Metzmacher [Fri, 23 Oct 2020 09:56:19 +0000 (11:56 +0200)]
librpc/dcesrv_core: let dcesrv_call_dispatch_local() call context->iface->reply()

This is needed in order to get NDR_PRINT_FUNCTION_DEBUG(..., NDR_OUT) called.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Fri Oct 23 17:24:37 UTC 2020 on sn-devel-184

3 years agolibrpc/dcesrv_core: assert that dcesrv_call_dispatch_local() never gets async.
Stefan Metzmacher [Fri, 23 Oct 2020 09:54:29 +0000 (11:54 +0200)]
librpc/dcesrv_core: assert that dcesrv_call_dispatch_local() never gets async.

This is just not supported for now...

We would need a dcesrv_call_dispatch_local_send/recv in order to
support async calls.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
3 years agolibrpc/dcesrv_core: make use of dcerpc_fault_to_nt_status() in dcesrv_call_dispatch_l...
Stefan Metzmacher [Fri, 23 Oct 2020 09:52:57 +0000 (11:52 +0200)]
librpc/dcesrv_core: make use of dcerpc_fault_to_nt_status() in dcesrv_call_dispatch_local()

The caller wants to get a useful NTSTATUS instead of a generic
NT_STATUS_NET_WRITE_FAULT.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
3 years agolibrpc/dcesrv_core: move two rpcint_dispatch() copies into dcesrv_call_dispatch_local()
Stefan Metzmacher [Fri, 23 Oct 2020 09:42:14 +0000 (11:42 +0200)]
librpc/dcesrv_core: move two rpcint_dispatch() copies into dcesrv_call_dispatch_local()

We only need this function once, so that we need to fix bugs only once...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
3 years agoexamples:auth: Do not install example plugin
Andreas Schneider [Fri, 23 Oct 2020 06:57:12 +0000 (08:57 +0200)]
examples:auth: Do not install example plugin

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Oct 23 15:32:08 UTC 2020 on sn-devel-184

3 years agos3:modules: Do not install vfs modules only used for testing
Andreas Schneider [Fri, 23 Oct 2020 06:53:43 +0000 (08:53 +0200)]
s3:modules: Do not install vfs modules only used for testing

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agounittests: Mark test binaries for selftest
Andreas Schneider [Thu, 22 Oct 2020 15:41:01 +0000 (17:41 +0200)]
unittests: Mark test binaries for selftest

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agobuildtools: Do not install binaries which are for selftest
Andreas Schneider [Thu, 22 Oct 2020 15:40:01 +0000 (17:40 +0200)]
buildtools: Do not install binaries which are for selftest

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agos3:script: Fix test_dfree_quota.sh
Andreas Schneider [Thu, 22 Oct 2020 09:08:19 +0000 (11:08 +0200)]
s3:script: Fix test_dfree_quota.sh

source3/script/tests/test_dfree_quota.sh: line 200: [: missing `]'

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agosmbd: split out POSIX info_levels from smbd_do_setfilepathinfo() into own function
Ralph Boehme [Thu, 22 Oct 2020 10:26:17 +0000 (12:26 +0200)]
smbd: split out POSIX info_levels from smbd_do_setfilepathinfo() into own function

smbd_do_setfilepathinfo() can be made fully handle based for all non-POSIX
infolevels with pathref fsps, but for a POSIX create we may not have a fsp if
the path points at a symlink.

Splitting the POSIX from the non-POSIX logic allows for cleaner handling of this
in the future with pathref fsps.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Oct 23 09:19:12 UTC 2020 on sn-devel-184

3 years agosmbd: mark UCF_UNIX_NAME_LOOKUP as unused
Ralph Boehme [Thu, 22 Oct 2020 09:12:11 +0000 (11:12 +0200)]
smbd: mark UCF_UNIX_NAME_LOOKUP as unused

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove use of UCF_UNIX_NAME_LOOKUP
Ralph Boehme [Thu, 22 Oct 2020 09:10:32 +0000 (11:10 +0200)]
smbd: remove use of UCF_UNIX_NAME_LOOKUP

This is now handled by SMB_FILENAME_POSIX_PATH.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: use UCF_POSIX_PATHNAMES flag for path validation logic in filename_convert_inte...
Ralph Boehme [Thu, 22 Oct 2020 09:04:59 +0000 (11:04 +0200)]
smbd: use UCF_POSIX_PATHNAMES flag for path validation logic in filename_convert_internal()

This change means that if a client path is a symlink, we *always* only call
check_veto_path() for POSIX clients using a POSIX pathname, not just when a
POSIX info-level was used in an SMB request.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: base POSIX semantics of call_trans2findfirst() on SMB_FILENAME_POSIX_PATH flag
Ralph Boehme [Thu, 15 Oct 2020 17:50:14 +0000 (19:50 +0200)]
smbd: base POSIX semantics of call_trans2findfirst() on SMB_FILENAME_POSIX_PATH flag

We really want to apply POSIX semantics in this place whenever the client has
enabled UNIX extensions, not only when using UNIX find info-levels.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: let directory entries inherit the smb_fname->flags from the directory
Ralph Boehme [Thu, 15 Oct 2020 17:45:21 +0000 (19:45 +0200)]
smbd: let directory entries inherit the smb_fname->flags from the directory

If the listed directory has SMB_FILENAME_POSIX_PATH set, this change causes the
smb_fname of directory entries to inherit the flag so subsequent operations on
the directory entry can correctly implement POSIX semantics.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: base POSIX semantics in call_trans2findfirst() on req->posix_pathnames
Ralph Boehme [Thu, 15 Oct 2020 08:27:23 +0000 (10:27 +0200)]
smbd: base POSIX semantics in call_trans2findfirst() on req->posix_pathnames

This will require a SMB1 client to enable SMB1 POSIX extensions, just sending
POSIX info-level requests without first enabling them won't cut it.

As discussed with Jeremy, SMB1 POSIX extensions is a global thing and the client
that wants to use it is expected to enable them explicitly before making use of
POSIX info-levels.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_default: allow dirfsps in the link VFS functions
Ralph Boehme [Wed, 14 Oct 2020 13:34:55 +0000 (15:34 +0200)]
vfs_default: allow dirfsps in the link VFS functions

The functions work just fine with real dirfsps.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoselftest: remove POSIX test from planned tests for ad_dc_ntvfs environ
Ralph Boehme [Thu, 15 Oct 2020 13:45:06 +0000 (15:45 +0200)]
selftest: remove POSIX test from planned tests for ad_dc_ntvfs environ

Just don't run the tests instead of retrofitting them to the skiplist.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_streams_depot: only assert AT_FDCWD for streams
Ralph Boehme [Sat, 17 Oct 2020 15:00:53 +0000 (17:00 +0200)]
vfs_streams_depot: only assert AT_FDCWD for streams

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_streams_xattr: only assert AT_FDCWD for streams
Ralph Boehme [Sat, 17 Oct 2020 14:59:55 +0000 (16:59 +0200)]
vfs_streams_xattr: only assert AT_FDCWD for streams

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: fix order of smb_fname flags and twrp args in call_trans2findfirst()
Ralph Boehme [Thu, 15 Oct 2020 17:49:24 +0000 (19:49 +0200)]
smbd: fix order of smb_fname flags and twrp args in call_trans2findfirst()

Also not creating a BUG for this one as I've not seen any reports from the field
that this is causing issues.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: fix order of smb_fname flags and twrp args in unlink_internals()
Ralph Boehme [Thu, 15 Oct 2020 17:48:42 +0000 (19:48 +0200)]
smbd: fix order of smb_fname flags and twrp args in unlink_internals()

As snapshots are read-only by design, this bug was likely not a real issue so
I'm not creating a BUG for this.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs: make dirfsp arg to SMB_VFS_READLINKAT() const
Ralph Boehme [Tue, 13 Oct 2020 13:19:30 +0000 (15:19 +0200)]
vfs: make dirfsp arg to SMB_VFS_READLINKAT() const

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowb_sids2xids: defer/skip wb_lookupsids* unless we get ID_TYPE_WB_REQUIRE_TYPE
Stefan Metzmacher [Fri, 11 Sep 2020 14:24:49 +0000 (16:24 +0200)]
wb_sids2xids: defer/skip wb_lookupsids* unless we get ID_TYPE_WB_REQUIRE_TYPE

We try to give a valid hint for predefined sids and
pass ID_TYPE_BOTH as a hint that the domain part of the sid is valid.

In most cases the idmap child/backend does not require a type_hint
as mappings already exist.

This is a speed up as we no longer need to contact a domain controller.

It's also possible to accept kerberos authentication without reaching
out to a domain controller at all (if the idmap backend doesn't need a
hint).

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

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

3 years agowinbindd: allow idmap backends to mark entries with ID_[TYPE_WB_]REQUIRE_TYPE
Stefan Metzmacher [Tue, 15 Sep 2020 15:26:11 +0000 (17:26 +0200)]
winbindd: allow idmap backends to mark entries with ID_[TYPE_WB_]REQUIRE_TYPE

This must only be used between winbindd parent and child!
It must not leak into outside world.

Some backends require ID_TYPE_UID or ID_TYPE_GID as type_hint,
while others may only need ID_TYPE_BOTH in order to validate that
the domain exists.

This will allow us to skip the wb_lookupsids_send/recv in the winbindd parent
in future and only do that on demand.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: build state->idmap_doms based on wb_parent_idmap_config
Stefan Metzmacher [Thu, 10 Sep 2020 15:13:14 +0000 (17:13 +0200)]
wb_sids2xids: build state->idmap_doms based on wb_parent_idmap_config

In future we'll try to avoid wb_lookupsids_send() and only call
it if needed.

The domain name passed should be only relevant to find the correct
idmap backend, and these should all be available in
wb_parent_idmap_config as it was created before the idmap child was forked.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: fill cache as soon as possible
Stefan Metzmacher [Thu, 10 Sep 2020 21:06:02 +0000 (23:06 +0200)]
wb_sids2xids: fill cache as soon as possible

After adding entries to the cache we can mark them
as filled from the cache by setting its domain_index
to UINT32_MAX.

This will allow further changes to fill the results
into state->all_ids in steps.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: directly use state->all_ids to collect results
Stefan Metzmacher [Tue, 15 Sep 2020 12:17:37 +0000 (14:17 +0200)]
wb_sids2xids: directly use state->all_ids to collect results

In order to translate the indexes from state->lookup_sids[]
for wb_lookupsids_send/recv() and state->map_ids.ids[]
for dcerpc_wbint_Sids2UnixIDs_send/recv() back to
state->all_ids.ids[] or state->sids[] we have state->tmp_idx[].

This simplifies wb_sids2xids_recv() a lot and make further
restructuring much easier.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: change 'i' to 'li' in wb_sids2xids_lookupsids_done()
Stefan Metzmacher [Tue, 15 Sep 2020 11:58:26 +0000 (13:58 +0200)]
wb_sids2xids: change 'i' to 'li' in wb_sids2xids_lookupsids_done()

With all the indexes we have into various array, this makes clear
'li' is the index into the state->lookup_sids array.

This makes the following changes easier to review.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: refactor wb_sids2xids_done() a bit
Stefan Metzmacher [Tue, 15 Sep 2020 11:54:24 +0000 (13:54 +0200)]
wb_sids2xids: refactor wb_sids2xids_done() a bit

Here we don't change the logic.

It will make the following changes easier.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: inline wb_sids2xids_extract_for_domain_index() into wb_sids2xids_next_s...
Stefan Metzmacher [Tue, 15 Sep 2020 11:36:43 +0000 (13:36 +0200)]
wb_sids2xids: inline wb_sids2xids_extract_for_domain_index() into wb_sids2xids_next_sids2unix()

Instead of re-creating the dom_ids element,
we just use a pre-allocated map_ids_in array.

This is a bit tricky as we need to use map_ids_out as a copy of
map_ids_in, because the _ids argument of dcerpc_wbint_Sids2UnixIDs_send()
in [in,out], which means that _ids->ids is changed between
dcerpc_wbint_Sids2UnixIDs_send() and dcerpc_wbint_Sids2UnixIDs_recv()!

If the domain doesn't need any mappings, we'll move to the next domain
early, for now this can't happend but it will in future.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: move more checks to wb_sids2xids_next_sids2unix()
Stefan Metzmacher [Tue, 15 Sep 2020 11:19:14 +0000 (13:19 +0200)]
wb_sids2xids: move more checks to wb_sids2xids_next_sids2unix()

For the first run this is a no-op, but it simplified the caller.

We'll call wb_sids2xids_next_sids2unix() in a few more places in future
and it's easier to have this all within wb_sids2xids_next_sids2unix().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: rename 'non_cached' to 'lookup_sids'
Stefan Metzmacher [Thu, 10 Sep 2020 15:45:24 +0000 (17:45 +0200)]
wb_sids2xids: rename 'non_cached' to 'lookup_sids'

This array is used to pass to wb_lookupsids_send()
and that will be the only reason to have this in future.

For now it's used for all non cached sids, but that will
also change in the next commits.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: maintain struct wbint_TransIDArray all_ids as cache
Stefan Metzmacher [Thu, 10 Sep 2020 14:45:03 +0000 (16:45 +0200)]
wb_sids2xids: maintain struct wbint_TransIDArray all_ids as cache

Entries with domain_index == UINT32_MAX are valid cache entries.

In the following commits we'll fill in missing entries step by step
until all entries are marked as filled.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: split out wb_sids2xids_next_sids2unix()
Ralph Boehme [Fri, 3 Jul 2020 14:39:26 +0000 (16:39 +0200)]
wb_sids2xids: split out wb_sids2xids_next_sids2unix()

Put the code that calls the per-domain idmap backend
in its own function.

This makes further reconstruction easier.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbindd: defer the setup_child() from init_idmap_child()
Stefan Metzmacher [Fri, 11 Sep 2020 13:42:42 +0000 (15:42 +0200)]
winbindd: defer the setup_child() from init_idmap_child()

At startup we trigger a wb_parent_idmap_setup_send() and make
sure setup_child() is called just before wb_parent_idmap_setup_recv()
finished.

This makes sure our view of the idmap config in the parent matches
what we have in the child.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbindd: assert wb_parent_idmap_setup_send/recv() was called before idmap_child_handle()
Stefan Metzmacher [Fri, 11 Sep 2020 12:12:17 +0000 (14:12 +0200)]
winbindd: assert wb_parent_idmap_setup_send/recv() was called before idmap_child_handle()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_queryuser: explain why wb_parent_idmap_setup_send/recv is not needed
Stefan Metzmacher [Fri, 11 Sep 2020 11:52:17 +0000 (13:52 +0200)]
wb_queryuser: explain why wb_parent_idmap_setup_send/recv is not needed

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: call wb_parent_idmap_setup_send/recv as the first step
Stefan Metzmacher [Fri, 11 Sep 2020 10:52:40 +0000 (12:52 +0200)]
wb_sids2xids: call wb_parent_idmap_setup_send/recv as the first step

This isn't really used yet, but it will in the next commits.

Also idmap_child_handle() will soon assert that
wb_parent_idmap_setup_send/recv() was called before it's used.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_xids2sids: make use of the new wb_parent_idmap_setup_send/recv() helpers
Stefan Metzmacher [Fri, 11 Sep 2020 10:31:13 +0000 (12:31 +0200)]
wb_xids2sids: make use of the new wb_parent_idmap_setup_send/recv() helpers

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbindd: add generic wb_parent_idmap_setup_send/recv() helpers
Stefan Metzmacher [Fri, 11 Sep 2020 10:16:00 +0000 (12:16 +0200)]
winbindd: add generic wb_parent_idmap_setup_send/recv() helpers

This is more or less a copy of wb_xids2sids_init_dom_maps_send/recv,
but it's more generic and doesn't imply global state.

It also closes a initialization race by using a tevent_queue to
serialize the calls.

In the next commits we'll replace wb_xids2sids_init_dom_maps_send/recv.

We'll also use the new function in the wb_sids2xids code.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbindd: add and use is_idmap_child()
Stefan Metzmacher [Fri, 11 Sep 2020 12:06:04 +0000 (14:06 +0200)]
winbindd: add and use is_idmap_child()

We should avoid calling idmap_child() as much as possible.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbindd: add and use idmap_child_pid()
Stefan Metzmacher [Fri, 11 Sep 2020 12:06:04 +0000 (14:06 +0200)]
winbindd: add and use idmap_child_pid()

We should avoid calling idmap_child() as much as possible.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_sids2xids: avoid idmap_child() and use idmap_child_handle() instead
Stefan Metzmacher [Thu, 10 Sep 2020 13:49:34 +0000 (15:49 +0200)]
wb_sids2xids: avoid idmap_child() and use idmap_child_handle() instead

This is the only aspect we need here.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_xids2sids: avoid idmap_child() and use idmap_child_handle() instead
Stefan Metzmacher [Fri, 11 Sep 2020 10:35:09 +0000 (12:35 +0200)]
wb_xids2sids: avoid idmap_child() and use idmap_child_handle() instead

This is the only aspect we need here.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowb_queryuser: avoid idmap_child() and use idmap_child_handle() instead
Stefan Metzmacher [Fri, 11 Sep 2020 11:52:17 +0000 (13:52 +0200)]
wb_queryuser: avoid idmap_child() and use idmap_child_handle() instead

This is the only aspect we need here.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbindd/idmap: apply const to struct nss_info_methods pointers
Stefan Metzmacher [Thu, 21 Mar 2019 11:30:37 +0000 (12:30 +0100)]
winbindd/idmap: apply const to struct nss_info_methods pointers

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbindd/idmap: apply const to struct idmap_methods pointers
Stefan Metzmacher [Thu, 21 Mar 2019 11:30:37 +0000 (12:30 +0100)]
winbindd/idmap: apply const to struct idmap_methods pointers

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agotest_idmap_tdb_common: correctly initialize the idmap domain with an init function
Stefan Metzmacher [Thu, 21 Mar 2019 11:29:00 +0000 (12:29 +0100)]
test_idmap_tdb_common: correctly initialize the idmap domain with an init function

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agos3:passdb: use ID_TYPE_* instead of WBC_ID_TYPE_*
Stefan Metzmacher [Tue, 15 Sep 2020 14:46:44 +0000 (16:46 +0200)]
s3:passdb: use ID_TYPE_* instead of WBC_ID_TYPE_*

Currently these enums have the same values, but that will
change in future.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agowinbind.idl: rename wbint_TransID.type to wbint_TransID.type_hint
Stefan Metzmacher [Tue, 15 Sep 2020 14:01:04 +0000 (16:01 +0200)]
winbind.idl: rename wbint_TransID.type to wbint_TransID.type_hint

This makes it clear that it's a hint from the parent to the
child.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agorpc: avoid undefined behaviour when parsing bindings
Douglas Bagnall [Mon, 19 Oct 2020 20:42:56 +0000 (09:42 +1300)]
rpc: avoid undefined behaviour when parsing bindings

If the binding string ends with "[", we were setting options to an
empty string, then asking for 'options[strlen(options)-1]', which
UBSan dosn't like because the offset evaluates to (size_t)0xFFFFF...
causing pointer overflow.

I believe this is actually well defined in practice, but we don't want
to be in the habit of leaving sanitiser warnings in code parsing
untrusted strings.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years ago.gitlab-ci.yml: Ensure we compile before we start the main parallel testing
Andrew Bartlett [Fri, 11 Sep 2020 06:06:51 +0000 (18:06 +1200)]
.gitlab-ci.yml: Ensure we compile before we start the main parallel testing

This build can be as fast as 10mins if the ccache matches and there
are few tests.  Therefore put it first as a sentinal.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years ago.gitlab-ci.yml: Run the coverity submission job in parallel with the builds
Andrew Bartlett [Sun, 19 Apr 2020 23:41:11 +0000 (11:41 +1200)]
.gitlab-ci.yml: Run the coverity submission job in parallel with the builds

This avoids a flapping test elsewhere delying the submission of the code to coverity
for checking.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agopy3: Add is_ad_dc_built option to python glue
David Mulder [Fri, 18 Sep 2020 17:27:24 +0000 (11:27 -0600)]
py3: Add is_ad_dc_built option to python glue

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agooss-fuzz: Add very verbose explaination for RPATH vs RUNPATH
Andrew Bartlett [Thu, 22 Oct 2020 21:06:20 +0000 (10:06 +1300)]
oss-fuzz: Add very verbose explaination for RPATH vs RUNPATH

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Oct 23 00:33:57 UTC 2020 on sn-devel-184

3 years agooss-fuzz: Always run the check, even on the oss-fuzz platform
Andrew Bartlett [Thu, 22 Oct 2020 18:49:47 +0000 (07:49 +1300)]
oss-fuzz: Always run the check, even on the oss-fuzz platform

It is much harder to determine why we get messages like
    Step #6: Error occured while running fuzz_reg_parse:
    Step #6: /workspace/out/coverage/fuzz_reg_parse: error while loading shared libraries: libavahi-common.so.3: cannot open shared object file: No such file or directory
instead this detects the failure to use RPATH (which is
strictly required instead of the modern RUNPATH)
otherwise.

We do this by creating a new build_samba.sh after renaming
build_samba.sh to do_build.sh because this is what oss-fuzz
runs, meaning we don't need to coordinate a MR there as well.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agooss-fuzz: update comment to reference RPATH for the static-ish binaries
Andrew Bartlett [Thu, 22 Oct 2020 02:39:50 +0000 (15:39 +1300)]
oss-fuzz: update comment to reference RPATH for the static-ish binaries

We strictly require RPATH, so fix the comment to avoid mentioning
the modern RUNPATH which is almost but not entirely similar.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agotestprogs: Fix and improve upgradeprovision-oldrelease test
Andreas Schneider [Wed, 21 Oct 2020 17:14:32 +0000 (19:14 +0200)]
testprogs: Fix and improve upgradeprovision-oldrelease test

This fixes running `make test` in a release tarball!

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

Signed-off-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 Oct 22 17:28:39 UTC 2020 on sn-devel-184

3 years agotestprogs: Fix and improve dbcheck-oldrelease test
Andreas Schneider [Wed, 21 Oct 2020 16:03:25 +0000 (18:03 +0200)]
testprogs: Fix and improve dbcheck-oldrelease test

This fixes running `make test` in a release tarball!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agotestprogs: Fix and improve functionalprep test
Andreas Schneider [Wed, 21 Oct 2020 15:54:54 +0000 (17:54 +0200)]
testprogs: Fix and improve functionalprep test

This fixes running `make test` in a release tarball!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agotestprogs: Fix and improve dbcheck-links test
Andreas Schneider [Wed, 21 Oct 2020 15:41:27 +0000 (17:41 +0200)]
testprogs: Fix and improve dbcheck-links test

This fixes running `make test` in a release tarball!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agotestprogs: Fix and improve runtime-links test
Andreas Schneider [Wed, 21 Oct 2020 15:35:34 +0000 (17:35 +0200)]
testprogs: Fix and improve runtime-links test

This fixes running `make test` in a release tarball!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agotestprogs: Fix and improve tombstones-expunge test
Andreas Schneider [Wed, 21 Oct 2020 15:04:12 +0000 (17:04 +0200)]
testprogs: Fix and improve tombstones-expunge test

This fixes running `make test` in a release tarball!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agotestprogs: Fix and improve demote-saveddb test
Andreas Schneider [Tue, 20 Oct 2020 18:47:43 +0000 (20:47 +0200)]
testprogs: Fix and improve demote-saveddb test

This fixes running `make test` in a release tarball!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agotestprogs: Add remove_directory to common test functions
Andreas Schneider [Thu, 22 Oct 2020 09:39:04 +0000 (11:39 +0200)]
testprogs: Add remove_directory to common test functions

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agopython: Create targetdir recursively
Andreas Schneider [Wed, 21 Oct 2020 05:43:08 +0000 (07:43 +0200)]
python: Create targetdir recursively

This fixes `make test` in a release tarball.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
3 years agolibndr: Avoid assigning duplicate versions to symbols
Amitay Isaacs [Tue, 20 Oct 2020 06:27:14 +0000 (17:27 +1100)]
libndr: Avoid assigning duplicate versions to symbols

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

Symbols _ndr_push_error and _ndr_pull_error keep getting redefined as
they are included without wildcard in abi_match.  Apparently on linux ld
does not complain about duplicate symbols, but on freebsd ld fails to
link with following error:

  [ 918/3912] Linking bin/default/librpc/libndr.so
  ld: error: duplicate symbol '_ndr_pull_error' in version script
  ld: error: duplicate symbol '_ndr_push_error' in version script
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agoAdd VFS-License-clarification.txt as discussed on the Team list.
Jeremy Allison [Wed, 21 Oct 2020 17:53:27 +0000 (10:53 -0700)]
Add VFS-License-clarification.txt as discussed on the Team list.

Update WHATSNEW.txt with a copy for the next release.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Oct 22 15:34:54 UTC 2020 on sn-devel-184

3 years agooss-fuzz: standardise on RPATH for the static-ish binaries
Andrew Bartlett [Thu, 22 Oct 2020 02:39:50 +0000 (15:39 +1300)]
oss-fuzz: standardise on RPATH for the static-ish binaries

This includes a revert of commit e60df214998afc145ca482cab184691b3ddc3bb2.

We strictly require RPATH, not the modern RUNPATH for the behaviour
we need in oss-fuzz, which is that not just the first line of dependencies
but the full set of libraries used by the program are looked for in the
'$ORIGIN/lib' directory.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Oct 22 14:10:04 UTC 2020 on sn-devel-184

3 years agofuzzing: Improve robustness and documentation of the ldd-base library copy
Andrew Bartlett [Wed, 21 Oct 2020 23:05:29 +0000 (12:05 +1300)]
fuzzing: Improve robustness and documentation of the ldd-base library copy

This tries to make progress towards understanding why we sometime see errors like
Step #6: Error occured while running fuzz_reg_parse:
Step #6: /workspace/out/coverage/fuzz_reg_parse: error while loading shared libraries: libavahi-common.so.3: cannot open shared object file: No such file or directory

in the previously failing coverage builds.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agos3:param:service - ensure registry shares loaded before home check
Andrew Walker [Wed, 21 Oct 2020 09:38:45 +0000 (05:38 -0400)]
s3:param:service - ensure registry shares loaded before home check

Registry shares should be loaded and checked prior to checking home
directories. This ensures that an explicitly defined service takes
priority over home directories (same behavior as non-registry shares).

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

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Jeremy Alison <jra@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 22 00:30:38 UTC 2020 on sn-devel-184

3 years agolib:util:loadparm - fix leak in lpcfg_dump_a_parameter
Andrew Walker [Wed, 21 Oct 2020 11:47:14 +0000 (07:47 -0400)]
lib:util:loadparm - fix leak in lpcfg_dump_a_parameter

This function calls talloc_strdup() for the parm_name passed into
it so that we can check whether it's a parametric entry. It's
allocated under the loadparm context passed into the function.
Primary consumer of this is "testparm" and so context short-lived in
typical use-case, but this is also exposed via pyparam and so the
loadparm context may be somewhat longer-lived depending on how it is
being used.

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

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 years agofuzzing: Fix the oss-fuzz coverage build
Andrew Bartlett [Wed, 21 Oct 2020 18:34:35 +0000 (07:34 +1300)]
fuzzing: Fix the oss-fuzz coverage build

It was long thought that the issue here was that no seed corpus was
provided, but actually the issue is that to obtain coverage output
just as we already know for gcc gcov, you must provide fuzzing flags
to both the compile and link phase.

Thankfully clang as a linker does not mind the strange non-linker options
from $COVERAGE_FLAGS.

REF: https://stackoverflow.com/questions/56112019/clang-does-not-generate-profraw-file-when-linking-manually
REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19495#c48

Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Oct 21 23:07:37 UTC 2020 on sn-devel-184

3 years agolib: Add tevent_req_received() to messaging_filtered_read_recv()
Volker Lendecke [Thu, 15 Oct 2020 14:31:46 +0000 (16:31 +0200)]
lib: Add tevent_req_received() to messaging_filtered_read_recv()

Early talloc_free() for the msg_rec if it's not picked up

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): Wed Oct 21 20:27:57 UTC 2020 on sn-devel-184

3 years agolibsmb: Simplify cli_resolve_path()
Volker Lendecke [Wed, 14 Oct 2020 05:09:13 +0000 (07:09 +0200)]
libsmb: Simplify cli_resolve_path()

The additional conditions in cli_dfs_check_error() were covered
earlier in cli_resolve_path() via cli_conn_have_dfs(). Without those
it's more obvious to directly call NT_STATUS_EQUAL here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Factor out cli_conn_have_dfs() from cli_resolve_path()
Volker Lendecke [Wed, 14 Oct 2020 05:06:15 +0000 (07:06 +0200)]
libsmb: Factor out cli_conn_have_dfs() from cli_resolve_path()

This also does the checks from cli_dfs_check_error(), which can be
removed in the next step.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoincludes: nt_printing.h does not need client.h
Volker Lendecke [Sun, 18 Oct 2020 16:31:17 +0000 (18:31 +0200)]
includes: nt_printing.h does not need client.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Fix a typo
Volker Lendecke [Sun, 18 Oct 2020 15:40:30 +0000 (17:40 +0200)]
libsmb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Use a direct struct initialization to avoid a memset
Volker Lendecke [Sun, 18 Oct 2020 20:43:41 +0000 (22:43 +0200)]
libsmb: Use a direct struct initialization to avoid a memset

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Use ZERO_STRUCTP
Volker Lendecke [Sun, 18 Oct 2020 20:43:24 +0000 (22:43 +0200)]
libsmb: Use ZERO_STRUCTP

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Use "struct" in self-references
Volker Lendecke [Sun, 18 Oct 2020 20:42:39 +0000 (22:42 +0200)]
libsmb: Use "struct" in self-references

Don't go via the typedefs for next and prev pointers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbcacls: Use direct struct initialization
Volker Lendecke [Tue, 20 Oct 2020 07:24:06 +0000 (09:24 +0200)]
smbcacls: Use direct struct initialization

Use implicit NULL/false initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbcacls: Use ISDOT[DOT] instead of strequal
Volker Lendecke [Tue, 20 Oct 2020 07:07:29 +0000 (09:07 +0200)]
smbcacls: Use ISDOT[DOT] instead of strequal

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibcli: Align integer types
Volker Lendecke [Fri, 16 Oct 2020 12:21:16 +0000 (14:21 +0200)]
libcli: Align integer types

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