samba.git
2 years agoVERSION: Disable GIT_SNAPSHOT for the 4.14.6 release. samba-4.14.6
Karolin Seeger [Tue, 13 Jul 2021 10:25:23 +0000 (12:25 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.14.6 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agoWHATSNEW: Add release notes for Samba 4.14.6.
Karolin Seeger [Tue, 13 Jul 2021 10:24:33 +0000 (12:24 +0200)]
WHATSNEW: Add release notes for Samba 4.14.6.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agosmbXsrv_{open,session,tcon}: protect smbXsrv_{open,session,tcon}_global_traverse_fn...
Stefan Metzmacher [Mon, 5 Jul 2021 15:17:30 +0000 (17:17 +0200)]
smbXsrv_{open,session,tcon}: protect smbXsrv_{open,session,tcon}_global_traverse_fn against invalid records

I saw systems with locking.tdb records being part of:
  ctdb catdb smbXsrv_tcon_global.tdb

It's yet unknown how that happened, but we should not panic in srvsvc_*
calls because the info0 pointer was NULL.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul  6 11:08:43 UTC 2021 on sn-devel-184

(cherry picked from commit 00bab5b3c821f272153a25ded9743460887a7907)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Mon Jul 12 13:52:06 UTC 2021 on sn-devel-184

2 years agogensec_krb5: restore ipv6 support for kpasswd
Stefan Metzmacher [Fri, 2 Jul 2021 07:37:25 +0000 (09:37 +0200)]
gensec_krb5: restore ipv6 support for kpasswd

We need to offer as much space we have in order to
get the address out of tsocket_address_bsd_sockaddr().

This fixes a regression in commit
43c808f2ff907497dfff0988ff90a48fdcfc16ef.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 0388a8f33bdde49f1cc805a0291859203c1a52b4)

2 years agonetcmd: Use next_free_rid() function to calculate a SID for restoring a backup
Joseph Sutton [Thu, 27 May 2021 03:35:35 +0000 (15:35 +1200)]
netcmd: Use next_free_rid() function to calculate a SID for restoring a backup

This means we won't get errors if the DC doesn't have a rIDNextRID
attribute, but we will still error if there is no RID Set or if all its
pools are exhausted.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 59d293b60608172ae61551c642d13d3b215924e4)

2 years agopython/tests/dsdb: Add tests for RID allocation functions
Joseph Sutton [Mon, 24 May 2021 04:46:28 +0000 (16:46 +1200)]
python/tests/dsdb: Add tests for RID allocation functions

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 7c7cad81844950c3efe9a540a47b9d4e1ce1b2a1)

2 years agodsdb: Add next_free_rid() function to allocate a RID without modifying the database
Joseph Sutton [Mon, 24 May 2021 00:59:59 +0000 (12:59 +1200)]
dsdb: Add next_free_rid() function to allocate a RID without modifying the database

If used to generate SIDs for objects, care should be taken, as the
possibility for having duplicate objectSIDs can arise.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit cc98e03e7a0f2bf7a1ace2950fe6500f53640c1b)

2 years agonetcmd: Add tests for performing an offline backup immediately after joining a domain
Joseph Sutton [Mon, 24 May 2021 02:58:40 +0000 (14:58 +1200)]
netcmd: Add tests for performing an offline backup immediately after joining a domain

This currently fails due to the DC not having a rIDNextRID attribute,
which is required for the restore process.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit b7e6a1c5da7283c49586dc29f85ab19e0e57b0f6)

2 years agonetcmd: Ignore rIDUsedPool attribute in offline domain backup test
Joseph Sutton [Wed, 26 May 2021 01:40:30 +0000 (13:40 +1200)]
netcmd: Ignore rIDUsedPool attribute in offline domain backup test

The RID Set of the newly created DC account has all its values
initialised to zero. If the rIDUsedPool attribute was previously
non-zero, then the restore process will cause its value to change.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 658e5a6cc20b57f48477affd370fe25458178b92)

2 years agonetcmd: Fix error-checking condition
Joseph Sutton [Mon, 24 May 2021 04:40:55 +0000 (16:40 +1200)]
netcmd: Fix error-checking condition

This condition probably meant to check the argument of the most recently
thrown exception, rather than the previous one again.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit e8c242bed19432d96e78dc345ab5f06422c5b104)

2 years agonetcmd: Avoid database corruption by opting not to create database files during an...
Joseph Sutton [Tue, 16 Mar 2021 09:20:21 +0000 (22:20 +1300)]
netcmd: Avoid database corruption by opting not to create database files during an offline domain backup

If backup dirs contain hardlinks, the backup process could previously
attempt to open an LMDB database already opened during the backup,
causing it to be recreated as a new TDB database. This commit ensures
that new database files are not created during this operation, and that
the main SamDB database is not modified.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit 4cf773591d49166b8c7ef8d637d7edfe755d48aa)

2 years agonetcmd: Determine which files are to be copied for an offline domain backup
Joseph Sutton [Tue, 16 Mar 2021 03:22:40 +0000 (16:22 +1300)]
netcmd: Determine which files are to be copied for an offline domain backup

The old behaviour attempted to check for and remove files with duplicate
names, but did not do so due to a bug, and would have left undetermined
which files were given priority when duplicate filenames were present.
Now when hardlinks are present, only one instance of each file is
chosen, with files in the private directory having priority. If one
backup dir is nested inside another, the files contained in the nested
directory are only added once. Additionally, the BIND DNS database is
omitted from the backup.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit 3723148e7aa7e6d4a48a1a38112f121f52b6ee6f)

2 years agonetcmd: Add test for an offline backup of nested directories
Joseph Sutton [Wed, 17 Mar 2021 21:52:52 +0000 (10:52 +1300)]
netcmd: Add test for an offline backup of nested directories

This test verifies that when performing an offline backup of a domain
where one of the directories to be backed up is nested inside another,
the contained files are only included once in the backup.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit f994783f4279884ec4d2ee3e7db80fb7af267d1c)

2 years agonetcmd: Add test for an offline backup of a directory containing hardlinks
Joseph Sutton [Tue, 16 Mar 2021 03:13:05 +0000 (16:13 +1300)]
netcmd: Add test for an offline backup of a directory containing hardlinks

