]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
6 years agos3: VFS: vfs_snapper: Make ntimes return errno = EROFS on a shadow copy path.
Jeremy Allison [Fri, 9 Aug 2019 17:25:14 +0000 (10:25 -0700)] 
s3: VFS: vfs_snapper: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_snapper: Make chown return errno = EROFS on a shadow copy path.
Jeremy Allison [Fri, 9 Aug 2019 17:24:11 +0000 (10:24 -0700)] 
s3: VFS: vfs_snapper: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_snapper: Make chmod return errno = EROFS on a shadow copy path.
Jeremy Allison [Fri, 9 Aug 2019 17:19:31 +0000 (10:19 -0700)] 
s3: VFS: vfs_snapper: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_snapper: Make unlink return errno = EROFS on a shadow copy path.
Jeremy Allison [Fri, 9 Aug 2019 17:07:04 +0000 (10:07 -0700)] 
s3: VFS: vfs_snapper: 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: David Disseldorp <ddiss@samba.org>
6 years agoloadparm: fix mem leak found by ASAN
Swen Schillig [Mon, 5 Aug 2019 08:58:53 +0000 (10:58 +0200)] 
loadparm: fix mem leak found by ASAN

==24948==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 232 byte(s) in 1 object(s) allocated from:
    #0 0x7fc44b971c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
    #1 0x7fc44a2fe7b0 in __talloc_with_prefix ../../lib/talloc/talloc.c:782
    #2 0x7fc44a2fe7b0 in __talloc ../../lib/talloc/talloc.c:824
    #3 0x7fc44a2fe7b0 in _talloc_named_const ../../lib/talloc/talloc.c:981
    #4 0x7fc44a2fe7b0 in _talloc_array ../../lib/talloc/talloc.c:2764
    #5 0x7fc44a1239bc in str_list_make_v3 ../../lib/util/util_strlist_v3.c:58
    #6 0x7fc44a123e3b in str_list_make_v3_const ../../lib/util/util_strlist_v3.c:127
    #7 0x7fc44b14cc1a in init_globals ../../source3/param/loadparm.c:547
    #8 0x7fc44b14deef in lp_load_ex ../../source3/param/loadparm.c:3876
    #9 0x7fc44b14f97c in lp_load_initial_only ../../source3/param/loadparm.c:4025
    #10 0x7fc44b479235 in cmdline_messaging_context ../../source3/lib/cmdline_contexts.c:34
    #11 0x557cf59d642c in process_options ../../source3/utils/smbpasswd.c:200
    #12 0x557cf59d642c in main ../../source3/utils/smbpasswd.c:633
    #13 0x7fc4419f5412 in __libc_start_main (/lib64/libc.so.6+0x24412)

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Aug 10 20:42:39 UTC 2019 on sn-devel-184

6 years agotorture: fix mem leak found by ASAN (smb2_scan)
Swen Schillig [Mon, 5 Aug 2019 09:15:59 +0000 (11:15 +0200)] 
torture: fix mem leak found by ASAN (smb2_scan)

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x7f63e6938c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
    #1 0x7f63e615fa5c in __talloc_with_prefix ../../lib/talloc/talloc.c:782
    #2 0x7f63e615fa5c in __talloc ../../lib/talloc/talloc.c:824
    #3 0x7f63e615fa5c in _talloc_named_const ../../lib/talloc/talloc.c:981
    #4 0x7f63e615fa5c in talloc_named_const ../../lib/talloc/talloc.c:1748
    #5 0x55609e7530cf in torture_smb2_scan ../../source4/torture/smb2/scan.c:203
    #6 0x7f63e2a37772 in wrap_simple_test ../../lib/torture/torture.c:633
    #7 0x7f63e2a3b75e in internal_torture_run_test ../../lib/torture/torture.c:442
    #8 0x7f63e2a3c543 in torture_run_tcase_restricted ../../lib/torture/torture.c:507
    #9 0x7f63e2a3cdd5 in torture_run_suite_restricted ../../lib/torture/torture.c:357
    #10 0x7f63e2a3cf25 in torture_run_suite_restricted ../../lib/torture/torture.c:362
    #11 0x7f63e2a3d434 in torture_run_suite ../../lib/torture/torture.c:339
    #12 0x55609e3a154a in run_matching ../../source4/torture/smbtorture.c:93
    #13 0x55609e3a2f56 in torture_run_named_tests ../../source4/torture/smbtorture.c:143
    #14 0x55609e3a699d in main ../../source4/torture/smbtorture.c:691
    #15 0x7f63dad59412 in __libc_start_main (/lib64/libc.so.6+0x24412)

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agotorture: fix mem leak found by ASAN
Swen Schillig [Mon, 5 Aug 2019 09:07:53 +0000 (11:07 +0200)] 
torture: fix mem leak found by ASAN

