gd/samba-autobuild/.git
4 months agopod2man is no longer needed
Mathieu Parent [Wed, 18 Sep 2019 03:15:47 +0000 (03:15 +0000)]
pod2man is no longer needed

Since e24e344d0da58013fd5fa404529fe1d25ef403bf.

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

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 months agos3:client:Use DEVICE_URI, instead of argv[0],for Device URI
Bryan Mason [Mon, 16 Sep 2019 19:35:06 +0000 (12:35 -0700)]
s3:client:Use DEVICE_URI, instead of argv[0],for Device URI

CUPS sanitizes argv[0] by removing username/password, so use
DEVICE_URI environment variable first.

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

Signed-off-by: Bryan Mason <bmason@redhat.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Sep 18 12:31:11 UTC 2019 on sn-devel-184

4 months agos3: VFS: Remove vfs_netatalk. Old, unused and unmaintained.
Jeremy Allison [Tue, 17 Sep 2019 23:08:17 +0000 (16:08 -0700)]
s3: VFS: Remove vfs_netatalk. Old, unused and unmaintained.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep 18 01:26:06 UTC 2019 on sn-devel-184

4 months agosmbd: Don't always walk the share mode array in open_mode_check()
Volker Lendecke [Mon, 16 Sep 2019 23:16:40 +0000 (16:16 -0700)]
smbd: Don't always walk the share mode array in open_mode_check()

share_mode_data->flags contains the "most restrictive" share mode of
the whole array. This is maintained lazily: Whenever set_share_mode()
is called, d->flags is updated if the new share mode got more
restrictive. It is not updated when a file is closed, as this would
mean we would have to walk the whole array, making sure that the
closed handle was indeed the only most restrictive one. Instead, we
walk the share mode array only when a conflict happens: Then we need
to know "the truth" and recalculate it by walking the share mode
array.

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): Wed Sep 18 00:07:13 UTC 2019 on sn-devel-184

4 months agosmbd: Add share mode flags
Volker Lendecke [Fri, 9 Aug 2019 14:27:48 +0000 (16:27 +0200)]
smbd: Add share mode flags

This will contain a summary of the "most restrictive" share mode and
lease, i.e. intersection of all share_access entries and the union of
all access_mask and leases in the share mode array. This way
open_mode_check in the non-conflicting case will only have to look at
the summary and not walk the share mode array.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Make "share_mode_flags" 16-bit wide
Volker Lendecke [Fri, 9 Aug 2019 14:16:21 +0000 (16:16 +0200)]
smbd: Make "share_mode_flags" 16-bit wide

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Introduce share_entries.tdb - ADD COMMENT FIXME !!
Volker Lendecke [Mon, 16 Sep 2019 17:01:36 +0000 (10:01 -0700)]
smbd: Introduce share_entries.tdb - ADD COMMENT FIXME !!

This moves share_modes[] from "struct share_mode_data" into a separate
share_entries.tdb with a sorted array of fixed-length (132 byte)
"struct share_mode_entry" entries.

I know it's one huge commit, but I did not see a way to keep both data
structures and associated code working together without a lot of code
duplication after having centralized all the code accessing the
share_modes[] array into a few routines.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agolib: Enable watching and storing dbwrap_watch records.
Volker Lendecke [Tue, 13 Aug 2019 12:18:05 +0000 (14:18 +0200)]
lib: Enable watching and storing dbwrap_watch records.

Samba so far on a dbwrap_watch record either watches or stores a
record, but never both from the same db_record instance acquired from
a dbwrap_fetch_locked(). In one of the next commits this will change,
we will watch a record and at the same time store data into it. This
patch enables a watch_send() followed by a storev() by properly
keeping the watchers around.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Allow another database between brlock.tdb and leases.tdb
Volker Lendecke [Sun, 15 Sep 2019 09:58:43 +0000 (11:58 +0200)]
smbd: Allow another database between brlock.tdb and leases.tdb

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agolib: Allow a 4th lock order
Volker Lendecke [Sun, 15 Sep 2019 09:56:25 +0000 (11:56 +0200)]
lib: Allow a 4th lock order

We will have another tdb soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agotorture3: Remove cleanup3
Volker Lendecke [Tue, 3 Sep 2019 12:37:26 +0000 (14:37 +0200)]
torture3: Remove cleanup3