This test verifies that when performing an offline backup of a domain
where the directories to be backed up contain hardlinks, only one
instance of each file is backed up, and that files in the private
directory take precedence.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
(cherry picked from commit 0e5738887524b467bfebcf657bcb00ed71827784)

2 years agomdssvc: avoid direct filesystem access, use the VFS
Ralph Boehme [Mon, 10 May 2021 10:34:32 +0000 (12:34 +0200)]
mdssvc: avoid direct filesystem access, use the VFS

This ensures mdssvc uses the same FileIDs as the fileserver as well as Spotlight
can be used working on a virtual filesystem like GlusterFS.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14740
RN: Spotlight RPC service doesn't work with vfs_glusterfs

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): Wed Jun 16 05:59:13 UTC 2021 on sn-devel-184

(backported from commit 620b99144359f45aa69c13731db8d793cfbba197)
[slow@samba.org: smbd_check_access_rights_fsp() doesn't take dirfsp arg]

2 years agomdssvc: chdir() to the conn of the RPC request
Ralph Boehme [Tue, 15 Jun 2021 12:14:52 +0000 (14:14 +0200)]
mdssvc: chdir() to the conn of the RPC request

In preperation of calling VFS functions.

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

Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6de3a88494b5932d0fd10f5c8c8ec57916aeefc5)

2 years agomdssvc: maintain a connection struct in the mds_ctx
Ralph Boehme [Mon, 10 May 2021 10:10:08 +0000 (12:10 +0200)]
mdssvc: maintain a connection struct in the mds_ctx

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8b681cfb5d9b1ece03f7e7b9d3a08ae6c461d679)

2 years agosmbd: add create_conn_struct_cwd()
Ralph Boehme [Fri, 28 May 2021 07:25:22 +0000 (09:25 +0200)]
smbd: add create_conn_struct_cwd()

Compared to create_conn_struct_tos_cwd() this takes a TALLOC_CTX and
tevent_context as additional arguments and the resulting connection_struct is
stable across the lifetime of mem_ctx and ev.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 9a2d6bcfd5797dd4db764921548c8dca6dd0eb21)

2 years agosmbd: pass tevent context to create_conn_struct_as_root()
Ralph Boehme [Tue, 15 Jun 2021 09:17:57 +0000 (11:17 +0200)]
smbd: pass tevent context to create_conn_struct_as_root()

The next commit will add another caller of create_conn_struct_as_root() that is
going to pass a long-lived tevent context.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 16c39b81d6f2c7d75cfe72bbbe2f6a5bde42c7b0)

2 years agomdssvc: pass messaging context to mds_init_ctx()
Ralph Boehme [Mon, 10 May 2021 10:08:17 +0000 (12:08 +0200)]
mdssvc: pass messaging context to mds_init_ctx()

This is needed in a subsequent commit. Note that I prefer to do the event
context unwrapping in the caller and pass both the event and messaging context
explicitly to mds_init_ctx().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 1ef2828e1025e4c89292df1dfa6161c4453b3afe)

2 years agomdssvc: don't fail mds_add_result() if result is not found in CNID set
Ralph Boehme [Mon, 10 May 2021 09:07:27 +0000 (11:07 +0200)]
mdssvc: don't fail mds_add_result() if result is not found in CNID set

Just skip adding the result to the pending results set, don't return an
error. Returning an error triggers an error at the MDSSVC RPC error which is NOT
what we want here.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8847f46f75ac5c1a753a0e7da88c522be25ef681)

2 years agomdssvc: use a helper variable in mds_add_result()
Ralph Boehme [Mon, 10 May 2021 09:04:38 +0000 (11:04 +0200)]
mdssvc: use a helper variable in mds_add_result()

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e2486d76b611f07b85b26c54fe14da7b76bd01c2)

2 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>
(cherry picked from commit d9f95b8cefe2d1c8020592434481025aa1045e2f)

2 years agos3: smbd: Remove erroneous TALLOC_FREE(smb_fname_parent) in change_file_owner_to_pare...
Jeremy Allison [Wed, 9 Jun 2021 19:22:26 +0000 (12:22 -0700)]
s3: smbd: Remove erroneous TALLOC_FREE(smb_fname_parent) in change_file_owner_to_parent() error path.

Caller is still using this !

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power<npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Fri Jun 11 10:17:46 UTC 2021 on sn-devel-184

(cherry picked from commit 4f20d310af2bb1f96dea4810a7130492cc4cfc55)

2 years agos3/modules: fchmod: fallback to path based chmod if pathref
Ralph Boehme [Fri, 9 Apr 2021 12:58:34 +0000 (14:58 +0200)]
s3/modules: fchmod: fallback to path based chmod if pathref

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

Signed-off-by: Noel Power <noel.power@suse.com>
Signed-off-by: Ralph Boehme <slow@samba.org>
Back-ported from master commit 6ad10836d6e04d8c95773e9122b63f5a5e040487)

2 years agos3: VFS: default: Add proc_fd's fallback for vfswrap_fchown().
Jeremy Allison [Wed, 9 Jun 2021 22:57:38 +0000 (15:57 -0700)]
s3: VFS: default: Add proc_fd's fallback for vfswrap_fchown().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Jun 10 09:16:22 UTC 2021 on sn-devel-184

(cherry picked from commit f44918e6c83c89936156eb24c982a897c9c45f61)

2 years agos3: lib: Fix talloc heirarcy error in parent_smb_fname().
Jeremy Allison [Tue, 1 Jun 2021 20:27:47 +0000 (13:27 -0700)]
s3: lib: Fix talloc heirarcy error in parent_smb_fname().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit c500d99e2f5aaec102bf952b7941a2596b3e35a1)

2 years agosmbd: fix pathref unlinking in create_file_unixpath()
Jeremy Allison [Tue, 8 Jun 2021 16:53:18 +0000 (18:53 +0200)]
smbd: fix pathref unlinking in create_file_unixpath()

This is really subtle. If someone passes in an smb_fname where smb_fname
actually is taken from fsp->fsp_name, then the lifetime of these objects is
meant to be the same.

This is commonly the case from an SMB1 path-based call
(eg call_trans2qfilepathinfo()) where we use the pathref fsp
(smb_fname->fsp) as the handle. In this case we must not unlink smb_fname->fsp
from it's owner.

The asserts below:

  SMB_ASSERT(fsp->fsp_name->fsp != NULL);
  SMB_ASSERT(fsp->fsp_name->fsp == fsp);

