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

118391 Commits

Author SHA1 Message Date
Jeremy Allison
a8ca5dc467 s3: smbd: Remove dptr_close() from reply_findclose().
Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
779dd3f1e6 s3: smbd: Remove dptr_close() from call_trans2findnext().
Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
269fbc9164 s3: smbd: Remove dptr_close() from call_trans2findfirst().
Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
63e1220a2b s3: smbd: Remove dptr_close() from reply_fclose().
Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
24722da0b1 s3: smbd: Remove dptr_close() from reply_search().
Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
f5eebfc725 s3: smbd: Remove dptr_fsp(). No longer used.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
37e1dd5af3 s3: smbd: Replace dptr_fsp() with dptr_fetch_lanman2_fsp() in reply_findclose().
Now we have no users of dptr_fsp() left.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
b4431ad305 s3: smbd: Remove dptr_fetch_lanman2() - unused.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
d6e709c43e s3: smbd: Convert call_trans2findnext() to use dptr_fetch_lanman2_fsp().
dptr_fetch_lanman2() is now no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
b922f6e704 s3: smbd: Add dptr_fetch_lanman2_fsp() - to replace dptr_fetch_lanman2().
Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:35 +00:00
Jeremy Allison
e63400841e s3: smbd: Remove dptr_fetch() - replace internals with dptr_fetch_fsp().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
a2ef44b71b s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_search().
We now no longer use dptr_fetch().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
68e403fa58 s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_fclose().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
96e8175dc8 s3: smbd: Add dptr_fetch_fsp() for SMB1 code. We will use this to replace dptr_fetch().
Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
5a7aaa8060 s3: smbd: Remove now unused dptr_activecnum().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
916afa3746 s3: smbd: All directory enumeration is now via file handles - remove unneeded code in idle connections.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
de2167668e s3: smbd: Remove now unused dptr_closepath().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
492b322237 s3: smbd: Now we properly open file handles for directory enumerations, we don't need this code in SMB1rmdir.
The share mode exclusion will prevent deletion of open directory
enumeration handles.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
247515982f s3: smbd: Now we are always using fsp handle-based client searches, simplify smb_Dir_destructor().
We know we always have a dir_hnd->dir and dir_hnd->fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
84312fc5c2 s3: smbd: Now we're using OpenDir_fsp() all the time, make sure we don't leak file handles.
We must always set dir_hnd->fsp, even in the fallback to
SMB_VFS_OPENDIR() case. Remember if we had to fall back
and fix the destructor to close the additional file
descriptor if we did.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
d485c43cc7 s3: smbd: Now we always use handle for directory enumeration, we can delete the fallback code.
The code inside open_dir_safely() is root safe
and can replace the deleted open_dir_with_privilege()
fallback code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
a130760f70 s3: smbd: Convert SMB1 reply_search() to use handle-based directory enumeration.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:34 +00:00
Jeremy Allison
043443ee33 s3: smbd: Convert SMB1 call_trans2findfirst() to use handle-based directory enumeration.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
5388df783e s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findnext()
Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
264d6b408e s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findfirst()
Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
61c239fcec s3: smbd: Prepare for SMB1 directory handle opens in reply_findclose()
Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
b055f1ac7b s3: smbd: Prepare for SMB1 directory handle opens in reply_fclose()
Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
e686e7b6b3 s3: smbd: Prepare for SMB1 directory handle opens in reply_search()
Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
aa3a087193 s3: smbd: Prepare for SMB1 directory handle opens in dptr_closecnum().
Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
a5f8769c25 s3: smbd: Change dptr_closecnum() to use dptr_close() instead of dptr_close_internal().
This will allow us to close any outstanding handles on
an SMB1 connection as later commits move us to using directory
handles instead of pathname directory opens.

