1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

119457 Commits

Author SHA1 Message Date
Günther Deschner
7eae4280d2 libcli/auth: add test for gensec_schannel code
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-10-07 08:13:44 +00:00
Jeremy Allison
ea82bca8ce s3: smbclient: Stop an SMB2-connection from blundering into SMB1-specific calls.
Fix in the same way this was done in SMBC_opendir_ctx() for libsmbclient.
This fix means the admin no longer has to remember to set 'min client protocol ='
when connecting to an SMB2-only server (MacOSX for example) and trying to
list shares.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-10-07 08:13:44 +00:00
Volker Lendecke
4b62c4f7ad lib/replace: Remove libaio support
io_uring is the way to go these days, libaio was never really useful
for Samba

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct  4 18:18:41 UTC 2019 on sn-devel-184
2019-10-04 18:18:40 +00:00
Volker Lendecke
bcbadeb826 ntvfs: Remove pvfs_aio.c
This uses the Linux libaio that does not meet Samba's needs. If
someone wanted to add async I/O to ntvfs, the io_uring API is the way
to go. Second option would be to use a pthreads-based API.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-04 17:01:39 +00:00
Martin Schwenke
0bddee8dac ctdb-tests: Rename functions to test_header() and test_footer()
That's all they do now.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Oct  4 10:58:10 UTC 2019 on sn-devel-184
2019-10-04 10:58:10 +00:00
Martin Schwenke
435d903ad8 ctdb-tests: Move test duration calculation to ctdb_test_run()
It makes sense to do this in one place in case other headers/footers
are added.

Reindent ctdb_test_begin() while touching this function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:29 +00:00
Martin Schwenke
23982477f3 ctdb-tests: Add handling for skipped tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
473a6fed11 ctdb-tests: Add a special failure code when a test error occurs
Use it when a test is not executable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
55dd0f047f ctdb-tests: Move test status interpretation to ctdb_test_run()
It makes sense to do this in one place in case other headers/footers
are added.

Simplify ctdb_test_end() accordingly, reindenting because nearly all
lines are modified.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
47c9b79262 ctdb-tests: Move use of show_progress() into ctdb_test_run()
This allows more variables to be set in this function because they are
no longer in a sub-shell.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
e7e6f4067e ctdb-tests: Simplify ctdb_test_run()
Only the test file name is ever passed.

Reindent while touching many existing lines.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
dc8ddbb084 ctdb-tests: Switch TEST_CLEANUP and TEST_TIMEOUT to script variables
These are not used outside this script so they do not need to be
environment variables.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
0ec83f32fa ctdb-tests: Add new test functions for running commands on nodes
* ctdb_onnode()
* testprog_onnode()
* function_onnode()

These encapsulate familiar patterns found when running
try_command_on_node().  The new function names are more concise and
encourage more readable tests.  Test writers can do less thinking
about the subtleties of running different types of commands on nodes.
For example, these functions ensure that $CTDB and $VALGRIND are used
in the correct contexts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
38b838b59c ctdb-tests: try_command_on_node() should return status of command
There is no point folding this down to 1.  Tests should be able to see
the original value, if required.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
e494eb3e8c ctdb-tests: Drop unused function ctdb_test_check_real_cluster()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
38138b42f7 ctdb-tests: Update preamble for CLUSTER tests
The main change is to source cluster.bash instead of integration.bash.

While touching the preamble, the following additional changes are also
made:

* Drop test_info() definition and replace it with a comment

  The use of test_info() is pointless.

* Drop call to ctdb_test_check_real_cluster()

  cluster.bash now does this.

* Drop call to cluster_is_healthy()

  This is a holdover from when the previous test would restart daemons
  to get things ready for a test.  There was also a bug where going
  into recovery during the restart would sometimes cause the cluster
  to become unhealthy.  If we really need something like this then we
  can add it to ctdb_test_init().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
653b35764a ctdb-tests: Add cluster.bash include file
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
5ad356c282 ctdb-tests: Add function ctdb_test_skip_on_cluster()
Use it in relevant tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
59055f4da1 ctdb-tests: Add function ctdb_test_on_cluster()
This centralises this logic.  Use it in a subset of tests - there are
other cases but these will be cleaned up soon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
65ca431c95 ctdb-tests: Add functions for terminating tests on failure, skip, error
This allows standard exit codes for failed and skipped tests, and test
errors.