ensure the required invarients are met.

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

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Jun  8 20:44:41 UTC 2021 on sn-devel-184

(cherry picked from commit 8a427783e5e780d3ffbe4f9710ac4a17c483ca33)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Thu Jun 10 10:31:11 UTC 2021 on sn-devel-184

2 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()

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

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

(cherry picked from commit 1b3d70e9ae95892a70bd0f46ae5bf733c1bc9548)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5898f5769e0b126cca33ba0002f1e4c3eb80d21a)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 544767f72df366baf50be6d841e36dbcbe9f4065)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8999c7d69c6312c7e7bef93417ecef93ddbdabf5)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f21eb28cb8737d3125e4c0c65545f93dd7ea863f)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6c2dad2aaef5eab75f3fe14219e9eca6724d6c99)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 300d851a89248ac9b220fbac55cd5daaebb7fbca)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f121374514ed6957b9c6d022a17cc4e5c8aea9a6)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0d454f34db52d2903c830e1f1acd56a9a1dca04b)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6e7142ba6c79c9c6f3ce299b6c7dd476cc229e6b)

2 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.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 977f37643b223e164fbbf6c3ba1d37aa546ddb7d)

2 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.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit cd3d970c84b340630745bc555a86ac2d1306baac)

2 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.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 48bc561d1a8bb5ce99663b58a2e5e9aa344af96a)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 87e97e1b519159b5f4c5ed4ef684783855e79ac3)

2 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.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b3a0d6a128989b593f135c425dd59351d13b6120)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit c31fe2f9e7d65409229b7ad73418793ab34d359d)

2 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().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 91edc50dc0aaa82d9ede7a7f8cf0f63312eb8503)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit aa0ef26d1e9dcef0bcb47974d7cf60db922d7d08)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e636e20f90d4ee221ce6e20cab15a3cecb03850f)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ab82dbc5ae43cdb661bf49627a84926163bc8998)

2 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()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4f30c04462fb1536323606dd4216fe5e32458ba5)

2 years agoVERSION: Bump version up to 4.14.6...
Karolin Seeger [Mon, 31 May 2021 09:18:34 +0000 (11:18 +0200)]
VERSION: Bump version up to 4.14.6...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agoVERSION: Disable GIT_SNAPSHOT for the 4.14.5 release. samba-4.14.5
Karolin Seeger [Mon, 31 May 2021 09:17:22 +0000 (11:17 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.14.5 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agoWHATSNEW: Add release notes for Samba 4.14.5.
Karolin Seeger [Mon, 31 May 2021 09:07:52 +0000 (11:07 +0200)]
WHATSNEW: Add release notes for Samba 4.14.5.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
2 years agos3: smbd: Fix uninitialized memory read in process_symlink_open() when used with...
Jeremy Allison [Thu, 27 May 2021 05:41:53 +0000 (22:41 -0700)]
s3: smbd: Fix uninitialized memory read in process_symlink_open() when used with vfs_shadow_copy2().

Valgrind trace follows.

==3627798== Invalid read of size 1
==3627798==    at 0x483FF46: strlen (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3627798==    by 0x55DE412: strdup (strdup.c:41)
==3627798==    by 0x4F4657E: smb_xstrdup (util.c:660)
==3627798==    by 0x4C62C2E: vfs_ChDir (vfs.c:988)
==3627798==    by 0x4C4A51C: process_symlink_open (open.c:656)
==3627798==    by 0x4C4ADE7: non_widelink_open (open.c:862)
==3627798==    by 0x4C4AFB7: fd_openat (open.c:918)
==3627798==    by 0x4BBE895: openat_pathref_fsp (files.c:506)
==3627798==    by 0x4C48A00: filename_convert_internal (filename.c:2027)
==3627798==    by 0x4C48B77: filename_convert (filename.c:2067)
==3627798==    by 0x4C32408: call_trans2qfilepathinfo (trans2.c:6173)
==3627798==    by 0x4C3C5DA: handle_trans2 (trans2.c:10143)
==3627798==  Address 0xda8bc90 is 96 bytes inside a block of size 217 free'd
==3627798==    at 0x483DA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3627798==    by 0x4FCA3C9: _tc_free_internal (talloc.c:1222)
==3627798==    by 0x4FCA481: _talloc_free_internal (talloc.c:1248)
==3627798==    by 0x4FCB825: _talloc_free (talloc.c:1792)
==3627798==    by 0xDB248DD: store_cwd_data (vfs_shadow_copy2.c:1473)
==3627798==    by 0xDB24BEF: shadow_copy2_chdir (vfs_shadow_copy2.c:1542)
==3627798==    by 0x4C662A4: smb_vfs_call_chdir (vfs.c:2257)
==3627798==    by 0x4C62B48: vfs_ChDir (vfs.c:940)
==3627798==    by 0x4C4A51C: process_symlink_open (open.c:656)
==3627798==    by 0x4C4ADE7: non_widelink_open (open.c:862)
==3627798==    by 0x4C4AFB7: fd_openat (open.c:918)
==3627798==    by 0x4BBE895: openat_pathref_fsp (files.c:506)
==3627798==  Block was alloc'd at
==3627798==    at 0x483C7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3627798==    by 0x4FC9365: __talloc_with_prefix (talloc.c:783)
==3627798==    by 0x4FC94FF: __talloc (talloc.c:825)
==3627798==    by 0x4FCCFDC: __talloc_strlendup (talloc.c:2454)
==3627798==    by 0x4FCD096: talloc_strdup (talloc.c:2470)
==3627798==    by 0xDB24977: store_cwd_data (vfs_shadow_copy2.c:1476)
==3627798==    by 0xDB24BEF: shadow_copy2_chdir (vfs_shadow_copy2.c:1542)
==3627798==    by 0x4C662A4: smb_vfs_call_chdir (vfs.c:2257)
==3627798==    by 0x4C62B48: vfs_ChDir (vfs.c:940)
==3627798==    by 0x4C4A92D: non_widelink_open (open.c:755)
==3627798==    by 0x4C4AFB7: fd_openat (open.c:918)
==3627798==    by 0x4BBE895: openat_pathref_fsp (files.c:506)
==3627798==

Even though SMB_VFS_CONNECTPATH() returns a const char,
vfs_shadow_copy2() can free and reallocate this whilst
in use inside process_symlink_open().

Take a copy to make sure we don't reference free'd memory.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May 27 17:25:43 UTC 2021 on sn-devel-184

(cherry picked from commit 2f0cfe82907516ecf23cc385d41b8d29ed6b8c96)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Fri May 28 08:55:50 UTC 2021 on sn-devel-184

2 years agodocs: Update list of available commands in rpcclient
Pavel Filipenský [Wed, 19 May 2021 11:12:31 +0000 (13:12 +0200)]
docs: Update list of available commands in rpcclient

The list of available commands in rpcclient.1 manpage is updated to
match the current state, which is visible via help commnad of rpcclient.

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 2d7740f65c69497de665043051228f6315de4f5c)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Wed May 26 12:45:16 UTC 2021 on sn-devel-184

2 years agos3:rpcclient: Document command of witness protocol
Pavel Filipenský [Wed, 19 May 2021 12:51:00 +0000 (14:51 +0200)]
s3:rpcclient: Document command of witness protocol

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 139cefceca20bd21ad557830f551eb51b343c660)

2 years agodocs-xml: Update smbcacls manpage
Pavel Filipenský [Wed, 19 May 2021 13:10:36 +0000 (15:10 +0200)]
docs-xml: Update smbcacls manpage

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 9d9ed421b26f733c59f9fac44e2034df704cef6a)

