gd/samba-autobuild/.git
4 years agosmbd: Slightly simplify set_share_mode()
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>
4 years agosmbd: Move fsp_client_guid() to locking/
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>
4 years agosmbd: Slightly optimize reply_open_and_X()
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>
4 years agosmbd: Remove "share_access" from fcb_or_dos_open()
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>
4 years agosmbd: Remove "share_access" from dup_file_fsp()
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>
4 years agosmbd: Remove "share_access" from files_struct
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>
4 years agovfs_gpfs: Avoid "fsp->share_access" in vfs_gpfs_kernel_flock()
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>
4 years agosmbd: Pass share_access/access_mask explicitly to grant_fsp_oplock_type()
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>
4 years agosmbd: Pass share_access/access_mask explicitly to set_share_mode()
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>
4 years agosmbd: Fix a typo
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>
4 years agosmbd: Fix a typo
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>
4 years agosmbd: Enhance debugging in push_deferred_open_message_smb()
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>
4 years agosmbd: Use timeval_str_buf() in defer_open()
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>
4 years agosmbd: Fix a signed/unsigned warning
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>
4 years agosmbd: Fix a signed/unsigned comparison
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>
4 years agosmbd: Remove a false comment
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>
4 years agotorture3: Don't duplicate set_blocking()
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>
4 years agolib: Remove a duplicate prototype for set_blocking()
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>
4 years agobuild: Only check rpc/xdr.h in tirpc if required
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>
4 years agovfs: Fix the nfs4acl build on FreeBSD
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>
4 years agobuild: Correctly detect rpc/xdr.h on FreeBSD
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>
4 years agowscript: Fix a typo
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>
4 years agowinbind: Fix the clang build
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>
4 years agovfs: Fix the FreeBSD nfs4acl build
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>
4 years agodsdb: Fix the FreeBSD build
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>
4 years agosmbd: Fix the build with clang
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>
4 years agosmbd: Pass in "struct smb_request" to request_timed_out()
Volker Lendecke [Thu, 1 Aug 2019 15:00:45 +0000 (17:00 +0200)]
smbd: Pass in "struct smb_request" to request_timed_out()

It seems more natural to pass in a request to a routine called
request_timed_out(), and it's a few bytes less .text

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use "req->request_time" in schedule_async_open()
Volker Lendecke [Thu, 1 Aug 2019 14:42:59 +0000 (16:42 +0200)]
smbd: Use "req->request_time" in schedule_async_open()

All callers passed that in

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use "req->request_time" in schedule_async_open()
Volker Lendecke [Thu, 1 Aug 2019 14:42:59 +0000 (16:42 +0200)]
smbd: Use "req->request_time" in schedule_async_open()

The one caller passed that in.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use "req->request_time" in setup_kernel_oplock_poll_open()
Volker Lendecke [Thu, 1 Aug 2019 14:42:59 +0000 (16:42 +0200)]
smbd: Use "req->request_time" in setup_kernel_oplock_poll_open()

Both callers passed that in.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use "req->request_time" in defer_open()
Volker Lendecke [Thu, 1 Aug 2019 14:42:59 +0000 (16:42 +0200)]
smbd: Use "req->request_time" in defer_open()

Both callers passed that in.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use "req->request_time" in schedule_defer_open()
Volker Lendecke [Thu, 1 Aug 2019 14:42:59 +0000 (16:42 +0200)]
smbd: Use "req->request_time" in schedule_defer_open()

Both callers passed that in.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Avoid a separate "request_time" variable in open_file_ntcreate
Volker Lendecke [Thu, 1 Aug 2019 14:36:48 +0000 (16:36 +0200)]
smbd: Avoid a separate "request_time" variable in open_file_ntcreate

We have "smb_request->request_time" that is already set up by
init_smb_request().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotdb: Inline the common part of tdb_oob
Volker Lendecke [Sun, 4 Aug 2019 16:26:05 +0000 (18:26 +0200)]
tdb: Inline the common part of tdb_oob

When you set

in tdbtorture.c to make it more similar to locking.tdb use,

bin/tdbtorture -m -n 1 -l 100000 -s

