The branch, master has been updated via 241f3709de5 docs-xml/Samba-Developers-Guide/vfs.xml: Fix incorrect VFS func names. via 5b8b9cd1c4d s4:smbtorture: also test for date >> UINT32_MAX in timestamps test via 9c81aa9dabc smbd: Fix a share_entries.tdb record leak via 8435128582a smbd: Test cleanup of disconnected durable handle records via f3802023feb selftest: Make durable_v2_delay more specific via 0bc3e7499b9 smbd: Panic if there's a leak in share_entries.tdb via 415fb7d2df4 build: Trim the deps of 'smbconf' via 4ff3e8ee8e1 build: util_cmdline depends on cli_credentials via cf9a0297584 build: secrets3 need E_md4hash and kerberos functions via 61b86d30d02 smbd: Make lp_use_sendfile() static to reply.c via 9e640226621 build: Explicitly depend on samba-modules where needed via cec30b2e063 build: gencache.c in 'samba3core' needs crc32() via 2f2961a1170 build: libcli/http does not need samba3core, only gensec via 42035d11597 build: messaging.c uses talloc_report_printf() via 63600b4f784 build: Multi-line a long list of deps from e79e943824a ldb:tests: Add missing null check for ldb_kv_private
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 241f3709de5bc8db39ec47976428e0284b79fb16 Author: Richard Sharpe <realrichardsha...@gmail.com> Date: Fri Dec 6 00:07:11 2019 -0500 docs-xml/Samba-Developers-Guide/vfs.xml: Fix incorrect VFS func names. Use SMB_VFS_P{READ,WRITE} since the others have been retired. Also, fix up the definitions. Signed-off-by: Richard Sharpe <realrichardsha...@gmail.com> Reviewed-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Sun Dec 8 21:50:52 UTC 2019 on sn-devel-184 commit 5b8b9cd1c4d0065d6987658fdd8e9ec0a7c37a6b Author: Ralph Boehme <s...@samba.org> Date: Fri Dec 6 10:27:22 2019 +0000 s4:smbtorture: also test for date >> UINT32_MAX in timestamps test Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9c81aa9dabc3dcb96fef169521bc7cb6e601a2e9 Author: Volker Lendecke <v...@samba.org> Date: Tue Dec 3 21:27:09 2019 +0100 smbd: Fix a share_entries.tdb record leak Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8435128582adf81a18e9d929970074d4f2326d20 Author: Volker Lendecke <v...@samba.org> Date: Tue Dec 3 21:33:28 2019 +0100 smbd: Test cleanup of disconnected durable handle records Right now this panics the scavenger daemon, preventing it from doing its work. The reopen we expect to fail with NT_STATUS_OBJECT_NAME_NOT_FOUND thus succeeds. I know that we should more precisely detect the scavenger crash and with Jeremy's pattern in 46899ecf836 this would be possible. However, this is C code right now, and scanning the logfile for the panic is more I have time for right now. The test successfully indicates failure, as the next commit will show. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f3802023feb9e5dfa82d2174437b7576470f575b Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 15:34:25 2019 +0100 selftest: Make durable_v2_delay more specific It will grow another subtest soon Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0bc3e7499b9a8a9d360f6c9454210f3cad334f90 Author: Volker Lendecke <v...@samba.org> Date: Tue Dec 3 12:44:18 2019 +0100 smbd: Panic if there's a leak in share_entries.tdb Hopefully dbwrap_tdb's dbwrap_exists is cheap enough for this to not impact performance too much. I could not measure any difference in an open/close benchmark, but at some point things might pile up and we might have to make this a #ifdef DEVELOPER Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 415fb7d2df4fdefd8aa78edde29abf64a008341b Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:30:05 2019 +0100 build: Trim the deps of 'smbconf' This does not pull in gensec anymore Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4ff3e8ee8e1ec0d21db9d103dd6fb04c24c3eaaa Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:49:55 2019 +0100 build: util_cmdline depends on cli_credentials Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit cf9a029758459399a9ad93f6bd1e393cee644fdc Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:48:20 2019 +0100 build: secrets3 need E_md4hash and kerberos functions Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 61b86d30d0218aab274601dd8d7d5c1ff6b5cf4f Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:25:21 2019 +0100 smbd: Make lp_use_sendfile() static to reply.c This is the only place where it's used. Also, via smb_signing_is_active it pulls in the dependency on 'cli_smb_common' (which pulls in all of gensec) into the 'smbconf' library. Without this, 'smbconf' is happy with just 'samba-hostconfig' instead of 'cli_smb_common' Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9e640226621e11c2bd44450c3c284d9f72bfa714 Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:20:36 2019 +0100 build: Explicitly depend on samba-modules where needed Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit cec30b2e063a4965fee2d4d9e8a50979a4f7647d Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:18:07 2019 +0100 build: gencache.c in 'samba3core' needs crc32() This comes from zlib, make the dependency explicit Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2f2961a1170cd6fcd0f95e30bd243c051276c125 Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:16:44 2019 +0100 build: libcli/http does not need samba3core, only gensec Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 42035d1159718a39bd00a3289300c91ec62ecf50 Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:40:00 2019 +0100 build: messaging.c uses talloc_report_printf() This used to be talloc_report_str() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 63600b4f7841e0a81e40599947dbc62e07078aa2 Author: Volker Lendecke <v...@samba.org> Date: Fri Dec 6 13:39:18 2019 +0100 build: Multi-line a long list of deps Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: docs-xml/Samba-Developers-Guide/vfs.xml | 8 +- libcli/http/wscript_build | 2 +- source3/include/proto.h | 1 - source3/locking/share_mode_lock.c | 7 ++ source3/param/loadparm.c | 20 ----- .../script/tests/test_durable_handle_reconnect.sh | 5 +- source3/smbd/reply.c | 19 +++++ source3/winbindd/wscript_build | 2 +- source3/wscript_build | 8 +- source4/lib/messaging/wscript_build | 12 ++- source4/torture/smb2/durable_v2_open.c | 91 ++++++++++++++++++++++ source4/torture/smb2/timestamps.c | 16 ++++ 12 files changed, 159 insertions(+), 32 deletions(-) Changeset truncated at 500 lines: diff --git a/docs-xml/Samba-Developers-Guide/vfs.xml b/docs-xml/Samba-Developers-Guide/vfs.xml index 8275d313ed1..948b98936a2 100644 --- a/docs-xml/Samba-Developers-Guide/vfs.xml +++ b/docs-xml/Samba-Developers-Guide/vfs.xml @@ -235,14 +235,14 @@ DO NOT ACCESS conn->vfs.ops.* directly !!! #define SMB_VFS_CLOSE(fsp, fd) \ ((fsp)->conn->vfs.ops.close(\ (fsp)->conn->vfs.handles.close, (fsp), (fd))) -#define SMB_VFS_READ(fsp, fd, data, n) \ +#define SMB_VFS_PREAD(fsp, fd, data, n, off) \ ((fsp)->conn->vfs.ops.read(\ (fsp)->conn->vfs.handles.read,\ - (fsp), (fd), (data), (n))) -#define SMB_VFS_WRITE(fsp, fd, data, n) \ + (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_PWRITE(fsp, fd, data, n, off) \ ((fsp)->conn->vfs.ops.write(\ (fsp)->conn->vfs.handles.write,\ - (fsp), (fd), (data), (n))) + (fsp), (fd), (data), (n), (off))) #define SMB_VFS_LSEEK(fsp, fd, offset, whence) \ ((fsp)->conn->vfs.ops.lseek(\ (fsp)->conn->vfs.handles.lseek,\ diff --git a/libcli/http/wscript_build b/libcli/http/wscript_build index 4ef1574bc67..da8768ffa06 100644 --- a/libcli/http/wscript_build +++ b/libcli/http/wscript_build @@ -2,7 +2,7 @@ bld.SAMBA_LIBRARY('http', source='http.c http_auth.c http_conn.c', - deps='talloc tevent samba3core dns_lookup', + deps='talloc tevent gensec dns_lookup', private_library=True, ) diff --git a/source3/include/proto.h b/source3/include/proto.h index 583814ea1bc..d543dc66955 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -873,7 +873,6 @@ bool lp_disable_spoolss( void ); void lp_set_spoolss_state( uint32_t state ); uint32_t lp_get_spoolss_state( void ); struct smb_signing_state; -bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state); void set_use_sendfile(int snum, bool val); void lp_set_mangling_method(const char *new_method); bool lp_posix_pathnames(void); diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 4697b6d9eee..72290126a0d 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -434,6 +434,11 @@ static NTSTATUS share_mode_data_store( d->sequence_number += 1; if (d->num_share_modes == 0) { + TDB_DATA key = dbwrap_record_get_key(rec); + bool share_entries_exist; + share_entries_exist = dbwrap_exists(share_entries_db, key); + SMB_ASSERT(!share_entries_exist); + TALLOC_FREE(d->delete_tokens); d->num_delete_tokens = 0; @@ -1257,6 +1262,8 @@ static bool share_mode_cleanup_disconnected_fn( return true; } + e->stale = true; + return false; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index fd5d90569cc..bef24b6821b 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4496,26 +4496,6 @@ uint32_t lp_get_spoolss_state( void ) return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING; } -/******************************************************************* - Ensure we don't use sendfile if server smb signing is active. -********************************************************************/ - -bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state) -{ - bool sign_active = false; - - /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */ - if (get_Protocol() < PROTOCOL_NT1) { - return false; - } - if (signing_state) { - sign_active = smb_signing_is_active(signing_state); - } - return (lp__use_sendfile(snum) && - (get_remote_arch() != RA_WIN95) && - !sign_active); -} - /******************************************************************* Turn off sendfile if we find the underlying OS doesn't support it. ********************************************************************/ diff --git a/source3/script/tests/test_durable_handle_reconnect.sh b/source3/script/tests/test_durable_handle_reconnect.sh index bca8e2def96..77d82c1b403 100755 --- a/source3/script/tests/test_durable_handle_reconnect.sh +++ b/source3/script/tests/test_durable_handle_reconnect.sh @@ -11,9 +11,10 @@ delay_inject_conf=$(dirname $SMB_CONF_PATH)/delay_inject.conf echo 'delay_inject:ntimes = 5000' > $delay_inject_conf -testit "durable_v2_delay" $VALGRIND \ +testit "durable_v2_delay.durable_v2_reconnect_delay" $VALGRIND \ $BINDIR/smbtorture //$SERVER_IP/delay_inject \ - -U$USERNAME%$PASSWORD smb2.durable-v2-delay || + -U$USERNAME%$PASSWORD \ + smb2.durable-v2-delay.durable_v2_reconnect_delay || failed=$(expr $failed + 1) rm $delay_inject_conf diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index f2d0b878e20..3c0c7dbb631 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3626,6 +3626,25 @@ static void reply_readbraw_error(struct smbXsrv_connection *xconn) smbd_unlock_socket(xconn); } +/******************************************************************* + Ensure we don't use sendfile if server smb signing is active. +********************************************************************/ + +static bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state) +{ + bool sign_active = false; + + /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */ + if (get_Protocol() < PROTOCOL_NT1) { + return false; + } + if (signing_state) { + sign_active = smb_signing_is_active(signing_state); + } + return (lp__use_sendfile(snum) && + (get_remote_arch() != RA_WIN95) && + !sign_active); +} /**************************************************************************** Use sendfile in readbraw. ****************************************************************************/ diff --git a/source3/winbindd/wscript_build b/source3/winbindd/wscript_build index b31926bf3ce..534dd0b206b 100644 --- a/source3/winbindd/wscript_build +++ b/source3/winbindd/wscript_build @@ -116,7 +116,7 @@ bld.SAMBA3_MODULE('idmap_autorid', bld.SAMBA3_LIBRARY('nss_info', source='nss_info.c', - deps='samba-util smbconf', + deps='samba-util smbconf samba-modules', private_library=True) bld.SAMBA3_MODULE('nss_info_template', diff --git a/source3/wscript_build b/source3/wscript_build index 8d0cc66f941..10d9f71ae76 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -177,6 +177,7 @@ bld.SAMBA3_SUBSYSTEM('pdb', LIBCLI_AUTH flag_mapping samba-credentials + samba-modules nscd ''') @@ -278,7 +279,7 @@ bld.SAMBA3_LIBRARY('popt_samba3_cmdline', bld.SAMBA3_LIBRARY('util_cmdline', source='lib/util_cmdline.c', - deps='secrets3', + deps='secrets3 samba-credentials', private_library=True) bld.SAMBA3_LIBRARY('cmdline_contexts', @@ -433,6 +434,7 @@ bld.SAMBA3_SUBSYSTEM('samba3core', talloc_report_printf access TDB_LIB + z ''') bld.SAMBA3_LIBRARY('smbd_shim', @@ -505,6 +507,8 @@ bld.SAMBA3_LIBRARY('secrets3', smbconf samba3util dbwrap + krb5samba + LIBCLI_AUTH ''', private_library=True) @@ -591,7 +595,7 @@ bld.SAMBA3_LIBRARY('smbconf', SAMBA_VERSION cap charset - cli_smb_common + samba-hostconfig errors3 SMBCONF_PARAM samba-util diff --git a/source4/lib/messaging/wscript_build b/source4/lib/messaging/wscript_build index 4688aa7bda4..3408396ebd0 100644 --- a/source4/lib/messaging/wscript_build +++ b/source4/lib/messaging/wscript_build @@ -9,7 +9,17 @@ bld.SAMBA_LIBRARY('MESSAGING_SEND', bld.SAMBA_LIBRARY('MESSAGING', source='messaging.c messaging_handlers.c', - public_deps='samba-util NDR_IRPC UNIX_PRIVS cluster ndr dcerpc messages_util server_id_db talloc_report', + public_deps=''' + samba-util + NDR_IRPC + UNIX_PRIVS + cluster + ndr + dcerpc + messages_util + server_id_db + talloc_report_printf + ''', private_library=True ) diff --git a/source4/torture/smb2/durable_v2_open.c b/source4/torture/smb2/durable_v2_open.c index 7609987e31f..7c8a17fdac9 100644 --- a/source4/torture/smb2/durable_v2_open.c +++ b/source4/torture/smb2/durable_v2_open.c @@ -2120,12 +2120,103 @@ done: return ret; } +/** + * basic test for doing a durable open with 1msec cleanup time + * tcp disconnect, wait a bit, reconnect, do a durable reopen (fails) + */ +static bool test_durable_v2_reconnect_delay_msec( + struct torture_context *tctx, struct smb2_tree *tree) +{ + NTSTATUS status; + TALLOC_CTX *mem_ctx = talloc_new(tctx); + char fname[256]; + struct smb2_handle _h; + struct smb2_handle *h = NULL; + struct smb2_create io; + struct GUID create_guid = GUID_random(); + struct smbcli_options options; + uint64_t previous_session_id; + uint8_t b = 0; + bool ret = true; + + options = tree->session->transport->options; + previous_session_id = smb2cli_session_current_id(tree->session->smbXcli); + + /* Choose a random name in case the state is left a little funky. */ + snprintf(fname, + sizeof(fname), + "durable_v2_reconnect_delay_%s.dat", + generate_random_str(tctx, 8)); + + smb2_util_unlink(tree, fname); + + smb2_oplock_create_share(&io, fname, + smb2_util_share_access(""), + smb2_util_oplock_level("b")); + io.in.durable_open = false; + io.in.durable_open_v2 = true; + io.in.persistent_open = false; + io.in.create_guid = create_guid; + io.in.timeout = 1; + + status = smb2_create(tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + + _h = io.out.file.handle; + h = &_h; + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + CHECK_VAL(io.out.durable_open_v2, true); + + status = smb2_util_write(tree, *h, &b, 0, 1); + CHECK_STATUS(status, NT_STATUS_OK); + + /* disconnect, leaving the durable open */ + TALLOC_FREE(tree); + + if (!torture_smb2_connection_ext(tctx, previous_session_id, + &options, &tree)) { + torture_warning(tctx, "couldn't reconnect, bailing\n"); + ret = false; + goto done; + } + + sleep(10); + + ZERO_STRUCT(io); + io.in.fname = fname; + io.in.durable_open_v2 = false; + io.in.durable_handle_v2 = h; + io.in.create_guid = create_guid; + h = NULL; + + status = smb2_create(tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + _h = io.out.file.handle; + h = &_h; + +done: + if (h != NULL) { + smb2_util_close(tree, *h); + } + + smb2_util_unlink(tree, fname); + + talloc_free(tree); + + talloc_free(mem_ctx); + + return ret; +} + struct torture_suite *torture_smb2_durable_v2_delay_init(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create(ctx, "durable-v2-delay"); torture_suite_add_1smb2_test(suite, "durable_v2_reconnect_delay", test_durable_v2_reconnect_delay); + torture_suite_add_1smb2_test(suite, + "durable_v2_reconnect_delay_msec", + test_durable_v2_reconnect_delay_msec); return suite; } diff --git a/source4/torture/smb2/timestamps.c b/source4/torture/smb2/timestamps.c index fa8183d0b34..9655e5bc164 100644 --- a/source4/torture/smb2/timestamps.c +++ b/source4/torture/smb2/timestamps.c @@ -235,6 +235,20 @@ done: return ret; } +static bool test_time_t_100000000000(struct torture_context *tctx, + struct smb2_tree *tree) +{ + return test_time_t(tctx, tree, "test_time_t_100000000000.txt", + 100000000000 /* >> INT32_MAX */); +} + +static bool test_time_t_10000000000(struct torture_context *tctx, + struct smb2_tree *tree) +{ + return test_time_t(tctx, tree, "test_time_t_10000000000.txt", + 10000000000 /* >> INT32_MAX */); +} + static bool test_time_t_4294967295(struct torture_context *tctx, struct smb2_tree *tree) { @@ -280,6 +294,8 @@ struct torture_suite *torture_smb2_timestamps_init(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create(ctx, "timestamps"); + torture_suite_add_1smb2_test(suite, "time_t_100000000000", test_time_t_100000000000); + torture_suite_add_1smb2_test(suite, "time_t_10000000000", test_time_t_10000000000); torture_suite_add_1smb2_test(suite, "time_t_4294967295", test_time_t_4294967295); torture_suite_add_1smb2_test(suite, "time_t_1", test_time_t_1); torture_suite_add_1smb2_test(suite, "time_t_0", test_time_t_0); -- Samba Shared Repository