Skipped tests currently just succeed and a test error is the same as a
failure.  These can be easily changed later when run_tests.sh is ready
to handle them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:27 +00:00
Martin Schwenke
2c54f6df71 ctdb-common: Mark VacuumLimit tunable as obsolete
Use of this tunable was dropped over 5 years ago in commit
16837bc309.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Oct  4 07:07:21 UTC 2019 on sn-devel-184
2019-10-04 07:07:21 +00:00
Martin Schwenke
815ae64400 ctdb-vacuum: Drop debug level of repacking message to NOTICE
This occurs rarely but can adversely impact performance, so it is
worth logging it more frequently.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 05:47:35 +00:00
Martin Schwenke
a8c4e7d1f6 ctdb-protocol: Initialise request->rdata.opcode where missing
Otherwise it is uninitialised, so...

==22889== Conditional jump or move depends on uninitialised value(s)
==22889==    at 0x12257B: ctdb_req_control_data_len (protocol_control.c:39)
==22889==    by 0x1228E9: ctdb_req_control_len (protocol_control.c:1786)
==22889==    by 0x12A51C: ctdb_client_control_send (client_control.c:101)
==22889==    by 0x138BE1: ctdb_tunnel_setup_send (client_tunnel.c:100)
==22889==    by 0x10EE4F: tunnel_test_send (tunnel_test.c:135)
==22889==    by 0x10EE4F: main (tunnel_test.c:463)

and similar.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 05:47:35 +00:00
Amitay Isaacs
33f1c9d965 ctdb-vacuum: Process all records not deleted on a remote node
This currently skips the last record.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14147
RN: Avoid potential data loss during recovery after vacuuming error

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-04 05:47:34 +00:00
Volker Lendecke
fe41238097 rpcclient: Remove unused global domain sid
For the auth_log tests using rpcclient this means one message less

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): Thu Oct  3 17:59:13 UTC 2019 on sn-devel-184
2019-10-03 17:59:13 +00:00
Volker Lendecke
8a09467221 rpcclient: Remove domain sid check
The samr calls can take care of this on their own

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-03 16:39:31 +00:00
Volker Lendecke
cb0b54d9ac rpcclient: Make cmd_samr.c independent of global domain_sid
Pure SAMR allows us to figure out the domain sid, we don't need LSA
for this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-03 16:39:31 +00:00
Volker Lendecke
dd108a171f rpcclient: Fix a comment
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-03 16:39:31 +00:00
Volker Lendecke
3cac5c1bd4 rpcclient: Move rpccli_try_samr_connects() to cmd_samr.c
That's the only user, make it static to cmd_samr.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-03 16:39:31 +00:00
Volker Lendecke
f74442b4b7 rpcclient: Remove rpcclient_cli_state
An unneeded global

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-03 16:39:31 +00:00
Volker Lendecke
8ca4fe6523 rpclient: Remove cmd_test
I can't even properly find why this went in. It's the only user of the
global rpcclient_cli_state, which can go if we remove this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-03 16:39:31 +00:00
Jeremy Allison
398cb8a56d s3: smbd: Fix the SMB2 server to pass SMB2-PATH-SLASH.
[MS-FSA] 2.1.5.1 Server Requests an Open of a File

Windows pathname specific processing.

Always disallow trailing /, and also \\ on FILE_NON_DIRECTORY_FILE.

We need to check this before the generic pathname parser
as the generic pathname parser removes any trailing '/' and '\\'.

Currently this is SMB2 only, but we could also add this
check to the SMB1 NTCreateX calls if ultimately neded.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Oct  2 09:31:40 UTC 2019 on sn-devel-184
2019-10-02 09:31:40 +00:00
Jeremy Allison
5642f288c8 s3: torture: Add MS-FSA style terminating '/' and '\\' test - SMB2-PATH-SLASH.
[MS-FSA] 2.1.5.1 Server Requests an Open of a File.

Checks how to behave on both files and directories.

Tested against Windows 10 server - passes. Currently smbd fails this.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:41 +00:00
Volker Lendecke
32d6cc84cf dbwrap_watch: Don't alert ourselves, fix raw.oplock.batch26 race
This fixes the following flaky test:

UNEXPECTED(failure): samba3.raw.oplock.batch26(nt4_dc)
REASON: Exception: Exception: (../../source4/torture/raw/oplock.c:3718): wrong value for break_info.count got 0x2 - should be 0x1