2 years agosmbd: correctly initialize close timestamp fields
Ralph Boehme [Mon, 24 May 2021 10:03:28 +0000 (12:03 +0200)]
smbd: correctly initialize close timestamp fields

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May 24 16:56:22 UTC 2021 on sn-devel-184

(cherry picked from commit f96cc29711181b5237a5b92c4bfb5e75fe2a73b9)

2 years agotorture: add a test that verifies SMB2 close fields without postqueryattrib
Ralph Boehme [Mon, 24 May 2021 10:21:38 +0000 (12:21 +0200)]
torture: add a test that verifies SMB2 close fields without postqueryattrib

The server must set all fields to 0 if postqueryattrib is not set.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ac9042ff4dc6c892764abd23a9445116ad40e62a)

2 years agoctdb: Fix a crash in run_proc_signal_handler()
Volker Lendecke [Tue, 18 May 2021 06:32:45 +0000 (08:32 +0200)]
ctdb: Fix a crash in run_proc_signal_handler()

If a script times out the caller can talloc_free() the script_list
output of run_event_recv, which talloc_free's proc->output from
run_proc.c as well. If the script generates further output after the
timeout and then exits after a while, the SIGCHLD handler in the
eventd tries to read into proc->output, which was already free'ed.

Fix this by not doing just a talloc_steal but a talloc_move. This way
proc_read_handler() called from run_proc_signal_handler() does not try
to realloc the stale reference to proc->output but gets a NULL
reference.

I don't really know how to do a knownfail in ctdb, so this commit
actually activates catching the signal by waiting long enough for
22.bar to exit and generate the SIGCHLD.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit adef87a621b17baf746d12f991c60a8a3ffcfcd3)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Tue May 25 09:51:20 UTC 2021 on sn-devel-184

2 years agoctdb: Introduce output before and after the 10-second timeout
Volker Lendecke [Tue, 18 May 2021 06:28:16 +0000 (08:28 +0200)]
ctdb: Introduce output before and after the 10-second timeout

This will lead to a crash in run_event_test.c soon

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit f320d1a7ab0f81eefdb28b36bfe346eacb8980de)

2 years agoctdb: Wait for SIGCHLD if script timed out
Volker Lendecke [Tue, 18 May 2021 06:23:05 +0000 (08:23 +0200)]
ctdb: Wait for SIGCHLD if script timed out

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 19290f10c7d39e055847eb45affd9e229a116b18)

2 years agoctdb: Introduce a helper variable in run_event_test.c
Volker Lendecke [Tue, 18 May 2021 06:18:25 +0000 (08:18 +0200)]
ctdb: Introduce a helper variable in run_event_test.c

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 07ab9b7a71d59f3ff2b9dee662632315062213ab)

2 years agoctdb: Call run_event_recv() in a callback function
Volker Lendecke [Tue, 18 May 2021 06:01:06 +0000 (08:01 +0200)]
ctdb: Call run_event_recv() in a callback function

Triggers a different code path in run_event_* and aligns it more what
the ctdb eventd really does.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 9398d4b912387be8cde0c2ca30734eca7d547d19)

2 years agoctdb: fix typos
Volker Lendecke [Fri, 7 May 2021 15:36:58 +0000 (17:36 +0200)]
ctdb: fix typos

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit f188c9d732e4b9b3d37c4cb09608aba747845997)

2 years agos3: smbd: Ensure POSIX default ACL is mapped into returned Windows ACL for directory...
Jeremy Allison [Mon, 17 May 2021 22:34:55 +0000 (15:34 -0700)]
s3: smbd: Ensure POSIX default ACL is mapped into returned Windows ACL for directory handles.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed May 19 09:22:56 UTC 2021 on sn-devel-184

(cherry picked from commit b7f62e13933da14c381f70cd46ad13849b108e68)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Fri May 21 07:59:08 UTC 2021 on sn-devel-184

3 years agolib:replace: Do not build strndup test with gcc 11 or newer
Andreas Schneider [Thu, 6 May 2021 17:07:04 +0000 (19:07 +0200)]
lib:replace: Do not build strndup test with gcc 11 or newer

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

gcc11 with -O3 detects that the size is incorrect:

lib/replace/tests/testsuite.c:286:13: error: ‘strndup’ specified bound 10 exceeds source size 4 [-Werror=stringop-overread]
  286 |         x = strndup("bla", 10);
      |             ^~~~~~~~~~~~~~~~~~

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 8f12793ca5e7c9aa7c23a17400986878ae110e70)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Wed May 12 09:07:45 UTC 2021 on sn-devel-184

3 years agoFix gcc11 compiler issue "-Werror=stringop-overflow="
Günther Deschner [Mon, 3 May 2021 19:27:58 +0000 (21:27 +0200)]
Fix gcc11 compiler issue "-Werror=stringop-overflow="

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

