]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agoselftest: Confirm that we fix any errors on the Deleted Objects container itself
Andrew Bartlett [Fri, 11 Dec 2020 02:37:04 +0000 (15:37 +1300)] 
selftest: Confirm that we fix any errors on the Deleted Objects container itself

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agos4:kdc:mit: Fix heap-use-after-free
Andreas Schneider [Tue, 2 Feb 2021 08:29:14 +0000 (09:29 +0100)] 
s4:kdc:mit: Fix heap-use-after-free

We need to duplicate the string as lp_load() will free the s4_conf_file
pointer and set it again.

Found with AddressSanitizer.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: Fix libasan preload
Andreas Schneider [Tue, 2 Feb 2021 08:17:17 +0000 (09:17 +0100)] 
selftest: Fix libasan preload

libasan.so needs to be the first library which is preloaded or it wont
work.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3: libsmb: cli_state_save_tcon(). Don't deepcopy tcon struct when temporarily swappi...
Jeremy Allison [Thu, 28 Jan 2021 19:08:48 +0000 (11:08 -0800)] 
s3: libsmb: cli_state_save_tcon(). Don't deepcopy tcon struct when temporarily swapping out a connection on a cli_state.

This used to make a deep copy of either
cli->smb2.tcon or cli->smb1.tcon, but this leaves
the original tcon pointer in place which will then get
TALLOC_FREE()'d when the new tree connection is made on
this cli_state.

As there may be pipes open on the old tree connection with
talloc'ed state allocated using the original tcon pointer as a
talloc parent we can't deep copy and then free this pointer
as that will fire the destructors on the pipe memory and
mark them as not connected.

This call is used to temporarily swap out a tcon pointer
(whilst keeping existing pipes open) to allow a new tcon
on the same cli_state and all users correctly call
cli_state_restore_tcon() once they are finished with
the new tree connection.

Just return the existing pointer and set the old value to NULL.
We know we MUST be calling cli_state_restore_tcon() below
to restore the original tcon tree connection pointer before
closing the session.

Remove the knownfail.d entry.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Feb  2 21:05:25 UTC 2021 on sn-devel-184

4 years agos3: torture: Change the SMB1-only UID-REGRESSION-TEST to do an explicit copy of the...
Jeremy Allison [Fri, 29 Jan 2021 01:35:55 +0000 (17:35 -0800)] 
s3: torture: Change the SMB1-only UID-REGRESSION-TEST to do an explicit copy of the tcon struct in use.

For this test only, explicitly copy the SMB1 tcon struct,
don't use cli_state_save_tcon()//cli_state_restore_tcon()
as these calls will soon change to just manipulate the pointer
to avoid TALLOC_FREE() on the tcon struct which calls
destructors on child pipe data.

In SMB1 this test calls cli_tdis() twice with an invalid
vuid and expects the SMB1 tcon struct to be preserved
across the calls.

SMB1 cli_tdis() frees cli->smb1.tcon so we must put back
a deep copy into cli->smb1.tcon to be able to safely call
cli_tdis() again.

This is a test-only hack. Real client code
uses cli_state_save_tcon()/cli_state_restore_tcon()
if it needs to temporarily swap out the active
tcon on a client connection.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbtorture3: Ensure run_tcon_test() always replaces any saved tcon and shuts...
Jeremy Allison [Thu, 28 Jan 2021 18:56:18 +0000 (10:56 -0800)] 
s3: smbtorture3: Ensure run_tcon_test() always replaces any saved tcon and shuts down correctly even in error paths.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: smbtorture3: Ensure we *always* replace the saved saved_tcon even in an error...
Jeremy Allison [Thu, 28 Jan 2021 18:46:33 +0000 (10:46 -0800)] 
s3: smbtorture3: Ensure we *always* replace the saved saved_tcon even in an error condition.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: libsmb: Ensure we disconnect the temporary SMB1 tcon pointer on failure to set...
Jeremy Allison [Thu, 28 Jan 2021 22:32:53 +0000 (14:32 -0800)] 
s3: libsmb: Ensure we disconnect the temporary SMB1 tcon pointer on failure to set up encryption.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3: tests: Add regression test for bug 13992.
Jeremy Allison [Thu, 28 Jan 2021 22:07:23 +0000 (14:07 -0800)] 
s3: tests: Add regression test for bug 13992.

