]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 years agos3: smbd: Remove the old dfs_path_lookup() code.
Jeremy Allison [Tue, 9 Aug 2022 19:13:10 +0000 (12:13 -0700)] 
s3: smbd: Remove the old dfs_path_lookup() code.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Switch get_referred_path() over to use the new dfs_path_lookup().
Jeremy Allison [Tue, 9 Aug 2022 19:11:07 +0000 (12:11 -0700)] 
s3: smbd: Switch get_referred_path() over to use the new dfs_path_lookup().

New function doesn't need a TWRP argument and returns NT_STATUS_OK
on successful redirect, not NT_STATUS_PATH_NOT_COVERED.

Comment out the old dfs_path_lookup().

There are now no more users of unix_convert().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add new version of dfs_path_lookup() that uses filename_convert_dirfsp().
Jeremy Allison [Tue, 9 Aug 2022 19:07:30 +0000 (12:07 -0700)] 
s3: smbd: Add new version of dfs_path_lookup() that uses filename_convert_dirfsp().

Commented out as not yet used but it's easier to see the
new logic this way.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Remove dfs_redirect().
Jeremy Allison [Wed, 10 Aug 2022 18:34:24 +0000 (11:34 -0700)] 
s3: smbd: Remove dfs_redirect().

A moment of silence please.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Remove call to dfs_redirect() from filename_convert_dirfsp_nosymlink().
Jeremy Allison [Wed, 10 Aug 2022 18:32:30 +0000 (11:32 -0700)] 
s3: smbd: Remove call to dfs_redirect() from filename_convert_dirfsp_nosymlink().

Use dfs_filename_convert() instead. There are now no more callers of dfs_redirect().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Remove call to dfs_redirect() from filename_convert_smb1_search_path().
Jeremy Allison [Wed, 10 Aug 2022 18:29:33 +0000 (11:29 -0700)] 
s3: smbd: Remove call to dfs_redirect() from filename_convert_smb1_search_path().

Use dfs_filename_convert() instead. Code is now much simpler.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In filename_convert_dirfsp_nosymlink(), cope with an MS-DFS link as the...
Jeremy Allison [Mon, 8 Aug 2022 20:18:56 +0000 (13:18 -0700)] 
s3: smbd: In filename_convert_dirfsp_nosymlink(), cope with an MS-DFS link as the terminal component.

If the terminal component was an MSDFS link, openat_pathref_fsp_case_insensitive() will
return NT_STATUS_OBJECT_NAME_NOT_FOUND with a VALID_STAT of a symlink.

If this is the case, check if we actually found a terminal MS-DFS link
at the end of the pathname and return NT_STATUS_PATH_NOT_COVERED.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In filename_convert_dirfsp_nosymlink(), allow a NT_STATUS_PATH_NOT_COVERED...
Jeremy Allison [Mon, 8 Aug 2022 20:15:17 +0000 (13:15 -0700)] 
s3: smbd: In filename_convert_dirfsp_nosymlink(), allow a NT_STATUS_PATH_NOT_COVERED error to be returned.

openat_pathref_dirfsp_nosymlink() can now return NT_STATUS_PATH_NOT_COVERED.
Don't convert this automatically into NT_STATUS_OBJECT_PATH_NOT_FOUND.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Allow openat_pathref_dirfsp_nosymlink() to return NT_STATUS_PATH_NOT_COVERE...
Jeremy Allison [Mon, 8 Aug 2022 18:31:39 +0000 (11:31 -0700)] 
s3: smbd: Allow openat_pathref_dirfsp_nosymlink() to return NT_STATUS_PATH_NOT_COVERED for a DFS link on a DFS share.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In get create_junction(), make sure check_path_syntax() is called on return...
Jeremy Allison [Fri, 12 Aug 2022 06:57:51 +0000 (23:57 -0700)] 
s3: smbd: In get create_junction(), make sure check_path_syntax() is called on returned reqpath.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In get referred_path(), make sure check_path_syntax() is called on returned...
Jeremy Allison [Fri, 12 Aug 2022 06:55:58 +0000 (23:55 -0700)] 
s3: smbd: In get referred_path(), make sure check_path_syntax() is called on returned reqpath.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add dfs_filename_convert(). Simple wrapper around parse_dfs_path().
Jeremy Allison [Mon, 8 Aug 2022 18:16:17 +0000 (11:16 -0700)] 
s3: smbd: Add dfs_filename_convert(). Simple wrapper around parse_dfs_path().