[3548/3991] Compiling source3/winbindd/winbindd_pam.c
../../source3/winbindd/winbindd_pam.c: In function ‘winbindd_dual_pam_auth_cached’:
../../source3/winbindd/winbindd_pam.c:1069:18: error: ‘winbindd_get_creds’ accessing 128 bytes in a region of size 8 [-Werror=stringop-overflow=]
 1069 |         result = winbindd_get_creds(domain,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
 1070 |                                     state->mem_ctx,
      |                                     ~~~~~~~~~~~~~~~
 1071 |                                     &sid,
      |                                     ~~~~~
 1072 |                                     &my_info3,
      |                                     ~~~~~~~~~~
 1073 |                                     &cached_nt_pass,
      |                                     ~~~~~~~~~~~~~~~~
 1074 |                                     &cached_salt);
      |                                     ~~~~~~~~~~~~~
../../source3/winbindd/winbindd_pam.c:1069:18: note: referencing argument 5 of type ‘const uint8_t **’ {aka ‘const unsigned char **’}
../../source3/winbindd/winbindd_pam.c:1069:18: error: ‘winbindd_get_creds’ accessing 128 bytes in a region of size 8 [-Werror=stringop-overflow=]
../../source3/winbindd/winbindd_pam.c:1069:18: note: referencing argument 6 of type ‘const uint8_t **’ {aka ‘const unsigned char **’}
In file included from ../../source3/winbindd/winbindd.h:359,
                 from ../../source3/winbindd/winbindd_pam.c:26:
../../source3/winbindd/winbindd_proto.h:251:10: note: in a call to function ‘winbindd_get_creds’
  251 | NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
      |          ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 17ae9974f36ce8929f0c50c357dd4f88fbf37d7c)

3 years agoFix gcc11 compiler issue "-Werror=maybe-uninitialized"
Günther Deschner [Mon, 3 May 2021 19:27:43 +0000 (21:27 +0200)]
Fix gcc11 compiler issue "-Werror=maybe-uninitialized"

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

../../source4/dsdb/common/util_links.c: In function ‘ndr_guid_compare’:
../../source4/dsdb/common/util_links.c:38:29: error: ‘v1_data’ may be used uninitialized [-Werror=maybe-uninitialized]
   38 |         struct ldb_val v1 = data_blob_const(v1_data, sizeof(v1_data));
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../source4/../lib/util/samba_util.h:48,
                 from ../../source4/include/includes.h:62,
                 from ../../source4/dsdb/common/util_links.c:22:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../source4/dsdb/common/util_links.c:37:17: note: ‘v1_data’ declared here
   37 |         uint8_t v1_data[16];
      |                 ^~~~~~~
cc1: all warnings being treated as errors

../../libcli/auth/smbencrypt.c: In function ‘decode_wkssvc_join_password_buffer’:
../../libcli/auth/smbencrypt.c:1045:32: error: ‘_confounder’ may be used uninitialized [-Werror=maybe-uninitialized]
 1045 |         DATA_BLOB confounder = data_blob_const(_confounder, 8);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../source4/../lib/util/samba_util.h:48,
                 from ../../source4/include/includes.h:62,
                 from ../../libcli/auth/smbencrypt.c:24:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../libcli/auth/smbencrypt.c:1044:17: note: ‘_confounder’ declared here
 1044 |         uint8_t _confounder[8];
      |                 ^~~~~~~~~~~
cc1: all warnings being treated as errors

[2624/3991] Compiling source4/torture/rpc/samr.c
../../source3/rpc_client/cli_samr.c: In function ‘dcerpc_samr_chgpasswd_user2’:
../../source3/rpc_client/cli_samr.c:158:33: error: ‘old_nt_hash’ may be used uninitialized [-Werror=maybe-uninitialized]
  158 |         DATA_BLOB session_key = data_blob_const(old_nt_hash, 16);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../source3/../lib/util/samba_util.h:48,
                 from ../../source3/include/includes.h:256,
                 from ../../source3/rpc_client/cli_samr.c:24:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../source3/rpc_client/cli_samr.c:152:17: note: ‘old_nt_hash’ declared here
  152 |         uint8_t old_nt_hash[16];
      |                 ^~~~~~~~~~~
../../source3/rpc_client/cli_samr.c: In function ‘dcerpc_samr_chgpasswd_user3’:
../../source3/rpc_client/cli_samr.c:365:33: error: ‘old_nt_hash’ may be used uninitialized [-Werror=maybe-uninitialized]
  365 |         DATA_BLOB session_key = data_blob_const(old_nt_hash, 16);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../source3/../lib/util/samba_util.h:48,
                 from ../../source3/include/includes.h:256,
                 from ../../source3/rpc_client/cli_samr.c:24:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../source3/rpc_client/cli_samr.c:358:17: note: ‘old_nt_hash’ declared here
  358 |         uint8_t old_nt_hash[16];
      |                 ^~~~~~~~~~~
cc1: all warnings being treated as errors

[3399/3991] Compiling source3/rpcclient/cmd_spotlight.c
../../source3/rpcclient/cmd_spotlight.c: In function ‘cmd_mdssvc_fetch_properties’:
../../source3/rpcclient/cmd_spotlight.c:60:18: error: ‘share_path’ may be used uninitialized [-Werror=maybe-uninitialized]
   60 |         status = dcerpc_mdssvc_open(b, mem_ctx,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   61 |                                     &device_id,
      |                                     ~~~~~~~~~~~
   62 |                                     &unkn1,
      |                                     ~~~~~~~
   63 |                                     &unkn2,
      |                                     ~~~~~~~
   64 |                                     argv[2],
      |                                     ~~~~~~~~
   65 |                                     argv[1],
      |                                     ~~~~~~~~
   66 |                                     share_path,
      |                                     ~~~~~~~~~~~
   67 |                                     &share_handle);
      |                                     ~~~~~~~~~~~~~~