This goes directly into the database, for which the format changes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Remove stale share mode entries while walking the array
Volker Lendecke [Mon, 2 Sep 2019 14:25:28 +0000 (16:25 +0200)]
smbd: Remove stale share mode entries while walking the array

Previously, we did this only when writing out the locking.tdb
record. That was because we had places where the index of a particular
share mode entry mattered while operating on the array. This is no
longer the case, so we can remove stale entries early.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Make remove_stale_share_mode_entries() static in share_mode_lock.c
Volker Lendecke [Mon, 26 Aug 2019 16:59:44 +0000 (18:59 +0200)]
smbd: Make remove_stale_share_mode_entries() static in share_mode_lock.c

... to the place where the record is stored in the database

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Avoid calling remove_stale_share_mode_entries() in open.c
Volker Lendecke [Mon, 26 Aug 2019 16:56:24 +0000 (18:56 +0200)]
smbd: Avoid calling remove_stale_share_mode_entries() in open.c

All places that matter explicitly check for staleness. This cleanup
action should only happen before writing the database

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in remove_lease_if_stale()
Volker Lendecke [Mon, 26 Aug 2019 15:09:57 +0000 (17:09 +0200)]
smbd: Use share_mode_forall_entries() in remove_lease_if_stale()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Pass share_mode_lock to remove_lease_if_stale()
Volker Lendecke [Mon, 26 Aug 2019 14:51:56 +0000 (16:51 +0200)]
smbd: Pass share_mode_lock to remove_lease_if_stale()

We'll want to use share_mode_forall_entries next

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Pass share_mode_lock to remove_share_mode_lease()
Volker Lendecke [Mon, 26 Aug 2019 14:47:44 +0000 (16:47 +0200)]
smbd: Pass share_mode_lock to remove_share_mode_lease()

Later we'll need "lck" further down

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Avoid duplicate assignments
Volker Lendecke [Mon, 26 Aug 2019 14:45:14 +0000 (16:45 +0200)]
smbd: Avoid duplicate assignments

remove_share_mode_lease() already does this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Remove unused share_mode_stale_pid()
Volker Lendecke [Fri, 23 Aug 2019 15:44:25 +0000 (17:44 +0200)]
smbd: Remove unused share_mode_stale_pid()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in share_entry_forall()
Volker Lendecke [Thu, 12 Sep 2019 11:03:53 +0000 (13:03 +0200)]
smbd: Use share_mode_forall_entries() in share_entry_forall()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_leases() in share_mode_cleanup_disconnected()
Volker Lendecke [Thu, 12 Sep 2019 10:41:14 +0000 (12:41 +0200)]
smbd: Use share_mode_forall_leases() in share_mode_cleanup_disconnected()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_leases() in lease_match()
Volker Lendecke [Mon, 19 Aug 2019 11:16:53 +0000 (13:16 +0200)]
smbd: Use share_mode_forall_leases() in lease_match()

We have to break leases referenced from multiple share modes only
once.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_leases() in delay_rename_for_lease_break()
Volker Lendecke [Thu, 12 Sep 2019 09:35:34 +0000 (11:35 +0200)]
smbd: Use share_mode_forall_leases() in delay_rename_for_lease_break()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in vfs_default_durable_reconnect()
Volker Lendecke [Fri, 23 Aug 2019 12:30:07 +0000 (14:30 +0200)]
smbd: Use share_mode_forall_entries() in vfs_default_durable_reconnect()

The durable reconnect mainly has to check that there is one and only one
entry, and it has to reset it with the new values.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Add reset_share_mode_entry
Volker Lendecke [Fri, 23 Aug 2019 12:13:41 +0000 (14:13 +0200)]
smbd: Add reset_share_mode_entry

Mostly for durable reconnect at this point

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Pass pid/share_file_id to find_share_mode_entry()
Volker Lendecke [Wed, 11 Sep 2019 14:50:24 +0000 (16:50 +0200)]
smbd: Pass pid/share_file_id to find_share_mode_entry()

Avoid the full fsp, this makes the indexing of the share mode array
clearer, and it makes the next commit easier

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in share_mode_forall_leases()
Volker Lendecke [Mon, 26 Aug 2019 20:05:14 +0000 (22:05 +0200)]
smbd: Use share_mode_forall_entries() in share_mode_forall_leases()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Stop passing "share_mode_lock" via share_mode_forall_leases()
Volker Lendecke [Tue, 10 Sep 2019 19:21:01 +0000 (21:21 +0200)]
smbd: Stop passing "share_mode_lock" via share_mode_forall_leases()