Not yet used.

This is what we will use to replace dfs_redirect() in the filename
conversion code. Keep as a wrapper for now as we might want to
add some error checking around the 'hostname' and 'service'
returns.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Use helper function msdfs_servicename_matches_connection() in dfs_redirect().
Jeremy Allison [Tue, 9 Aug 2022 17:58:24 +0000 (10:58 -0700)] 
s3: smbd: Use helper function msdfs_servicename_matches_connection() in dfs_redirect().

Replaces ugly complex logic.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Use helper function msdfs_servicename_matches_connection() in parse_dfs_path().
Jeremy Allison [Tue, 9 Aug 2022 17:53:18 +0000 (10:53 -0700)] 
s3: smbd: Use helper function msdfs_servicename_matches_connection() in parse_dfs_path().

Replaces ugly complex logic.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add helper function msdfs_servicename_matches_connection().
Jeremy Allison [Tue, 9 Aug 2022 17:49:46 +0000 (10:49 -0700)] 
s3: smbd: Add helper function msdfs_servicename_matches_connection().

Not yet used so commented out.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Remove definition of struct dfs_path.
Jeremy Allison [Mon, 8 Aug 2022 17:27:16 +0000 (10:27 -0700)] 
s3: smbd: Remove definition of struct dfs_path.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Remove use of 'struct dfs_path'. Not needed for a (hostname, servicename...
Jeremy Allison [Wed, 10 Aug 2022 18:17:49 +0000 (11:17 -0700)] 
s3: smbd: Remove use of 'struct dfs_path'. Not needed for a (hostname, servicename, path) tuple.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add TALLOC_CTX * parameter to parse_dfs_path().
Jeremy Allison [Wed, 10 Aug 2022 18:06:47 +0000 (11:06 -0700)] 
s3: smbd: Add TALLOC_CTX * parameter to parse_dfs_path().

Not yet used. Preparing to remove 'struct dfs_path'.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Ensure smb2_file_rename_information() uses the SMB2 pathname parsers, not...
Jeremy Allison [Tue, 9 Aug 2022 17:43:45 +0000 (10:43 -0700)] 
s3: smbd: Ensure smb2_file_rename_information() uses the SMB2 pathname parsers, not the SMB1 parsers.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Make sure we have identical check_path_syntax logic in smbd_smb2_create_dur...
Jeremy Allison [Tue, 9 Aug 2022 17:41:39 +0000 (10:41 -0700)] 
s3: smbd: Make sure we have identical check_path_syntax logic in smbd_smb2_create_durable_lease_check(), as for smb2_create.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: In smbd_smb2_create_send() call the helper function check_path_syntax_smb2().
Jeremy Allison [Tue, 9 Aug 2022 17:39:41 +0000 (10:39 -0700)] 
s3: smbd: In smbd_smb2_create_send() call the helper function check_path_syntax_smb2().

Previously for DFS names we were skipping this.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add helper function check_path_syntax_smb2().
Jeremy Allison [Tue, 9 Aug 2022 17:36:00 +0000 (10:36 -0700)] 
s3: smbd: Add helper function check_path_syntax_smb2().

Not yet used, but uses check_path_syntax_smb2_msdfs()
so remove the #ifdef's around that.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Add new function check_path_syntax_smb2_msdfs() for SMB2 MSDFS paths.
Jeremy Allison [Fri, 5 Aug 2022 19:16:44 +0000 (12:16 -0700)] 
s3: smbd: Add new function check_path_syntax_smb2_msdfs() for SMB2 MSDFS paths.

 #ifdef'ed out as static and not yet used.

We can't just call check_path_syntax() on these as
they are of the form hostname\share[\extrapath]
(where [\extrapath] is optional).

hostname here can be an IPv6 ':' separated address,
which check_path_syntax() fails on due to the streamname
processing.

NB. This also has to cope with out existing (broken)
libsmbclient libraries that sometimes set the DFS
flag and then send a local pathname. Cope by just
calling the normal check_path_syntax() on the
whole pathname in that case.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3: smbd: Fix cosmetic bug logging pathnames from Linux kernel clients using SMB1...
Jeremy Allison [Sat, 6 Aug 2022 02:27:33 +0000 (19:27 -0700)] 
s3: smbd: Fix cosmetic bug logging pathnames from Linux kernel clients using SMB1 DFS calls.

The Linux kernel SMB1 client has a bug - it sends
DFS pathnames as:

\\server\share\path

instead of:

\server\share\path

Causing us to mis-parse server,share,remaining_path here
and jump into 'goto local_path' at 'share\path' instead
of 'path'.

This doesn't cause an error as the limits on share names
are similar to those on pathnames.

parse_dfs_path() which we call before filename parsing
copes with this by calling trim_char on the leading '\'
characters before processing.

Do the same here so logging of pathnames looks better.

How did I find this ? Lots and lots of manual
testing with the Linux kernel client to make
sure all the recent changes haven't broken Linux
SMB1/2/3 DFS :-).

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos4:torture/smb2: add smb2.bench.echo
Stefan Metzmacher [Wed, 10 Aug 2022 13:14:52 +0000 (13:14 +0000)] 
s4:torture/smb2: add smb2.bench.echo