In file included from ../../source3/rpcclient/cmd_spotlight.c:24:
source3/../librpc/gen_ndr/ndr_mdssvc_c.h:26:10: note: by argument 8 of type ‘const char *’ to ‘dcerpc_mdssvc_open’ declared here
   26 | NTSTATUS dcerpc_mdssvc_open(struct dcerpc_binding_handle *h,
      |          ^~~~~~~~~~~~~~~~~~
../../source3/rpcclient/cmd_spotlight.c:40:14: note: ‘share_path’ declared here
   40 |         char share_path[1025];
      |              ^~~~~~~~~~
cc1: all warnings being treated as errors

../../source4/torture/rpc/samr.c: In function ‘test_ChangePasswordUser2’:
../../source4/torture/rpc/samr.c:2266:19: error: ‘old_nt_hash’ may be used uninitialized [-Werror=maybe-uninitialized]
 2266 |                 = data_blob_const(old_nt_hash, sizeof(old_nt_hash));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../source4/../lib/util/samba_util.h:48,
                 from ../../source4/include/includes.h:62,
                 from ../../source4/torture/rpc/samr.c:24:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../source4/torture/rpc/samr.c:2263:17: note: ‘old_nt_hash’ declared here
 2263 |         uint8_t old_nt_hash[16], new_nt_hash[16];
      |                 ^~~~~~~~~~~
../../source4/torture/rpc/samr.c: In function ‘test_ChangePasswordUser2_ntstatus’:
../../source4/torture/rpc/samr.c:2371:19: error: ‘old_nt_hash’ may be used uninitialized [-Werror=maybe-uninitialized]
 2371 |                 = data_blob_const(old_nt_hash, sizeof(old_nt_hash));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../source4/../lib/util/samba_util.h:48,
                 from ../../source4/include/includes.h:62,
                 from ../../source4/torture/rpc/samr.c:24:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../source4/torture/rpc/samr.c:2368:17: note: ‘old_nt_hash’ declared here
 2368 |         uint8_t old_nt_hash[16], new_nt_hash[16];
      |                 ^~~~~~~~~~~
../../source4/torture/rpc/samr.c: In function ‘test_ChangePasswordUser3’:
../../source4/torture/rpc/samr.c:2478:38: error: ‘old_nt_hash’ may be used uninitialized [-Werror=maybe-uninitialized]
 2478 |         DATA_BLOB old_nt_hash_blob = data_blob_const(old_nt_hash, 16);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../source4/../lib/util/samba_util.h:48,
                 from ../../source4/include/includes.h:62,
                 from ../../source4/torture/rpc/samr.c:24:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../source4/torture/rpc/samr.c:2473:17: note: ‘old_nt_hash’ declared here
 2473 |         uint8_t old_nt_hash[16], new_nt_hash[16];
      |                 ^~~~~~~~~~~
../../source4/torture/rpc/samr.c: In function ‘test_ChangePasswordRandomBytes’:
../../source4/torture/rpc/samr.c:2794:19: error: ‘old_nt_hash’ may be used uninitialized [-Werror=maybe-uninitialized]
 2794 |                 = data_blob_const(old_nt_hash,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2795 |                                   sizeof(old_nt_hash));
      |                                   ~~~~~~~~~~~~~~~~~~~~
In file included from ../../source4/../lib/util/samba_util.h:48,
                 from ../../source4/include/includes.h:62,
                 from ../../source4/torture/rpc/samr.c:24:
../../lib/util/data_blob.h:116:20: note: by argument 1 of type ‘const void *’ to ‘data_blob_const’ declared here
  116 | _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
      |                    ^~~~~~~~~~~~~~~
../../source4/torture/rpc/samr.c:2792:17: note: ‘old_nt_hash’ declared here
 2792 |         uint8_t old_nt_hash[16], new_nt_hash[16];
      |                 ^~~~~~~~~~~
cc1: all warnings being treated as errors

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0e1695df7fe8952b5c503cf7ab1ff31784736988)

3 years agos3: smbd: SMB1 SMBsplwr doesn't send a reply packet on success.
Jeremy Allison [Thu, 29 Apr 2021 16:50:30 +0000 (09:50 -0700)]
s3: smbd: SMB1 SMBsplwr doesn't send a reply packet on success.

Missing call to set up req->outbuf means no reply is sent.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Apr 29 21:27:58 UTC 2021 on sn-devel-184

(cherry picked from commit 47d79d7e7e406f7dd204ded7c72cfed3e0761ad5)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Mon May  3 08:16:14 UTC 2021 on sn-devel-184

3 years agos3:winbind: For 'security = ADS' require realm/workgroup to be set
Andreas Schneider [Wed, 28 Apr 2021 10:25:42 +0000 (12:25 +0200)]
s3:winbind: For 'security = ADS' require realm/workgroup to be set

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 757c49f6dc52afd6ee39c0b282e9a787b6df7a12)

3 years agos3:utils: Tell users that workgroup/realm is required for ADS mode
Andreas Schneider [Wed, 28 Apr 2021 10:09:21 +0000 (12:09 +0200)]
s3:utils: Tell users that workgroup/realm is required for ADS mode

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 328682860940679553831b6ff23acff4ce80a22f)

3 years agodocs: Expand the "log level" docs on audit logging
Andrew Bartlett [Thu, 15 Apr 2021 22:43:07 +0000 (10:43 +1200)]
docs: Expand the "log level" docs on audit logging

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 38fe888f95f8d22736080ed521939be932e7bca0)

3 years agodocs: underline special words in the audit logging part of "log level" in man smb...
Andrew Bartlett [Thu, 15 Apr 2021 02:40:30 +0000 (14:40 +1200)]
docs: underline special words in the audit logging part of "log level" in man smb.conf

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit d03e7ffcff32452bb92f2ced9f06cbeab9843e04)

3 years agodocs: Further discourage the use of the "event notification" options
Andrew Bartlett [Thu, 15 Apr 2021 02:45:07 +0000 (14:45 +1200)]
docs: Further discourage the use of the "event notification" options

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 364b8be9816b34b2a1b07c6259345c406d68c9f2)

3 years agodocs: Add proper explination on why transactions need to be audited.
Andrew Bartlett [Thu, 15 Apr 2021 02:44:22 +0000 (14:44 +1200)]
docs: Add proper explination on why transactions need to be audited.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit a778a3a6420f094a953563b87f84457fdebd20a3)

3 years agodocs: Add missing documentation on dsdb_group_audit and dsdb_group_audit_json
Andrew Bartlett [Thu, 15 Apr 2021 02:39:49 +0000 (14:39 +1200)]
docs: Add missing documentation on dsdb_group_audit and dsdb_group_audit_json

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 2e533664e756ccde8fc1b3e41e70437c9e7bafcd)