Why? Next commit will make share_mode_forall_leases() use
share_mode_forall_entries(), and that does not necessarily have to
depend on "share_mode_lock". And as we can pass the required
information via "private_data", don't embed the "share_mode_lock"
reference into this lowlevel library routine.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Avoid "share_mode_lock" dependency cleanup_disconnected_lease()
Volker Lendecke [Tue, 10 Sep 2019 19:17:34 +0000 (21:17 +0200)]
smbd: Avoid "share_mode_lock" dependency cleanup_disconnected_lease()

share_mode_forall_leases() will stop passing "lck" soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Avoid "share_mode_lock" dependency in rename_lease_fn()
Volker Lendecke [Tue, 10 Sep 2019 19:12:23 +0000 (21:12 +0200)]
smbd: Avoid "share_mode_lock" dependency in rename_lease_fn()

share_mode_forall_leases() will stop passing "lck" soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in delay_for_oplock()
Volker Lendecke [Tue, 20 Aug 2019 12:47:27 +0000 (14:47 +0200)]
smbd: Use share_mode_forall_entries() in delay_for_oplock()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Pass "struct file_id" to get_lease_type()
Volker Lendecke [Tue, 10 Sep 2019 19:00:29 +0000 (21:00 +0200)]
smbd: Pass "struct file_id" to get_lease_type()

It does not have to depend on the whole struct share_mode_data.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in validate_oplock_types()
Volker Lendecke [Sun, 18 Aug 2019 15:49:23 +0000 (17:49 +0200)]
smbd: Use share_mode_forall_entries() in validate_oplock_types()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in file_has_open_streams()
Volker Lendecke [Fri, 16 Aug 2019 13:56:23 +0000 (15:56 +0200)]
smbd: Use share_mode_forall_entries() in file_has_open_streams()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in rename_share_filename()
Volker Lendecke [Fri, 16 Aug 2019 13:40:55 +0000 (15:40 +0200)]
smbd: Use share_mode_forall_entries() in rename_share_filename()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in open_mode_check()
Volker Lendecke [Fri, 16 Aug 2019 11:08:23 +0000 (13:08 +0200)]
smbd: Use share_mode_forall_entries() in open_mode_check()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() for validate_my_share_entries()
Volker Lendecke [Fri, 16 Aug 2019 10:48:15 +0000 (12:48 +0200)]
smbd: Use share_mode_forall_entries() for validate_my_share_entries()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in has_delete_on_close()
Volker Lendecke [Fri, 16 Aug 2019 09:11:36 +0000 (11:11 +0200)]
smbd: Use share_mode_forall_entries() in has_delete_on_close()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in has_other_nonposix_opens_fn()
Volker Lendecke [Wed, 14 Aug 2019 19:40:07 +0000 (21:40 +0200)]
smbd: Use share_mode_forall_entries() in has_other_nonposix_opens_fn()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in set_delete_on_close_lck()
Volker Lendecke [Wed, 14 Aug 2019 15:29:19 +0000 (17:29 +0200)]
smbd: Use share_mode_forall_entries() in set_delete_on_close_lck()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_mode_forall_entries() in contend_level2_oplocks_begin_default()
Volker Lendecke [Tue, 13 Aug 2019 13:21:59 +0000 (15:21 +0200)]
smbd: Use share_mode_forall_entries() in contend_level2_oplocks_begin_default()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Add share_mode_forall_entries()
Volker Lendecke [Tue, 13 Aug 2019 13:09:51 +0000 (15:09 +0200)]
smbd: Add share_mode_forall_entries()

Abstract away the fact that we store the share modes as an array inside
"struct share_mode_data".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use share_entry_stale_pid() in share_mode_stale_pid()
Volker Lendecke [Tue, 13 Aug 2019 14:04:13 +0000 (16:04 +0200)]
smbd: Use share_entry_stale_pid() in share_mode_stale_pid()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Add share_entry_stale_pid()
Volker Lendecke [Tue, 13 Aug 2019 14:00:09 +0000 (16:00 +0200)]
smbd: Add share_entry_stale_pid()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Avoid passing a share mode entry to share_conflict()
Volker Lendecke [Fri, 6 Sep 2019 09:15:27 +0000 (11:15 +0200)]
smbd: Avoid passing a share mode entry to share_conflict()