Subtle extra test. Mark as knownfail for now.

'^ user1$' must appear MORE THAN ONCE, as it can read more than one
share. The previous test found user1, but only once as the bug only
allows reading the security descriptor for one share, and we were
unlucky that the first share security descriptor returned allows
user1 to read from it.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: Add support for python-dateutil >= 2.7.1
Andreas Schneider [Tue, 2 Feb 2021 12:44:01 +0000 (13:44 +0100)] 
selftest: Add support for python-dateutil >= 2.7.1

This uses the more widespread python-dateutil instead of python-iso8601.

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): Tue Feb  2 19:53:35 UTC 2021 on sn-devel-184

4 years agoselftest: Directly import python-iso8601
Andreas Schneider [Tue, 2 Feb 2021 12:11:56 +0000 (13:11 +0100)] 
selftest: Directly import python-iso8601

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agopython:subunit: Use UTC timezone from datatime module
Andreas Schneider [Mon, 1 Feb 2021 09:38:08 +0000 (10:38 +0100)] 
python:subunit: Use UTC timezone from datatime module

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agos3:smbd: Fix invalid memory access in posix_sys_acl_blob_get_fd()
Andreas Schneider [Mon, 1 Feb 2021 11:03:17 +0000 (12:03 +0100)] 
s3:smbd: Fix invalid memory access in posix_sys_acl_blob_get_fd()

We are handing down an out of scope buffer.

Found by AddressSanitizer.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Feb  1 22:55:10 UTC 2021 on sn-devel-184

4 years agoselftest: Disable detection of ODR violations
Andreas Schneider [Mon, 1 Feb 2021 11:06:16 +0000 (12:06 +0100)] 
selftest: Disable detection of ODR violations

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:libsmb: Use C99 initializer for py_cli_notify_state_methods
Andreas Schneider [Mon, 1 Feb 2021 18:49:18 +0000 (19:49 +0100)] 
s3:libsmb: Use C99 initializer for py_cli_notify_state_methods

error: missing field 'ml_meth' initializer [-Werror,-Wmissing-field-initializers]
        { NULL }
               ^

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib:krb5_wrap: Check the format string of krb5_warnx()
Andreas Schneider [Mon, 1 Feb 2021 17:32:25 +0000 (18:32 +0100)] 
lib:krb5_wrap: Check the format string of krb5_warnx()

error: format string is not a string literal [-Werror,-Wformat-nonliteral]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib:texpect: Check the format string of err()
Andreas Schneider [Mon, 1 Feb 2021 17:30:15 +0000 (18:30 +0100)] 
lib:texpect: Check the format string of err()

error: format string is not a string literal [-Werror,-Wformat-nonliteral]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibndr: Use better and more clear check for empty flags
Andreas Schneider [Mon, 1 Feb 2021 17:20:18 +0000 (18:20 +0100)] 
libndr: Use better and more clear check for empty flags

warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:printing: Correctly mark fall through switch statements
Andreas Schneider [Mon, 1 Feb 2021 17:16:25 +0000 (18:16 +0100)] 
s3:printing: Correctly mark fall through switch statements

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:registry: Mark fall through switch statement
Andreas Schneider [Mon, 1 Feb 2021 13:35:34 +0000 (14:35 +0100)] 
s4:registry: Mark fall through switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:registry: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 13:36:57 +0000 (14:36 +0100)] 
s4:registry: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:ntvfs: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 17:18:39 +0000 (18:18 +0100)] 
s4:ntvfs: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:smbd: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 17:15:08 +0000 (18:15 +0100)] 
s3:smbd: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:rpcclient: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 18:50:27 +0000 (19:50 +0100)] 
s3:rpcclient: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:rpc_server: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 17:19:51 +0000 (18:19 +0100)] 
s4:rpc_server: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:printing: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 17:17:29 +0000 (18:17 +0100)] 
s3:printing: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:lib: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 17:13:10 +0000 (18:13 +0100)] 
s3:lib: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib:ldb: Add missing break in switch statement
Andreas Schneider [Mon, 1 Feb 2021 13:21:21 +0000 (14:21 +0100)] 
lib:ldb: Add missing break in switch statement