This test calls SMB2_Echo in a loop per connection.

For 4 connections with 2 parallel loops use this:

time smbtorture //127.0.0.1/m -Uroot%test smb2.bench.echo \
--option="torture:timelimit=600" \
--option="torture:nprocs=1" \
--option="torture:qdepth=2"

Sometimes the bottleneck is the smbtorture process.
In order to bring the smbd process to 100% cpu, you can use
'--option="libsmb:client_guid=6112f7d3-9528-4a2a-8861-0ca129aae6c4"'
and run multiple instances of the test at the same time,
which both talk to the same smbd process.

This is a very useful test to show how many requests are possible
at the raw SMB2 layer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 11 19:23:37 UTC 2022 on sn-devel-184

3 years agos4:torture/smb2: teach smb2.bench.path-contention-shared about --option="torture...
Stefan Metzmacher [Wed, 10 Aug 2022 11:43:20 +0000 (11:43 +0000)] 
s4:torture/smb2: teach smb2.bench.path-contention-shared about --option="torture:qdepth=4"

This can now test more than one open/close loop per connection.

time smbtorture //127.0.0.1/m -Uroot%test \
smb2.create.bench-path-contention-shared \
--option='torture:bench_path=' \
--option="torture:timelimit=60" \
--option="torture:nprocs=1" \
--option="torture:qdepth=4"

The default is still 1, but it's very useful for tests.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4:param: add --option="libsmb:client_guid=6112f7d3-9528-4a2a-8861-0ca129aae6c4"...
Stefan Metzmacher [Wed, 10 Aug 2022 13:15:45 +0000 (13:15 +0000)] 
s4:param: add --option="libsmb:client_guid=6112f7d3-9528-4a2a-8861-0ca129aae6c4" support...

We already handle this in the source3/libsmb code, but it's good to
have this also for torture tests.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:g_lock: use TDB_VOLATILE to avoid fcntl locks
Stefan Metzmacher [Wed, 10 Aug 2022 13:16:14 +0000 (13:16 +0000)] 
s3:g_lock: use TDB_VOLATILE to avoid fcntl locks

This improves 'time smbtorture3 //foo/bar -U% local-g-lock-ping-pong -o 50000000'
from ~1.400.000 to ~3.400.000 operations per second any a testsystem.

As we also use TDB_VOLATILE for locking.tdb, this is a much more
realistic test now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: avoid calling SMB_VFS_FGET_NT_ACL() if do_not_check_mask already covers all
Stefan Metzmacher [Tue, 9 Aug 2022 14:07:12 +0000 (14:07 +0000)] 
smbd: avoid calling SMB_VFS_FGET_NT_ACL() if do_not_check_mask already covers all

This is inspired by 0d4cb5a641e1fea2d369bdc66470a580321366c2,
which avoids SMB_VFS_FGET_NT_ACL() for the root user again.