Make the real data dependencies clearer, we don't need a full
share_entry, only its access and sharemode masks

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Rewrite share_conflict()
Volker Lendecke [Mon, 12 Aug 2019 10:44:39 +0000 (12:44 +0200)]
smbd: Rewrite share_conflict()

It was hard for me to understand share_conflict(), so once I understood
it I thought this version would be easier to follow.  It violates
README.Coding (one argument per line), but grouping the parameters to
mask_conflict makes it clearer to me what belongs together.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Fix a debug message hickup
Volker Lendecke [Thu, 5 Sep 2019 07:52:10 +0000 (09:52 +0200)]
smbd: Fix a debug message hickup

Mind the missing space before "(e.g. another...". While there, avoid
casts.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agolib: Use server_id_cmp() in server_id_equal()
Volker Lendecke [Sat, 7 Sep 2019 16:56:54 +0000 (18:56 +0200)]
lib: Use server_id_cmp() in server_id_equal()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agolib: Add server_id_cmp()
Volker Lendecke [Sat, 7 Sep 2019 16:55:57 +0000 (18:55 +0200)]
lib: Add server_id_cmp()

Will be used later for sorting the share mode array

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Introduce helper variables in open_mode_check()
Volker Lendecke [Fri, 6 Sep 2019 09:30:23 +0000 (11:30 +0200)]
smbd: Introduce helper variables in open_mode_check()

Less bytes .text, the compiler now does not have to expect other threads to
alter the pointers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Let fsp_lease_type() look at leases.tdb
Volker Lendecke [Thu, 15 Aug 2019 10:10:52 +0000 (12:10 +0200)]
smbd: Let fsp_lease_type() look at leases.tdb

The same lease can be used via different TCP connections (yes, we have
tests for this!). At the end of downgrade_lease() we update all fsp's
with fsps_lease_update() that link to the lease that just was
changed. However, this is only in the local process, this is not
cross-smbd. So other smbds using the same lease can use stale
information and for example get the mandatory locking wrong.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Add quick leases_db_get_current_state()
Volker Lendecke [Tue, 13 Aug 2019 20:07:47 +0000 (22:07 +0200)]
smbd: Add quick leases_db_get_current_state()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Make "current_state" show up first in the blob
Volker Lendecke [Thu, 15 Aug 2019 14:33:57 +0000 (16:33 +0200)]
smbd: Make "current_state" show up first in the blob

Believe it or not, but without this change "num_files" was first.
Thanks Metze for this (to me at least) really, really surprising
insight!

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Make lease_type_is_exclusive() static
Volker Lendecke [Thu, 15 Aug 2019 09:59:11 +0000 (11:59 +0200)]
smbd: Make lease_type_is_exclusive() static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Remove unused smbXsrv_open_hash()
Volker Lendecke [Mon, 16 Sep 2019 18:18:00 +0000 (11:18 -0700)]
smbd: Remove unused smbXsrv_open_hash()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Make fsp->fh->gen_id unique per process
Volker Lendecke [Mon, 16 Sep 2019 10:54:32 +0000 (03:54 -0700)]
smbd: Make fsp->fh->gen_id unique per process

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agovfs: Make "fd_handle->gen_id" 64-bit everywhere
Volker Lendecke [Mon, 16 Sep 2019 10:50:02 +0000 (03:50 -0700)]
vfs: Make "fd_handle->gen_id" 64-bit everywhere

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agoidl: Fix a typo
Volker Lendecke [Mon, 16 Sep 2019 12:04:06 +0000 (05:04 -0700)]
idl: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: Use direct struct assignments in smbXsrv_*.c
Volker Lendecke [Mon, 16 Sep 2019 12:26:05 +0000 (05:26 -0700)]
smbd: Use direct struct assignments in smbXsrv_*.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agovfs/full_audit: always log full filenames
Björn Baumbach [Mon, 16 Sep 2019 14:22:37 +0000 (16:22 +0200)]
vfs/full_audit: always log full filenames

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Sep 17 17:55:55 UTC 2019 on sn-devel-184

5 months agobuild: Remove tests for getdents() and getdirentries()
Andrew Bartlett [Thu, 5 Sep 2019 19:39:09 +0000 (07:39 +1200)]
build: Remove tests for getdents() and getdirentries()

These date back to 3a9beef2b7b25427ee4611cfc375e05cc82a1150 in 2003 and
829e72fe9c97feaa3d45b768984a4c47b906a23a in 1998 and appear to be related
to smbwrapper.