3 years agodebug: Synchronise "log level" in smb.conf with the code
Andrew Bartlett [Thu, 15 Apr 2021 01:52:38 +0000 (13:52 +1200)]
debug: Synchronise "log level" in smb.conf with the code

This is done by pasting in the contents of default_classname_table[]
in lib/util/debug.c into
cut -f 2 -d \"| xargs -i sh -c 'echo "\t<listitem><para><parameter moreinfo=\"none\">{}</parameter></para></listitem>"'

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0d30d74e89829cc7b4faa6ba835e3d90c1c410aa)

3 years agoVERSION: Bump version up to 4.14.5.
Karolin Seeger [Thu, 29 Apr 2021 09:09:46 +0000 (11:09 +0200)]
VERSION: Bump version up to 4.14.5.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
3 years agoMerge tag 'samba-4.14.4' into v4-14-test
Karolin Seeger [Thu, 29 Apr 2021 09:09:10 +0000 (11:09 +0200)]
Merge tag 'samba-4.14.4' into v4-14-test

samba: tag release samba-4.14.4

3 years agoVERSION: Disable GIT_SNAPSHOT for the 4.14.4 release. samba-4.14.4
Karolin Seeger [Mon, 26 Apr 2021 08:26:38 +0000 (10:26 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.14.4 release.

BUG 14571: CVE-2021-20254: Buffer overrun in sids_to_unixids().

Signed-off-by: Karolin Seeger <kseeger@samba.org>
3 years agoWHATSNEW: Add release notes for Samba 4.14.4.
Karolin Seeger [Mon, 26 Apr 2021 08:26:10 +0000 (10:26 +0200)]
WHATSNEW: Add release notes for Samba 4.14.4.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
3 years agoCVE-2021-20254 passdb: Simplify sids_to_unixids()
Volker Lendecke [Sat, 20 Feb 2021 14:50:12 +0000 (15:50 +0100)]
CVE-2021-20254 passdb: Simplify sids_to_unixids()

Best reviewed with "git show -b", there's a "continue" statement that
changes subsequent indentation.

Decouple lookup status of ids from ID_TYPE_NOT_SPECIFIED

Add comments to explain the use of the three lookup
loops.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry-picked from commit for master)

3 years agoVERSION: Bump version up to 4.14.4...
Karolin Seeger [Mon, 19 Apr 2021 07:57:25 +0000 (09:57 +0200)]
VERSION: Bump version up to 4.14.4...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
(cherry picked from commit a8b9ea7e1aa4f526bd73baee45f0a3483c95381a)

3 years agoVERSION: Bump version up to 4.14.4...
Karolin Seeger [Mon, 19 Apr 2021 07:57:25 +0000 (09:57 +0200)]
VERSION: Bump version up to 4.14.4...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
3 years agoVERSION: Disable GIT_SNAPSHOT for the 4.14.3 release. samba-4.14.3
Karolin Seeger [Mon, 19 Apr 2021 07:56:47 +0000 (09:56 +0200)]
VERSION: Disable GIT_SNAPSHOT for the 4.14.3 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
3 years agoWHATSNEW: Add release notes for Samba 4.14.3.
Karolin Seeger [Mon, 19 Apr 2021 07:56:20 +0000 (09:56 +0200)]
WHATSNEW: Add release notes for Samba 4.14.3.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
3 years agobuild: Notice if flex is missing at configure time
Andrew Bartlett [Fri, 26 Mar 2021 08:48:45 +0000 (21:48 +1300)]
build: Notice if flex is missing at configure time

This may also fix the coverage build by ensuring --noline
is always specified to flex.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Mar 29 02:12:23 UTC 2021 on sn-devel-184

(cherry picked from commit 942c0d2128cb8e64a9354dde6bdae82a1c1c3d88)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Tue Apr 20 07:39:05 UTC 2021 on sn-devel-184

3 years agos3-iremotewinspool: set the per-request memory context
Samuel Cabrero [Thu, 8 Apr 2021 16:45:38 +0000 (18:45 +0200)]
s3-iremotewinspool: set the per-request memory context

The iremotewinspool service is not using the pidl autogenerated code.
Set the per-request memory context following the changes made is commit
5a7e9ade9a4cdfa68900c6a64b639f53c0da47ad.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14675
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1890

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Apr  9 15:20:02 UTC 2021 on sn-devel-184

(cherry picked from commit 1efa9ffd7ae77ebf22b28c12dd642a89991b75d2)

3 years agobuild: Only add -Wl,--as-needed when supported
Martin Schwenke [Mon, 29 Mar 2021 05:30:37 +0000 (16:30 +1100)]
build: Only add -Wl,--as-needed when supported

If -Wl,--as-needed is added to EXTRA_LDFLAGS (via ADD_LDFLAGS, as per
commit 996560191ac6bd603901dcd6c0de5d239e019ef4) then on some
platforms (at least CentOS 8 and Fedora 33), any indirect/recursive
dependencies (i.e. private libraries) are added to both the
binary (reqid_test in the CTDB case) and to samba-util.so.  However,
only samba-util.so has rpath set to find private libraries.

When ld.so tries to resolve these dependencies for the binary it
fails. This may be a bug on those platforms, but it occurs reliably
and our users will also hit the bug.  For binaries that have other
private library dependencies (e.g. bundled talloc) rpath will contain
the private library directory so the duplicate private library
dependencies are then found... that is, when it works, it works by
accident!

For some reason (deep in waf or wafsamba) if -Wl,--as-needed is added to
LINKFLAGS (as is done in conf.add_as_needed()) then it works: the direct
dependencies are only added to samba-util.so and the same depenencies
(indirect dependencies for binaries) are not added incorrectly to the
binaries.

So, without changing 1/2 of waf/wafsamba the simplest fix is to revert
to adding -Wl,--as-needed to LINKFLAGS, which was the case before
commit 996560191ac6bd603901dcd6c0de5d239e019ef4.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14288
RN: Fix the build on OmniOS

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(backported from commit ff1c3af603b47a7e8f9faad8d1c2e4a489559155)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Wed Apr 14 07:34:20 UTC 2021 on sn-devel-184

3 years agos3: smbd: fix deferred renames
Ralph Boehme [Mon, 29 Mar 2021 10:24:39 +0000 (12:24 +0200)]
s3: smbd: fix deferred renames

This was broken by c7a9e0e4cdfb22e66533b5c8e20af3cfdb8ae78c.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14679
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1875

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@amba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Mar 31 06:13:39 UTC 2021 on sn-devel-184

(cherry picked from commit 10d753868e810604d8f60673bbd48f55aaff0797)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Thu Apr  1 11:26:31 UTC 2021 on sn-devel-184

3 years agos4: torture. Add smb2.lease.rename_wait test to reproduce regression in delay rename...
Jeremy Allison [Tue, 30 Mar 2021 22:05:47 +0000 (15:05 -0700)]
s4: torture. Add smb2.lease.rename_wait test to reproduce regression in delay rename for lease break code.

Passes against Windows 10. Add to knownfail, the
next commit will fix this.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14679
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1875

Back-ported from 8d9a0b8d57713781c72440c7e91746b5d89e6f6a.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agorpc_server3: Fix a memleak for internal pipes
Volker Lendecke [Tue, 23 Mar 2021 16:06:15 +0000 (17:06 +0100)]
rpc_server3: Fix a memleak for internal pipes

state->call should not be talloc'ed off a long-lived context

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14675
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1861
RN: Memory leak in the RPC server

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Mar 31 12:14:01 UTC 2021 on sn-devel-184

(cherry picked from commit 12f516e4680753460e7fe8811e6c6ff70057580c)

3 years agospools: avoid leaking memory into the callers mem_ctx
Ralph Boehme [Mon, 22 Mar 2021 11:06:39 +0000 (12:06 +0100)]
spools: avoid leaking memory into the callers mem_ctx

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14675
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1861

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 481176ec745c14b78fca68e01a61c83405a4b97b)