Opens with just FILE_READ_ATTRIBUTES are very common, so it's worth
optimizing for it.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:include: remove unused update_stat_ex_file_id() prototype
Stefan Metzmacher [Wed, 10 Aug 2022 14:45:26 +0000 (16:45 +0200)] 
s3:include: remove unused update_stat_ex_file_id() prototype

It was removed by commit 643da37fd139413651a6198fb0f6e550f7de6584

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:passdb: Consolidate error checking in fetch_ldap_pw()
Pavel Filipenský [Fri, 5 Aug 2022 19:43:25 +0000 (21:43 +0200)] 
s3:passdb: Consolidate error checking in fetch_ldap_pw()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 11 06:34:56 UTC 2022 on sn-devel-184

3 years agos3:passdb: Remove upgrade support of samba-2.2 style ldap password
Pavel Filipenský [Fri, 5 Aug 2022 15:30:19 +0000 (17:30 +0200)] 
s3:passdb: Remove upgrade support of samba-2.2 style ldap password

It was introduced in 2002. Probably we no longer need to support
password upgrade from samba-2.2.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agovfs_default: assert all passed in fsp's and names are non-stream type
Ralph Boehme [Wed, 27 Jul 2022 16:40:21 +0000 (18:40 +0200)] 
vfs_default: assert all passed in fsp's and names are non-stream type

Enforce fsp is a non-stream one in as many VFS operations as possible in
vfs_default. We really need an assert here instead of returning an error, as
otherwise he can have very hard to diagnose bugs.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Aug 10 16:32:35 UTC 2022 on sn-devel-184

3 years agovfs_streams_xattr: restrict which fcntl's are allowed on streams
Ralph Boehme [Fri, 29 Jul 2022 05:07:25 +0000 (07:07 +0200)] 
vfs_streams_xattr: restrict which fcntl's are allowed on streams

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: skip access checks for stat-opens on streams in open_file()
Ralph Boehme [Wed, 27 Jul 2022 13:58:37 +0000 (15:58 +0200)] 
smbd: skip access checks for stat-opens on streams in open_file()

For streams, access is already checked in create_file_unixpath() by
check_base_file_access().

We already skip the access check in this function when doing an IO open of a
file, see above in open_file(), also skip it for "stat opens".

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: use metadata_fsp() in get_acl_group_bits()
Ralph Boehme [Wed, 27 Jul 2022 17:05:26 +0000 (19:05 +0200)] 
smbd: use metadata_fsp() in get_acl_group_bits()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: ignore request to set the SPARSE attribute on streams
Ralph Boehme [Fri, 29 Jul 2022 12:56:41 +0000 (14:56 +0200)] 
smbd: ignore request to set the SPARSE attribute on streams

As per MS-FSA 2.1.1.5 this is a per stream attribute, but our backends don't
support it in a consistent way, therefor just pretend success and ignore the
request.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: use metadata_fsp() with SMB_VFS_FSET_DOS_ATTRIBUTES()
Ralph Boehme [Fri, 29 Jul 2022 12:56:21 +0000 (14:56 +0200)] 
smbd: use metadata_fsp() with SMB_VFS_FSET_DOS_ATTRIBUTES()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: use metadata_fsp() with SMB_VFS_FGET_DOS_ATTRIBUTES()
Ralph Boehme [Fri, 29 Jul 2022 12:55:08 +0000 (14:55 +0200)] 
smbd: use metadata_fsp() with SMB_VFS_FGET_DOS_ATTRIBUTES()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: use metadata_fsp() with SMB_VFS_FSET_NT_ACL()
Ralph Boehme [Fri, 29 Jul 2022 12:54:07 +0000 (14:54 +0200)] 
smbd: use metadata_fsp() with SMB_VFS_FSET_NT_ACL()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmbd: use metadata_fsp() with SMB_VFS_FGET_NT_ACL()
Ralph Boehme [Fri, 29 Jul 2022 12:49:56 +0000 (14:49 +0200)] 
smbd: use metadata_fsp() with SMB_VFS_FGET_NT_ACL()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agoCI: add a test trying to delete a stream on a pathref ("stat open") handle
Ralph Boehme [Wed, 27 Jul 2022 11:37:32 +0000 (13:37 +0200)] 
CI: add a test trying to delete a stream on a pathref ("stat open") handle

