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

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

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

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

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

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

2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 years agosmbstatus: add service path to byte-range locks
Jule Anger [Mon, 25 Apr 2022 10:15:57 +0000 (12:15 +0200)]
smbstatus: add service path to byte-range locks

The service/share path was added in 39ddd0a520bc and removed in
3a7d372e2eb5.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add machine readable time info to locked files
Jule Anger [Mon, 9 May 2022 08:00:22 +0000 (10:00 +0200)]
smbstatus: add machine readable time info to locked files

Time has the format "2022-03-31T12:23:30+0200".

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add general caching information about open files to json output
Jule Anger [Mon, 1 Aug 2022 10:02:15 +0000 (12:02 +0200)]
smbstatus: add general caching information about open files to json output

Adds a dictionary named "caching" to a opens dictionary.
Represents both oplock and leases caching. The dictionary contains a
boolean for each type (READE, WRITE and HANDLE), the hex value and a string
representation.
If no oplocks are used, the dictionary is left empty.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add sharemode information about open files to json output
Jule Anger [Mon, 1 Aug 2022 10:01:41 +0000 (12:01 +0200)]
smbstatus: add sharemode information about open files to json output

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

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add lease information about open files to json output
Jule Anger [Wed, 30 Mar 2022 15:05:02 +0000 (17:05 +0200)]
smbstatus: add lease information about open files to json output

Adds a dictionary named "lease" to a opens dictionary.
If leases are used, the dictionary contains a boolean for each type
(READE, WRITE and HANDLE or UNKNOWN) and a string representation of
the lease. Otherwise the dict is left empty.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add oplock information about open files to json output
Jule Anger [Wed, 30 Mar 2022 13:40:56 +0000 (15:40 +0200)]
smbstatus: add oplock information about open files to json output

Adds a dictionary named "oplock" to a opens dictionary.
Contains a string representation and booleans for each oplock type
(EXCLUSIVE, BATCH, LEVEL_II, LEASE).

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add access mode information about open files to json output
Jule Anger [Wed, 30 Mar 2022 13:39:42 +0000 (15:39 +0200)]
smbstatus: add access mode information about open files to json output

Adds a dictionary named "access_mask" to a open dictionary.
Contains the hex value of the mask, a text representation and booleans
for each attribute.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add opens to files in json output
Jule Anger [Wed, 30 Mar 2022 13:36:13 +0000 (15:36 +0200)]
smbstatus: add opens to files in json output

At the moment, there is only information about the open files.
Adds a list of its opens for each file. An open is represented as
a dictionary. Contains only the basic information (pid, uid and
time) about the open.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add file_id information about open files to json output
Jule Anger [Wed, 30 Mar 2022 13:14:13 +0000 (15:14 +0200)]
smbstatus: add file_id information about open files to json output

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

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add a basic dictionary with open files
Jule Anger [Wed, 30 Mar 2022 13:11:11 +0000 (15:11 +0200)]
smbstatus: add a basic dictionary with open files

Adds an empty json dictionary under the key "open_files" and adds foreach
locked file a dictionary with information (path, filename and pending
deletes) to the locked files dictionary. Uses path and filename 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>
2 years agosmbstatus: add encryption and signing to sessions
Jule Anger [Mon, 9 May 2022 10:26:30 +0000 (12:26 +0200)]
smbstatus: add encryption and signing to sessions

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

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add a sessions dictionary
Jule Anger [Thu, 24 Mar 2022 13:09:35 +0000 (14:09 +0100)]
smbstatus: add a sessions dictionary

Adds an empty json dictionary under the key "sessions" and adds foreach
session a dictionary with information to the session dictionary. Uses the
session_id as key.
uid_str and gid_str are needed because both receive their own JSON field.

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>
2 years agosmbstatus: add encryption and signing to connections
Jule Anger [Mon, 9 May 2022 08:11:38 +0000 (10:11 +0200)]
smbstatus: add encryption and signing to connections

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add machine readable time to connections
Jule Anger [Mon, 9 May 2022 07:59:32 +0000 (09:59 +0200)]
smbstatus: add machine readable time to connections

Time has the format "2022-03-31T12:23:30+0200".

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoconn_tdb: change type of connections_data.start to NTTIME
Jule Anger [Mon, 18 Jul 2022 09:33:12 +0000 (11:33 +0200)]
conn_tdb: change type of connections_data.start to NTTIME

connections_data.start previously had the type time_t, but time_t
only had a precision for seconds. NTTIME has a higer precision,
which is useful for debugging.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add session_id to connections dictionary
Jule Anger [Thu, 7 Jul 2022 08:09:05 +0000 (10:09 +0200)]
smbstatus: add session_id to connections dictionary

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoconn_tdb: add sess_id to struct connections_data
Jule Anger [Thu, 7 Jul 2022 08:08:36 +0000 (10:08 +0200)]
conn_tdb: add sess_id to struct connections_data

Save the session global id as sess_id in the connections_data struct.

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

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

