samba.git
3 years agos3: VFS: media_harmony: Fix mh_linkat() to cope with real directory fsps.
Jeremy Allison [Wed, 3 Feb 2021 20:36:27 +0000 (12:36 -0800)]
s3: VFS: media_harmony: Fix mh_linkat() to cope with real directory fsps.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
3 years agos3: VFS: full_audit: Fix smb_full_audit_linkat() to cope with real directory fsps.
Jeremy Allison [Mon, 1 Feb 2021 21:08:46 +0000 (13:08 -0800)]
s3: VFS: full_audit: Fix smb_full_audit_linkat() to cope with real directory fsps.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
3 years agos3: VFS: gluster: Fix vfs_gluster_linkat() to cope with real directory fsps.
Jeremy Allison [Tue, 19 Jan 2021 19:54:51 +0000 (11:54 -0800)]
s3: VFS: gluster: Fix vfs_gluster_linkat() to cope with real directory fsps.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
3 years agos3: VFS: ceph: Fix cephwrap_linkat() to cope with real directory fsps.
Jeremy Allison [Tue, 19 Jan 2021 19:04:12 +0000 (11:04 -0800)]
s3: VFS: ceph: Fix cephwrap_linkat() to cope with real directory fsps.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
3 years agos3: VFS: cap: Fix cap_linkat() to cope with real directory fsps.
Jeremy Allison [Mon, 1 Feb 2021 21:04:34 +0000 (13:04 -0800)]
s3: VFS: cap: Fix cap_linkat() to cope with real directory fsps.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
3 years agoRevert "VFS: shadow_copy2: Fixup shadow_copy2_mknodat() to correctly use the dirfsp...
Jeremy Allison [Wed, 3 Feb 2021 21:55:12 +0000 (13:55 -0800)]
Revert "VFS: shadow_copy2: Fixup shadow_copy2_mknodat() to correctly use the dirfsp path."

This isn't needed as the existing code will refuse a new name with
a non-zero twp in the target name.

This reverts commit 2f74056a916aef9925cae76016378b993560e22b.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
3 years agoRevert "VFS: shadow_copy2: Fixup shadow_copy2_symlinkat() to correctly use the dirfsp...
Jeremy Allison [Wed, 3 Feb 2021 21:52:33 +0000 (13:52 -0800)]
Revert "VFS: shadow_copy2: Fixup shadow_copy2_symlinkat() to correctly use the dirfsp path."

This isn't needed as the existing code will refuse a new name with
a non-zero twp in the target name.

This reverts commit ec27c4c44d1e9035639e033689fa739518f17132.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
3 years agosamba-tool: Add a gpo command for removing VGP Files Group Policy
David Mulder [Thu, 28 Jan 2021 16:21:42 +0000 (09:21 -0700)]
samba-tool: Add a gpo command for removing VGP Files Group Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Feb  8 23:36:57 UTC 2021 on sn-devel-184

3 years agosamba-tool: Test gpo manage files remove command
David Mulder [Wed, 27 Jan 2021 21:05:29 +0000 (14:05 -0700)]
samba-tool: Test gpo manage files remove command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosamba-tool: Add a gpo command for adding VGP Files Group Policy
David Mulder [Wed, 27 Jan 2021 20:21:32 +0000 (13:21 -0700)]
samba-tool: Add a gpo command for adding VGP Files Group Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosamba-tool: Test gpo manage files add command
David Mulder [Tue, 26 Jan 2021 20:43:43 +0000 (13:43 -0700)]
samba-tool: Test gpo manage files add command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosamba-tool: Add a gpo command for listing VGP Files Group Policy
David Mulder [Tue, 26 Jan 2021 17:46:27 +0000 (10:46 -0700)]
samba-tool: Add a gpo command for listing VGP Files Group Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosamba-tool: Test gpo manage files list command
David Mulder [Tue, 26 Jan 2021 17:07:18 +0000 (10:07 -0700)]
samba-tool: Test gpo manage files list command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogpo: Apply Group Policy Files Policy from VGP
David Mulder [Mon, 25 Jan 2021 15:13:18 +0000 (08:13 -0700)]
gpo: Apply Group Policy Files Policy from VGP

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogpo: Test Group Policy VGP Files Policy
David Mulder [Fri, 22 Jan 2021 17:09:55 +0000 (10:09 -0700)]
gpo: Test Group Policy VGP Files Policy

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoctdb-tests: Actually wait for record to migrate to lmaster node
Martin Schwenke [Tue, 2 Feb 2021 01:45:04 +0000 (12:45 +1100)]
ctdb-tests: Actually wait for record to migrate to lmaster node