When using vfs_streams_xattr, for a pathref handle of a stream the system fd
will be a fake fd created by pipe() in vfs_fake_fd().

For the following callchain we wrongly pass a stream fsp to
SMB_VFS_FGET_NT_ACL():

SMB_VFS_CREATE_FILE(..., "file:stream", ...)
=> open_file():
   if (open_fd):
   -> taking the else branch:
   -> smbd_check_access_rights_fsp(stream_fsp)
      -> SMB_VFS_FGET_NT_ACL(stream_fsp)

This is obviously wrong and can lead to strange permission errors when using
vfs_acl_xattr:

in vfs_acl_xattr we will try to read the stored ACL by calling
fgetxattr(fake-fd) which of course faild with EBADF. Now unfortunately the
vfs_acl_xattr code ignores the specific error and handles this as if there was
no ACL stored and subsequently runs the code to synthesize a default ACL
according to the setting of "acl:default acl style".

As the correct access check for streams has already been carried out by calling
check_base_file_access() from create_file_unixpath(), the above problem is not
a security issue: it can only lead to "decreased" permissions resulting in
unexpected ACCESS_DENIED errors.

The fix is obviously going to be calling
smbd_check_access_rights_fsp(stream_fsp->base_fsp).

This test verifies that deleting a file works when the stored NT ACL grants
DELETE_FILE while the basic POSIX permissions (used in the acl_xattr fallback
code) do not.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agovfs_xattr_tdb: add "xattr_tdb:ignore_user_xattr" option
Ralph Boehme [Wed, 27 Jul 2022 10:47:21 +0000 (12:47 +0200)] 
vfs_xattr_tdb: add "xattr_tdb:ignore_user_xattr" option

Allows passing on "user." xattr to the backend. This can be useful for testing
specific aspects of operation on streams when "streams_xattr" is configured as
stream filesystem backend.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agovfs_xattr_tdb: add a module config
Ralph Boehme [Wed, 27 Jul 2022 09:59:54 +0000 (11:59 +0200)] 
vfs_xattr_tdb: add a module config

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agovfs_xattr_tdb: move close_xattr_db()
Ralph Boehme [Wed, 27 Jul 2022 10:43:01 +0000 (12:43 +0200)] 
vfs_xattr_tdb: move close_xattr_db()

This just makes the diff of the next commit smaller and easier to digest.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agosmdb: use fsp_is_alternate_stream() in open_file()
Ralph Boehme [Wed, 27 Jul 2022 14:04:24 +0000 (16:04 +0200)] 
smdb: use fsp_is_alternate_stream() in open_file()

No change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agothird_party: Reformat shell scripts
Andreas Schneider [Wed, 23 Feb 2022 11:11:07 +0000 (12:11 +0100)] 
third_party: Reformat shell scripts

shfmt -w -p -i 0 -fn third_party/update.sh
shfmt -w -p -i 0 -fn third_party/waf/update.sh

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): Wed Aug 10 14:14:04 UTC 2022 on sn-devel-184

3 years agotestsuite: Reformat shell scripts
Andreas Schneider [Wed, 23 Feb 2022 11:12:09 +0000 (12:12 +0100)] 
testsuite: Reformat shell scripts

shfmt -f testsuite/ | xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat upgradeprovision-oldrelease.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:06 +0000 (15:46 +0200)] 
testprogs: Reformat upgradeprovision-oldrelease.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/upgradeprovision-oldrelease.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat tombstones-expunge.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:06 +0000 (15:46 +0200)] 
testprogs: Reformat tombstones-expunge.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/tombstones-expunge.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_wintest.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:06 +0000 (15:46 +0200)] 
testprogs: Reformat test_wintest.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_wintest.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_weak_disable_ntlmssp_ldap.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:06 +0000 (15:46 +0200)] 
testprogs: Reformat test_weak_disable_ntlmssp_ldap.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_weak_disable_ntlmssp_ldap.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_weak_crypto_server.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:06 +0000 (15:46 +0200)] 
testprogs: Reformat test_weak_crypto_server.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_weak_crypto_server.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_weak_crypto.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:06 +0000 (15:46 +0200)] 
testprogs: Reformat test_weak_crypto.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_weak_crypto.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_trust_utils.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:06 +0000 (15:46 +0200)] 
testprogs: Reformat test_trust_utils.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_trust_utils.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_trust_user_account.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_trust_user_account.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_trust_user_account.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_trust_token.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_trust_token.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_trust_token.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_trust_ntlm.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_trust_ntlm.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_trust_ntlm.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_special_group.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_special_group.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_special_group.sh

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): Wed Aug 10 10:21:48 UTC 2022 on sn-devel-184