More of these should be removed but the getdirents() test caused a timeout
on an ARM builder in Debian.  It might just be a fluke but the tests are
pointless regardless.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Sep 17 13:48:18 UTC 2019 on sn-devel-184

5 months agoutil_sec.c: Move __thread variable to global scope
Khem Raj [Fri, 6 Sep 2019 04:39:05 +0000 (21:39 -0700)]
util_sec.c: Move __thread variable to global scope

Make clang happy otherwise it complains about variable scope

fixes

source3/./lib/util_sec.c:470:4: error: '__thread' variables must have global storage
        } __thread cache;
          ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 months agolib/replace/wscript: Avoid generating nested main function
Khem Raj [Fri, 6 Sep 2019 04:37:33 +0000 (21:37 -0700)]
lib/replace/wscript: Avoid generating nested main function

clang is not happy when it sees another main nested inside the main
function and fails the test for prctl syscall, therefore avoid adding
implicit main() here

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 months agoctdb-client: Fix some typos in debug messages
Martin Schwenke [Wed, 4 Sep 2019 04:14:22 +0000 (14:14 +1000)]
ctdb-client: Fix some typos in debug messages

  tdb_sore -> tdb_store
  SCHDULE_FOR_DELETION -> SCHEDULE_FOR_DELETION

Switch to modern debug macros while touching the lines.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Sep 17 05:52:15 UTC 2019 on sn-devel-184

5 months agoctdb-scripts: Drop bit-rotted shellcheck directive
Martin Schwenke [Tue, 3 Sep 2019 05:24:52 +0000 (15:24 +1000)]
ctdb-scripts: Drop bit-rotted shellcheck directive

The code has changed so this is no longer needed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-scripts: Silence shellcheck warning SC2166
Martin Schwenke [Mon, 2 Sep 2019 04:58:22 +0000 (14:58 +1000)]
ctdb-scripts: Silence shellcheck warning SC2166

This covers the following:

  SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
  SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.

POSIX agrees that -a and -o should not be used:

  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

Fixing these doesn't cause much churn.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-utils: CID 1273087 - Resource leak
Martin Schwenke [Wed, 3 Jul 2019 10:40:44 +0000 (20:40 +1000)]
ctdb-utils: CID 1273087 - Resource leak

Ensure that p is not leaked.

This is a test program and the program exits anyway.  No need to
backport.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tools: Stop deleted nodes from influencing ctdb nodestatus exit code
Martin Schwenke [Tue, 13 Aug 2019 11:42:15 +0000 (21:42 +1000)]
ctdb-tools: Stop deleted nodes from influencing ctdb nodestatus exit code

Deleted nodes should simply be ignored.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14129
RN: Stop deleted nodes from influencing ctdb nodestatus exit code

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Put the summary file inside $TEST_VAR_DIR
Martin Schwenke [Wed, 4 Sep 2019 05:04:05 +0000 (15:04 +1000)]
ctdb-tests: Put the summary file inside $TEST_VAR_DIR

This means less random files dropped in /tmp or similar.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Drop run_tests -d option
Martin Schwenke [Wed, 4 Sep 2019 04:59:22 +0000 (14:59 +1000)]
ctdb-tests: Drop run_tests -d option

The usage message says it is dodgy and some test suites may not
support it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Simplify setup_ctdb()
Martin Schwenke [Tue, 3 Sep 2019 09:12:45 +0000 (19:12 +1000)]
ctdb-tests: Simplify setup_ctdb()

There is no point inventing a whole new set of options here.

Continue to locally implement the --no-event-scripts option.  This
must be first, though in practice only one option is ever passed to
setup_ctdb() from ctdb_test_init().

Simply pass all other options through to "local_daemons.sh setup".
This has the side effect of causing failure when an invalid option is
passed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Invert some logic so it makes sense
Martin Schwenke [Tue, 3 Sep 2019 07:54:29 +0000 (17:54 +1000)]
ctdb-tests: Invert some logic so it makes sense

The test should be outside the loop.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Avoid shellcheck warnings
Martin Schwenke [Thu, 5 Sep 2019 23:01:36 +0000 (09:01 +1000)]
ctdb-tests: Avoid shellcheck warnings

SC2086 Double quote to prevent globbing and word splitting

This one doesn't need the double quotes if it is contained within the
preceding variable expansion.