error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:gensec: Fix overflow issues in switch statement
Andreas Schneider [Mon, 1 Feb 2021 13:33:55 +0000 (14:33 +0100)] 
s4:gensec: Fix overflow issues in switch statement

error: overflow converting case value to switch condition type (-1765328344 to 2529638952) [-Werror,-Wswitch]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: Add missing lock free and file close in error path.
Jeremy Allison [Fri, 29 Jan 2021 19:38:07 +0000 (11:38 -0800)] 
s3: smbd: Add missing lock free and file close in error path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Feb  1 18:38:23 UTC 2021 on sn-devel-184

4 years agolibrpc: Simplify find_interface_by_binding()
Volker Lendecke [Wed, 27 Jan 2021 13:00:06 +0000 (14:00 +0100)] 
librpc: Simplify find_interface_by_binding()

Use find_interface_by_syntax_id() instead of duplicating the loop.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 28 18:03:53 UTC 2021 on sn-devel-184

4 years agolibrpc: Simplify find_interface_by_syntax_id()
Volker Lendecke [Wed, 27 Jan 2021 12:54:25 +0000 (13:54 +0100)] 
librpc: Simplify find_interface_by_syntax_id()

Directly use ndr_syntax_id_equal() instead of duplicating it with
interface_match_by_uuid().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Convert find_interface_by_uuid to search by syntax_id
Volker Lendecke [Wed, 27 Jan 2021 12:51:33 +0000 (13:51 +0100)] 
librpc: Convert find_interface_by_uuid to search by syntax_id

All callers manually dissected the syntax id for this API.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolib: Fix file_ploadv_send()/_recv()
Volker Lendecke [Tue, 26 Jan 2021 15:39:29 +0000 (16:39 +0100)] 
lib: Fix file_ploadv_send()/_recv()

When reading more than 1024 bytes, don't insert '\0' bytes in between
those chunks.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Fix a typo
Volker Lendecke [Tue, 26 Jan 2021 14:44:47 +0000 (15:44 +0100)] 
librpc: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Simplify dcesrv_check_or_create_context()
Volker Lendecke [Wed, 27 Jan 2021 08:49:33 +0000 (09:49 +0100)] 
librpc: Simplify dcesrv_check_or_create_context()

Use ndr_syntax_id_buf_string(), avoid a talloc/talloc_free

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agoepmapper: Simplify endpoints_match()
Volker Lendecke [Sun, 24 Jan 2021 14:40:11 +0000 (15:40 +0100)] 
epmapper: Simplify endpoints_match()

strequal() deals fine with either string being NULL. We only have to
take of the case where both are NULL.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Simplify dcerpc_binding_string()
Volker Lendecke [Sun, 24 Jan 2021 14:14:58 +0000 (15:14 +0100)] 
librpc: Simplify dcerpc_binding_string()

Make it follow a more conventional memory handling style for reallocs.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Simplify dcerpc_binding_string()
Volker Lendecke [Sun, 24 Jan 2021 14:07:47 +0000 (15:07 +0100)] 
librpc: Simplify dcerpc_binding_string()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agoepmapper: Simplify _epm_Map()
Volker Lendecke [Sun, 24 Jan 2021 11:35:07 +0000 (12:35 +0100)] 
epmapper: Simplify _epm_Map()

We have a routine to compare ndr_syntax_id, don't do it manually.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agorpc_server: Introduce "goto nomem;" to dcesrv_endpoint_connect()
Volker Lendecke [Wed, 20 Jan 2021 13:30:57 +0000 (14:30 +0100)] 
rpc_server: Introduce "goto nomem;" to dcesrv_endpoint_connect()

Avoid the control-flow changing NT_STATUS_HAVE_NO_MEMORY macro.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibwbclient: Fix wbcStringToGuid
Volker Lendecke [Sun, 24 Jan 2021 08:36:15 +0000 (09:36 +0100)] 
libwbclient: Fix wbcStringToGuid