becomes twice as fast. This is a pretty extreme case, but all other
tests that I did improve significantly as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotdb: Speed up tdb_oob()
Volker Lendecke [Sun, 4 Aug 2019 10:18:19 +0000 (12:18 +0200)]
tdb: Speed up tdb_oob()

This is common between both implementations of tdb_oob(). It's
faster if we don't have to dereference function pointers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotdb: Introduce tdb_oob()
Volker Lendecke [Sun, 4 Aug 2019 10:15:14 +0000 (12:15 +0200)]
tdb: Introduce tdb_oob()

Initially just encapsulate the pointer dereferences

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotdb: Rename tdb_oob() to tdb_notrans_oob()
Volker Lendecke [Sun, 4 Aug 2019 10:10:03 +0000 (12:10 +0200)]
tdb: Rename tdb_oob() to tdb_notrans_oob()

tdb_oob() will become a public function encapsulating the pointer
dereferences.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopidl/ndr/python: avoid memory errors in getsetters
Douglas Bagnall [Thu, 1 Aug 2019 23:29:55 +0000 (23:29 +0000)]
pidl/ndr/python: avoid memory errors in getsetters

This:

   $ python3 -c'from samba.dcerpc import lsa; x = lsa.EnumAccounts(); x.in_handle'

should not raise a MemoryError, which is very unfriendly given that
'x.in_handle' is just named, not called, as far as the user is
concerned. Returning None is the proper thing.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Aug  6 18:17:11 UTC 2019 on sn-devel-184

4 years agos4/messaging/py: don't DECREF borrowed references
Douglas Bagnall [Thu, 1 Aug 2019 04:02:05 +0000 (16:02 +1200)]
s4/messaging/py: don't DECREF borrowed references

This made Message.deregister() a decref machine, with talloc crashes
and segfaults available thus:

    from samba import messaging
    m = messaging.Messaging()
    for i in range(20):
        m.deregister(m)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agoldb_dn: free dn components on explode failure
Douglas Bagnall [Thu, 7 Mar 2019 23:12:00 +0000 (12:12 +1300)]
ldb_dn: free dn components on explode failure

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
4 years agos3:smbd: Fix sync dosmode fallback in async dosmode codepath
Ralph Boehme [Mon, 5 Aug 2019 09:11:14 +0000 (11:11 +0200)]
s3:smbd: Fix sync dosmode fallback in async dosmode codepath

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14070
RN: Fix sync dosmode fallback in async dosmode codepath

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Aug  6 15:40:18 UTC 2019 on sn-devel-184

4 years agos3:smbd: Incomplete conversion of former parametric options
Ralph Boehme [Mon, 5 Aug 2019 08:59:22 +0000 (10:59 +0200)]
s3:smbd: Incomplete conversion of former parametric options

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14069
RN: Incomplete conversion of former parametric options

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agoctdb: fix compilation on systems with glibc robust mutexes
Ralph Boehme [Fri, 12 Jul 2019 08:49:13 +0000 (10:49 +0200)]
ctdb: fix compilation on systems with glibc robust mutexes

On older systems like SLES 11 without POSIX robust mutexes, but with glib robust
mutexes where all the functions are available but have a "_np" suffix,
compilation fails in:

ctdb/tests/src/test_mutex_raw.c.239.o: In function `worker':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:129: undefined reference to `pthread_mutex_consistent'
ctdb/tests/src/test_mutex_raw.c.239.o: In function `main':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:285: undefined reference to `pthread_mutex_consistent'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:332: undefined reference to `pthread_mutexattr_setrobust'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:363: undefined reference to `pthread_mutex_consistent'
collect2: ld returned 1 exit status

This could be fixed by using libreplace system/threads.h instead of pthreads.h
directly, but as there has been a desire to keep test_mutex_raw.c standalone and
compilable without other external depenencies then libc and libpthread, make the
tool developer build only. This should get the average user over the cliff.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14038
RN: Fix compiling ctdb on older systems lacking POSIX robust mutexes

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agos3: smbd: fix a comment in fd_close()
Ralph Boehme [Sun, 4 Aug 2019 07:29:44 +0000 (09:29 +0200)]
s3: smbd: fix a comment in fd_close()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: inline dptr_close_internal()
Ralph Boehme [Sun, 4 Aug 2019 07:21:55 +0000 (09:21 +0200)]
s3: smbd: inline dptr_close_internal()

There's now only one caller left.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: simplify dptr_CloseDir()
Ralph Boehme [Sun, 4 Aug 2019 07:15:47 +0000 (09:15 +0200)]
s3: smbd: simplify dptr_CloseDir()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: remove redundant smb_dname arg from dptr_create()
Ralph Boehme [Sun, 4 Aug 2019 07:13:34 +0000 (09:13 +0200)]
s3: smbd: remove redundant smb_dname arg from dptr_create()

Now that dptr_create() is handle based, we can simply used the fsp name.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: Remove call to dptr_closecnum() on connection shutdown.
Jeremy Allison [Wed, 17 Jul 2019 21:59:00 +0000 (14:59 -0700)]
s3: smbd: Remove call to dptr_closecnum() on connection shutdown.

Now all client enumerations use fsp file handles we will
aleady close them in file_close_conn() above.

The only user of dptr_closecnum() is for the strange old OS/2
semantics, so I can't get rid of it until SMB1 is removed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_close().
Jeremy Allison [Wed, 17 Jul 2019 21:58:25 +0000 (14:58 -0700)]
s3: smbd: Remove dptr_close().

No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_close() from dptr_closecnum().
Jeremy Allison [Wed, 17 Jul 2019 21:56:42 +0000 (14:56 -0700)]
s3: smbd: Remove dptr_close() from dptr_closecnum().

Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_close() from reply_findclose().
Jeremy Allison [Wed, 17 Jul 2019 20:55:25 +0000 (13:55 -0700)]
s3: smbd: Remove dptr_close() from reply_findclose().

Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_close() from call_trans2findnext().
Jeremy Allison [Wed, 17 Jul 2019 20:54:43 +0000 (13:54 -0700)]
s3: smbd: Remove dptr_close() from call_trans2findnext().

Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_close() from call_trans2findfirst().
Jeremy Allison [Wed, 17 Jul 2019 20:53:33 +0000 (13:53 -0700)]
s3: smbd: Remove dptr_close() from call_trans2findfirst().

Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_close() from reply_fclose().
Jeremy Allison [Wed, 17 Jul 2019 20:37:02 +0000 (13:37 -0700)]
s3: smbd: Remove dptr_close() from reply_fclose().

Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_close() from reply_search().
Jeremy Allison [Wed, 17 Jul 2019 20:35:57 +0000 (13:35 -0700)]
s3: smbd: Remove dptr_close() from reply_search().

Now we're handle-based close_file() already does
what is needed to shut down directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_fsp(). No longer used.
Jeremy Allison [Wed, 17 Jul 2019 20:45:16 +0000 (13:45 -0700)]
s3: smbd: Remove dptr_fsp(). No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Replace dptr_fsp() with dptr_fetch_lanman2_fsp() in reply_findclose().
Jeremy Allison [Wed, 17 Jul 2019 20:43:43 +0000 (13:43 -0700)]
s3: smbd: Replace dptr_fsp() with dptr_fetch_lanman2_fsp() in reply_findclose().

Now we have no users of dptr_fsp() left.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_fetch_lanman2() - unused.
Jeremy Allison [Wed, 17 Jul 2019 20:28:53 +0000 (13:28 -0700)]
s3: smbd: Remove dptr_fetch_lanman2() - unused.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Convert call_trans2findnext() to use dptr_fetch_lanman2_fsp().
Jeremy Allison [Wed, 17 Jul 2019 20:26:40 +0000 (13:26 -0700)]
s3: smbd: Convert call_trans2findnext() to use dptr_fetch_lanman2_fsp().

dptr_fetch_lanman2() is now no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add dptr_fetch_lanman2_fsp() - to replace dptr_fetch_lanman2().
Jeremy Allison [Wed, 17 Jul 2019 20:20:08 +0000 (13:20 -0700)]
s3: smbd: Add dptr_fetch_lanman2_fsp() - to replace dptr_fetch_lanman2().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove dptr_fetch() - replace internals with dptr_fetch_fsp().
Jeremy Allison [Wed, 17 Jul 2019 20:16:37 +0000 (13:16 -0700)]
s3: smbd: Remove dptr_fetch() - replace internals with dptr_fetch_fsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_search().
Jeremy Allison [Wed, 17 Jul 2019 20:11:57 +0000 (13:11 -0700)]
s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_search().

We now no longer use dptr_fetch().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_fclose().
Jeremy Allison [Wed, 17 Jul 2019 20:07:33 +0000 (13:07 -0700)]
s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_fclose().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add dptr_fetch_fsp() for SMB1 code. We will use this to replace dptr_fetch().
Jeremy Allison [Wed, 17 Jul 2019 20:05:43 +0000 (13:05 -0700)]
s3: smbd: Add dptr_fetch_fsp() for SMB1 code. We will use this to replace dptr_fetch().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove now unused dptr_activecnum().
Jeremy Allison [Tue, 16 Jul 2019 16:44:25 +0000 (09:44 -0700)]
s3: smbd: Remove now unused dptr_activecnum().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: All directory enumeration is now via file handles - remove unneeded code...
Jeremy Allison [Tue, 16 Jul 2019 16:43:04 +0000 (09:43 -0700)]
s3: smbd: All directory enumeration is now via file handles - remove unneeded code in idle connections.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Remove now unused dptr_closepath().
Jeremy Allison [Tue, 16 Jul 2019 16:41:39 +0000 (09:41 -0700)]
s3: smbd: Remove now unused dptr_closepath().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Now we properly open file handles for directory enumerations, we don't...
Jeremy Allison [Tue, 16 Jul 2019 16:39:54 +0000 (09:39 -0700)]
s3: smbd: Now we properly open file handles for directory enumerations, we don't need this code in SMB1rmdir.

The share mode exclusion will prevent deletion of open directory
enumeration handles.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Now we are always using fsp handle-based client searches, simplify smb_Dir_...
Jeremy Allison [Wed, 17 Jul 2019 22:25:11 +0000 (15:25 -0700)]
s3: smbd: Now we are always using fsp handle-based client searches, simplify smb_Dir_destructor().

We know we always have a dir_hnd->dir and dir_hnd->fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Now we're using OpenDir_fsp() all the time, make sure we don't leak file...
Jeremy Allison [Wed, 17 Jul 2019 22:21:21 +0000 (15:21 -0700)]
s3: smbd: Now we're using OpenDir_fsp() all the time, make sure we don't leak file handles.

We must always set dir_hnd->fsp, even in the fallback to
SMB_VFS_OPENDIR() case. Remember if we had to fall back
and fix the destructor to close the additional file
descriptor if we did.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Now we always use handle for directory enumeration, we can delete the fallb...
Jeremy Allison [Wed, 17 Jul 2019 18:21:12 +0000 (11:21 -0700)]
s3: smbd: Now we always use handle for directory enumeration, we can delete the fallback code.

The code inside open_dir_safely() is root safe
and can replace the deleted open_dir_with_privilege()
fallback code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Convert SMB1 reply_search() to use handle-based directory enumeration.
Jeremy Allison [Tue, 16 Jul 2019 00:13:33 +0000 (17:13 -0700)]
s3: smbd: Convert SMB1 reply_search() to use handle-based directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Convert SMB1 call_trans2findfirst() to use handle-based directory enumeration.
Jeremy Allison [Tue, 16 Jul 2019 00:06:52 +0000 (17:06 -0700)]
s3: smbd: Convert SMB1 call_trans2findfirst() to use handle-based directory enumeration.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Prepare for SMB1 directory handle opens in call_trans2findnext()
Jeremy Allison [Wed, 17 Jul 2019 17:46:09 +0000 (10:46 -0700)]
s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findnext()

Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Prepare for SMB1 directory handle opens in call_trans2findfirst()
Jeremy Allison [Wed, 17 Jul 2019 17:45:14 +0000 (10:45 -0700)]
s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findfirst()

Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Prepare for SMB1 directory handle opens in reply_findclose()
Jeremy Allison [Wed, 17 Jul 2019 17:42:21 +0000 (10:42 -0700)]
s3: smbd: Prepare for SMB1 directory handle opens in reply_findclose()

Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Prepare for SMB1 directory handle opens in reply_fclose()
Jeremy Allison [Wed, 17 Jul 2019 17:40:51 +0000 (10:40 -0700)]
s3: smbd: Prepare for SMB1 directory handle opens in reply_fclose()

Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Prepare for SMB1 directory handle opens in reply_search()
Jeremy Allison [Wed, 17 Jul 2019 17:38:45 +0000 (10:38 -0700)]
s3: smbd: Prepare for SMB1 directory handle opens in reply_search()

Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Prepare for SMB1 directory handle opens in dptr_closecnum().
Jeremy Allison [Wed, 17 Jul 2019 17:36:20 +0000 (10:36 -0700)]
s3: smbd: Prepare for SMB1 directory handle opens in dptr_closecnum().

Call close_file() on any SMB1 directory handle once the dptr is closed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Change dptr_closecnum() to use dptr_close() instead of dptr_close_internal().
Jeremy Allison [Mon, 15 Jul 2019 23:06:09 +0000 (16:06 -0700)]
s3: smbd: Change dptr_closecnum() to use dptr_close() instead of dptr_close_internal().

This will allow us to close any outstanding handles on
an SMB1 connection as later commits move us to using directory
handles instead of pathname directory opens.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Make dptr_close() safe to call with an fsp handle stored in dptr->dir_hnd.
Jeremy Allison [Wed, 17 Jul 2019 19:57:00 +0000 (12:57 -0700)]
s3: smbd: Make dptr_close() safe to call with an fsp handle stored in dptr->dir_hnd.

SMB1 doesn't currently do this, but subsequent changes will add handle based
calls to SMB1 so dptr_close() has to be able to cleanly remove any back pointers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Add dptr_fsp() to return any stored files_struct pointer.
Jeremy Allison [Wed, 17 Jul 2019 18:00:06 +0000 (11:00 -0700)]
s3: smbd: Add dptr_fsp() to return any stored files_struct pointer.

Will allow [find/search]_next() calls to find and close any associated
fsp. This function is temporary and will eventually go away once I
modify dptr_fetch() to return an fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: Move the strange OS/2 directory key == -1 close semantics to the caller.
Jeremy Allison [Mon, 15 Jul 2019 22:57:48 +0000 (15:57 -0700)]
s3: smbd: Move the strange OS/2 directory key == -1 close semantics to the caller.

This will allow us to change dptr_closecnum() to close outstanding fsp
handles for SMB1 later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agos3: smbd: dptr_close() can only be called from SMB1 code.
Jeremy Allison [Mon, 15 Jul 2019 21:58:21 +0000 (14:58 -0700)]
s3: smbd: dptr_close() can only be called from SMB1 code.

SMB_ASSERT this is the case.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agodoc: improve vfs objects parameter description
Björn Jacke [Mon, 5 Aug 2019 15:16:32 +0000 (17:16 +0200)]
doc: improve vfs objects parameter description

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(master): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(master): Tue Aug  6 13:40:21 UTC 2019 on sn-devel-184

4 years agowafsamba: change --picky-developer into --disable-warnings-as-errors
Stefan Metzmacher [Wed, 12 Mar 2014 10:48:06 +0000 (11:48 +0100)]
wafsamba: change --picky-developer into --disable-warnings-as-errors

By default we're using -Werror now if --enable-developer is
specified.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Aug  6 07:50:14 UTC 2019 on sn-devel-184

4 years agoscript/autobuild.py: remove explicit --picky-developer"
Stefan Metzmacher [Tue, 11 Nov 2014 13:55:55 +0000 (14:55 +0100)]
script/autobuild.py: remove explicit --picky-developer"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
4 years agoldb: skip indexes on full_search
Aaron Haslett [Tue, 23 Jul 2019 23:46:01 +0000 (11:46 +1200)]
ldb: skip indexes on full_search

Use iterate_range kv op to skip the index section of the database when
running a full search. Quick local testing showed 18% improved throughput
on a full search with no results on a 50k database. With more results,
improvement is smaller but still noticeable.

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Aug  2 02:29:42 UTC 2019 on sn-devel-184

4 years agotests/dcerpc/raw_protocol: Add more tests for DCERPC_AUTH_LEVEL_PACKET
Günther Deschner [Wed, 31 Aug 2016 13:55:10 +0000 (15:55 +0200)]
tests/dcerpc/raw_protocol: Add more tests for DCERPC_AUTH_LEVEL_PACKET

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug  1 16:59:02 UTC 2019 on sn-devel-184

4 years agotests/dcerpc/raw_protocol: split test_spnego_integrity_request into 2 parts
Stefan Metzmacher [Thu, 1 Aug 2019 11:04:16 +0000 (13:04 +0200)]
tests/dcerpc/raw_protocol: split test_spnego_integrity_request into 2 parts

This can be a generic test that can be used for more auth_levels.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agotests/dcerpc/raw_protocol: split test_spnego_connect_request() into 2 parts
Stefan Metzmacher [Thu, 1 Aug 2019 11:04:16 +0000 (13:04 +0200)]
tests/dcerpc/raw_protocol: split test_spnego_connect_request() into 2 parts

This can be a generic test that can be used for more auth_levels.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosmbd: Fix use-after-free from exit_server_common()
Volker Lendecke [Wed, 31 Jul 2019 12:17:02 +0000 (14:17 +0200)]
smbd: Fix use-after-free from exit_server_common()

We need to keep the smbXsrv_connection structures around until all
pending requests have had their chance to clean up behind them. If you
look at srv_send_smb(), it's exactly prepared already to just drop
anything on the floor when the transport has been declared dead:

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

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug  1 15:39:13 UTC 2019 on sn-devel-184

4 years agos3:torture: Fix the FreeBSD build
Volker Lendecke [Wed, 31 Jul 2019 08:52:40 +0000 (10:52 +0200)]
s3:torture: Fix the FreeBSD build

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 years agolibcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID
Stefan Metzmacher [Thu, 25 Jul 2019 12:38:26 +0000 (14:38 +0200)]
libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_ID

Note: Unlike the current documentation, the utf16 string
is not null-terminated, that matches Windows Server 1903
as a client.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
4 years agolibcli/smb: add new COMPRESSION and NETNAME negotiate context ids
Stefan Metzmacher [Thu, 25 Jul 2019 12:37:31 +0000 (14:37 +0200)]
libcli/smb: add new COMPRESSION and NETNAME negotiate context ids

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
4 years agovfs:glusterfs_fuse: build only if we have setmntent()
Michael Adam [Wed, 31 Jul 2019 22:47:29 +0000 (00:47 +0200)]
vfs:glusterfs_fuse: build only if we have setmntent()

FreeBSD and other platforms that don't have setmntent() and friends can
not compile this module. This patch lets changes the build to only
compile this module if the setmntent() function is found.

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

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

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Aug  1 09:49:04 UTC 2019 on sn-devel-184

4 years agotests/ldap: Use TLDAP to check the extended DN return
Garming Sam [Wed, 31 Jul 2019 01:14:42 +0000 (01:14 +0000)]
tests/ldap: Use TLDAP to check the extended DN return

Tests commit 9f6b87d3f6cc9930d75c1f8d38ad4f5a37da34ab

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

Reverting the above commit makes this test fail:

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

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

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

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug  1 06:20:28 UTC 2019 on sn-devel-184

4 years agotests/tldap: Actually check the paging return code
Garming Sam [Wed, 31 Jul 2019 03:29:07 +0000 (15:29 +1200)]
tests/tldap: Actually check the paging return code

The test never worked correctly because the code was overlooked. It was
also the case that the connection was never authenticated, and so an
LDAP BIND call has now been added.

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

4 years agotldap: Paged searches fail when they get to the end
Garming Sam [Wed, 31 Jul 2019 01:39:13 +0000 (13:39 +1200)]
tldap: Paged searches fail when they get to the end

The normal case hit the goto label, and should have just returned.

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

4 years agotldap: Make memcpy of no controls safe
Garming Sam [Wed, 31 Jul 2019 01:08:23 +0000 (01:08 +0000)]
tldap: Make memcpy of no controls safe

Static analyzers sometimes complain about this case.

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