SC2181 Check exit code directly with e.g. 'if mycmd;', not indirectly with $?
SC2004 $/${} is unnecessary on arithmetic variables

These are straightforward.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Fix zero event scripts test so it tests something
Martin Schwenke [Tue, 3 Sep 2019 07:40:59 +0000 (17:40 +1000)]
ctdb-tests: Fix zero event scripts test so it tests something

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Drop unused code from onnode unit test ctdb stub
Martin Schwenke [Fri, 6 Sep 2019 10:03:36 +0000 (20:03 +1000)]
ctdb-tests: Drop unused code from onnode unit test ctdb stub

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Only set TEST_SUBDIR when needed
Martin Schwenke [Thu, 5 Sep 2019 05:51:08 +0000 (15:51 +1000)]
ctdb-tests: Only set TEST_SUBDIR when needed

This is only needed for setup_ctdb_base() so only set it when calling
this function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Move NFS test functions to complex local script
Martin Schwenke [Thu, 5 Sep 2019 06:15:54 +0000 (16:15 +1000)]
ctdb-tests: Move NFS test functions to complex local script

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Don't run setup_ctdb_base() for real cluster
Martin Schwenke [Mon, 9 Sep 2019 06:58:06 +0000 (16:58 +1000)]
ctdb-tests: Don't run setup_ctdb_base() for real cluster

This has not been needed for some time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Use db_ctdb_cattdb_count_records()
Martin Schwenke [Fri, 2 Aug 2019 06:18:32 +0000 (16:18 +1000)]
ctdb-tests: Use db_ctdb_cattdb_count_records()

Avoid reinventing the wheel.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Use ctdb_get_all_pnns()
Martin Schwenke [Mon, 16 Sep 2019 09:08:11 +0000 (19:08 +1000)]
ctdb-tests: Use ctdb_get_all_pnns()

The nested, arbitrary use of onnode can cause messages from ssh on
stderr to appear in the node list:

  Getting list of nodes...
  Output of "onnode -pq all ctdb pnn | grep '^[0-9][0-9]*$'":
  Warning: Permanently added '10.0.0.72' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.75' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.73' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.74' (RSA) to the list of known hosts.^M
  1
  0
  3
  2
  Create/wipe test database rec_test.tdb
  Failed to execute "Permanently added '10.0.0.72' (RSA) to the list of known hosts.^M ctdb attach rec_test.tdb" on node(s) "Warning:"
  Invalid <nodespec>

Avoid that by using an existing function that does not nest ssh uses.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agoctdb-tests: Drop reference to unused ctdb_eventd test directory
Martin Schwenke [Mon, 9 Sep 2019 06:04:36 +0000 (16:04 +1000)]
ctdb-tests: Drop reference to unused ctdb_eventd test directory

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 months agowhitespace: Conform to coding convention
Garming Sam [Wed, 11 Sep 2019 01:58:48 +0000 (13:58 +1200)]
whitespace: Conform to coding convention

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Fri Sep 13 12:33:32 UTC 2019 on sn-devel-184

5 months agoparam: Allow rpc server dynamic port range to roundtrip
Garming Sam [Wed, 11 Sep 2019 01:55:37 +0000 (13:55 +1200)]
param: Allow rpc server dynamic port range to roundtrip

Originally this parameter only set two other parameters, but never set
the original string. By setting the string as well, we can make it be
emitted by testparm -v correctly (instead of ''), and set it back as the
value for the parameter.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
5 months agos4:torture: fix file cleanup in smb2.create.delete
Ralph Wuerthner [Thu, 12 Sep 2019 09:16:50 +0000 (11:16 +0200)]
s4:torture: fix file cleanup in smb2.create.delete

Cleanup of test files created by smb2.create.delete is broken because
READONLY is set on the test file. Clear READONLY first before doing
the cleanup.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-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 Sep 12 17:36:50 UTC 2019 on sn-devel-184

5 months agos4:torture: fix closure of test directory handle
Ralph Wuerthner [Thu, 12 Sep 2019 09:18:51 +0000 (11:18 +0200)]
s4:torture: fix closure of test directory handle

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agos4:torture: correctly cast printf() argument
Ralph Wuerthner [Thu, 12 Sep 2019 08:22:58 +0000 (10:22 +0200)]
s4:torture: correctly cast printf() argument