The "x" sscanf conversion specifier requires an unsigned int. It is
likely that this is actually a uint32_t, don't rely on that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolib: Simplify parse_guid_string() and ndr_syntax_id_from_string()
Volker Lendecke [Sun, 24 Jan 2021 08:15:29 +0000 (09:15 +0100)] 
lib: Simplify parse_guid_string() and ndr_syntax_id_from_string()

Return "bool" instead of NTSTATUS, use hex_byte() instead of
read_hex_bytes(). And parse directly into a struct GUID instead of the
components. 99 lines less code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agos4-torture: Add a test for ndr_syntax_id_from_string()
Samuel Cabrero [Thu, 28 Jan 2021 12:14:49 +0000 (13:14 +0100)] 
s4-torture: Add a test for ndr_syntax_id_from_string()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos4-torture: Add a test for GUID_from_data_blob
Samuel Cabrero [Thu, 28 Jan 2021 11:37:30 +0000 (12:37 +0100)] 
s4-torture: Add a test for GUID_from_data_blob

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agodsdb: Avoid an unneeded #include
Volker Lendecke [Sun, 24 Jan 2021 08:21:23 +0000 (09:21 +0100)] 
dsdb: Avoid an unneeded #include

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Simplify dcerpc_binding_set_abstract_syntax()
Volker Lendecke [Fri, 22 Jan 2021 19:01:27 +0000 (20:01 +0100)] 
librpc: Simplify dcerpc_binding_set_abstract_syntax()

It might be a question of style, but I find it simpler this way.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Use ndr_syntax_id_buf_string() in dcerpc_binding_set_abstract_syntax()
Volker Lendecke [Fri, 22 Jan 2021 18:59:52 +0000 (19:59 +0100)] 
librpc: Use ndr_syntax_id_buf_string() in dcerpc_binding_set_abstract_syntax()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Use ndr_syntax_id_buf_string() in dcerpc_sec_vt_pctx_check()
Volker Lendecke [Fri, 22 Jan 2021 18:56:20 +0000 (19:56 +0100)] 
librpc: Use ndr_syntax_id_buf_string() in dcerpc_sec_vt_pctx_check()

"mem_ctx" is no longer needed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Add ndr_syntax_id_buf_string()
Volker Lendecke [Fri, 22 Jan 2021 18:50:04 +0000 (19:50 +0100)] 
librpc: Add ndr_syntax_id_buf_string()

Same pattern as GUID_buf_string()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibrpc: Add a NULL check to dcerpc_binding_build_tower()
Volker Lendecke [Fri, 22 Jan 2021 18:40:37 +0000 (19:40 +0100)] 
librpc: Add a NULL check to dcerpc_binding_build_tower()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agolibndr: Simplify ndr_print_GUID()
Volker Lendecke [Fri, 22 Jan 2021 18:33:51 +0000 (19:33 +0100)] 
libndr: Simplify ndr_print_GUID()

Fix a small memleak of the tmp GUID_string

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agovfs: restore platform specific POSIX sys_acl_set_file() functions
Ralph Boehme [Tue, 26 Jan 2021 14:50:00 +0000 (15:50 +0100)] 
vfs: restore platform specific POSIX sys_acl_set_file() functions

92b149954237a445594c993b79a860c63113d54b removed SMB_VFS_SYS_ACL_SET_FILE() and
all the VFS module implementations. But sys_acl_set_file() in vfs_default calls
into sys_acl_set_file() in sysacls.c which calls back into platform specific
modules.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Jan 28 15:21:02 UTC 2021 on sn-devel-184

4 years agovfs: update status of SMB_VFS_UNLINKAT()
Ralph Boehme [Fri, 22 Jan 2021 13:56:46 +0000 (14:56 +0100)] 
vfs: update status of SMB_VFS_UNLINKAT()

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): Thu Jan 28 09:16:30 UTC 2021 on sn-devel-184