3 years agopidl: set the per-request memory context in the pidl generator
Ralph Boehme [Tue, 23 Mar 2021 10:40:21 +0000 (11:40 +0100)]
pidl: set the per-request memory context in the pidl generator

The talloc memory context referenced by the pipe_struct mem_ctx member is used
as talloc parent for RPC response data by the RPC service implementations.

In Samba versions up to 4.10 all talloc children of p->mem_ctx were freed after
a RPC response was delivered by calling talloc_free_children(p->mem_ctx). Commit
60fa8e255254d38e9443bf96f2c0f31430be6ab8 removed this call which resulted in all
memory allocations on this context not getting released, which can consume
significant memory in long running RPC connections.

Instead of putting the talloc_free_children(p->mem_ctx) back, just use the
mem_ctx argument of the ${pipename}_op_dispatch_internal() function which is a
dcesrv_call_state object created by dcesrv_process_ncacn_packet() and released
by the RPC server when the RPC request processing is finished.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14675
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1861

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 4c3fb2a5912966a61e7ebdb05eb3231a0e1d6033)

3 years agosmbd: free open_rec state in remove_deferred_open_message_smb2_internal()
Ralph Boehme [Tue, 16 Mar 2021 17:18:46 +0000 (18:18 +0100)]
smbd: free open_rec state in remove_deferred_open_message_smb2_internal()

The lifetime of open_rec (struct deferred_open_record) ojects is the time
processing the SMB open request every time the request is scheduled, ie once we
reschedule we must wipe the slate clean. In case the request gets deferred
again, a new open_rec will be created by the schedule functions.

This ensures any timer-event tied to the open_rec gets cancelled and doesn't
fire unexpectedly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14672
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1843
RN: smbd panic when two clients open same file

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 Mar 18 18:04:09 UTC 2021 on sn-devel-184

(cherry picked from commit 591c9196962b695b01c0d86918b8f8a263e9665c)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Wed Mar 31 11:10:29 UTC 2021 on sn-devel-184

3 years agosmbd: cancel pending poll open timer in poll_open_done()
Ralph Boehme [Wed, 17 Mar 2021 15:24:28 +0000 (16:24 +0100)]
smbd: cancel pending poll open timer in poll_open_done()

The retry of the open is scheduled below, avoid rescheduling it a second time in
the open retry timeout function.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14672
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1843

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 171a58ff3e8ee07cf5d7af08eabcb4a7379e7ce5)

3 years agosmbd: reset dangling watch_req pointer in poll_open_done
Ralph Boehme [Wed, 17 Mar 2021 15:22:37 +0000 (16:22 +0100)]
smbd: reset dangling watch_req pointer in poll_open_done

We just freed subreq and a pointer to subreq is stored in open_rec->watch_req,
so we must invalidate the pointer.

Otherwise if the poll open timer fires it will do a

  TALLOC_FREE(open_rec->watch_req);

on the dangling pointer which may crash or do something worse like freeing some
other random talloc memory.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14672
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1843

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 065ed088b3d5710c288e46a5bf1e063f9a29c8cc)

3 years agos3:modules:vfs_virusfilter: Recent New_VFS changes break vfs_virusfilter_openat.
Trever L. Adams [Sat, 13 Mar 2021 19:47:21 +0000 (12:47 -0700)]
s3:modules:vfs_virusfilter: Recent New_VFS changes break vfs_virusfilter_openat.

The_New_VFS introduces several changes that broke vfs_virusfilter_openat. The assert to make sure certain checks would work broke.

This patch fixes those breaks and converts to the SMB_VFS_FSTAT_NEXT instead of SMB_VFS_STAT_NEXT.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14671
RN: vfs_virusfilter_openat support New_VFS FSTAT, avoid SMB_ASSERT(fsp_get_pathref_fd(dirfsp) == AT_FDCWD); problem.

Signed-off-by: Trever L. Adams" <trever.adams@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Mar 22 19:44:30 UTC 2021 on sn-devel-184

(cherry picked from commit d6a16ad00e426a6f815215af71c071dd8e85a50a)

3 years agosamba-gpupdate: Check sysvol download paths in case-insensitive way
David Mulder [Tue, 9 Mar 2021 18:13:40 +0000 (11:13 -0700)]
samba-gpupdate: Check sysvol download paths in case-insensitive way

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

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
(cherry picked from commit 2d6bed495e14349e19ba680bd72c3f110f1c397b)

3 years agosamba-gpupdate: Test that sysvol paths download in case-insensitive way
David Mulder [Tue, 9 Mar 2021 19:30:14 +0000 (12:30 -0700)]
samba-gpupdate: Test that sysvol paths download in case-insensitive way

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

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
(cherry picked from commit 554f2134a9f9638ebd8ac2500e5b6c94b74c27d5)