==14507==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f3c76fe5c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
    #1 0x7f3c7680df33 in __talloc_with_prefix ../../lib/talloc/talloc.c:782
    #2 0x7f3c7680df33 in __talloc ../../lib/talloc/talloc.c:824
    #3 0x7f3c7680df33 in _talloc_named_const ../../lib/talloc/talloc.c:981
    #4 0x7f3c7680df33 in _talloc_zero ../../lib/talloc/talloc.c:2422
    #5 0x7f3c7680e2a5 in _talloc_zero_array ../../lib/talloc/talloc.c:2775
    #6 0x557a50d4a09f in torture_bench_treeconnect ../../source4/torture/raw/tconrate.c:165
    #7 0x7f3c730e4772 in wrap_simple_test ../../lib/torture/torture.c:633
    #8 0x7f3c730e875e in internal_torture_run_test ../../lib/torture/torture.c:442
    #9 0x7f3c730e9543 in torture_run_tcase_restricted ../../lib/torture/torture.c:507
    #10 0x7f3c730e9dd5 in torture_run_suite_restricted ../../lib/torture/torture.c:357
    #11 0x7f3c730ea434 in torture_run_suite ../../lib/torture/torture.c:339
    #12 0x557a50c1b54a in run_matching ../../source4/torture/smbtorture.c:93
    #13 0x557a50c1cf56 in torture_run_named_tests ../../source4/torture/smbtorture.c:143
    #14 0x557a50c2099d in main ../../source4/torture/smbtorture.c:691
    #15 0x7f3c6b406412 in __libc_start_main (/lib64/libc.so.6+0x24412)

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb: Fix mem-leak if talloc_realloc fails
Swen Schillig [Wed, 31 Jul 2019 08:27:37 +0000 (10:27 +0200)] 
ldb: Fix mem-leak if talloc_realloc fails

In case of a failing talloc_realloc(), the only reference
to the originally allocated memory is overwritten.
Instead use a temp var until success is verified.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agogitlab-ci: Install compat-gnutls34 on CentOS7
Andreas Schneider [Thu, 8 Aug 2019 06:18:55 +0000 (08:18 +0200)] 
gitlab-ci: Install compat-gnutls34 on CentOS7

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agos3:modules: Link vfs_acl_common against gnutls
Andreas Schneider [Thu, 8 Aug 2019 11:14:45 +0000 (13:14 +0200)] 
s3:modules: Link vfs_acl_common against gnutls

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agolibcli:smb: Add forward declaration for gnutls_hmac_hd_t
Andreas Schneider [Thu, 8 Aug 2019 09:57:02 +0000 (11:57 +0200)] 
libcli:smb: Add forward declaration for gnutls_hmac_hd_t

This file is basically included everywhere. So use a forward declaration
for gnutls_hmac_hd_t. This way we don't have to link everthing against
gnutls to get access to the header path.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agosmbd: Simplify fd_open_atomic()
Volker Lendecke [Wed, 24 Jul 2019 15:39:59 +0000 (17:39 +0200)] 
smbd: Simplify fd_open_atomic()

