]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 years agos3: smbd: Remove unneeded NULL check inside msdfs_servicename_matches_connection().
Jeremy Allison [Thu, 11 Aug 2022 04:37:41 +0000 (21:37 -0700)] 
s3: smbd: Remove unneeded NULL check inside msdfs_servicename_matches_connection().

This is now only called from is from parse_dfs_path(),
and for that we know conn is non-NULL.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In create_junction() don't read hostname from parse_dfs_path_strict().
Jeremy Allison [Thu, 18 Aug 2022 04:50:19 +0000 (21:50 -0700)] 
s3: smbd: In create_junction() don't read hostname from parse_dfs_path_strict().

It isn't used anymore inside create_junction().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In create_junction() remove hostname check. parse_dfs_path_strict() already...
Jeremy Allison [Thu, 11 Aug 2022 18:06:05 +0000 (11:06 -0700)] 
s3: smbd: In create_junction() remove hostname check. parse_dfs_path_strict() already does this.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Change create_junction() to use parse_dfs_path_strict().
Jeremy Allison [Thu, 11 Aug 2022 04:34:29 +0000 (21:34 -0700)] 
s3: smbd: Change create_junction() to use parse_dfs_path_strict().

Note we no longer use allow_broken_path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Change get_referred_path() to use parse_dfs_path_strict().
Jeremy Allison [Thu, 11 Aug 2022 04:33:32 +0000 (21:33 -0700)] 
s3: smbd: Change get_referred_path() to use parse_dfs_path_strict().

Remove #ifdef's around parse_dfs_path_strict() as we're
now using it.

Note we no longer use allow_broken_path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add a comment explaing why dfs_filename_convert() must continue to use...
Jeremy Allison [Wed, 17 Aug 2022 21:23:45 +0000 (14:23 -0700)] 
s3: smbd: Add a comment explaing why dfs_filename_convert() must continue to use parse_dfs_path().

libsmbclient libraries will always set the FLAGS2_DFS_PATHNAMES
bit when talking to a DFS share, but don't always canonicalize
the incoming pathname to a DFS one (see the code for cli_list()
that puts a non-DFS pathname into SMB2trans2_FindFirst for
example). This is a problem in our client libraries for both
SMB1 and SMB2+

As we still must cope with these older clients we must
keep the lenient parsing for DFS filenames sent over SMB1/2/3.

