The branch, master has been updated via aab17124785 smbd: Assert that INTERNAL_OPEN_ONLY never gets real oplocks via 5e05686e392 smbd: Remove deferred_open_record_create() via 718c4e27cd5 smbd: Remove "delayed_for_oplocks" from deferred_open_record_create() via fc09be5b51f smbd: Remove "deferred_open_record->delayed_for_oplocks" via 61765c7e15b smbd: Remove "id" from deferred_open_record_create() via 67c5034531d smbd: Remove "deferred_open_record->id" via fbc36759541 smbd: Clean up leases.tdb if set_share_mode() fails via 6e7d28c8e03 smbd: Factor out remove_lease_if_stale() via 2d4e2ea2494 smbd: Inline remove_oplock_under_lock() into its only caller via e28c2ee9038 smbd: Make remove_oplock_under_lock static via e4d5c53e808 smbd: Slightly simplify set_share_mode() via 3851062916c smbd: Move fsp_client_guid() to locking/ via e94ebc70554 smbd: Slightly optimize reply_open_and_X() via ef0cf081603 smbd: Remove "share_access" from fcb_or_dos_open() via c56be509f1f smbd: Remove "share_access" from dup_file_fsp() via 13921645c48 smbd: Remove "share_access" from files_struct via 81731c91414 vfs_gpfs: Avoid "fsp->share_access" in vfs_gpfs_kernel_flock() via 71c6da46eee smbd: Pass share_access/access_mask explicitly to grant_fsp_oplock_type() via 41ab2b8ec5d smbd: Pass share_access/access_mask explicitly to set_share_mode() via 1d9970735ce smbd: Fix a typo via a7d4d5effa5 smbd: Fix a typo via 303c4829e1c smbd: Enhance debugging in push_deferred_open_message_smb() via 88768fdecdf smbd: Use timeval_str_buf() in defer_open() via aedfee8f49b smbd: Fix a signed/unsigned warning via 2181221d6f0 smbd: Fix a signed/unsigned comparison via 4c6f12c3239 smbd: Remove a false comment via df1caf29fbb torture3: Don't duplicate set_blocking() via e049ef3e787 lib: Remove a duplicate prototype for set_blocking() via 04dcae23ab4 build: Only check rpc/xdr.h in tirpc if required via 42e72f1a30d vfs: Fix the nfs4acl build on FreeBSD via d2d4e03b962 build: Correctly detect rpc/xdr.h on FreeBSD via 9bae499da78 wscript: Fix a typo via a8e034794be winbind: Fix the clang build via d103af280af vfs: Fix the FreeBSD nfs4acl build via d8ae2811520 dsdb: Fix the FreeBSD build via a8a1ca3f83d smbd: Fix the build with clang via 3ca52f11dcc smbd: Pass in "struct smb_request" to request_timed_out() via bb81b9a75ad smbd: Use "req->request_time" in schedule_async_open() via af97381b115 smbd: Use "req->request_time" in schedule_async_open() via 2d05524e846 smbd: Use "req->request_time" in setup_kernel_oplock_poll_open() via d5b5ef3e2fa smbd: Use "req->request_time" in defer_open() via e5ad2d37202 smbd: Use "req->request_time" in schedule_defer_open() via 2ef382fa764 smbd: Avoid a separate "request_time" variable in open_file_ntcreate via f5735e2c666 tdb: Inline the common part of tdb_oob via 897bffa8166 tdb: Speed up tdb_oob() via 5a388453e0c tdb: Introduce tdb_oob() via 885ba572efa tdb: Rename tdb_oob() to tdb_notrans_oob() from fe9b12b2740 pidl/ndr/python: avoid memory errors in getsetters
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit aab17124785b6e4c004368b69bee28fb6cad55c3 Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 6 17:27:12 2019 +0200 smbd: Assert that INTERNAL_OPEN_ONLY never gets real oplocks Slightly simplify assumptions in the code Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Aug 6 23:06:41 UTC 2019 on sn-devel-184 commit 5e05686e392107b0e75ca9db6a735eef90245665 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 30 07:20:42 2019 +0200 smbd: Remove deferred_open_record_create() This hides a talloc off the NULL context: The caller needs to make sure this is put on a real talloc context later. Make that more obvious. Also, it passes down a boolean flag, making its purpose a bit opaque to the caller sites. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 718c4e27cd502ebb74da41c9911e8d752ac45922 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 30 07:16:12 2019 +0200 smbd: Remove "delayed_for_oplocks" from deferred_open_record_create() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit fc09be5b51fa99bacf6ad761217c9d422a8753d1 Author: Volker Lendecke <v...@samba.org> Date: Mon Jul 29 21:42:12 2019 +0200 smbd: Remove "deferred_open_record->delayed_for_oplocks" Nobody used this Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 61765c7e15b52df9c18541cf8604887f2d558bde Author: Volker Lendecke <v...@samba.org> Date: Fri Jul 26 19:18:37 2019 +0200 smbd: Remove "id" from deferred_open_record_create() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 67c5034531dca175a70772eedd1489333d511fb4 Author: Volker Lendecke <v...@samba.org> Date: Fri Jul 26 19:16:09 2019 +0200 smbd: Remove "deferred_open_record->id" Nobody used this Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit fbc367595418dee16333f3334381a226d37d4e25 Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 6 10:45:27 2019 +0200 smbd: Clean up leases.tdb if set_share_mode() fails Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6e7d28c8e03a832bd0704e7f72b25e448746c35a Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 18:50:08 2019 +0200 smbd: Factor out remove_lease_if_stale() remove_lease_if_stale() does not have the check if (e == e2) { /* Not ourselves. */ continue; } that remove_share_mode_lease() had. However, remove_share_mode_lease() has already set e->op_type=NO_OPLOCK, so that the if (e->op_type != LEASE_OPLOCK) { continue; } statement has the same effect. Why? The next commit will need it for proper error path cleanup. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2d4e2ea24947c4d2eb647c98b36d9cebb54d434d Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 18:18:41 2019 +0200 smbd: Inline remove_oplock_under_lock() into its only caller Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e28c2ee903855627bc71924a6449267725a7f75d Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 17:05:20 2019 +0200 smbd: Make remove_oplock_under_lock static We have support for nested get_share_mode_lock calls, so we can avoid this additional function. It's one more talloc/free per close, but I hope this can't be measurable. Our open/close path is pretty expensive anyway. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e4d5c53e8083406552f361d2df27528d1c2ea061 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 14:59:18 2019 +0200 smbd: Slightly simplify set_share_mode() The fsp carries all required information also for leases. There's no need to pass that as additional parameters Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3851062916cbee2114f6aa5154cdc89425724d87 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 14:57:28 2019 +0200 smbd: Move fsp_client_guid() to locking/ Yes, this adds another peek from locking/ back into smbd/proto.h, but locking/locking.c does the same already. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e94ebc705542ffca536d15e28fc99e023f4748bc Author: Volker Lendecke <v...@samba.org> Date: Fri Jul 26 16:20:17 2019 +0200 smbd: Slightly optimize reply_open_and_X() Well, this is just a drive-by patch: We don't use "mtime" if we exit early. So it's not really a worthwhile optimization, to me it's more a code clarity thing. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ef0cf081603b4f23c7fcdbde1ac6be7b7fd58a48 Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 16:22:51 2019 +0200 smbd: Remove "share_access" from fcb_or_dos_open() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c56be509f1f7957057243047470f7bbf26186b2c Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 16:20:04 2019 +0200 smbd: Remove "share_access" from dup_file_fsp() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 13921645c4856ddc325a0f8c8a64d0bbecab119d Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 16:15:46 2019 +0200 smbd: Remove "share_access" from files_struct Nobody used this (except vfs_gpfs, which did not need it really). If you *really* need this, you can always look in locking.tdb, but this should never happen in any hot code path, as no runtime decisions are made on the share access after the open is done. Bump VFS interface number to 42. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 81731c91414fdf32b150e6be120741dc3a3fdde3 Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 14:50:35 2019 +0200 vfs_gpfs: Avoid "fsp->share_access" in vfs_gpfs_kernel_flock() This was in vfs_gpfs.c from day one, no idea why both "share_mode" and "fsp->share_access" were used as if they were two different things. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 71c6da46eee4acc245bd326865f84336f457f538 Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 16:08:35 2019 +0200 smbd: Pass share_access/access_mask explicitly to grant_fsp_oplock_type() Why? While restructuring open_file_ntcreate() I found the data flow for these values confusing: grant_fsp_oplock_type() depends on fsp->access_mask, which changes its value inside open_file_ntcreate(). I find the data flow easier to follow if it happens in explicit variables. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 41ab2b8ec5d398ef6187562c7620c359837f3899 Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 15:01:37 2019 +0200 smbd: Pass share_access/access_mask explicitly to set_share_mode() Makes the interface more obvious to me. Also, I want to remove fsp->share_access, which is not really used anywhere after the fsp has been fully established. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1d9970735ced7adae24f4926a4eeed902d132426 Author: Volker Lendecke <v...@samba.org> Date: Fri Jul 26 16:28:39 2019 +0200 smbd: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a7d4d5effa5e3e6c2e09e16ad1ce303e31b61544 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 23 17:46:22 2019 +0200 smbd: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 303c4829e1c28a889293aad312ea50d380fbd043 Author: Volker Lendecke <v...@samba.org> Date: Fri Aug 2 12:02:24 2019 +0200 smbd: Enhance debugging in push_deferred_open_message_smb() Real timestamps are easier to read Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 88768fdecdf4aea12a8a0edfdbe22345ff05be20 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 13:24:49 2019 +0200 smbd: Use timeval_str_buf() in defer_open() Also make this a hires timestamp for better debugging. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit aedfee8f49b643ae7d1ee4f0bc53f2a835652f30 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 30 07:10:28 2019 +0200 smbd: Fix a signed/unsigned warning For whatever reason, "st_size" in "struct stat" is an off_t, which is a signed integer. Negative sizes don't really make sense, so this cast should be safe. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2181221d6f06b3285a57bcf57ef263770ef0ccb0 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 30 06:55:45 2019 +0200 smbd: Fix a signed/unsigned comparison In the 2nd for-loop we need a signed int as we are comparing to >=0. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4c6f12c3239c926a34e6b93fa6d0ec167a62c63d Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 12:04:49 2019 +0200 smbd: Remove a false comment Looking at the code we do respect the kernel_flock failure. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit df1caf29fbb745927f94a26598ee8e01ba8d9807 Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 11:39:19 2019 +0200 torture3: Don't duplicate set_blocking() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e049ef3e787d8e7939b70d67a167766e89a04083 Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 25 11:38:36 2019 +0200 lib: Remove a duplicate prototype for set_blocking() This is now in lib/util/blocking.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 04dcae23ab47a31a7348f0246cc2cf434d4e5fc6 Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 12:19:24 2019 +0200 build: Only check rpc/xdr.h in tirpc if required Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 42e72f1a30db9090d53669ca68cc71bbe784758d Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 12:18:42 2019 +0200 vfs: Fix the nfs4acl build on FreeBSD FreeBSD needs rpc/types.h before rpc/xdr.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d2d4e03b962d22875d6a3b170880c588fdc2688b Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 12:14:03 2019 +0200 build: Correctly detect rpc/xdr.h on FreeBSD FreeBSD needs rpc/types.h included before rpc/xdr.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9bae499da78b7978a8145bd6c3499d047b1afe68 Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 11:45:31 2019 +0200 wscript: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a8e034794beaed00205ba198cbb77c5705767eb1 Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 11:40:20 2019 +0200 winbind: Fix the clang build clang complains that lm_resp and nt_resp is used uninitialized. This is true for the "goto done;" in line 2644. This directly calls log_authentication without having initialized those two blobs. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d103af280afd29d633b1958620e7b3beddfd6087 Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 11:37:59 2019 +0200 vfs: Fix the FreeBSD nfs4acl build I get error messages telling SMB4ACL_T isn't defined in the prototype. Take the easy way to just define that anonymously. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d8ae28115200196546ace109e338b55a7ae72a93 Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 11:08:40 2019 +0200 dsdb: Fix the FreeBSD build My FreeBSD install does not have __compar_fn_t. libreplace has the QSORT_CAST for systems that do. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a8a1ca3f83dce6d725392989cbc97271cbf52f4a Author: Volker Lendecke <v...@samba.org> Date: Wed Jul 31 10:42:24 2019 +0200 smbd: Fix the build with clang clang correctly complains that "close_fsp" is used uninitialized if "get_posix_fsp" fails and we end up in "goto out;". Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3ca52f11dcc27de0cbd67c8f030d2984869c3085 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 17:00:45 2019 +0200 smbd: Pass in "struct smb_request" to request_timed_out() It seems more natural to pass in a request to a routine called request_timed_out(), and it's a few bytes less .text Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit bb81b9a75ad66ad8a78f146d217e74c3bf7cc7f8 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 16:42:59 2019 +0200 smbd: Use "req->request_time" in schedule_async_open() All callers passed that in Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit af97381b11572befe35dc0cb32ccce59a3f4beaa Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 16:42:59 2019 +0200 smbd: Use "req->request_time" in schedule_async_open() The one caller passed that in. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2d05524e846cf75b1a5482855b0afc9092040b17 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 16:42:59 2019 +0200 smbd: Use "req->request_time" in setup_kernel_oplock_poll_open() Both callers passed that in. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d5b5ef3e2fa56a67fec4265384508c74e41f1ca5 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 16:42:59 2019 +0200 smbd: Use "req->request_time" in defer_open() Both callers passed that in. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e5ad2d372027fea64d62deaffe6baf95df36f58a Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 16:42:59 2019 +0200 smbd: Use "req->request_time" in schedule_defer_open() Both callers passed that in. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2ef382fa764da3dae9f251925c2d9057bb7bb260 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 1 16:36:48 2019 +0200 smbd: Avoid a separate "request_time" variable in open_file_ntcreate We have "smb_request->request_time" that is already set up by init_smb_request(). Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f5735e2c666a5a494131c1d25f7ba5c7fbeae923 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 4 18:26:05 2019 +0200 tdb: Inline the common part of tdb_oob When you set in tdbtorture.c to make it more similar to locking.tdb use, bin/tdbtorture -m -n 1 -l 100000 -s becomes twice as fast. This is a pretty extreme case, but all other tests that I did improve significantly as well. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 897bffa8166f643eb9063a848bb0c02455663317 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 4 12:18:19 2019 +0200 tdb: Speed up tdb_oob() This is common between both implementations of tdb_oob(). It's faster if we don't have to dereference function pointers. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5a388453e0cb038fa3ed5fb46f972470f7793566 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 4 12:15:14 2019 +0200 tdb: Introduce tdb_oob() Initially just encapsulate the pointer dereferences Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 885ba572efaac6c20388b8e119315c837e8f5236 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 4 12:10:03 2019 +0200 tdb: Rename tdb_oob() to tdb_notrans_oob() tdb_oob() will become a public function encapsulating the pointer dereferences. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/tdb/common/check.c | 6 +- lib/tdb/common/freelist.c | 2 +- lib/tdb/common/io.c | 33 +++-- lib/tdb/common/open.c | 6 +- lib/tdb/common/rescue.c | 4 +- lib/tdb/common/tdb_private.h | 13 ++ lib/tdb/common/transaction.c | 7 +- lib/tdb/common/traverse.c | 3 +- lib/tdb/test/run-3G-file.c | 2 +- source3/include/proto.h | 1 - source3/include/vfs.h | 6 +- source3/locking/leases_util.c | 6 + source3/locking/locking.c | 88 +++++++------- source3/locking/proto.h | 8 +- source3/modules/nfs4acl_xattr_ndr.h | 2 + source3/modules/nfs4acl_xattr_nfs.c | 3 + source3/modules/nfs4acl_xattr_nfs.h | 2 + source3/modules/nfs4acl_xattr_xdr.c | 3 + source3/modules/vfs_gpfs.c | 2 +- source3/smbd/close.c | 2 +- source3/smbd/durable.c | 1 - source3/smbd/files.c | 15 +-- source3/smbd/open.c | 174 +++++++++++---------------- source3/smbd/oplock.c | 29 ++--- source3/smbd/process.c | 25 ++-- source3/smbd/proto.h | 18 +-- source3/smbd/reply.c | 4 +- source3/smbd/smb1_utils.c | 2 - source3/smbd/smb1_utils.h | 1 - source3/smbd/trans2.c | 3 +- source3/torture/wbc_async.c | 28 +---- source3/winbindd/winbindd_pam.c | 2 +- source3/wscript | 6 +- source4/dsdb/samdb/ldb_modules/count_attrs.c | 4 +- 34 files changed, 240 insertions(+), 271 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/tdb/common/check.c b/lib/tdb/common/check.c index 3a5c8b8ba94..d7741f6b2f9 100644 --- a/lib/tdb/common/check.c +++ b/lib/tdb/common/check.c @@ -94,7 +94,7 @@ static bool tdb_check_record(struct tdb_context *tdb, off, rec->next)); goto corrupt; } - if (tdb->methods->tdb_oob(tdb, rec->next, sizeof(*rec), 0)) + if (tdb_oob(tdb, rec->next, sizeof(*rec), 0)) goto corrupt; /* Check rec_len: similar to rec->next, implies next record. */ @@ -112,7 +112,7 @@ static bool tdb_check_record(struct tdb_context *tdb, goto corrupt; } /* OOB allows "right at the end" access, so this works for last rec. */ - if (tdb->methods->tdb_oob(tdb, off, sizeof(*rec)+rec->rec_len, 0)) + if (tdb_oob(tdb, off, sizeof(*rec)+rec->rec_len, 0)) goto corrupt; /* Check tailer. */ @@ -362,7 +362,7 @@ _PUBLIC_ int tdb_check(struct tdb_context *tdb, } /* Make sure we know true size of the underlying file. */ - tdb->methods->tdb_oob(tdb, tdb->map_size, 1, 1); + tdb_oob(tdb, tdb->map_size, 1, 1); /* Header must be OK: also gets us the recovery ptr, if any. */ if (!tdb_check_header(tdb, &recovery_start)) diff --git a/lib/tdb/common/freelist.c b/lib/tdb/common/freelist.c index 37a4c168533..046c747cf9b 100644 --- a/lib/tdb/common/freelist.c +++ b/lib/tdb/common/freelist.c @@ -50,7 +50,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct tdb_record rec->magic, off)); return -1; } - if (tdb->methods->tdb_oob(tdb, rec->next, sizeof(*rec), 0) != 0) + if (tdb_oob(tdb, rec->next, sizeof(*rec), 0) != 0) return -1; return 0; } diff --git a/lib/tdb/common/io.c b/lib/tdb/common/io.c index df460176159..0de0dabd827 100644 --- a/lib/tdb/common/io.c +++ b/lib/tdb/common/io.c @@ -136,8 +136,8 @@ static int tdb_fstat(struct tdb_context *tdb, struct stat *buf) see if the database has been expanded by someone else and expand if necessary */ -static int tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, - int probe) +static int tdb_notrans_oob( + struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, int probe) { struct stat st; if (len + off < len) { @@ -150,6 +150,11 @@ static int tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, return -1; } + /* + * This duplicates functionality from tdb_oob(). Don't remove: + * we still have direct callers of tdb->methods->tdb_oob() + * inside transaction.c. + */ if (off + len <= tdb->map_size) return 0; if (tdb->flags & TDB_INTERNAL) { @@ -216,7 +221,7 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off, return -1; } - if (tdb->methods->tdb_oob(tdb, off, len, 0) != 0) + if (tdb_oob(tdb, off, len, 0) != 0) return -1; if (tdb->map_ptr) { @@ -271,7 +276,7 @@ void *tdb_convert(void *buf, uint32_t size) static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf, tdb_len_t len, int cv) { - if (tdb->methods->tdb_oob(tdb, off, len, 0) != 0) { + if (tdb_oob(tdb, off, len, 0) != 0) { return -1; } @@ -596,7 +601,7 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size) } /* must know about any previous expansions by another process */ - tdb->methods->tdb_oob(tdb, tdb->map_size, 1, 1); + tdb_oob(tdb, tdb->map_size, 1, 1); /* * Note: that we don't care about tdb->hdr_ofs != 0 here @@ -662,6 +667,12 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size) return -1; } +int _tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, int probe) +{ + int ret = tdb->methods->tdb_oob(tdb, off, len, probe); + return ret; +} + /* read/write a tdb_off_t */ int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d) { @@ -714,7 +725,7 @@ int tdb_parse_data(struct tdb_context *tdb, TDB_DATA key, * Optimize by avoiding the malloc/memcpy/free, point the * parser directly at the mmap area. */ - if (tdb->methods->tdb_oob(tdb, offset, len, 0) != 0) { + if (tdb_oob(tdb, offset, len, 0) != 0) { return -1; } data.dptr = offset + (unsigned char *)tdb->map_ptr; @@ -756,20 +767,20 @@ int tdb_rec_read(struct tdb_context *tdb, tdb_off_t offset, struct tdb_record *r return -1; } - ret = tdb->methods->tdb_oob(tdb, offset, rec->key_len, 1); + ret = tdb_oob(tdb, offset, rec->key_len, 1); if (ret == -1) { return -1; } - ret = tdb->methods->tdb_oob(tdb, offset, rec->data_len, 1); + ret = tdb_oob(tdb, offset, rec->data_len, 1); if (ret == -1) { return -1; } - ret = tdb->methods->tdb_oob(tdb, offset, rec->rec_len, 1); + ret = tdb_oob(tdb, offset, rec->rec_len, 1); if (ret == -1) { return -1; } - return tdb->methods->tdb_oob(tdb, rec->next, sizeof(*rec), 0); + return tdb_oob(tdb, rec->next, sizeof(*rec), 0); } int tdb_rec_write(struct tdb_context *tdb, tdb_off_t offset, struct tdb_record *rec) @@ -782,7 +793,7 @@ static const struct tdb_methods io_methods = { tdb_read, tdb_write, tdb_next_hash_chain, - tdb_oob, + tdb_notrans_oob, tdb_expand_file, }; diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c index dd5783ef8bc..f7f65b0e237 100644 --- a/lib/tdb/common/open.c +++ b/lib/tdb/common/open.c @@ -655,7 +655,7 @@ _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int td * As this skips tdb->hdr_ofs. */ tdb->map_size = 0; - ret = tdb->methods->tdb_oob(tdb, 0, 1, 0); + ret = tdb_oob(tdb, 0, 1, 0); if (ret == -1) { errno = EIO; goto fail; @@ -677,7 +677,7 @@ _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int td goto fail; } - ret = tdb->methods->tdb_oob(tdb, FREELIST_TOP, 4*tdb->hash_size, 1); + ret = tdb_oob(tdb, FREELIST_TOP, 4*tdb->hash_size, 1); if (ret == -1) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " "hash size %"PRIu32" does not fit\n", tdb->hash_size)); @@ -895,7 +895,7 @@ static int tdb_reopen_internal(struct tdb_context *tdb, bool active_lock) * As this skips tdb->hdr_ofs. */ tdb->map_size = 0; - if (tdb->methods->tdb_oob(tdb, 0, 1, 0) != 0) { + if (tdb_oob(tdb, 0, 1, 0) != 0) { goto fail; } #endif /* fake pread or pwrite */ diff --git a/lib/tdb/common/rescue.c b/lib/tdb/common/rescue.c index e608db41dea..7a85ebc9311 100644 --- a/lib/tdb/common/rescue.c +++ b/lib/tdb/common/rescue.c @@ -60,7 +60,7 @@ static bool looks_like_valid_record(struct tdb_context *tdb, if (rec->next > 0 && rec->next < TDB_DATA_START(tdb->hash_size)) return false; - if (tdb->methods->tdb_oob(tdb, rec->next, sizeof(*rec), 1)) + if (tdb_oob(tdb, rec->next, sizeof(*rec), 1)) return false; key->dsize = rec->key_len; @@ -228,7 +228,7 @@ _PUBLIC_ int tdb_rescue(struct tdb_context *tdb, } /* Make sure we know true size of the underlying file. */ - tdb->methods->tdb_oob(tdb, tdb->map_size, 1, 1); + tdb_oob(tdb, tdb->map_size, 1, 1); /* Suppress logging, since we anticipate errors. */ tdb->log.log_fn = logging_suppressed; diff --git a/lib/tdb/common/tdb_private.h b/lib/tdb/common/tdb_private.h index 42aaac62f59..29790434211 100644 --- a/lib/tdb/common/tdb_private.h +++ b/lib/tdb/common/tdb_private.h @@ -304,6 +304,19 @@ void *tdb_convert(void *buf, uint32_t size); int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct tdb_record *rec); tdb_off_t tdb_allocate(struct tdb_context *tdb, int hash, tdb_len_t length, struct tdb_record *rec); + +int _tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, int probe); + +static inline int tdb_oob( + struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, int probe) +{ + if (likely((off + len >= off) && (off + len <= tdb->map_size))) { + return 0; + } + return _tdb_oob(tdb, off, len, probe); +} + + int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d); int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d); int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off); diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index e9b0b26ea59..4f8d1f8cdcc 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -378,6 +378,11 @@ static void transaction_next_hash_chain(struct tdb_context *tdb, uint32_t *chain static int transaction_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, int probe) { + /* + * This duplicates functionality from tdb_oob(). Don't remove: + * we still have direct callers of tdb->methods->tdb_oob() + * inside transaction.c. + */ if (off + len >= off && off + len <= tdb->map_size) { return 0; } @@ -524,7 +529,7 @@ static int _tdb_transaction_start(struct tdb_context *tdb, /* make sure we know about any file expansions already done by anyone else */ - tdb->methods->tdb_oob(tdb, tdb->map_size, 1, 1); + tdb_oob(tdb, tdb->map_size, 1, 1); tdb->transaction->old_map_size = tdb->map_size; /* finally hook the io methods, replacing them with diff --git a/lib/tdb/common/traverse.c b/lib/tdb/common/traverse.c index 54a69dc8d03..d69e7dff285 100644 --- a/lib/tdb/common/traverse.c +++ b/lib/tdb/common/traverse.c @@ -453,8 +453,7 @@ _PUBLIC_ int tdb_traverse_chain(struct tdb_context *tdb, if ((tdb->transaction == NULL) && (tdb->map_ptr != NULL)) { - ret = tdb->methods->tdb_oob( - tdb, key_ofs, full_len, 0); + ret = tdb_oob(tdb, key_ofs, full_len, 0); if (ret == -1) { goto fail; } diff --git a/lib/tdb/test/run-3G-file.c b/lib/tdb/test/run-3G-file.c index 748c972284a..79e291b294e 100644 --- a/lib/tdb/test/run-3G-file.c +++ b/lib/tdb/test/run-3G-file.c @@ -48,7 +48,7 @@ static const struct tdb_methods large_io_methods = { tdb_read, tdb_write, tdb_next_hash_chain, - tdb_oob, + tdb_notrans_oob, tdb_expand_file_sparse }; diff --git a/source3/include/proto.h b/source3/include/proto.h index 04fab2cd928..e3ed2b8e4cb 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -334,7 +334,6 @@ ssize_t message_push_blob(uint8_t **outbuf, DATA_BLOB blob); char *unix_clean_name(TALLOC_CTX *ctx, const char *s); char *clean_name(TALLOC_CTX *ctx, const char *s); ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, off_t pos); -int set_blocking(int fd, bool set); NTSTATUS init_before_fork(void); NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx, struct tevent_context *ev_ctx, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 4c778839880..268f286916c 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -269,8 +269,10 @@ /* Version 41 - Remove "blocking_lock" parameter from SMB_VFS_BRL_LOCK_WINDOWS */ /* Version 41 - Remove "msg_ctx" parameter from SMB_VFS_BRL_UNLOCK_WINDOWS */ +/* Bump to version 42, Samba 4.12 will ship with that */ +/* Version 42 - Remove share_access member from struct files_struct */ -#define SMB_VFS_INTERFACE_VERSION 41 +#define SMB_VFS_INTERFACE_VERSION 42 /* All intercepted VFS operations must be declared as static functions inside module source @@ -333,8 +335,6 @@ typedef struct files_struct { struct write_cache *wcp; struct timeval open_time; uint32_t access_mask; /* NTCreateX access bits (FILE_READ_DATA etc.) */ - uint32_t share_access; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */ - bool kernel_share_modes_taken; bool update_write_time_triggered; diff --git a/source3/locking/leases_util.c b/source3/locking/leases_util.c index af1e8374128..f10c91f0d32 100644 --- a/source3/locking/leases_util.c +++ b/source3/locking/leases_util.c @@ -23,6 +23,7 @@ #include "includes.h" #include "../librpc/gen_ndr/open_files.h" #include "locking/proto.h" +#include "smbd/globals.h" uint32_t map_oplock_to_lease_type(uint16_t op_type) { @@ -70,3 +71,8 @@ bool fsp_lease_type_is_exclusive(const struct files_struct *fsp) return lease_type_is_exclusive(lease_type); } + +const struct GUID *fsp_client_guid(const files_struct *fsp) +{ + return &fsp->conn->sconn->client->connections->smb2.client.guid; +} diff --git a/source3/locking/locking.c b/source3/locking/locking.c index d87a882d14f..c19b899e468 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -645,6 +645,42 @@ bool is_valid_share_mode_entry(const struct share_mode_entry *e) return (num_props != 0); } +NTSTATUS remove_lease_if_stale(const struct share_mode_data *d, + const struct GUID *client_guid, + const struct smb2_lease_key *lease_key) +{ + uint32_t i; + NTSTATUS status; + + for (i=0; i<d->num_share_modes; i++) { + const struct share_mode_entry *e = &d->share_modes[i]; + bool same; + + if (e->stale) { + continue; + } + if (e->op_type != LEASE_OPLOCK) { + continue; + } + + same = smb2_lease_equal( + &e->client_guid, + &e->lease_key, + client_guid, + lease_key); + if (same) { + return NT_STATUS_RESOURCE_IN_USE; + } + } + + status = leases_db_del(client_guid, lease_key, &d->id); + if (!NT_STATUS_IS_OK(status)) { + DBG_DEBUG("leases_db_del failed: %s\n", + nt_errstr(status)); + } + return status; +} + /* * See if we need to remove a lease being referred to by a * share mode that is being marked stale or deleted. @@ -654,7 +690,6 @@ static void remove_share_mode_lease(struct share_mode_data *d, struct share_mode_entry *e) { uint16_t op_type; - uint32_t i; op_type = e->op_type; e->op_type = NO_OPLOCK; @@ -665,45 +700,7 @@ static void remove_share_mode_lease(struct share_mode_data *d, return; } - /* - * This used to reference a lease. If there's no other one referencing - * it, remove it. - */ - - for (i=0; i<d->num_share_modes; i++) { - struct share_mode_entry *e2 = &d->share_modes[i]; - - if (e2->stale) { - continue; - } - if (e == e2) { - /* Not ourselves. */ - continue; - } - if (smb2_lease_equal(&e->client_guid, - &e->lease_key, - &e2->client_guid, - &e2->lease_key)) { - break; - } - } - if (i < d->num_share_modes) { - /* - * Found another one - */ - return; - } - - { - NTSTATUS status; - - status = leases_db_del(&e->client_guid, - &e->lease_key, - &d->id); - - DEBUG(10, ("%s: leases_db_del returned %s\n", __func__, - nt_errstr(status))); - } + remove_lease_if_stale(d, &e->client_guid, &e->lease_key); } /* @@ -794,8 +791,8 @@ bool set_share_mode(struct share_mode_lock *lck, uid_t uid, uint64_t mid, uint16_t op_type, - const struct GUID *client_guid, - const struct smb2_lease_key *lease_key) + uint32_t share_access, + uint32_t access_mask) { struct share_mode_data *d = lck->data; struct share_mode_entry *tmp, *e; @@ -812,15 +809,16 @@ bool set_share_mode(struct share_mode_lock *lck, ZERO_STRUCTP(e); e->pid = messaging_server_id(fsp->conn->sconn->msg_ctx); - e->share_access = fsp->share_access; + e->share_access = share_access; e->private_options = fsp->fh->private_options; - e->access_mask = fsp->access_mask; + e->access_mask = access_mask; e->op_mid = mid; e->op_type = op_type; if (op_type == LEASE_OPLOCK) { + const struct GUID *client_guid = fsp_client_guid(fsp); e->client_guid = *client_guid; - e->lease_key = *lease_key; + e->lease_key = fsp->lease->lease.lease_key; } e->time.tv_sec = fsp->open_time.tv_sec; diff --git a/source3/locking/proto.h b/source3/locking/proto.h index 3a086fa0516..53688cb52df 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -160,8 +160,11 @@ bool set_share_mode(struct share_mode_lock *lck, uid_t uid, uint64_t mid, uint16_t op_type, - const struct GUID *client_guid, - const struct smb2_lease_key *lease_key); + uint32_t share_access, + uint32_t access_mask); +NTSTATUS remove_lease_if_stale(const struct share_mode_data *d, + const struct GUID *client_guid, + const struct smb2_lease_key *lease_key); void remove_stale_share_mode_entries(struct share_mode_data *d); bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp); bool mark_share_mode_disconnected(struct share_mode_lock *lck, @@ -248,5 +251,6 @@ uint32_t map_oplock_to_lease_type(uint16_t op_type); uint32_t fsp_lease_type(const struct files_struct *fsp); uint32_t lease_type_is_exclusive(uint32_t lease_type); bool fsp_lease_type_is_exclusive(const struct files_struct *fsp); +const struct GUID *fsp_client_guid(const files_struct *fsp); #endif /* _LOCKING_PROTO_H_ */ diff --git a/source3/modules/nfs4acl_xattr_ndr.h b/source3/modules/nfs4acl_xattr_ndr.h -- Samba Shared Repository