summaryrefslogtreecommitdiff
path: root/source3/rpc_server
Commit message (Collapse)AuthorAgeFilesLines
* s3: rename talloc_sub_advanced() to talloc_sub_full()Ralph Boehme2019-11-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have the following substitution functions: talloc_sub_basic() talloc_sub_advanced() talloc_sub_basic() currently substitutes a subset of talloc_sub_advanced(). We'll need a function X that only substitutes what talloc_sub_advanced() substitutes *without* what talloc_sub_basic() does. To get there rename talloc_sub_advanced() to talloc_sub_full(). A subsequent commit will then bring back talloc_sub_advanced() as described above. Examples with fictional replacement letters A and B. Currently: talloc_sub_basic: A talloc_sub_advanced: AB New: talloc_sub_basic: A talloc_sub_advanced: B talloc_sub_full: AB BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib: Remove #define serverid_equal server_id_equalVolker Lendecke2019-11-061-2/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* mdssvc.idl: pass policy_handle as pointerRalph Boehme2019-10-091-8/+8
| | | | | | | | | | | | No change in behaviour, this just changes all functions to take the policy_handle argument as pointer instead of passing it by value. This is how all other IDLs pass it. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed Oct 9 15:52:55 UTC 2019 on sn-devel-184
* s3:mdssvc: fix service startup in deamon modeRalph Boehme2019-10-092-6/+7
| | | | | | | | | | | | | | | | | | | | | Changes: * Don't initialize the RPC service by calling setup_rpc_module() in the parent mdssd. This is not needed in the parent, only in the worker childs. * In the worker childs call setup_rpc_module() instead of init_rpc_module() which ensures rpc_mdssvc_init() is called with the mdssvc callback which is needed to initialize mdssvc via mdssvc_init_cb() -> init_service_mdssvc() * Finally rpc_setup_mdssvc() is adjusted to be a noop if mdssvc is configured to as external and when called by the main parent smbd via dcesrv_ep_setup() -> setup_rpc_modules() I've manually tested all 4 combinations of external=yes|no X module=yes|no with the new mdfind command. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3:mdssvc: use a helper variable for the service typeRalph Boehme2019-10-091-2/+3
| | | | | | | No change in behaviour. Simplifies a subsequent logical change. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* mdssd: fix a debug messageRalph Boehme2019-10-091-1/+1
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3: rpc_server: enable mdssvc by defaultRalph Boehme2019-10-091-1/+1
| | | | | | | | Now that mdssvc is built by default and also tested in CI, enable it by default, running as embedded service. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3:mdssvc: add unit tests for the Spotlight to Elasticsearch parserRalph Boehme2019-10-091-0/+233
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3:mdssvc: add Elasticsearch backendRalph Boehme2019-10-0910-0/+2230
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3:mdssvc: add missing mds_ctx deallocationRalph Boehme2019-10-091-0/+1
| | | | | | | | | | | The mds_ctx object was created in _mdssvc_open() as a talloc child of the pipe which means as long as the pipe is connected it's not freed. To ensure we do proper rundown of all resources including backend connections and pending queries, we must free the mds_ctx object. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3:mdssvc: fix a long lineRalph Boehme2019-10-091-1/+3
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3:mdssvc: modernize a few DEBUG macrosRalph Boehme2019-10-091-2/+2
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* s3:mdssvc: remove unused snum from struct sl_queryRalph Boehme2019-10-091-1/+0
| | | | | | | Looks like this was never used, it's also available via mds_ctx->snum. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* epmapper: Fix printf specifiersVolker Lendecke2019-10-021-2/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* smbd: rename [un]become_user*() to [un]become_user_without_service*()Stefan Metzmacher2019-09-111-8/+8
| | | | | | | | | | | | We should make the behavior change (that gives up some protection) more obvious, by changing the function names. At least some OEMs have patches relying on the 4.9/4.10 behaviour and we want them to detect that they have to do more work when they need to change directories. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Spelling fixes s/negotatie/negotiate/Mathieu Parent2019-09-011-1/+1
| | | | | | Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s3-rpc_server: Check NTSTATUS return value from netlogon_creds_aes_decrypt()Andrew Bartlett2019-08-211-4/+6
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* smbd: Fix CID 1452293 Incorrect expression (NO_EFFECT)Volker Lendecke2019-08-141-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed Aug 14 11:48:42 UTC 2019 on sn-devel-184
* mdssvc: Fix the clang buildVolker Lendecke2019-08-091-1/+1
| | | | | | | | | | clang complains about "%lu" not to match size_t on 32-bit FreeBSD Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Fri Aug 9 07:34:05 UTC 2019 on sn-devel-184
* s3:mdssvc: fix slrpc_fetch_attributes() when CNID is not knownRalph Boehme2019-08-081-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Samba currenlty fails the whole RPC request, macOS returns returns a nil entry for the requested CNID: DALLOC_CTX(#1): { sl_array_t(#3): { uint64_t: 0x0000 CNIDs: unkn1: 0xfec, unkn2: 0x6b000020 DALLOC_CTX(#1): { uint64_t: 0xe4bbf314c03b1e } sl_filemeta_t(#1): { sl_array_t(#2): { nil nil } } } } Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Aug 8 21:43:14 UTC 2019 on sn-devel-184
* s3:mdssvc: close mdssvc rpc command must return in handleRalph Boehme2019-08-081-1/+1
| | | | | | | Checked against macOS mdssvc. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: failing the RPC request if the mdssvc policy handle is not foundRalph Boehme2019-08-081-2/+34
| | | | | | | | | | Turns out macOS mdssvc doesn't fail the RPC request if the policy handle is all zero. Also, if it fails with a non-all-zero handle, it returns a different RPC error, namely DCERPC_NCA_S_PROTO_ERROR, not DCERPC_FAULT_CONTEXT_MISMATCH (or rather their mapped NT_STATUS codes). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: the open command must work on shares with Spotlight disabledRalph Boehme2019-08-082-5/+3
| | | | | | | | | | | | Move the implementation of this setting down to the actual search query processing. macOS has no notion of "spotlight = false" at the DCERPC layer and the open request will always succeed even on all shares. When later the client issues search requests on such shares, we ensure we use the noindex backend. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: use an early return if spotlight is not enabled.Ralph Boehme2019-08-081-25/+25
| | | | | | | No change in behaviour, best viewed with git show -w. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: update a few debug macros to modern styleRalph Boehme2019-08-081-6/+6
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvv: don't fail the RPC request if the share name is unknownRalph Boehme2019-08-081-1/+0
| | | | | | | | Taken from macOS. We have to return an empty share_path and an empty policy handle, but not fail the RPC request. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: initialize the returned share_path with the empty stringRalph Boehme2019-08-081-1/+3
| | | | | | | | | | macOS returns the empty path for an unknown share. This paves the way for that change. Currently we still fail the RPC request if the share is not known with DCERPC_FAULT_CANT_PERFORM, but this is wrong and is going to be changed in the next commit. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: macOS returns the client values in the open commandRalph Boehme2019-08-081-4/+4
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: macOS returns UINT64_MAX, not 0 for closeQueryForContext mdscmdRalph Boehme2019-08-081-1/+1
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: fix error handling of mdssvc RPC requestsRalph Boehme2019-08-081-19/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems for certain error cases macOS just sends an empty response blob. So if our mdssvc request processing fails, we should just return an empty response blob, but not fail the mdssvc request at the DCERPC layer. Example, passing "xxx" as sharename which does not exist at the server: $ bin/rpcclient -U slow%pass macmini -c "fetch_attributes xxx /foo/bar 123" -d 10 .... Got pdu len 56, data_len 32 rpc_api_pipe: got frag len of 56 at offset 0: NT_STATUS_OK rpc_api_pipe: host macmini returned 32 bytes. mdssvc_cmd: struct mdssvc_cmd out: struct mdssvc_cmd fragment : * fragment : 0x00000000 (0) response_blob : * response_blob: struct mdssvc_blob length : 0x00000000 (0) size : 0x00010000 (65536) spotlight_blob : * spotlight_blob: ARRAY(0) unkn9 : * unkn9 : 0x00000000 (0) ... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: fix unmarshalling of empty CNID arrayRalph Boehme2019-08-081-4/+9
| | | | | | | | 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>
* s3:mdssvc: marshalling: fix unpacking empty CNID structureRalph Boehme2019-08-081-1/+1
| | | | | | | | | | | 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>
* s3:mdssvc: marshalling: fix unpacking empty filemeta structureRalph Boehme2019-08-081-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* s3:mdssvc: marshalling: add a newline to a DEBUG messageRalph Boehme2019-08-081-1/+1
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: avoid strncpy when marshalling stringsRalph Boehme2019-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* s3:mdssvc: supposed status field is in fact a fragment indicatorRalph Boehme2019-08-081-2/+3
| | | | | | | | | | | | | 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>
* s3:mdssvc: add noindex backendRalph Boehme2019-08-084-0/+99
| | | | | | | | | | | | | | 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>
* s3:mdssvc: log inode number in ino_path_map_destr_cb()Ralph Boehme2019-08-081-1/+1
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: move some code to a subsystemRalph Boehme2019-08-081-3/+7
| | | | | | | | 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>
* s3:mdssvc: mds_dalloc_dump() -> dalloc_dump()Ralph Boehme2019-08-084-171/+176
| | | | | | | 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>
* s3:mdssvc: add Unicode normalisationRalph Boehme2019-08-082-13/+83
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: new option "spotlight backend"Ralph Boehme2019-08-083-12/+34
| | | | | | | | 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>
* s3:mdssvc: pass down sharename and SNUMRalph Boehme2019-08-083-5/+24
| | | | | | | 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>
* s3-mdssvc: factor out Tracker backend logicRalph Boehme2019-08-087-337/+623
| | | | | | | | | | | | | | | | 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>
* s3:mdssvc: move debug macro to header fileRalph Boehme2019-08-082-20/+20
| | | | | | | 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>
* s3:mdssvc: README.Coding fixes, long lines, modernize debug macrosRalph Boehme2019-08-081-10/+16
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:rpc_server: factor out rpc_mdssvc_sourcesRalph Boehme2019-08-081-8/+12
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:rpc_server: Only dump passwords in developer buildsAndreas Schneider2019-07-261-0/+8
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jul 26 03:05:01 UTC 2019 on sn-devel-184
* netlogon: Fix potential use of uninitialized variableDavid Disseldorp2019-07-261-0/+1
| | | | | | | | | | The _netr_NetrEnumerateTrustedDomains()->dcerpc_lsa_open_policy2() error path checks the policy handle and closes it if non-empty. The policy handle may be uninitialized in this code-path - fix this. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Use a stackframe for temporary memoryAndreas Schneider2019-07-261-7/+13
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>