This test has been failing with:

  Wait until record is migrated to lmaster node 0
  <30|BAD: node 0 is not dmaster
  dmaster: 1
  rsn: 8
  flags: 0x00010000 MIGRATED_WITH_DATA
  data(6) = "value1"
  *** TEST COMPLETED (RC=1) AT 2021-02-02 06:18:48, CLEANING UP...

This should never happen.  If this really fails then the wait should
time out.

The problem is that wait_until() does:

  "$@" || _rc=$?

and vacuum_test_key_dmaster() currently calls ctdb_test_fail() on
failure, which causes the shell to exit.  Instead, pass a variant to
wait_until() that simply returns the correct status instead of
exiting.

An alternative would be to change the statement in wait_until() to do:

  ("$@") || _rc=$?

so it captures the exit.  However, this is a global change and
requires more thought.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from call_trans2findfirst()
Ralph Boehme [Tue, 2 Feb 2021 15:01:19 +0000 (16:01 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from call_trans2findfirst()

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 Feb  5 07:26:44 UTC 2021 on sn-devel-184

3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()
Ralph Boehme [Tue, 2 Feb 2021 15:00:32 +0000 (16:00 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()
Ralph Boehme [Tue, 2 Feb 2021 14:58:57 +0000 (15:58 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from copy_file()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()
Ralph Boehme [Tue, 2 Feb 2021 14:58:42 +0000 (15:58 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()
Ralph Boehme [Tue, 2 Feb 2021 14:58:30 +0000 (15:58 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from rename_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from reply_search()
Ralph Boehme [Tue, 2 Feb 2021 14:57:26 +0000 (15:57 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from reply_search()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from create_file_unixpath()
Ralph Boehme [Tue, 2 Feb 2021 14:57:09 +0000 (15:57 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from create_file_unixpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from open_streams_for_del...
Ralph Boehme [Tue, 2 Feb 2021 14:56:44 +0000 (15:56 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from open_streams_for_delete()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from parent_pathref()
Ralph Boehme [Tue, 2 Feb 2021 14:56:26 +0000 (15:56 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from parent_pathref()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from synthetic_pathref()
Ralph Boehme [Tue, 2 Feb 2021 14:56:16 +0000 (15:56 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from synthetic_pathref()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from get_file_handle_for_...
Ralph Boehme [Tue, 2 Feb 2021 14:54:43 +0000 (15:54 +0100)]
smbd: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from get_file_handle_for_metadata()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonet: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from openat_pathref_fsp()
Ralph Boehme [Tue, 2 Feb 2021 14:54:02 +0000 (15:54 +0100)]
net: remove NT_STATUS_STOPPED_ON_SYMLINK status code check from openat_pathref_fsp()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: don't return NT_STATUS_STOPPED_ON_SYMLINK in openat_pathref_fsp()
Ralph Boehme [Tue, 2 Feb 2021 10:18:54 +0000 (11:18 +0100)]
smbd: don't return NT_STATUS_STOPPED_ON_SYMLINK in openat_pathref_fsp()

NT_STATUS_STOPPED_ON_SYMLINK is returned when trying to open a symlink, most
callers are not interested in this.

Some callers that would want to know whether openat_pathref_fsp() failed
specifically on a symlink are setup_close_full_information(),
smbd_dirptr_get_entry(), unlink_internals() and filename_convert_internal(), so
we fix those callers to handle the symlink case themselves.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: simplify error codepath in openat_pathref_fsp()
Ralph Boehme [Tue, 2 Feb 2021 12:49:56 +0000 (13:49 +0100)]
smbd: simplify error codepath in openat_pathref_fsp()

No change in behaviour: the cleanup code at the fail label does the same as the
cleanup this patch removes. It has an extra fd_close() that is not existing in
the removed cleanup, but as fsp->fd is -1, that's a noop.

And when previously the

return NT_STATUS_OBJECT_NAME_NOT_FOUND;

returns an an explicit status code, when now doing goto fail status will also be
set to NT_STATUS_OBJECT_NAME_NOT_FOUND.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: expect valid stat info in openat_pathref_fsp()
Ralph Boehme [Mon, 1 Feb 2021 09:17:13 +0000 (10:17 +0100)]
smbd: expect valid stat info in openat_pathref_fsp()

We're never creating files here, so instead of waiting for the underlying open()
to return ENOENT, just check that we have valid stat info, expecting all callers
to have called SMB_VFS_[L]STAT() on the smb_fname.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: stat path before calling openat_pathref_fsp() in smbd_dirptr_get_entry()
Ralph Boehme [Mon, 1 Feb 2021 11:09:39 +0000 (12:09 +0100)]
smbd: stat path before calling openat_pathref_fsp() in smbd_dirptr_get_entry()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: move smb_fname creation to earlier point in smbd_dirptr_get_entry()
Ralph Boehme [Mon, 1 Feb 2021 11:04:49 +0000 (12:04 +0100)]
smbd: move smb_fname creation to earlier point in smbd_dirptr_get_entry()

No change in behaviour. Makes way for the next commit adding additional logic.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: stat path before calling openat_pathref_fsp() in open_pathref_base_fsp()
Ralph Boehme [Mon, 1 Feb 2021 11:04:01 +0000 (12:04 +0100)]
smbd: stat path before calling openat_pathref_fsp() in open_pathref_base_fsp()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: remove a redundant fstat()in create_file_unixpath()
Ralph Boehme [Mon, 1 Feb 2021 11:03:08 +0000 (12:03 +0100)]
smbd: remove a redundant fstat()in create_file_unixpath()

openat_pathref_fsp() deep inside already calls fstat().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: call stat before openat_pathref_fsp() in create_file_unixpath()
Ralph Boehme [Mon, 1 Feb 2021 11:01:22 +0000 (12:01 +0100)]
smbd: call stat before openat_pathref_fsp() in create_file_unixpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: fix a resource leak in create_file_unixpath()
Ralph Boehme [Mon, 1 Feb 2021 11:01:01 +0000 (12:01 +0100)]
smbd: fix a resource leak in create_file_unixpath()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: stat path before calling openat_pathref_fsp() in unlink_internals()
Ralph Boehme [Mon, 1 Feb 2021 11:00:35 +0000 (12:00 +0100)]
smbd: stat path before calling openat_pathref_fsp() in unlink_internals()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3/libadouble: stat path before calling openat_pathref_fsp() in ad_unconvert_open_ad()
Ralph Boehme [Mon, 1 Feb 2021 10:59:37 +0000 (11:59 +0100)]
s3/libadouble: stat path before calling openat_pathref_fsp() in ad_unconvert_open_ad()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: don't overwrite _mode if neither a msdfs symlink nor get_dosmode is requested
Ralph Boehme [Mon, 1 Feb 2021 11:37:10 +0000 (12:37 +0100)]
smbd: don't overwrite _mode if neither a msdfs symlink nor get_dosmode is requested

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoCI: verify a symlink has FILE_ATTRIBUTE_NORMAL set
Ralph Boehme [Mon, 1 Feb 2021 13:44:03 +0000 (14:44 +0100)]
CI: verify a symlink has FILE_ATTRIBUTE_NORMAL set

Not that it really makes sense to set FILE_ATTRIBUTE_NORMAL for symlinks in
POSIX client context, but that's what we had before 4.14.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib:util: Avoid free'ing our own pointer
Andreas Schneider [Tue, 2 Feb 2021 17:10:38 +0000 (18:10 +0100)]
lib:util: Avoid free'ing our own pointer

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Feb  3 10:57:01 UTC 2021 on sn-devel-184

3 years agolib:util: Add cache oversize test for memcache
Andreas Schneider [Wed, 3 Feb 2021 09:37:12 +0000 (10:37 +0100)]
lib:util: Add cache oversize test for memcache

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agolib:util: Add basic memcache unit test
Andreas Schneider [Wed, 3 Feb 2021 09:30:08 +0000 (10:30 +0100)]
lib:util: Add basic memcache unit test

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agodbcheck: Check Deleted Objects and reduce noise in reports about expired tombstones
Andrew Bartlett [Thu, 10 Dec 2020 03:03:49 +0000 (16:03 +1300)]
dbcheck: Check Deleted Objects and reduce noise in reports about expired tombstones

These reports (about recently deleted objects)
create concern about a perfectly normal part of DB operation.

We must not operate on objects that are expired or we might reanimate them,
but we must fix "Deleted Objects" if it is wrong (mostly it is set as being
deleted in 9999, but in alpha19 we got this wrong).

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>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Feb  3 05:29:11 UTC 2021 on sn-devel-184

3 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>
3 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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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

3 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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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

3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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

3 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

3 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>