3 years agotestprogs: Reformat test_smbtorture_test_names.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_smbtorture_test_names.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_smbtorture_test_names.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_samba_upgradedns.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_samba_upgradedns.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_samba_upgradedns.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_samba-tool_ntacl.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_samba-tool_ntacl.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_samba-tool_ntacl.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_s4u_heimdal.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_s4u_heimdal.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_s4u_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_rpcclient_schannel.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_rpcclient_schannel.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_rpcclient_schannel.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_primary_group.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_primary_group.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_primary_group.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_pkinit_simple.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_pkinit_simple.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_pkinit_simple.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_pkinit_pac.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_pkinit_pac.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_pkinit_pac.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_pdbtest.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_pdbtest.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_pdbtest.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_password_settings.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_password_settings.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_password_settings.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_old_enctypes.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_old_enctypes.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_old_enctypes.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_offline_logon.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_offline_logon.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_offline_logon.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_net_rpc_user.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_net_rpc_user.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_net_rpc_user.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_net_offline.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_net_offline.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_net_offline.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_net_ads_fips.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_net_ads_fips.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_net_ads_fips.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_net_ads_dns.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_net_ads_dns.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_net_ads_dns.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_net_ads.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_net_ads.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_net_ads.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_ldb_simple.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_ldb_simple.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_ldb_simple.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agotestprogs: Reformat test_ldb.sh
Andreas Schneider [Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)] 
testprogs: Reformat test_ldb.sh

shfmt -w -p -i 0 -fn testprogs/blackbox/test_ldb.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
3 years agosmbstatus: Fix the 32-bit build on FreeBSD
Volker Lendecke [Tue, 9 Aug 2022 10:42:05 +0000 (12:42 +0200)] 
smbstatus: Fix the 32-bit build on FreeBSD

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): Tue Aug  9 20:04:26 UTC 2022 on sn-devel-184

3 years agosmbd: Use dirfsp where we have it
Volker Lendecke [Mon, 8 Aug 2022 12:05:46 +0000 (14:05 +0200)] 
smbd: Use dirfsp where we have it

One reference to conn->cwd_fsp less, makes "mkdir" look less ugly in
strace.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3:passdb: Remove unused function secrets_fetch_trust_account_password()
Pavel Filipenský [Fri, 5 Aug 2022 22:35:22 +0000 (00:35 +0200)] 
s3:passdb: Remove unused function secrets_fetch_trust_account_password()

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Aug  8 19:03:08 UTC 2022 on sn-devel-184

3 years agos3:include: Fix trailing whitespaces in secrets.h
Pavel Filipenský [Sat, 6 Aug 2022 08:11:47 +0000 (10:11 +0200)] 
s3:include: Fix trailing whitespaces in secrets.h

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoldb: change the version to 2.7.0 for Samba 4.18
Jule Anger [Mon, 8 Aug 2022 14:49:03 +0000 (16:49 +0200)] 
ldb: change the version to 2.7.0 for Samba 4.18

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Mon Aug  8 15:51:44 UTC 2022 on sn-devel-184