This is inefficient, as it means walking the list twice,
but this will only be called with active dptrs in the
OS/2 -1 case, in the connection shutdown case the
directory handles will already have been closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
5a038f5114 s3: smbd: Make dptr_close() safe to call with an fsp handle stored in dptr->dir_hnd.
SMB1 doesn't currently do this, but subsequent changes will add handle based
calls to SMB1 so dptr_close() has to be able to cleanly remove any back pointers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
2ba48f76ec s3: smbd: Add dptr_fsp() to return any stored files_struct pointer.
Will allow [find/search]_next() calls to find and close any associated
fsp. This function is temporary and will eventually go away once I
modify dptr_fetch() to return an fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
f61dae7635 s3: smbd: Move the strange OS/2 directory key == -1 close semantics to the caller.
This will allow us to change dptr_closecnum() to close outstanding fsp
handles for SMB1 later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:33 +00:00
Jeremy Allison
23d0555c0d s3: smbd: dptr_close() can only be called from SMB1 code.
SMB_ASSERT this is the case.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-06 14:23:32 +00:00
Björn Jacke
eebcc88ddf doc: improve vfs objects parameter description
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Karolin Seeger <kseeger@samba.org>

Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Tue Aug  6 13:40:21 UTC 2019 on sn-devel-184
2019-08-06 13:40:21 +00:00
Stefan Metzmacher
bed7fc5a1b wafsamba: change --picky-developer into --disable-warnings-as-errors
By default we're using -Werror now if --enable-developer is
specified.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Noel Power <npower@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Aug  6 07:50:14 UTC 2019 on sn-devel-184
2019-08-06 07:50:13 +00:00
Stefan Metzmacher
0df28b3d14 script/autobuild.py: remove explicit --picky-developer"
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2019-08-06 06:32:28 +00:00
Aaron Haslett
81186651ee ldb: skip indexes on full_search
Use iterate_range kv op to skip the index section of the database when
running a full search. Quick local testing showed 18% improved throughput
on a full search with no results on a 50k database. With more results,
improvement is smaller but still noticeable.

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Aug  2 02:29:42 UTC 2019 on sn-devel-184
2019-08-02 02:29:42 +00:00
Günther Deschner
4b88e1d997 tests/dcerpc/raw_protocol: Add more tests for DCERPC_AUTH_LEVEL_PACKET
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug  1 16:59:02 UTC 2019 on sn-devel-184
2019-08-01 16:59:02 +00:00
Stefan Metzmacher
e0e68ea255 tests/dcerpc/raw_protocol: split test_spnego_integrity_request into 2 parts
This can be a generic test that can be used for more auth_levels.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-08-01 15:40:17 +00:00
Stefan Metzmacher
ff2f20439c tests/dcerpc/raw_protocol: split test_spnego_connect_request() into 2 parts
This can be a generic test that can be used for more auth_levels.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-08-01 15:40:17 +00:00
Volker Lendecke
c226dc6e8a smbd: Fix use-after-free from exit_server_common()
We need to keep the smbXsrv_connection structures around until all
pending requests have had their chance to clean up behind them. If you
look at srv_send_smb(), it's exactly prepared already to just drop
anything on the floor when the transport has been declared dead:

	if (!NT_STATUS_IS_OK(xconn->transport.status)) {
		/*
		 * we're not supposed to do any io
		 */
		return true;
	}

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14064

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug  1 15:39:13 UTC 2019 on sn-devel-184
2019-08-01 15:39:12 +00:00
Volker Lendecke
10e140d25c s3:torture: Fix the FreeBSD build
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14060

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-08-01 14:21:36 +00:00
Stefan Metzmacher
21f6cece54 libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID
Note: Unlike the current documentation, the utf16 string
is not null-terminated, that matches Windows Server 1903
as a client.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055
RN: Add the target server name of SMB 3.1.1 connections
as a hint to load balancers or servers with "multi-tenancy"
support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
2019-08-01 14:21:36 +00:00
Stefan Metzmacher
e10b90f33b libcli/smb: add new COMPRESSION and NETNAME negotiate context ids
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
2019-08-01 14:21:36 +00:00
Michael Adam
f258cfaa1d vfs:glusterfs_fuse: build only if we have setmntent()
FreeBSD and other platforms that don't have setmntent() and friends can
not compile this module. This patch lets changes the build to only
compile this module if the setmntent() function is found.

This is the a follow-up fix to the actual fix for bug #13972.

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

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Aug  1 09:49:04 UTC 2019 on sn-devel-184
2019-08-01 09:49:04 +00:00
Garming Sam
464fef34d1 tests/ldap: Use TLDAP to check the extended DN return
Tests commit 9f6b87d3f6

To run: make test TESTS="samba3.smbtorture_s3.plain.TLDAP"

Reverting the above commit makes this test fail:

'GUID format in control (no hyphens) doesn't match output
tldap_search with extended dn (no val) failed: LDAP error 0 (TLDAP_SUCCESS),
TEST TLDAP FAILED!'

This behaviour couldn't be tested via LDB libraries because they never
deal with the underlying DN string.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug  1 06:20:28 UTC 2019 on sn-devel-184
2019-08-01 06:20:28 +00:00
Garming Sam
85a7b594c5 tests/tldap: Actually check the paging return code
The test never worked correctly because the code was overlooked. It was
also the case that the connection was never authenticated, and so an
LDAP BIND call has now been added.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029
2019-08-01 05:01:15 +00:00
Garming Sam
bff466943e tldap: Paged searches fail when they get to the end
The normal case hit the goto label, and should have just returned.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029
2019-08-01 05:01:15 +00:00
Garming Sam
e5452a3742 tldap: Make memcpy of no controls safe
Static analyzers sometimes complain about this case.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029
2019-08-01 05:01:15 +00:00