Adds an empty json dictionary under the key "tcons" and adds foreach
connection a dictionary with information to the shares 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>
2 years agosmbstatus: add general information to the json output
Jule Anger [Thu, 31 Mar 2022 09:04:52 +0000 (11:04 +0200)]
smbstatus: add general information to the json output

Adds timestamp, samba version and path to smb.conf to a given json
object.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add method add_section_to_json
Jule Anger [Thu, 31 Mar 2022 08:17:47 +0000 (10:17 +0200)]
smbstatus: add method add_section_to_json

The method adds an empty json object (value) under a given section name
(key) to a given json object.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add json items to traverse_struct
Jule Anger [Thu, 24 Mar 2022 14:46:35 +0000 (15:46 +0100)]
smbstatus: add json items to traverse_struct

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add frame files for json specific methods
Jule Anger [Thu, 24 Mar 2022 13:38:46 +0000 (14:38 +0100)]
smbstatus: add frame files for json specific methods

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: use new enum crypto_degree
Jule Anger [Mon, 11 Jul 2022 09:05:12 +0000 (11:05 +0200)]
smbstatus: use new enum crypto_degree

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add enum to handle partial encryption and signing
Jule Anger [Mon, 11 Jul 2022 08:40:16 +0000 (10:40 +0200)]
smbstatus: add enum to handle partial encryption and signing

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: move the output of the content to their own methods
Jule Anger [Thu, 24 Mar 2022 10:36:56 +0000 (11:36 +0100)]
smbstatus: move the output of the content to their own methods

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: move the output of the title lines to their own methods
Jule Anger [Thu, 24 Mar 2022 15:34:10 +0000 (16:34 +0100)]
smbstatus: move the output of the title lines to their own methods

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: pass the traverse_state to the traverse methods
Jule Anger [Thu, 24 Mar 2022 15:27:10 +0000 (16:27 +0100)]
smbstatus: pass the traverse_state to the traverse methods

The state cannot be used as a context, so a NULL context tmp_ctx must be created.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: add struct traverse_state
Jule Anger [Wed, 23 Mar 2022 14:17:48 +0000 (15:17 +0100)]
smbstatus: add struct traverse_state

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: use variables in print_share_mode instead of printing directly
Jule Anger [Wed, 23 Mar 2022 08:13:58 +0000 (09:13 +0100)]
smbstatus: use variables in print_share_mode instead of printing directly

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: print errors to stderr instead of stdout
Jule Anger [Wed, 23 Mar 2022 07:58:54 +0000 (08:58 +0100)]
smbstatus: print errors to stderr instead of stdout

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoaudit_logging: add method to replace the object for a given key with a new object
Jule Anger [Tue, 22 Mar 2022 15:06:37 +0000 (16:06 +0100)]
audit_logging: add method to replace the object for a given key with a new object

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbstatus: delete wrong EXCLUSIVE+BATCH oplock
Jule Anger [Mon, 9 May 2022 10:09:18 +0000 (12:09 +0200)]
smbstatus: delete wrong EXCLUSIVE+BATCH oplock

It is not possible to have an EXCLUSIVE+BATCH oplock, because a BATCH
oplock includes an EXCLUSIVE oplock. Therefore, an EXCLUSIVE+BATCH-Oplock
and a BATCH-Oplock are the same thing.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Oops. DBG_ERR messages I used to debug parse_dfs_path(), should have been...
Jeremy Allison [Fri, 5 Aug 2022 18:06:13 +0000 (11:06 -0700)]
s3: smbd: Oops. DBG_ERR messages I used to debug parse_dfs_path(), should have been DBG_DEBUG.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug  8 09:07:24 UTC 2022 on sn-devel-184

2 years agolib/util/access: source3/auth/user_util: Check for INNETGR
listout [Thu, 14 Jul 2022 13:21:09 +0000 (18:51 +0530)]
lib/util/access: source3/auth/user_util: Check for INNETGR

Checking for presence of both netgroup and innetgr. INNETGR is not
defined on libc's such as musl so not checking results in a build error.

Signed-off-by: listout <brahmajit.xyz@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug  8 07:28:31 UTC 2022 on sn-devel-184

2 years agonsswitch/wins: Define NETDB_* for other libc's
listout [Thu, 14 Jul 2022 13:15:17 +0000 (18:45 +0530)]
nsswitch/wins: Define NETDB_* for other libc's

Define NETDB_SUCCESS and NETDB_INTERNAL if they are not defined. On
libc's such as musl NETDB_INTERNAL and NETDB_SUCCESS are not defined.

Signed-off-by: listout <brahmajit.xyz@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 years agovfs: Add struct vfs_open_how.resolve
Volker Lendecke [Fri, 3 Jun 2022 14:45:41 +0000 (16:45 +0200)]
vfs: Add struct vfs_open_how.resolve

This prepares the later introduction of VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS,
which will be used to make use of RESOLVE_NO_SYMLINKS on linux with openat2().

Right now all terminal VFS objects reject any resolve bits with ENOSYS.
So we only prepare the vfs layer for now without any real change.
But this will make backports to 4.17 much easier.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
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): Sat Aug  6 02:39:11 UTC 2022 on sn-devel-184