A future task - change the use of parse_dfs_path() in
dfs_filename_convert() to parse_dfs_path_strict() for SMB2
only and then try and get all our torture tests to pass.
This is not an easy fix (and would still break old clients
out there as well :-( ).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In dfs_filename_convert(), don't ask for hostname, sharename and then just...
Jeremy Allison [Wed, 17 Aug 2022 21:21:59 +0000 (14:21 -0700)] 
s3: smbd: In dfs_filename_convert(), don't ask for hostname, sharename and then just free them.

Wastes a talloc/free.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add a new function parse_dfs_path_strict().
Jeremy Allison [Wed, 17 Aug 2022 21:17:23 +0000 (14:17 -0700)] 
s3: smbd: Add a new function parse_dfs_path_strict().

 #ifdef'ed out as not yet used. This will replace
parse_dfs_path() for all client sent names via
DFS RPC calls and for SMB_VFS_GET_DFS_REFERRALS().

The paths sent in these calls are guaranteed
to be of canonical form:

\SERVER\share\pathname.

Both for SMB1 and SMB2+ so we can be more strict
when parsing them.

 Checks DFS path starts with separator.
 Checks hostname is ours.
 Ensures servicename (share) is sent, and
    if so, terminates the name or is followed by
    \pathname.

Errors out if any checks fail.

Reserve parse_dfs_path() for DFS names sent
via "ordinary" SMB 1/2/3 calls where we must
be more lenient in parsing.

Note parse_dfs_path_strict() does not have
bool allow_broken_path or 'struct connection_struct'
as it will not be called from places that use
these.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbd: add missing check for IPC share for TRANS2_GET_DFS_REFERRAL
Ralph Boehme [Sun, 28 Aug 2022 09:12:52 +0000 (11:12 +0200)] 
smbd: add missing check for IPC share for TRANS2_GET_DFS_REFERRAL

Cf MS-CIFS 3.3.5.58.11.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbXcli: Pass negotiate contexts through smbXcli_negprot_send/recv
Volker Lendecke [Thu, 25 Aug 2022 07:54:52 +0000 (09:54 +0200)] 
smbXcli: Pass negotiate contexts through smbXcli_negprot_send/recv

We already don't allow setting max_credits in the sync wrapper, so
omit the contexts there as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug 26 19:54:03 UTC 2022 on sn-devel-184

3 years agolibsmb: Introduce helper var to cli_tree_connect_*_done()
Volker Lendecke [Thu, 25 Aug 2022 08:43:54 +0000 (10:43 +0200)] 
libsmb: Introduce helper var to cli_tree_connect_*_done()

README.Coding, makes it easier to debug

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Remove cli_full_connection_creds_sess_start()
Volker Lendecke [Thu, 25 Aug 2022 08:31:42 +0000 (10:31 +0200)] 
libsmb: Remove cli_full_connection_creds_sess_start()

This contained very simple tevent_req logic, hiding that confused the
code for me when reading. Also, this change saves 3 lines...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Remove unused code
Volker Lendecke [Tue, 23 Aug 2022 11:13:48 +0000 (13:13 +0200)] 
libsmb: Remove unused code

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Remove map_fnum_to_smb2_handle() from cli_smb2_qpathinfo2()
Volker Lendecke [Tue, 23 Aug 2022 10:59:50 +0000 (12:59 +0200)] 
libsmb: Remove map_fnum_to_smb2_handle() from cli_smb2_qpathinfo2()

Not used

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Remove map_fnum_to_smb2_handle() from cli_smb2_getatr()
Volker Lendecke [Tue, 23 Aug 2022 10:59:29 +0000 (12:59 +0200)] 
libsmb: Remove map_fnum_to_smb2_handle() from cli_smb2_getatr()

Not used

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Correctly return ioctl error from cli_readlink()
Volker Lendecke [Sun, 14 Aug 2022 14:13:32 +0000 (16:13 +0200)] 
libsmb: Correctly return ioctl error from cli_readlink()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Save a few lines in cli_unix_extensions_version()
Volker Lendecke [Sat, 13 Aug 2022 13:43:47 +0000 (15:43 +0200)] 
libsmb: Save a few lines in cli_unix_extensions_version()

This is more recent style for sync wrappers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Add tevent_req_received() to cli_posix_readlink_recv()
Volker Lendecke [Sat, 13 Aug 2022 13:42:50 +0000 (15:42 +0200)] 
libsmb: Add tevent_req_received() to cli_posix_readlink_recv()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Fix a typo
Volker Lendecke [Sat, 13 Aug 2022 11:30:26 +0000 (13:30 +0200)] 
lib: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Modernize DBG statements in open_fake_file()
Volker Lendecke [Fri, 12 Aug 2022 10:49:07 +0000 (12:49 +0200)] 
smbd: Modernize DBG statements in open_fake_file()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Move static strings to the .text segment
Volker Lendecke [Wed, 17 Aug 2022 05:56:18 +0000 (07:56 +0200)] 
libsmb: Move static strings to the .text segment

We don't need to copy these to the stack, this saves 200 bytes of .text

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoexamples: A tiny bit of README.Coding for teststat.c
Volker Lendecke [Wed, 17 Aug 2022 09:40:11 +0000 (11:40 +0200)] 
examples: A tiny bit of README.Coding for teststat.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Tab-indent SMBC_module_[init|terminate]()
Volker Lendecke [Wed, 17 Aug 2022 10:08:44 +0000 (12:08 +0200)] 
libsmb: Tab-indent SMBC_module_[init|terminate]()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Fix a typo
Volker Lendecke [Wed, 17 Aug 2022 10:07:38 +0000 (12:07 +0200)] 
libsmb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmb: Slightly simplify SMBC_parse_path()
Volker Lendecke [Wed, 17 Aug 2022 10:03:35 +0000 (12:03 +0200)] 
libsmb: Slightly simplify SMBC_parse_path()

Don't manually duplicate the talloc_strndup() functionality

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Adapt np_[read|write]_send() to more recent tevent_req conventions
Volker Lendecke [Wed, 10 Aug 2022 06:39:12 +0000 (08:39 +0200)] 
smbd: Adapt np_[read|write]_send() to more recent tevent_req conventions

We usually don't do "goto post_status;" anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoexamples: Make libsmbclient samples look a *bit* less ugly
Volker Lendecke [Wed, 17 Aug 2022 08:51:06 +0000 (10:51 +0200)] 
examples: Make libsmbclient samples look a *bit* less ugly

Remove trailing whitespace, indent to tabs. Yes, this introduces long
lines, but makes review with "git show -w" trivial.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Save a line with tevent_req_nomem()
Volker Lendecke [Fri, 29 Jul 2022 12:57:54 +0000 (14:57 +0200)] 
smbd: Save a line with tevent_req_nomem()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: Fix a typo
Volker Lendecke [Mon, 1 Aug 2022 10:30:51 +0000 (12:30 +0200)] 
lib: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agodfs_server: Fix typos
Volker Lendecke [Wed, 10 Aug 2022 06:13:26 +0000 (08:13 +0200)] 
dfs_server: Fix typos

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs: Fix a copy&paste error
Volker Lendecke [Tue, 9 Aug 2022 14:26:13 +0000 (16:26 +0200)] 
vfs: Fix a copy&paste error

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Adapt a call to setup_dfs_referral() to README.Coding
Volker Lendecke [Tue, 9 Aug 2022 12:51:10 +0000 (14:51 +0200)] 
smbd: Adapt a call to setup_dfs_referral() to README.Coding

Makes it easier to handle in a debugger

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolibsmbclient: Fix a typo
Volker Lendecke [Thu, 25 Aug 2022 08:34:51 +0000 (10:34 +0200)] 
libsmbclient: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Implement SMB_VFS_FSTATAT
Anoop C S [Wed, 24 Aug 2022 09:31:31 +0000 (15:01 +0530)] 
vfs_glusterfs: Implement SMB_VFS_FSTATAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug 26 17:33:15 UTC 2022 on sn-devel-184

3 years agovfs_glusterfs: Use glfs_fgetxattr() for SMB_VFS_GET_REAL_FILENAME_AT
Anoop C S [Fri, 19 Aug 2022 06:46:08 +0000 (12:16 +0530)] 
vfs_glusterfs: Use glfs_fgetxattr() for SMB_VFS_GET_REAL_FILENAME_AT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_readlinkat() for SMB_VFS_READ_DFS_PATHAT
Anoop C S [Fri, 19 Aug 2022 07:38:42 +0000 (13:08 +0530)] 
vfs_glusterfs: Use glfs_readlinkat() for SMB_VFS_READ_DFS_PATHAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_symlinkat() for SMB_VFS_CREATE_DFS_PATHAT
Anoop C S [Fri, 19 Aug 2022 07:21:16 +0000 (12:51 +0530)] 
vfs_glusterfs: Use glfs_symlinkat() for SMB_VFS_CREATE_DFS_PATHAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_mknodat() for SMB_VFS_MKNODAT
Anoop C S [Fri, 19 Aug 2022 06:45:10 +0000 (12:15 +0530)] 
vfs_glusterfs: Use glfs_mknodat() for SMB_VFS_MKNODAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_linkat() for SMB_VFS_LINKAT
Anoop C S [Fri, 19 Aug 2022 06:44:29 +0000 (12:14 +0530)] 
vfs_glusterfs: Use glfs_linkat() for SMB_VFS_LINKAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_readlinkat() for SMB_VFS_READLINKAT
Anoop C S [Fri, 19 Aug 2022 06:43:33 +0000 (12:13 +0530)] 
vfs_glusterfs: Use glfs_readlinkat() for SMB_VFS_READLINKAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_symlinkat() for SMB_VFS_SYMLINKAT
Anoop C S [Fri, 19 Aug 2022 06:42:43 +0000 (12:12 +0530)] 
vfs_glusterfs: Use glfs_symlinkat() for SMB_VFS_SYMLINKAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_unlinkat() for SMB_VFS_UNLINKAT
Anoop C S [Fri, 19 Aug 2022 06:41:54 +0000 (12:11 +0530)] 
vfs_glusterfs: Use glfs_unlinkat() for SMB_VFS_UNLINKAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_renameat() for SMB_VFS_RENAMEAT
Anoop C S [Fri, 19 Aug 2022 06:41:02 +0000 (12:11 +0530)] 
vfs_glusterfs: Use glfs_renameat() for SMB_VFS_RENAMEAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_mkdirat() for SMB_VFS_MKDIRAT
Anoop C S [Fri, 19 Aug 2022 06:40:16 +0000 (12:10 +0530)] 
vfs_glusterfs: Use glfs_mkdirat() for SMB_VFS_MKDIRAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Use glfs_openat() for SMB_VFS_OPENAT
Anoop C S [Fri, 19 Aug 2022 06:37:08 +0000 (12:07 +0530)] 
vfs_glusterfs: Use glfs_openat() for SMB_VFS_OPENAT

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosource3/wscript: Detect glusterfs-api with *at() calls support
Anoop C S [Fri, 19 Aug 2022 06:47:33 +0000 (12:17 +0530)] 
source3/wscript: Detect glusterfs-api with *at() calls support

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_glusterfs: Accept fsp with const qualifier
Anoop C S [Fri, 19 Aug 2022 06:28:34 +0000 (11:58 +0530)] 
vfs_glusterfs: Accept fsp with const qualifier

This is in preparation to avoid any `const` qualifier being discarded
warning with future changes to various *_at() calls which has `const
file_struct` arguments.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agopyglue:generate_random_[machine]_password: ValueError for bad values
Douglas Bagnall [Wed, 22 Jun 2022 03:21:31 +0000 (15:21 +1200)] 
pyglue:generate_random_[machine]_password: ValueError for bad values

The actual range is 14 to 255 for machine passwords, and there is a
min <= max check for both.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Aug 26 08:59:28 UTC 2022 on sn-devel-184

3 years agopyglue: generate_random_[machine]_password: reject negative numbers
Douglas Bagnall [Tue, 21 Jun 2022 23:12:30 +0000 (11:12 +1200)] 
pyglue: generate_random_[machine]_password: reject negative numbers

Other range errors (e.g. min > max) are caught in the wrapped
functions which returns EINVAL, so we don't recapitulate that logic
(see next commit though).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agopyglue: generate_random_bytes/str accept positive numbers only
Douglas Bagnall [Sun, 4 Aug 2019 12:41:49 +0000 (00:41 +1200)] 
pyglue: generate_random_bytes/str accept positive numbers only

We aren't yet able to generate negative numbers of random bytes.

Instead a request for -n bytes is implicitly converted into one for
SIZE_MAX - n bytes, which is typically very large. Memory exhaustion
seems a likely outcome.

With this patch callers will see a ValueError.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agopyglue: check talloc buffer for random bytes
Douglas Bagnall [Sun, 4 Aug 2019 12:28:31 +0000 (00:28 +1200)] 
pyglue: check talloc buffer for random bytes

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agopytest/segfault: abort for generate_random_bytes(-1)
Douglas Bagnall [Fri, 5 Aug 2022 00:39:24 +0000 (12:39 +1200)] 
pytest/segfault: abort for generate_random_bytes(-1)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero sensitive memory in lsa_secret_{set/get}_common()
Pavel Filipenský [Sat, 20 Aug 2022 13:37:26 +0000 (15:37 +0200)] 
s3:passdb: Zero sensitive memory in lsa_secret_{set/get}_common()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero secrets_domain_info1_password created via secrets_domain_info_passwor...
Pavel Filipenský [Sat, 20 Aug 2022 07:38:55 +0000 (09:38 +0200)] 
s3:passdb: Zero secrets_domain_info1_password created via secrets_domain_info_password_create()

Zero out these members of struct secrets_domain_info1_password:

DATA_BLOB cleartext_blob;
struct samr_Password nt_hash;
struct secrets_domain_info1_kerberos_key *keys;

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero secrets_domain_info1_password created via secrets_fetch()
Pavel Filipenský [Sat, 20 Aug 2022 07:34:30 +0000 (09:34 +0200)] 
s3:passdb: Zero secrets_domain_info1_password created via secrets_fetch()

Zero out these members of struct secrets_domain_info1_password:

DATA_BLOB cleartext_blob;
struct samr_Password nt_hash;
struct secrets_domain_info1_kerberos_key *keys;

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero local memory in secrets_domain_info_kerberos_keys()
Pavel Filipenský [Fri, 19 Aug 2022 13:25:28 +0000 (15:25 +0200)] 
s3:passdb: Zero local memory in secrets_domain_info_kerberos_keys()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero local memory in secrets_fetch()
Pavel Filipenský [Thu, 11 Aug 2022 08:09:00 +0000 (10:09 +0200)] 
s3:passdb: Zero local memory in secrets_fetch()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib:krb5: Change memset() to BURN_PTR_SIZE()
Pavel Filipenský [Wed, 17 Aug 2022 15:33:42 +0000 (17:33 +0200)] 
lib:krb5: Change memset() to BURN_PTR_SIZE()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:afs: Zero memory for afs_keyfile
Pavel Filipenský [Wed, 10 Aug 2022 07:07:07 +0000 (09:07 +0200)] 
s3:afs: Zero memory for afs_keyfile

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:net: Zero password in secrets_fetch_ipc_userpass() callers
Pavel Filipenský [Tue, 9 Aug 2022 13:37:15 +0000 (15:37 +0200)] 
s3:net: Zero password in secrets_fetch_ipc_userpass() callers

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Fix possible memory leak in secrets_fetch_ipc_userpass()
Pavel Filipenský [Thu, 11 Aug 2022 08:39:37 +0000 (10:39 +0200)] 
s3:passdb: Fix possible memory leak in secrets_fetch_ipc_userpass()

If domain or username are empty strings (""), we need to free them.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero password in secrets_fetch_ipc_userpass()
Pavel Filipenský [Tue, 9 Aug 2022 13:36:34 +0000 (15:36 +0200)] 
s3:passdb: Zero password in secrets_fetch_ipc_userpass()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:net: Fix trailing whitespace in net.c
Pavel Filipenský [Wed, 10 Aug 2022 12:48:14 +0000 (14:48 +0200)] 
s3:net: Fix trailing whitespace in net.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero memory in pdb_set_pw_history()
Pavel Filipenský [Tue, 9 Aug 2022 07:09:49 +0000 (09:09 +0200)] 
s3:passdb: Zero memory in pdb_set_pw_history()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero memory in pdb_set_plaintext_passwd()
Pavel Filipenský [Mon, 8 Aug 2022 16:23:40 +0000 (18:23 +0200)] 
s3:passdb: Zero memory in pdb_set_plaintext_passwd()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: s/BURN_PTR_SIZE/BURN_STR/ in samu_destroy()
Pavel Filipenský [Mon, 8 Aug 2022 15:49:11 +0000 (17:49 +0200)] 
s3:passdb: s/BURN_PTR_SIZE/BURN_STR/ in samu_destroy()

This makes sure that strlen(user->plaintext_pw) is not called twice.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:auth: Zero memory in sam_password_ok()
Pavel Filipenský [Mon, 8 Aug 2022 13:23:05 +0000 (15:23 +0200)] 
s3:auth: Zero memory in sam_password_ok()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero memory for plaintext_pw from 'struct samu'
Pavel Filipenský [Mon, 8 Aug 2022 12:30:24 +0000 (14:30 +0200)] 
s3:passdb: Zero memory for plaintext_pw from 'struct samu'

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Fix whitespaces in pdb_get_set.c
Pavel Filipenský [Mon, 8 Aug 2022 12:14:53 +0000 (14:14 +0200)] 
s3:passdb: Fix whitespaces in pdb_get_set.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero password in fetch_ldap_pw() callers
Pavel Filipenský [Wed, 10 Aug 2022 18:51:46 +0000 (20:51 +0200)] 
s3:passdb: Zero password in fetch_ldap_pw() callers

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero password in fetch_ldap_pw()
Pavel Filipenský [Thu, 11 Aug 2022 08:49:01 +0000 (10:49 +0200)] 
s3:passdb: Zero password in fetch_ldap_pw()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Fix trailing whitespaces in pdb_ldap.c
Pavel Filipenský [Fri, 5 Aug 2022 09:44:53 +0000 (11:44 +0200)] 
s3:passdb: Fix trailing whitespaces in pdb_ldap.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:lib: Fix trailing whitespaces in smbldap.c
Pavel Filipenský [Fri, 5 Aug 2022 09:11:37 +0000 (11:11 +0200)] 
s3:lib: Fix trailing whitespaces in smbldap.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3: Zero memory of idmap_fetch_secret() users
Pavel Filipenský [Fri, 5 Aug 2022 09:09:37 +0000 (11:09 +0200)] 
s3: Zero memory of idmap_fetch_secret() users

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero password in secrets_{fetch,store}_trusted_domain_password()
Pavel Filipenský [Wed, 3 Aug 2022 19:06:21 +0000 (21:06 +0200)] 
s3:passdb: Zero password in secrets_{fetch,store}_trusted_domain_password()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero memory using BURN_FREE_STR() in get_trust_pw_hash2()
Pavel Filipenský [Tue, 2 Aug 2022 15:32:43 +0000 (17:32 +0200)] 
s3:passdb: Zero memory using BURN_FREE_STR() in get_trust_pw_hash2()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero memory using BURN_FREE_STR() in secrets_fetch_or_upgrade_domain_info()
Pavel Filipenský [Tue, 2 Aug 2022 15:24:29 +0000 (17:24 +0200)] 
s3:passdb: Zero memory using BURN_FREE_STR() in secrets_fetch_or_upgrade_domain_info()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:passdb: Zero memory using BURN_FREE() in secrets_fetch_trust_account_password_lega...
Pavel Filipenský [Tue, 26 Jul 2022 17:03:11 +0000 (19:03 +0200)] 
s3:passdb: Zero memory using BURN_FREE() in secrets_fetch_trust_account_password_legacy() and secrets_fetch_domain_info1_by_key()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:libsmb: Zero memory in trust_pw_change()
Pavel Filipenský [Wed, 27 Jul 2022 15:21:08 +0000 (17:21 +0200)] 
s3:libsmb: Zero memory in trust_pw_change()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:libads: Zero memory in ads_change_trust_account_password()
Pavel Filipenský [Wed, 27 Jul 2022 15:21:07 +0000 (17:21 +0200)] 
s3:libads: Zero memory in ads_change_trust_account_password()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib:util: Zero memory in generate_random_machine_password()
Pavel Filipenský [Tue, 26 Jul 2022 17:02:28 +0000 (19:02 +0200)] 
lib:util: Zero memory in generate_random_machine_password()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib:replace: Add macro BURN_STR() to zero memory of a string
Pavel Filipenský [Mon, 8 Aug 2022 15:47:28 +0000 (17:47 +0200)] 
lib:replace: Add macro BURN_STR() to zero memory of a string

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agolib:util: Add BURN_FREE() and BURN_FREE_STR()
Pavel Filipenský [Wed, 27 Jul 2022 15:40:03 +0000 (17:40 +0200)] 
lib:util: Add BURN_FREE() and BURN_FREE_STR()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:libsmb: Fix trailing whitespaces in trusts_util.c
Pavel Filipenský [Wed, 27 Jul 2022 14:03:55 +0000 (16:03 +0200)] 
s3:libsmb: Fix trailing whitespaces in trusts_util.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:libads: Fix trailing whitespaces in util.c
Pavel Filipenský [Wed, 27 Jul 2022 14:01:25 +0000 (16:01 +0200)] 
s3:libads: Fix trailing whitespaces in util.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agos3:tests: Transfer test files into temporary directory
Joseph Sutton [Thu, 25 Aug 2022 02:03:17 +0000 (14:03 +1200)] 
s3:tests: Transfer test files into temporary directory

The presence of these two files is causing 'check-clean-tree' to fail.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 25 17:56:31 UTC 2022 on sn-devel-184

3 years agos3:tests: Create test directory and file prior to revoking permissions
Joseph Sutton [Thu, 25 Aug 2022 01:56:47 +0000 (13:56 +1200)] 
s3:tests: Create test directory and file prior to revoking permissions

If 'chmod 0' is performed first, then we won't have the required
permissions for the subsequent 'mkdir' and 'touch', and they will fail.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoctdb-tests: Avoid shellcheck warnings
Martin Schwenke [Mon, 8 Aug 2022 08:19:34 +0000 (18:19 +1000)] 
ctdb-tests: Avoid shellcheck warnings

Mostly

  SC2086: Double quote to prevent globbing and word splitting.

Use ctdb_onnode() where it simplifies code.  No behaviour changes
intended.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Aug 25 16:15:45 UTC 2022 on sn-devel-184

3 years agoctdb-tests: Simplify IP address checking
Martin Schwenke [Wed, 10 Aug 2022 23:15:38 +0000 (09:15 +1000)] 
ctdb-tests: Simplify IP address checking

Use a new function and wait_until() to simplify.

get_test_ip_mask_and_iface() not needed here because
select_test_node_and_ips() sets $test_ip, and neither $mask nor $iface
is used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Fix typos
Martin Schwenke [Mon, 8 Aug 2022 08:11:26 +0000 (18:11 +1000)] 
ctdb-tests: Fix typos

These lines are just wrong:

  try_command_on_node -v $test_node "ip addr show to ${test_node}"
  if -n "$out"; then

The 2nd variable referenced should be $test_ip.  The 2nd line causes
"-n: command not found" because it is missing [] test command
brackets.

Both typos would probably make the test pass unconditionally.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Reformat script using shfmt -w -p -i 0 -fn
Martin Schwenke [Mon, 8 Aug 2022 08:09:56 +0000 (18:09 +1000)] 
ctdb-tests: Reformat script using shfmt -w -p -i 0 -fn

Whitespace changes only.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agopython:tests: Allocate OID range for testing to avoid collisions
Joseph Sutton [Thu, 25 Aug 2022 08:21:01 +0000 (20:21 +1200)] 
python:tests: Allocate OID range for testing to avoid collisions

sid_strings.py used the same OID range as ldap_schema.py, which
occasionally led to test failures when the same OID was generated twice.
Using a different range, and making use of the expected RID if we have
it, should reduce the likelihood of collisions.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Aug 25 13:55:47 UTC 2022 on sn-devel-184

3 years agoschema_samba4.ldif: Allocate previously added OIDs
Joseph Sutton [Thu, 25 Aug 2022 08:15:33 +0000 (20:15 +1200)] 
schema_samba4.ldif: Allocate previously added OIDs

DSDB_CONTROL_FORCE_ALLOW_VALIDATED_DNS_HOSTNAME_SPN_WRITE_OID was added
to source4/dsdb/samdb/samdb.h in commit
c2ab1f4696fa3f52918a126d0b37993a07f68bcb.

DSDB_EXTENDED_SCHEMA_LOAD was added in commit
1fd4cdfafaa6a41c824d1b3d76635bf3e446de0f.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agosmbd: implement access checks for SMB2-GETINFO as per MS-SMB2 3.3.5.20.1
Ralph Boehme [Sun, 14 Aug 2022 16:46:24 +0000 (18:46 +0200)] 
smbd: implement access checks for SMB2-GETINFO as per MS-SMB2 3.3.5.20.1

The spec lists the following as requiring special access:

- for requiring FILE_READ_ATTRIBUTES:

  FileBasicInformation
  FileAllInformation
  FileNetworkOpenInformation
  FileAttributeTagInformation

- for requiring FILE_READ_EA:

  FileFullEaInformation

All other infolevels are unrestricted.

We ignore the IPC related infolevels:

  FilePipeInformation
  FilePipeLocalInformation
  FilePipeRemoteInformation

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15153
RN: Missing SMB2-GETINFO access checks from MS-SMB2 3.3.5.20.1

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Aug 23 12:54:08 UTC 2022 on sn-devel-184

3 years agosmbtorture: check required access for SMB2-GETINFO
Ralph Boehme [Fri, 19 Aug 2022 15:29:55 +0000 (17:29 +0200)] 
smbtorture: check required access for SMB2-GETINFO

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agos4/libcli/smb2: avoid using smb2_composite_setpathinfo() in smb2_util_setatr()
Ralph Boehme [Sun, 14 Aug 2022 16:51:30 +0000 (18:51 +0200)] 
s4/libcli/smb2: avoid using smb2_composite_setpathinfo() in smb2_util_setatr()

smb2_composite_setpathinfo() uses SEC_FLAG_MAXIMUM_ALLOWED which can
have unwanted side effects like breaking oplocks if the effective access
includes [READ|WRITE]_DATA.

For changing the DOS attributes we only need SEC_FILE_WRITE_ATTRIBUTE. With this
change test_smb2_oplock_batch25() doesn't trigger an oplock break anymore.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 years agogitlab-ci: Add a shellcheck runner
Andreas Schneider [Mon, 21 Feb 2022 10:36:39 +0000 (11:36 +0100)] 
gitlab-ci: Add a shellcheck runner

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon Aug 22 21:30:09 UTC 2022 on sn-devel-184

3 years agotestprogs: Fix shellcheck errors in upgradeprovision-oldrelease.sh
Andreas Schneider [Mon, 13 Jun 2022 14:11:31 +0000 (16:11 +0200)] 
testprogs: Fix shellcheck errors in upgradeprovision-oldrelease.sh

testprogs/blackbox/upgradeprovision-oldrelease.sh:134:103: error: Double
quote array expansions to avoid re-splitting elements. [SC2068]

testprogs/blackbox/upgradeprovision-oldrelease.sh:140:117: error: Double
quote array expansions to avoid re-splitting elements. [SC2068]

testprogs/blackbox/upgradeprovision-oldrelease.sh:145:105: error: Double
quote array expansions to avoid re-splitting elements. [SC2068]

testprogs/blackbox/upgradeprovision-oldrelease.sh:151:122: error: Double
quote array expansions to avoid re-splitting elements. [SC2068]

testprogs/blackbox/upgradeprovision-oldrelease.sh:156:110: error: Double
quote array expansions to avoid re-splitting elements. [SC2068]

testprogs/blackbox/upgradeprovision-oldrelease.sh:162:134: error: Double
quote array expansions to avoid re-splitting elements. [SC2068]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Fix shellcheck errors in test_wintest.sh
Andreas Schneider [Mon, 13 Jun 2022 14:08:40 +0000 (16:08 +0200)] 
testprogs: Fix shellcheck errors in test_wintest.sh

testprogs/blackbox/test_wintest.sh:15:97: error: Double quote array
expansions to avoid re-splitting elements. [SC2068]

testprogs/blackbox/test_wintest.sh:40:31: error: Double quote array
expansions to avoid re-splitting elements. [SC2068]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Fix shellcheck errors in test_weak_crypto_server.sh
Andreas Schneider [Mon, 13 Jun 2022 14:07:21 +0000 (16:07 +0200)] 
testprogs: Fix shellcheck errors in test_weak_crypto_server.sh

testprogs/blackbox/test_weak_crypto_server.sh:59:65: error: Use braces
when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
[SC1087]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>