Ralph Boehme [Tue, 16 Apr 2019 14:46:43 +0000 (16:46 +0200)]
lib:torture: add torture_assert_u32_[not_]equal[_goto] macros
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Wed, 7 Aug 2019 12:02:12 +0000 (14:02 +0200)]
s3:mdssvc: fix unmarshalling of empty CNID array
len=0 is invalid, len=8 is an empty array, len>8 is an array with members, so
for the len=8 case we must add the empty cnid array.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Fri, 3 May 2019 20:52:33 +0000 (22:52 +0200)]
s3:mdssvc: marshalling: fix unpacking empty CNID structure
Pass the correct tag member tag.size to sl_unpack_CNID(), not
tag.length. tag.size is the size actually used in a buffer of size tag.length.
Cf other users of tag.size that already do this correctly, this was only wrong
in this place.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Fri, 3 May 2019 20:52:56 +0000 (22:52 +0200)]
s3:mdssvc: marshalling: fix unpacking empty filemeta structure
This is how a correct dump of an empty sl_filemeta_t container should look like:
DALLOC_CTX(#1): {
sl_array_t(#3): {
uint64_t: 0x0023
CNIDs: unkn1: 0x0, unkn2: 0x0
DALLOC_CTX(#0): {
}
sl_filemeta_t(#0): {
}
}
}
This is basically the response from macOS mdssvc for a query that yields no
results: sl_filemeta_t is empty, the CNIDs array as well.
Looking at the raw packet data, the empty sl_filemeta_t container as a size of 8
bytes which fails the following check in sl_unpack_cpx():
case SQ_CPX_TYPE_FILEMETA:
...
if (tag.size < 16) {
*boom*
}
Only tag.size=0 is invalid, tag.size=8 denotes an empty container and tag.size>=16
denotes a sl_filemeta_t container with actual content must be unpacked by
calling sl_unpack(). Note that size is always a muliple of 8.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Sat, 4 May 2019 09:10:37 +0000 (11:10 +0200)]
s3:mdssvc: marshalling: add a newline to a DEBUG message
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Sat, 4 May 2019 06:53:48 +0000 (08:53 +0200)]
torture: start of a mdssvc packet (un)marshalling testsuite
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Mon, 15 Jul 2019 14:44:08 +0000 (16:44 +0200)]
librpc: add RPC_NDR_MDSSVC
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Wed, 17 Apr 2019 14:42:20 +0000 (16:42 +0200)]
s3:wscript: enable Spotlight by default
Now that we have a no-op backend that is always available, we can compile mdssvc
by default.
The new behaviour is:
option not used Default: build mdsvc with available backends
from autodetection
--disable-spotlight Do not build mdssvc
--enable-spotlight Build mdssvc and require a real backend
(currently Tracker, in the future also Elasticsearch)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Tue, 30 Jul 2019 13:39:38 +0000 (15:39 +0200)]
s3:mdssvc: avoid strncpy when marshalling strings
Avoids failure when at O3 level:
[2082/4232] Compiling source3/rpc_server/mdssvc/marshalling.c
==> /builds/samba-team/devel/samba/samba-o3.stderr <==
In file included from /usr/include/string.h:494,
from /usr/include/bsd/string.h:30,
from ../../lib/tevent/../replace/replace.h:164,
from ../../source3/include/includes.h:23,
from ../../source3/rpc_server/mdssvc/marshalling.c:21:
In function ‘strncpy’,
inlined from ‘sl_pack_string’ at ../../source3/rpc_server/mdssvc/marshalling.c:493:2,
inlined from ‘sl_pack_loop’ at ../../source3/rpc_server/mdssvc/marshalling.c:607:13:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ output
truncated before terminating nul copying as many bytes from a string as its
length [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../source3/rpc_server/mdssvc/marshalling.c: In function ‘sl_pack_loop’:
../../source3/rpc_server/mdssvc/marshalling.c:458:8: note: length computed here
458 | len = strlen(s);
| ^~~~~~~~~
cc1: all warnings being treated as errors
Marshalled strings are not 0 terminated.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Sun, 21 Apr 2019 06:38:23 +0000 (08:38 +0200)]
unittest: workaround dependency problem in test_lib_util_modules
waf somehow screws the dependencies and the module ends up with a bunch of
missing RPC related symbols once an RPC service has special dependencies like
the mdssvc RPC service.
$ bin/test_lib_util_modules
test: test_samba_module_probe
success: test_samba_module_probe
test: test_samba_module_probe_dummy
Error loading module '/home/samba/src/bin/modules/rpc/test_dummy_module.so':
/home/samba/src/bin/modules/rpc/test_dummy_module.so: undefined symbol:
rpc_service_mode
failure: test_samba_module_probe_dummy [
NT_STATUS_IS_OK(status)
../../testsuite/unittests/test_lib_util_modules.c:39: error: Failure!
]
test: test_samba_module_probe_slash
success: test_samba_module_probe_slash
This is currently not noticed as mdssvc is not enabled in selftest, but that is
going to change with a subsequent commit.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Tue, 16 Apr 2019 12:04:16 +0000 (14:04 +0200)]
s3:mdssvc: supposed status field is in fact a fragment indicator
Spotted this in mdssvc response that containied many results for a search
request: if the mdssvc response blob is larger then ~32k, the server fragments
the response in 32k fragments and sets the "fragment" field to 1.
Note that mdssvc implemenets result set "fragmentation" at the result set layer,
not at the marshalled response buffer layer. Therefor mdssvc always sets this
field to 0.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Wed, 17 Apr 2019 09:00:52 +0000 (11:00 +0200)]
s3:mdssvc: add noindex backend
Add a new default backend that, while allowing mdsvc RPC and search queries from
clients, always returns no results.
Shares using this backend will behave the same way as shares on a macOS SMB
server where indexing is disabled.
This change will later also allow us to compile the Spotlight RPC service by
default which is a big step in the direction of adding tests to CI.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Tue, 16 Apr 2019 09:24:02 +0000 (11:24 +0200)]
s3:mdssvc: log inode number in ino_path_map_destr_cb()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Sun, 8 Mar 2015 07:01:06 +0000 (08:01 +0100)]
s3:mdssvc: move some code to a subsystem
We need this in a later patchset when adding a mdssvc client library and for
unit tests.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Fri, 16 Nov 2018 13:24:35 +0000 (14:24 +0100)]
s3:mdssvc: mds_dalloc_dump() -> dalloc_dump()
Move mds_dalloc_dump() to dalloc and rename it to dalloc_dump().
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Tue, 9 Apr 2019 09:19:43 +0000 (11:19 +0200)]
s3:mdssvc: add Unicode normalisation
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Mon, 6 May 2019 13:03:02 +0000 (15:03 +0200)]
s3:mdssvc: new option "spotlight backend"
Currently there's only the tracker backend, but subsequent commits will add
other backends.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Fri, 12 Apr 2019 10:15:56 +0000 (12:15 +0200)]
s3:mdssvc: pass down sharename and SNUM
Not used for now, will be needed in the upcoming Elasticsearch backend.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Thu, 14 Mar 2019 06:38:20 +0000 (07:38 +0100)]
s3-mdssvc: factor out Tracker backend logic
This moves all Tracker backend logic into a modularized component.
This should not result in any change in behaviour, it just paves the way
for adding additional backends. Currently the only available backend is
Gnome Tracker.
slq_destroy_send/recv is not needed anymore as the problem is solved now by
correctly checking if an async Tracker request was cancelled and we got
G_IO_ERROR_CANCELLED in tracker_con_cb() or tracker_query_cb() and avoid using
user_data in that the case.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Wed, 7 Aug 2019 09:59:39 +0000 (11:59 +0200)]
s3:mdssvc: move debug macro to header file
This is going to be used from other parts of the code soon.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Wed, 7 Aug 2019 09:55:44 +0000 (11:55 +0200)]
s3:mdssvc: README.Coding fixes, long lines, modernize debug macros
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Ralph Boehme [Wed, 13 Mar 2019 14:42:51 +0000 (15:42 +0100)]
s3:rpc_server: factor out rpc_mdssvc_sources
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Swen Schillig [Mon, 29 Jul 2019 13:46:15 +0000 (15:46 +0200)]
tfork: Free memory in torture test to satisfy sanitizer
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug 8 11:33:32 UTC 2019 on sn-devel-184
Swen Schillig [Mon, 29 Jul 2019 12:55:10 +0000 (14:55 +0200)]
ldb: Free memory in torture test to satisfy sanitizer
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Swen Schillig [Mon, 29 Jul 2019 08:47:20 +0000 (10:47 +0200)]
util: Free memory in charset torture test to satisfy sanitizer
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Swen Schillig [Mon, 29 Jul 2019 08:23:14 +0000 (10:23 +0200)]
ndr: Free memory in torture test to satisfy sanitizer
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Swen Schillig [Mon, 29 Jul 2019 08:00:26 +0000 (10:00 +0200)]
util: Free memory in genrand torture test to satisfy sanitizer
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Swen Schillig [Mon, 29 Jul 2019 07:50:24 +0000 (09:50 +0200)]
ldb: Fix mem allocation in torture test to satisfy sanitizer
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Swen Schillig [Mon, 29 Jul 2019 13:27:58 +0000 (15:27 +0200)]
registry: Free memory at the end of each loop run to prevent mem leak
Found during torture test runs with enable address-sanitizer.
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug 8 06:44:12 UTC 2019 on sn-devel-184
Volker Lendecke [Thu, 1 Aug 2019 12:47:41 +0000 (14:47 +0200)]
torture: SMB1 unlink needs delay for a stream's SHARING_VIOLATION
Survives against W2k12R2
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 Aug 8 01:05:38 UTC 2019 on sn-devel-184
Volker Lendecke [Tue, 30 Jul 2019 12:54:40 +0000 (14:54 +0200)]
smbd: Move handling the 1sec sharing_violation delay into smb1 code
Simplify the flow in open_file_ntcreate, streamline it for SMB2
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 30 Jul 2019 12:54:18 +0000 (14:54 +0200)]
smbd: Add defer_sharing_violation_smb1
This is close to what Windows SMB1 does: Instead of waiting for the
share entry causing the SHARING_VIOLATION to disappear, retry every
200msec up to one second. Windows does it a little differently: Retry
up to 5 times. But up to one second should be close enough.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 2 Aug 2019 09:54:11 +0000 (11:54 +0200)]
smbd: Get "req->request_time" early in create_file_default()
This is necessary for the following case:
We want to delete a file with an open stream that is not open with
FILE_SHARE_DELETE. In SMB1, we need to defer the sharing violation
reply (we don't do that right now, test to follow). However, when we
move that sharing violation delay to where it belongs, into the outer
layers, only very deep in the nested open_streams_for_delete smb1
sharing violation delay handling call we will hit the sharing
violation in the 1-second retry case. However, that
open_streams_for_delete itself is INTERNAL_OPEN_ONLY and thus not
deferred itself. This means that it will not overwrite
req->request_time at all.
Exec summary: We only have one request_time now, set it properly as
early as possible.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 2 Aug 2019 12:33:22 +0000 (14:33 +0200)]
smbd: Do not exceed the req's max timeout in setup_poll_open()
This will become important in the next commits when the SMB1 sharing
violation delay will use this. We want to be able to reduce the
timeout to less than 200msec, see the next commits.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 30 Jul 2019 12:51:00 +0000 (14:51 +0200)]
smbd: Make setup_poll_open() return bool
This is for callers who don't want to call open_was_deferred()
afterwards
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 30 Jul 2019 12:00:17 +0000 (14:00 +0200)]
smbd: Make setup_kernel_oplock_poll_open() more general
This is a generic "open retry without locking.tdb waiter" loop: Take
the specific timeouts as parameters.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 30 Jul 2019 11:41:17 +0000 (13:41 +0200)]
smbd: Avoid exit_server() in setup_kernel_oplock_poll_open()
Failure to postpone a request is not really fatal: We just don't retry
as wanted but return an error to the client that might have resolved
itself after a few seconds. From my point of view such a spurious and
rare error, which is highly unlikely anyway does not justify to kill
that client's connection.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 26 Jul 2019 10:09:14 +0000 (12:09 +0200)]
smbd: Remove access check on SHARING_VIOLATION
This piece of code predates our user-space access checks, which we
nowadays always do in open_file()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:40:43 +0000 (13:40 -0700)]
s3: VFS: Make setxattr return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
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 Aug 7 17:59:25 UTC 2019 on sn-devel-184
Jeremy Allison [Thu, 1 Aug 2019 20:39:42 +0000 (13:39 -0700)]
s3: VFS: Make removexattr return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:35:47 +0000 (13:35 -0700)]
s3: VFS: Make chflags return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:33:27 +0000 (13:33 -0700)]
s3: VFS: Make rmdir return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:32:32 +0000 (13:32 -0700)]
s3: VFS: Make mkdir return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:31:01 +0000 (13:31 -0700)]
s3: VFS: Make mknod return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:29:54 +0000 (13:29 -0700)]
s3: VFS: Make ntimes return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:25:37 +0000 (13:25 -0700)]
s3: VFS: Make chown return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:23:48 +0000 (13:23 -0700)]
s3: VFS: Make chmod return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Jeremy Allison [Thu, 1 Aug 2019 20:18:42 +0000 (13:18 -0700)]
s3: VFS: Make unlink return errno = EROFS on a shadow copy path.
smbd has no business modifying a shadow copy filesystem, it should be read-only.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Samuel Cabrero [Tue, 6 Aug 2019 16:21:12 +0000 (18:21 +0200)]
s4:librpc/rpc: Use generic roh_connect_channel_send/recv
The HTTP connection code is common to in and out channels.
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Aug 7 14:12:40 UTC 2019 on sn-devel-184
Samuel Cabrero [Tue, 6 Aug 2019 16:12:41 +0000 (18:12 +0200)]
s4:librpc/rpc: Add roh_connect_channel_send/recv
Generic function to connect a ROH channel. The use comes later to avoid
duplicated code.
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
Ralph Boehme [Tue, 2 Apr 2019 16:34:24 +0000 (18:34 +0200)]
s4:lib/http: move to the toplevel
This is going to be used from the s3 RPC server soon...
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Wed, 3 Apr 2019 12:33:12 +0000 (14:33 +0200)]
s4:lib/http: add support for http POST
Even though GET would work as well, only adding POST, as that's the only method
that's going to be exersized in code and tests (RPC mdssvc elasticsearch
backend).
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Tue, 6 Aug 2019 10:33:40 +0000 (12:33 +0200)]
s4:lib/http: use http_conn in http_send_request_send() and http_read_response_send()
Works, tested with
$ bin/smbtorture -W RIVERSIDE --realm=RIVERSIDE.SITE -s /dev/null \
-U Administrator%Passw0rd \
ncacn_http:10.10.11.164[HttpProxy=10.10.11.164:593,HttpUseTls=false,HttpAuthOption=basic,HttpConnectOption=UseHttpProxy] \
rpc.epmapper.epmapper.Lookup_simple
I get an ACCESS_DENIED error, but I get it over HTTP. :)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Thu, 28 Mar 2019 14:36:00 +0000 (15:36 +0100)]
s4:librpc/rpc: use http_connect_send/recv in ncacn_http
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Tue, 26 Mar 2019 14:04:28 +0000 (15:04 +0100)]
s4:lib/http: remove stream and send_queue from state
They're not used, so remove them.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Tue, 26 Mar 2019 13:53:21 +0000 (14:53 +0100)]
s4:lib/http: move struct http_read_response_state to the implementation
This is only used by the implemementation of http_send_request_send/recv, no
need to have this in the header file.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Tue, 26 Mar 2019 13:53:21 +0000 (14:53 +0100)]
s4:lib/http: move struct http_send_request_state to the implementation
This is only used by the implemementation of http_send_request_send/recv, no
need to have this in the header file.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Mon, 25 Mar 2019 13:39:59 +0000 (14:39 +0100)]
s4:lib/http: add http_[dis]connect_send and recv
Not used for now, that comes later.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Ralph Boehme [Tue, 9 Apr 2019 11:34:39 +0000 (13:34 +0200)]
charset: add tests for Unicode NFC <-> NFD conversion
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Aug 7 07:25:39 UTC 2019 on sn-devel-184
Ralph Boehme [Tue, 9 Apr 2019 09:21:57 +0000 (11:21 +0200)]
charset: add support for Unicode normalisation with libicu
This adds a direct conversion hook using libicu to perform NFC <-> NFD
conversion on UTF8 strings. The defined charset strings are "UTF8-NFC" and
"UTF8-NFD", to convert from one to the other the caller calls smb_iconv_open()
with the desired source and target charsets, eg
smb_iconv_open("UTF8-NFD", "UTF8-NFC");
for converting from NFC to NFD.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Ralph Boehme [Tue, 23 Apr 2019 14:47:45 +0000 (16:47 +0200)]
torture: add torture_assert_errno_equal_goto()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Michael Hanselmann [Wed, 3 Apr 2019 23:10:11 +0000 (01:10 +0200)]
Add fuzzing binary for oLschema2ldif
Use the oLschema2ldif library functions introduced in commit
0c7c44a284a26790081c000f5b8f4ed32f9f21d7 to implement a fuzzing utility.
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Michael Hanselmann [Wed, 3 Apr 2019 23:03:58 +0000 (01:03 +0200)]
Add fuzzing binary for tiniparser
The "tiniparser_load" function is made into a wrapper for the newly
added "tiniparser_load_stream" function which accepts a FILE pointer.
This way no actual files have to be opened for fuzzing (memfd_create(2)
isn't readily available on all systems yet).
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Michael Hanselmann [Wed, 3 Apr 2019 22:23:07 +0000 (00:23 +0200)]
Add fuzzing support to build system
LibFuzzer, Honggfuzz and other programs implement simple interfaces for
fuzzing appropriately prepared code. Samba contains quite a lot of
parsing code, often a good target for fuzzing.
With this change the build system is amended to support building fuzzing
binaries (added in later changes).
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Volker Lendecke [Tue, 6 Aug 2019 15:27:12 +0000 (17:27 +0200)]
smbd: Assert that INTERNAL_OPEN_ONLY never gets real oplocks
Slightly simplify assumptions in the code
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 6 23:06:41 UTC 2019 on sn-devel-184
Volker Lendecke [Tue, 30 Jul 2019 05:20:42 +0000 (07:20 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 30 Jul 2019 05:16:12 +0000 (07:16 +0200)]
smbd: Remove "delayed_for_oplocks" from deferred_open_record_create()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Mon, 29 Jul 2019 19:42:12 +0000 (21:42 +0200)]
smbd: Remove "deferred_open_record->delayed_for_oplocks"
Nobody used this
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 26 Jul 2019 17:18:37 +0000 (19:18 +0200)]
smbd: Remove "id" from deferred_open_record_create()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 26 Jul 2019 17:16:09 +0000 (19:16 +0200)]
smbd: Remove "deferred_open_record->id"
Nobody used this
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 6 Aug 2019 08:45:27 +0000 (10:45 +0200)]
smbd: Clean up leases.tdb if set_share_mode() fails
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Mon, 5 Aug 2019 16:50:08 +0000 (18:50 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Mon, 5 Aug 2019 16:18:41 +0000 (18:18 +0200)]
smbd: Inline remove_oplock_under_lock() into its only caller
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Mon, 5 Aug 2019 15:05:20 +0000 (17:05 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Mon, 5 Aug 2019 12:59:18 +0000 (14:59 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Mon, 5 Aug 2019 12:57:28 +0000 (14:57 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 26 Jul 2019 14:20:17 +0000 (16:20 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 14:22:51 +0000 (16:22 +0200)]
smbd: Remove "share_access" from fcb_or_dos_open()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 14:20:04 +0000 (16:20 +0200)]
smbd: Remove "share_access" from dup_file_fsp()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 14:15:46 +0000 (16:15 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 12:50:35 +0000 (14:50 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 14:08:35 +0000 (16:08 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 13:01:37 +0000 (15:01 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 26 Jul 2019 14:28:39 +0000 (16:28 +0200)]
smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 23 Jul 2019 15:46:22 +0000 (17:46 +0200)]
smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Fri, 2 Aug 2019 10:02:24 +0000 (12:02 +0200)]
smbd: Enhance debugging in push_deferred_open_message_smb()
Real timestamps are easier to read
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 1 Aug 2019 11:24:49 +0000 (13:24 +0200)]
smbd: Use timeval_str_buf() in defer_open()
Also make this a hires timestamp for better debugging.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 30 Jul 2019 05:10:28 +0000 (07:10 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Tue, 30 Jul 2019 04:55:45 +0000 (06:55 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 10:04:49 +0000 (12:04 +0200)]
smbd: Remove a false comment
Looking at the code we do respect the kernel_flock failure.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 09:39:19 +0000 (11:39 +0200)]
torture3: Don't duplicate set_blocking()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Thu, 25 Jul 2019 09:38:36 +0000 (11:38 +0200)]
lib: Remove a duplicate prototype for set_blocking()
This is now in lib/util/blocking.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 10:19:24 +0000 (12:19 +0200)]
build: Only check rpc/xdr.h in tirpc if required
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 10:18:42 +0000 (12:18 +0200)]
vfs: Fix the nfs4acl build on FreeBSD
FreeBSD needs rpc/types.h before rpc/xdr.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 10:14:03 +0000 (12:14 +0200)]
build: Correctly detect rpc/xdr.h on FreeBSD
FreeBSD needs rpc/types.h included before rpc/xdr.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 09:45:31 +0000 (11:45 +0200)]
wscript: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 09:40:20 +0000 (11:40 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 09:37:59 +0000 (11:37 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 09:08:40 +0000 (11:08 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Volker Lendecke [Wed, 31 Jul 2019 08:42:24 +0000 (10:42 +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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>