* Assign *file_created on every exit.

* Directly assign curr_flags without &= / |=

Both of these changes make the routine easier to understand for me,
less jumping around in the code to see where the values came from.

* Do the retry in a "positive" if-clause

Normally I'm a big fan of early returns, but this single retry is so
simple that to me it's easier to understand this way.

Overall, 13 lines less code. YMMV :-)

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): Sat Aug 10 00:07:28 UTC 2019 on sn-devel-184

6 years agosmbd: FTRUNCATE regular files only
Volker Lendecke [Wed, 24 Jul 2019 13:48:50 +0000 (15:48 +0200)] 
smbd: FTRUNCATE regular files only

I don't really have a test case, but to me a positive test for a
regular file makes more sense here than just ruling out FIFOs. While
we probably only ever hit regular files (or FIFOs), there might be
more that we catch and don't properly handle.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: Make "lease" const in SMB_VFS_CREATE_FILE()
Volker Lendecke [Wed, 7 Aug 2019 20:00:11 +0000 (22:00 +0200)] 
smbd: Make "lease" const in SMB_VFS_CREATE_FILE()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: Make "lease" const in create_file_default()
Volker Lendecke [Wed, 7 Aug 2019 19:41:22 +0000 (21:41 +0200)] 
smbd: Make "lease" const in create_file_default()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: Make "lease" const in create_file_unixpath()
Volker Lendecke [Wed, 7 Aug 2019 19:37:31 +0000 (21:37 +0200)] 
smbd: Make "lease" const in create_file_unixpath()

This is the one place where *lease actually got modified. We can
easily make a copy, "struct smb2_lease" is not too large, and this
case is pretty rare anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: Make "lease_key" const in lease_match()
Volker Lendecke [Wed, 7 Aug 2019 19:36:25 +0000 (21:36 +0200)] 
smbd: Make "lease_key" const in lease_match()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: Make "lease" const in open_file_ntcreate()
Volker Lendecke [Wed, 7 Aug 2019 19:30:56 +0000 (21:30 +0200)] 
smbd: Make "lease" const in open_file_ntcreate()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: Make "lease" const in grant_fsp_oplock_type()
Volker Lendecke [Wed, 7 Aug 2019 19:29:14 +0000 (21:29 +0200)] 
smbd: Make "lease" const in grant_fsp_oplock_type()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbd: Nobody uses the changed "lease" from grant_fsp_oplock_type
Volker Lendecke [Wed, 7 Aug 2019 19:27:42 +0000 (21:27 +0200)] 
smbd: Nobody uses the changed "lease" from grant_fsp_oplock_type