4 years agos3/libadouble: use real dirfsp in ad_convert_delete_adfile()
Ralph Boehme [Fri, 22 Jan 2021 16:12:33 +0000 (17:12 +0100)] 
s3/libadouble: use real dirfsp in ad_convert_delete_adfile()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/libadouble: remove dirfsp arg from ad_convert_delete_adfile()
Ralph Boehme [Fri, 22 Jan 2021 16:06:26 +0000 (17:06 +0100)] 
s3/libadouble: remove dirfsp arg from ad_convert_delete_adfile()

Going to open a dirfsp in the function itself in a later commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/libadouble: remove dirfsp arg from ad_convert()
Ralph Boehme [Fri, 22 Jan 2021 16:03:30 +0000 (17:03 +0100)] 
s3/libadouble: remove dirfsp arg from ad_convert()

ad_convert() doesn't really need the dirfsp in most places. Only
ad_convert_delete_adfile() would use it, so instead open a dirfsp internally for
this function in a later commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use real dirfsp for SMB_VFS_UNLINKAT() in py_smbd_unlink()
Ralph Boehme [Fri, 22 Jan 2021 13:54:18 +0000 (14:54 +0100)] 
smbd: use real dirfsp for SMB_VFS_UNLINKAT() in py_smbd_unlink()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use real dirfsp for SMB_VFS_UNLINKAT() in remove_msdfs_link()
Ralph Boehme [Fri, 22 Jan 2021 13:51:33 +0000 (14:51 +0100)] 
smbd: use real dirfsp for SMB_VFS_UNLINKAT() in remove_msdfs_link()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs: update status of SMB_VFS_CREATE_DFS_PATHAT()
Ralph Boehme [Fri, 22 Jan 2021 13:52:31 +0000 (14:52 +0100)] 
vfs: update status of SMB_VFS_CREATE_DFS_PATHAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use real dirfsp for SMB_VFS_CREATE_DFS_PATHAT() in create_msdfs_link()
Ralph Boehme [Fri, 22 Jan 2021 13:49:01 +0000 (14:49 +0100)] 
smbd: use real dirfsp for SMB_VFS_CREATE_DFS_PATHAT() in create_msdfs_link()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use real dirfsp for SMB_VFS_UNLINKAT() in create_msdfs_link()
Ralph Boehme [Fri, 22 Jan 2021 13:47:13 +0000 (14:47 +0100)] 
smbd: use real dirfsp for SMB_VFS_UNLINKAT() in create_msdfs_link()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use real dirfsp with SMB_VFS_UNLINKAT() in rmdir_internals()
Ralph Boehme [Fri, 22 Jan 2021 13:40:36 +0000 (14:40 +0100)] 
smbd: use real dirfsp with SMB_VFS_UNLINKAT() in rmdir_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: reduce indentation in rmdir_internals()
Ralph Boehme [Fri, 22 Jan 2021 12:23:00 +0000 (13:23 +0100)] 
smbd: reduce indentation in rmdir_internals()

No change in behaviour. Best viewed with

$ git show -w

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: simplify rmdir_internals()
Ralph Boehme [Fri, 22 Jan 2021 12:14:28 +0000 (13:14 +0100)] 
smbd: simplify rmdir_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: README.Coding fixes in rmdir_internals()
Ralph Boehme [Fri, 22 Jan 2021 12:10:54 +0000 (13:10 +0100)] 
smbd: README.Coding fixes in rmdir_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use real dirfsp for SMB_VFS_UNLINKAT() in recursive_rmdir()
Ralph Boehme [Fri, 22 Jan 2021 11:49:56 +0000 (12:49 +0100)] 
smbd: use real dirfsp for SMB_VFS_UNLINKAT() in recursive_rmdir()