In most cases sattrib is passed as a long int literal. Avoid
compile errors by casting the value passed to printf().

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: remove unused current_user.{need,done}_chdir stacking
Stefan Metzmacher [Tue, 16 Jul 2019 12:20:33 +0000 (14:20 +0200)]
smbd: remove unused current_user.{need,done}_chdir stacking

All become_*()/unbecome_*() functions don't alter the working
directory. Only change_to_user_and_service*() does.

Pair-Programmed-With: Ralph Boehme <slow@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
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): Wed Sep 11 21:16:57 UTC 2019 on sn-devel-184

5 months agosmbd: inline change_to_user_internal() into change_to_user_and_service()
Stefan Metzmacher [Tue, 16 Jul 2019 12:11:22 +0000 (14:11 +0200)]
smbd: inline change_to_user_internal() into change_to_user_and_service()

There was only one caller left.

Pair-Programmed-With: Ralph Boehme <slow@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: rename [un]become_user*() to [un]become_user_without_service*()
Stefan Metzmacher [Fri, 19 Jul 2019 09:14:13 +0000 (11:14 +0200)]
smbd: rename [un]become_user*() to [un]become_user_without_service*()

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>
5 months agosmbd: remove directory changing from become_user*()
Stefan Metzmacher [Tue, 16 Jul 2019 12:06:09 +0000 (14:06 +0200)]
smbd: remove directory changing from become_user*()

This was the behavior in versions before 4.9 and
it is hopefully not required by current callers of
become_user*().

Pair-Programmed-With: Ralph Boehme <slow@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: inline change_to_user_and_service() into become_user()
Stefan Metzmacher [Tue, 16 Jul 2019 12:03:57 +0000 (14:03 +0200)]
smbd: inline change_to_user_and_service() into become_user()

In the next commit we'll drop the _and_service() part.

Pair-Programmed-With: Ralph Boehme <slow@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: inline change_to_user_by_session()
Ralph Boehme [Sat, 13 Jul 2019 14:38:02 +0000 (16:38 +0200)]
smbd: inline change_to_user_by_session()

Prepares for removing changing cwd from become_user*() in a subsequent commit.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: README.Coding fixes
Ralph Boehme [Sat, 13 Jul 2019 14:10:53 +0000 (16:10 +0200)]
smbd: README.Coding fixes

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: rename change_to_user_by_fsp() to change_to_user_and_service_by_fsp()
Ralph Boehme [Sat, 13 Jul 2019 14:20:11 +0000 (16:20 +0200)]
smbd: rename change_to_user_by_fsp() to change_to_user_and_service_by_fsp()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: rename change_to_user() to change_to_user_and_service()
Ralph Boehme [Sat, 13 Jul 2019 14:17:17 +0000 (16:17 +0200)]
smbd: rename change_to_user() to change_to_user_and_service()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agosmbd: Enhance debugging if chdir fails
Volker Lendecke [Wed, 9 Jan 2019 16:24:57 +0000 (17:24 +0100)]
smbd: Enhance debugging if chdir fails

This helps admins to figure out which user has a problem

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agolib: Add "utok_string"
Volker Lendecke [Wed, 9 Jan 2019 16:04:34 +0000 (17:04 +0100)]
lib: Add "utok_string"

A terse, one-line unix token representation for debugging purposes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 months agos3: VFS: Complete the replacement of SMB_VFS_MKDIR() -> SMB_VFS_MKDIRAT().
Jeremy Allison [Fri, 6 Sep 2019 23:01:20 +0000 (16:01 -0700)]
s3: VFS: Complete the replacement of SMB_VFS_MKDIR() -> SMB_VFS_MKDIRAT().

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 Sep 11 19:44:44 UTC 2019 on sn-devel-184

5 months agos3: VFS: vfs_time_audit. Remove mkdir_fn(). No longer used.
Jeremy Allison [Fri, 6 Sep 2019 22:53:12 +0000 (15:53 -0700)]
s3: VFS: vfs_time_audit. Remove mkdir_fn(). No longer used.

NB, this will now fail smb_vfs_assert_all_fns()
until we remove the mkdir_fn() from the VFS definitions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 months agos3: VFS: vfs_full_audit. Remove mkdir_fn(). No longer used.
Jeremy Allison [Fri, 6 Sep 2019 22:52:14 +0000 (15:52 -0700)]
s3: VFS: vfs_full_audit. Remove mkdir_fn(). No longer used.

NB, this will now fail smb_vfs_assert_all_fns()
until we remove the mkdir_fn() from the VFS definitions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>