.. except for the DEBUG message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make setxattr return errno = EROFS on a shadow copy...
Jeremy Allison [Thu, 8 Aug 2019 22:59:15 +0000 (15:59 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug  9 18:08:03 UTC 2019 on sn-devel-184

6 years agos3: VFS: vfs_ceph_snapshots: Make removexattr return errno = EROFS on a shadow copy...
Jeremy Allison [Thu, 8 Aug 2019 22:58:10 +0000 (15:58 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make chflags return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:56:59 +0000 (15:56 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make rmdir return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:56:01 +0000 (15:56 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make mkdir return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:55:04 +0000 (15:55 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make mknod return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:53:51 +0000 (15:53 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make ntimes return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:52:14 +0000 (15:52 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make chown return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:48:54 +0000 (15:48 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make chmod return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:47:44 +0000 (15:47 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agos3: VFS: vfs_ceph_snapshots: Make unlink return errno = EROFS on a shadow copy path.
Jeremy Allison [Thu, 8 Aug 2019 22:45:10 +0000 (15:45 -0700)] 
s3: VFS: vfs_ceph_snapshots: 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: David Disseldorp <ddiss@samba.org>
6 years agomdssvc: Fix the clang build
Volker Lendecke [Fri, 9 Aug 2019 06:02:41 +0000 (08:02 +0200)] 
mdssvc: Fix the clang build

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

6 years agos3:mdssvc: fix slrpc_fetch_attributes() when CNID is not known
Ralph Boehme [Mon, 6 May 2019 12:19:31 +0000 (14:19 +0200)] 
s3:mdssvc: fix slrpc_fetch_attributes() when CNID is not known

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

6 years agos3:mdssvc: close mdssvc rpc command must return in handle
Ralph Boehme [Mon, 6 May 2019 12:18:27 +0000 (14:18 +0200)] 
s3:mdssvc: close mdssvc rpc command must return in handle

Checked against macOS mdssvc.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:mdssvc: failing the RPC request if the mdssvc policy handle is not found
Ralph Boehme [Mon, 6 May 2019 12:14:26 +0000 (14:14 +0200)] 
s3:mdssvc: failing the RPC request if the mdssvc policy handle is not found

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>
6 years agos3:mdssvc: the open command must work on shares with Spotlight disabled
Ralph Boehme [Mon, 6 May 2019 12:11:31 +0000 (14:11 +0200)] 
s3:mdssvc: the open command must work on shares with Spotlight disabled

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>
6 years agos3:mdssvc: use an early return if spotlight is not enabled.
Ralph Boehme [Tue, 16 Apr 2019 17:32:52 +0000 (19:32 +0200)] 
s3:mdssvc: use an early return if spotlight is not enabled.

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>
6 years agos3:mdssvc: update a few debug macros to modern style
Ralph Boehme [Wed, 17 Apr 2019 05:38:53 +0000 (07:38 +0200)] 
s3:mdssvc: update a few debug macros to modern style

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:mdssvv: don't fail the RPC request if the share name is unknown
Ralph Boehme [Mon, 6 May 2019 12:07:53 +0000 (14:07 +0200)] 
s3:mdssvv: don't fail the RPC request if the share name is unknown

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>
6 years agos3:mdssvc: initialize the returned share_path with the empty string
Ralph Boehme [Tue, 16 Apr 2019 17:25:09 +0000 (19:25 +0200)] 
s3:mdssvc: initialize the returned share_path with the empty string

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>
6 years agos3:mdssvc: macOS returns the client values in the open command
Ralph Boehme [Tue, 16 Apr 2019 17:23:25 +0000 (19:23 +0200)] 
s3:mdssvc: macOS returns the client values in the open command

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:mdssvc: macOS returns UINT64_MAX, not 0 for closeQueryForContext mdscmd
Ralph Boehme [Tue, 16 Apr 2019 17:14:39 +0000 (19:14 +0200)] 
s3:mdssvc: macOS returns UINT64_MAX, not 0 for closeQueryForContext mdscmd

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:mdssvc: fix error handling of mdssvc RPC requests
Ralph Boehme [Tue, 16 Apr 2019 12:17:11 +0000 (14:17 +0200)] 
s3:mdssvc: fix error handling of mdssvc RPC requests

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>
6 years agotorture: beginning of a mdssvc RPC service test-suite
Ralph Boehme [Tue, 16 Apr 2019 14:54:21 +0000 (16:54 +0200)] 
torture: beginning of a mdssvc RPC service test-suite

Yikes! Most tests fail atm.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agorpcclient: add some simple commands for Spotlight RPC
Ralph Boehme [Sun, 8 Mar 2015 06:57:57 +0000 (07:57 +0100)] 
rpcclient: add some simple commands for Spotlight RPC

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agorpcclient: domain_sid is only needed for SAMR
Ralph Boehme [Fri, 16 Nov 2018 15:07:13 +0000 (16:07 +0100)] 
rpcclient: domain_sid is only needed for SAMR

This allows using rpcclient commands with servers that don't implement LSA
QueryInfoPolicy.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolib:torture: add torture_assert_u32_[not_]equal[_goto] macros
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>
6 years agos3:mdssvc: fix unmarshalling of empty CNID array
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>
6 years agos3:mdssvc: marshalling: fix unpacking empty CNID structure
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>
6 years agos3:mdssvc: marshalling: fix unpacking empty filemeta structure
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>
6 years agos3:mdssvc: marshalling: add a newline to a DEBUG message
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>
6 years agotorture: start of a mdssvc packet (un)marshalling testsuite
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>
6 years agolibrpc: add RPC_NDR_MDSSVC
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>
6 years agos3:wscript: enable Spotlight by default
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>
6 years agos3:mdssvc: avoid strncpy when marshalling strings
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>
6 years agounittest: workaround dependency problem in test_lib_util_modules
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>
6 years agos3:mdssvc: supposed status field is in fact a fragment indicator
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>
6 years agos3:mdssvc: add noindex backend
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>
6 years agos3:mdssvc: log inode number in ino_path_map_destr_cb()
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>
6 years agos3:mdssvc: move some code to a subsystem
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>
6 years agos3:mdssvc: mds_dalloc_dump() -> dalloc_dump()
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>
6 years agos3:mdssvc: add Unicode normalisation
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>
6 years agos3:mdssvc: new option "spotlight backend"
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>
6 years agos3:mdssvc: pass down sharename and SNUM
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>
6 years agos3-mdssvc: factor out Tracker backend logic
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>
6 years agos3:mdssvc: move debug macro to header file
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>
6 years agos3:mdssvc: README.Coding fixes, long lines, modernize debug macros
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>
6 years agos3:rpc_server: factor out rpc_mdssvc_sources
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>
6 years agotfork: Free memory in torture test to satisfy sanitizer
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

6 years agoldb: Free memory in torture test to satisfy sanitizer
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>
6 years agoutil: Free memory in charset torture test to satisfy sanitizer
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>
6 years agondr: Free memory in torture test to satisfy sanitizer
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>
6 years agoutil: Free memory in genrand torture test to satisfy sanitizer
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>
6 years agoldb: Fix mem allocation in torture test to satisfy sanitizer
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>
6 years agoregistry: Free memory at the end of each loop run to prevent mem leak
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

6 years agotorture: SMB1 unlink needs delay for a stream's SHARING_VIOLATION
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

6 years agosmbd: Move handling the 1sec sharing_violation delay into smb1 code
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>
6 years agosmbd: Add defer_sharing_violation_smb1
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>
6 years agosmbd: Get "req->request_time" early in create_file_default()
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>
6 years agosmbd: Do not exceed the req's max timeout in setup_poll_open()
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>
6 years agosmbd: Make setup_poll_open() return bool
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>
6 years agosmbd: Make setup_kernel_oplock_poll_open() more general
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>
6 years agosmbd: Avoid exit_server() in setup_kernel_oplock_poll_open()
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>
6 years agosmbd: Remove access check on SHARING_VIOLATION
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>
6 years agos3: VFS: Make setxattr return errno = EROFS on a shadow copy path.
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

6 years agos3: VFS: Make removexattr return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make chflags return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make rmdir return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make mkdir return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make mknod return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make ntimes return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make chown return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make chmod return errno = EROFS on a shadow copy path.
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>
6 years agos3: VFS: Make unlink return errno = EROFS on a shadow copy path.
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>
6 years agos4:librpc/rpc: Use generic roh_connect_channel_send/recv
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

6 years agos4:librpc/rpc: Add roh_connect_channel_send/recv
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>
6 years agos4:lib/http: move to the toplevel
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>
6 years agos4:lib/http: add support for http POST
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>
6 years agos4:lib/http: use http_conn in http_send_request_send() and http_read_response_send()
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>
6 years agos4:librpc/rpc: use http_connect_send/recv in ncacn_http
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>
6 years agos4:lib/http: remove stream and send_queue from state
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>