Also use synthetic_pathref() to ensure atname->fsp has a valid pathref as some
backends may make use of it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add dir_hnd_fetch_fsp()
Ralph Boehme [Fri, 22 Jan 2021 11:46:04 +0000 (12:46 +0100)] 
smbd: add dir_hnd_fetch_fsp()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add some space in recursive_rmdir()
Ralph Boehme [Fri, 22 Jan 2021 11:01:56 +0000 (12:01 +0100)] 
smbd: add some space in recursive_rmdir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: simplify recursive_rmdir()
Ralph Boehme [Fri, 22 Jan 2021 11:00:56 +0000 (12:00 +0100)] 
smbd: simplify recursive_rmdir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use real dirfsp and atname when deleting file in close_remove_share_mode()
Ralph Boehme [Thu, 21 Jan 2021 15:45:47 +0000 (16:45 +0100)] 
smbd: use real dirfsp and atname when deleting file in close_remove_share_mode()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopysmbd: use parent_pathref() in py_smbd_mkdir()
Ralph Boehme [Mon, 25 Jan 2021 14:51:05 +0000 (15:51 +0100)] 
pysmbd: use parent_pathref() in py_smbd_mkdir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use parent_pathref() in smb_set_file_unix_link()
Ralph Boehme [Mon, 25 Jan 2021 14:48:59 +0000 (15:48 +0100)] 
smbd: use parent_pathref() in smb_set_file_unix_link()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use parent_pathref() in smb_unix_mknod()
Ralph Boehme [Mon, 25 Jan 2021 14:46:04 +0000 (15:46 +0100)] 
smbd: use parent_pathref() in smb_unix_mknod()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use parent_pathref() in mkdir_internal()
Ralph Boehme [Mon, 25 Jan 2021 14:43:31 +0000 (15:43 +0100)] 
smbd: use parent_pathref() in mkdir_internal()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add parent_pathref()
Ralph Boehme [Thu, 21 Jan 2021 16:05:17 +0000 (17:05 +0100)] 
smbd: add parent_pathref()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4/torture: move deletion out of close loop in torture_smb2_maxfid()
Ralph Boehme [Fri, 22 Jan 2021 06:57:31 +0000 (07:57 +0100)] 
s4/torture: move deletion out of close loop in torture_smb2_maxfid()

A subsequent commit is changing the delete-on-close code in the fileserver to
open a handle on the parent directory of the file that is to be deleted.

If we've consumed all available handles, that open would fail causing a test
failure. As it's not really needed for the test semantics, don't set
delete-on-close when closing the handles, instead let the subsequent
smb2_deltree() do the cleanup.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: support real dirfsps in fruit_unlinkat()
Ralph Boehme [Thu, 21 Jan 2021 09:42:06 +0000 (10:42 +0100)] 
vfs_fruit: support real dirfsps in fruit_unlinkat()

Now that all callees are updated, we can remove the assert.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: support real dirfsps in fruit_unlink_rsrc_adouble()
Ralph Boehme [Thu, 21 Jan 2021 09:41:41 +0000 (10:41 +0100)] 
vfs_fruit: support real dirfsps in fruit_unlink_rsrc_adouble()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: support real dirfsps in fruit_unlink_rsrc_stream()
Ralph Boehme [Thu, 21 Jan 2021 09:41:19 +0000 (10:41 +0100)] 
vfs_fruit: support real dirfsps in fruit_unlink_rsrc_stream()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: use SMB_VFS_FREMOVEXATTR() in fruit_unlink_meta_netatalk()
Ralph Boehme [Thu, 21 Jan 2021 09:27:22 +0000 (10:27 +0100)] 
vfs_fruit: use SMB_VFS_FREMOVEXATTR() in fruit_unlink_meta_netatalk()

Use the pathref fsp from the caller.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_acl_common: support real dirfsps in acl_common_remove_object()
Ralph Boehme [Wed, 20 Jan 2021 15:08:58 +0000 (16:08 +0100)] 
vfs_acl_common: support real dirfsps in acl_common_remove_object()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_xattr_tdb: support real dirfsps in xattr_tdb_unlinkat()
Ralph Boehme [Wed, 20 Jan 2021 14:22:52 +0000 (15:22 +0100)] 
vfs_xattr_tdb: support real dirfsps in xattr_tdb_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_virusfilter: support real dirfsps in virusfilter_vfs_unlinkat()
Ralph Boehme [Wed, 20 Jan 2021 14:22:16 +0000 (15:22 +0100)] 
vfs_virusfilter: support real dirfsps in virusfilter_vfs_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_unityed_media: support real dirfsps in um_unlinkat()
Ralph Boehme [Wed, 20 Jan 2021 14:20:15 +0000 (15:20 +0100)] 
vfs_unityed_media: support real dirfsps in um_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_time_audit: support real dirfsps in smb_time_audit_unlinkat()
Ralph Boehme [Wed, 20 Jan 2021 14:19:59 +0000 (15:19 +0100)] 
vfs_time_audit: support real dirfsps in smb_time_audit_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: use synthetic_pathref() in delete_invalid_meta_stream()
Ralph Boehme [Thu, 21 Jan 2021 13:37:53 +0000 (14:37 +0100)] 
vfs_fruit: use synthetic_pathref() in delete_invalid_meta_stream()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: fix use after free in delete_invalid_meta_stream()
Ralph Boehme [Thu, 21 Jan 2021 13:36:59 +0000 (14:36 +0100)] 
vfs_fruit: fix use after free in delete_invalid_meta_stream()