You can reproduce it with two small msleeps, which means it's a race
condition:

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 20b5a3e294c..126c7fc021d 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1917,6 +1917,14 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
 	DATA_BLOB blob;
 	NTSTATUS status;

+	{
+		static bool sent = false;
+		if (sent) {
+			smb_msleep(500);
+		}
+		sent = true;
+	}
+
 	if (DEBUGLVL(10)) {
 		struct server_id_buf buf;
 		DBG_DEBUG("Sending break message to %s\n",
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index b3da84b1269..d9c4dbb9487 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -858,6 +858,8 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
 	uint16_t break_to;
 	bool break_needed = true;

+	smb_msleep(100);
+
 	msg = talloc(talloc_tos(), struct oplock_break_message);
 	if (msg == NULL) {
 		DBG_WARNING("talloc failed\n");

15a8af075a introduced a bug where we immediately wake up ourselves
after doing a watch_send, leading to two inter-smbd oplock break
messages for this case. In theory, this should not matter, as in the
oplock break handler in the destination smbd we check

(fsp->sent_oplock_break != NO_BREAK_SENT)

so that the break does not get sent twice. However, with the above two
sleeps the oplock holding client could send out its oplock downgrade
while the second inter-smbd break messages was on its way.

The real fix would be to note in the share mode array that the
inter-smbd message has already been sent, but as other users of
dbwrap_watched_watch_send might also be affected by this bug, this fix
should be sufficient to get rid of this flaky test.

Unfortunately, dbwrap_watch.c is now pretty complex and needs some
serious refactoring to become understandable again. But that's
something for another day, sorry.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:41 +00:00
Volker Lendecke
64da66a75c dbwrap_watch: Remove "addwatch" handling from dbwrap_watched_save()
This has been moved to dbwrap_watched_watch_send()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:41 +00:00
Volker Lendecke
491b71f29b dbwrap_watch: Move reallocating watchers to dbwrap_watched_watch_send()
Before 15a8af075a we did not have a separately allocated watchers
array and dbwrap_watched_save() could play (too) smart tricks with
dbwrap_record_storev(). Now that we always have watchers talloc'ed, we
can remove those smart tricks from dbwrap_watched_save() in the next
commit.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:41 +00:00
Volker Lendecke
88f8edf69b dbwrap_watch: Slightly simplify dbwrap_watched_fetch_locked()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:41 +00:00
Volker Lendecke
86672659c6 epmapper: Fix printf specifiers
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:40 +00:00
Volker Lendecke
e3e5894b85 torture: Fix a comment
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:40 +00:00
Volker Lendecke
9dc2cd86f6 lib: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:40 +00:00
Volker Lendecke
5d8493f5b4 rpc_client: Don't pass a NULL string to talloc_asprintf
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:40 +00:00
Volker Lendecke
34a35ac15e smbd: Fix CID 1453984: Null pointer dereferences (REVERSE_INULL)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:40 +00:00
Volker Lendecke
b66b8a74b1 lib: Fix CID 1453985: Null pointer dereferences (FORWARD_NULL)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:40 +00:00
Volker Lendecke
f21af2ace2 lib: Remove some unneeded #includes from tftw.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-02 08:01:40 +00:00
Ralph Boehme
993d327f5d s3:smbd: use is_named_stream() in a a few places
This simplifies (and corrects) things in the VFS as there the caller is only
interested in whether a name is pointing to a real named stream most of the times.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-02 08:01:40 +00:00
Ralph Boehme
4b2e44a6ed vfs_default: use is_named_stream() for stream check
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-02 08:01:40 +00:00
Ralph Boehme
c190f3efa9 s3:smbd: add a comment explaining the File-ID semantics when a file is created
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14137

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-02 08:01:40 +00:00
Ralph Boehme
90a14c90c4 s3:smbd: ensure a created stream picks up the File-ID from the basefile
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14137

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-02 08:01:40 +00:00
Ralph Boehme
091e3fdab6 s3:lib: add is_named_stream()
Add a new utility functions that checks whether a struct smb_filename points to
a real named stream, excluding the default stream "::$DATA".

  foo           -> false
  foo::$DATA    -> false
  foo:bar       -> true
  foo:bar:$DATA -> true

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-02 08:01:40 +00:00
Ralph Boehme
780a8dcba9 s3:lib: use strequal_m() in is_ntfs_default_stream_smb_fname()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14137

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-10-02 08:01:39 +00:00