3 years agoWHATSNEW: Start release notes for Samba 4.18.0pre1.
Jule Anger [Mon, 8 Aug 2022 14:24:21 +0000 (16:24 +0200)] 
WHATSNEW: Start release notes for Samba 4.18.0pre1.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 years agoVERSION: Bump version up to 4.18.0pre1...
Jule Anger [Mon, 8 Aug 2022 14:19:11 +0000 (16:19 +0200)] 
VERSION: Bump version up to 4.18.0pre1...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 years agoVERSION: Disable GIT_SNAPSHOT for the Samba 4.17.0rc1 release. samba-4.17.0rc1
Jule Anger [Mon, 8 Aug 2022 14:18:47 +0000 (16:18 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the Samba 4.17.0rc1 release.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 years agoWHATSNEW: Up to Samba 4.17.0rc1.
Jule Anger [Mon, 8 Aug 2022 14:21:26 +0000 (16:21 +0200)] 
WHATSNEW: Up to Samba 4.17.0rc1.

Signed-off-by: Jule Anger <janger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
3 years agos3:tests: Add a test to check json output of smbstatus profile
Jule Anger [Thu, 31 Mar 2022 12:40:17 +0000 (14:40 +0200)] 
s3:tests: Add a test to check json output of smbstatus profile

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Mon Aug  8 14:01:45 UTC 2022 on sn-devel-184

3 years agosmbstatus: add JSON support for smbstatus --profile
Jule Anger [Fri, 25 Mar 2022 13:16:27 +0000 (14:16 +0100)] 
smbstatus: add JSON support for smbstatus --profile

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: fix indentation in profile_separator()
Ralph Boehme [Thu, 4 Aug 2022 16:43:05 +0000 (18:43 +0200)] 
smbstatus: fix indentation in profile_separator()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jule Anger <janger@samba.org>
3 years agosmbstatus: add a method to add profile items to json
Jule Anger [Fri, 5 Aug 2022 11:05:26 +0000 (13:05 +0200)] 
smbstatus: add a method to add profile items to json

The method changes the json item of a given traverse_state.
The root dictionary contains for each section a dictionary, which has
a dictionary for each subsection.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agos3:tests: Add a test to check json output of smbstatus
Jule Anger [Tue, 22 Mar 2022 15:12:41 +0000 (16:12 +0100)] 
s3:tests: Add a test to check json output of smbstatus

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add JSON support for smbstatus
Jule Anger [Thu, 24 Mar 2022 14:46:50 +0000 (15:46 +0100)] 
smbstatus: add JSON support for smbstatus

Adds the option --json for all informations except the profiling.
With --json sets the json_output variable to true, so that the json dictionary
can be created and printed.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add machine readable creation_time to notify
Jule Anger [Mon, 1 Aug 2022 09:04:23 +0000 (11:04 +0200)] 
smbstatus: add machine readable creation_time to notify

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add server_id to notifies
Jule Anger [Mon, 2 May 2022 08:58:24 +0000 (10:58 +0200)] 
smbstatus: add server_id to notifies

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add a notifies dictionary
Jule Anger [Mon, 1 Aug 2022 09:19:37 +0000 (11:19 +0200)] 
smbstatus: add a notifies dictionary

Adds an empty json dictionary under the key "notifies" and adds foreach
notify a dictionary with information to the notify dictionary. Uses the
pid as key.

Only print to stdout, if json_output is not set.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add file_id information to byte-range locks in json output
Jule Anger [Mon, 1 Aug 2022 09:15:44 +0000 (11:15 +0200)] 
smbstatus: add file_id information to byte-range locks in json output

Adds a dictionary with file_id information (devid, inode and extid) for
each byte-range locked file.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add locks to byte-range locked files in json output
Jule Anger [Thu, 31 Mar 2022 08:31:31 +0000 (10:31 +0200)] 
smbstatus: add locks to byte-range locked files in json output

At the moment, there is only information about the byte-range locked files.
Adds a list of its locks for each file. An open is represented as
a dictionary. Contains all information (pid, dev_inode, read_write, start
and size) about the lock.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add server_id to byte-range locks
Jule Anger [Mon, 2 May 2022 08:57:28 +0000 (10:57 +0200)] 
smbstatus: add server_id to byte-range locks

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agosmbstatus: add a basic byte-range locks dictionary
Jule Anger [Thu, 31 Mar 2022 08:30:30 +0000 (10:30 +0200)] 
smbstatus: add a basic byte-range locks dictionary

Adds an empty json dictionary under the key "byte_range_locks"
and adds foreach locked file a dictionary with information
(path and filename) to the byte-range locks dictionary.

Only print to stdout, if json_output is not set.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>