sname is used in the DBG_ERR message.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_xattr: use pathref in streams_xattr_unlink_internal()
Ralph Boehme [Wed, 20 Jan 2021 14:19:31 +0000 (15:19 +0100)] 
vfs_streams_xattr: use pathref in streams_xattr_unlink_internal()

All callers now pass an smb_fname that has a valid pathref fsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use synthetic_pathref() in delete_all_streams()
Ralph Boehme [Wed, 20 Jan 2021 14:27:48 +0000 (15:27 +0100)] 
smbd: use synthetic_pathref() in delete_all_streams()

This ensures backends can use the pathref fsp as needed.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: use synthetic_pathref() in driver_unlink_internals()
Ralph Boehme [Mon, 25 Jan 2021 15:11:37 +0000 (16:11 +0100)] 
printing: use synthetic_pathref() in driver_unlink_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_fruit: use synthetic_pathref() in readdir_attr_meta_finderi_stream()
Ralph Boehme [Mon, 25 Jan 2021 15:10:12 +0000 (16:10 +0100)] 
vfs_fruit: use synthetic_pathref() in readdir_attr_meta_finderi_stream()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add synthetic_pathref()
Ralph Boehme [Thu, 21 Jan 2021 14:04:57 +0000 (15:04 +0100)] 
smbd: add synthetic_pathref()

Similar to synthetic_smb_fname(), but also opens a pathref fsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_depot: support real dirfsps in streams_depot_unlinkat()
Ralph Boehme [Thu, 21 Jan 2021 15:07:25 +0000 (16:07 +0100)] 
vfs_streams_depot: support real dirfsps in streams_depot_unlinkat()

Now that our callees support real dirfsps, remove the assert.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_depot: support real dirfsps in streams_depot_rmdir_internal()
Ralph Boehme [Thu, 21 Jan 2021 15:07:03 +0000 (16:07 +0100)] 
vfs_streams_depot: support real dirfsps in streams_depot_rmdir_internal()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_depot: support real dirfsps in streams_depot_unlink_internal()
Ralph Boehme [Thu, 21 Jan 2021 15:06:21 +0000 (16:06 +0100)] 
vfs_streams_depot: support real dirfsps in streams_depot_unlink_internal()

Also remove the smb_fname_base variable, just use full_fname. If
is_named_stream(full_fname)) returns false, full_fname->stream_name will be
NULL.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_streams_depot: remove indentation
Ralph Boehme [Thu, 21 Jan 2021 15:29:46 +0000 (16:29 +0100)] 
vfs_streams_depot: remove indentation

Makes the code easier to read.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_recycle: support real dirfsps in recycle_unlinkat()
Ralph Boehme [Wed, 20 Jan 2021 14:16:07 +0000 (15:16 +0100)] 
vfs_recycle: support real dirfsps in recycle_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_posix_eadb: support real dirfsps in posix_eadb_unlinkat()
Ralph Boehme [Wed, 20 Jan 2021 14:15:41 +0000 (15:15 +0100)] 
vfs_posix_eadb: support real dirfsps in posix_eadb_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs_posix_eadb: support real dirfsps in posix_eadb_rmdir_internal()
Ralph Boehme [Wed, 20 Jan 2021 14:15:25 +0000 (15:15 +0100)] 
vfs_posix_eadb: support real dirfsps in posix_eadb_rmdir_internal()

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