samba.git
5 years agos3/libsmb: adjust smb2 code for new idl structs & generated ndr push/pull funcs.
Noel Power [Fri, 26 May 2017 14:50:18 +0000 (15:50 +0100)]
s3/libsmb: adjust smb2 code for new idl structs & generated ndr push/pull funcs.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3/libsmb: adjust smb1 cli code to use idl structs and ndr push/pull funcs.
Noel Power [Fri, 26 May 2017 14:01:17 +0000 (15:01 +0100)]
s3/libsmb: adjust smb1 cli code to use idl structs and ndr push/pull funcs.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibrpc/idl Add some query [getset]info quota related structures
Noel Power [Thu, 2 Mar 2017 09:20:24 +0000 (09:20 +0000)]
librpc/idl Add some query [getset]info quota related structures

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3/smbd: Don't stat when doing a quota operation (as it's a fake file)
Noel Power [Tue, 28 Feb 2017 11:36:47 +0000 (11:36 +0000)]
s3/smbd: Don't stat when doing a quota operation (as it's a fake file)

calling SMB_VFS_STAT on the quota fake file fails and caused
FS_INFO/FileFsControlInfo request to error out early, in turn stopped a
Win8.1 client from proceeding with quota queries.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3/libsmb: Avoid potential smbpanic calling parse_user_quota_list.
Noel Power [Tue, 28 Feb 2017 15:04:16 +0000 (15:04 +0000)]
s3/libsmb: Avoid potential smbpanic calling parse_user_quota_list.

Calling parse_user_quota_list with a NULL buffer can cause a panic, while
this shouldn't happen, I managed to trigger this with an early implementation
of SMB2 quota support in smbd which didn't pass back NT_STATUS_NO_MORE_ENTRIES
when handling a SMB2_0_INFO_QUOTA GETINFO message.
OTHOH the Windows client handled the same situation gracefully.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3/lib: Fix misleading typo in debug message
Noel Power [Wed, 22 Mar 2017 14:53:22 +0000 (14:53 +0000)]
s3/lib: Fix misleading typo in debug message

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_query_directory: make 'return true' explicit in smb2_query_directory_next_entry()
Stefan Metzmacher [Tue, 31 Jul 2018 07:45:00 +0000 (09:45 +0200)]
smb2_query_directory: make 'return true' explicit in smb2_query_directory_next_entry()

'return req' should do the same as 'return true' for a bool function,
it's implicitly expanded as 'return (req!=NULL)?true:false.

There's no point in that as 'req' is always a valid pointer.

This was most likely just a copy and paste bug.

So we make this explicit now and avoid that Coverity reports this:

CID 1438158:  Null pointer dereferences  (REVERSE_INULL)
Null-checking "req" suggests that it may be null, but it has already
been dereferenced on all paths leading to the check.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jul 31 14:20:49 CEST 2018 on sn-devel-144

5 years agopthreadpool: reset monitor_fd after calling tevent_fd_set_auto_close()
Stefan Metzmacher [Tue, 31 Jul 2018 07:42:40 +0000 (09:42 +0200)]
pthreadpool: reset monitor_fd after calling tevent_fd_set_auto_close()

This tries to convince Coverity that we don't have a resource leak:

CID 1438157:    (RESOURCE_LEAK)
Handle variable "monitor_fd" going out of scope leaks the handle.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
5 years agopthreadpool: ignore the return value of poll(NULL, 0UL, 1)
Stefan Metzmacher [Tue, 31 Jul 2018 07:40:20 +0000 (09:40 +0200)]
pthreadpool: ignore the return value of poll(NULL, 0UL, 1)

Otherwise Coverity reports this:

CID 1438160:    (CHECKED_RETURN)
Calling "poll(NULL, 0UL, 1)" without checking return value. This
library function may fail and return an error code.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
5 years agos3/locking: Fix assertion check on lock reference count
Anoop C S [Fri, 27 Jul 2018 06:20:39 +0000 (11:50 +0530)]
s3/locking: Fix assertion check on lock reference count

lock_ref_count will always hold the old value prior to change. Thus it
would mean that if lock_ref_count is 0 the new value is already -1 which
is not expected here. Therefore it is better to make sure that it is
always greater than 0 rather than >= 0.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 31 04:23:47 CEST 2018 on sn-devel-144

5 years agolib ldb key value: convert TDB_DATA structs to ldb_val
Gary Lockyer [Mon, 23 Jul 2018 01:20:46 +0000 (13:20 +1200)]
lib ldb key value: convert TDB_DATA structs to ldb_val

Convert the key value functions to use ldb_val instead of TDB_DATA.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul 30 17:23:22 CEST 2018 on sn-devel-144

5 years agolib ldb: rename LTDB_* constants to LDB_KV_*
Gary Lockyer [Sun, 22 Jul 2018 22:08:26 +0000 (10:08 +1200)]
lib ldb: rename LTDB_* constants to LDB_KV_*

Rename all the LTDB_* constants to LDB_KV_* as they are key value level
constants and not tdb specific.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: move key value code to lib/ldb/ldb_key_value
Gary Lockyer [Sun, 22 Jul 2018 22:02:16 +0000 (10:02 +1200)]
lib ldb: move key value code to lib/ldb/ldb_key_value

Move the key value code to a separate subdirectory.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename ltdb_parse_data_unpack_ctx
Gary Lockyer [Fri, 20 Jul 2018 01:50:00 +0000 (13:50 +1200)]
lib ldb: rename ltdb_parse_data_unpack_ctx

Rename ltdb_parse_data_unpack_ctx to ldb_kv_parse_data_unpack_ctx, as
it's a key value level structure and not ltdb specific.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: remove unused function prototypes
Gary Lockyer [Fri, 20 Jul 2018 01:47:16 +0000 (13:47 +1200)]
lib ldb: remove unused function prototypes

Remove unused function prototypes

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename ltdb_idxptr to ldb_kv_idxptr
Gary Lockyer [Fri, 20 Jul 2018 01:40:02 +0000 (13:40 +1200)]
lib ldb: rename ltdb_idxptr to ldb_kv_idxptr

Rename ltdb_idxptr to ldb_kv_idxptr as it's key value level and not tdb
specific.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename tdb_key_ctx to key_ctx
Gary Lockyer [Fri, 20 Jul 2018 01:36:07 +0000 (13:36 +1200)]
lib ldb: rename tdb_key_ctx to key_ctx

Rename tdb_key_ctx to key_ctx, as it's key value level and not tdb
specific.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename ltdb_cache to ldb_kv_cache
Gary Lockyer [Fri, 20 Jul 2018 01:31:27 +0000 (13:31 +1200)]
lib ldb: rename ltdb_cache to ldb_kv_cache

Rename ltdb_cache to ldb_kv_cache as it's key value level and not tdb
specific

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: format rename ldb_kv_private
Gary Lockyer [Thu, 19 Jul 2018 23:54:39 +0000 (11:54 +1200)]
lib ldb: format rename ldb_kv_private

Tidy up the code format after the rename of ltdb_private to
ldb_kv_private

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename ltdb_private to ldb_kv_private
Gary Lockyer [Thu, 19 Jul 2018 23:53:21 +0000 (11:53 +1200)]
lib ldb: rename ltdb_private to ldb_kv_private

Rename ltdb_private to ldb_kv_private as it contains key value operation
context.

Note there is still some tdb specific context that can be refactored into a
separate structure along the lines of the lmdb context.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: format rename of ltdb_req_spy
Gary Lockyer [Thu, 19 Jul 2018 21:15:24 +0000 (09:15 +1200)]
lib ldb: format rename of ltdb_req_spy

Fix up the code formatting after the rename of ltdb_req_spy to
ldb_kv_req_spy

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename ltdb_req_spy to ldb_kv_req_spy
Gary Lockyer [Thu, 19 Jul 2018 21:14:52 +0000 (09:14 +1200)]
lib ldb: rename ltdb_req_spy to ldb_kv_req_spy

Rename ltdb_req_spy to ldb_kv_req_spy, as it is key value level and not
tdb specific.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename ltdb_context to ldb_kv_context
Gary Lockyer [Thu, 19 Jul 2018 21:07:47 +0000 (09:07 +1200)]
lib ldb: rename ltdb_context to ldb_kv_context

Rename ltdb_context to ldb_kv_context as it is a key value level
structure and not tdb specific.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: reformat ltdb_reindex_context rename
Gary Lockyer [Thu, 19 Jul 2018 20:53:28 +0000 (08:53 +1200)]
lib ldb: reformat ltdb_reindex_context rename

Fix up the formatting after the rename of ltdb_reindex_context to
ldb_kv_reindex_context.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: rename struct ltdb_reindex_context
Gary Lockyer [Thu, 19 Jul 2018 20:52:48 +0000 (08:52 +1200)]
lib ldb: rename struct ltdb_reindex_context

Rename struct ltdb_reindex_context to ldb_kv_reindex_context, as this is
a key value level structure and not a tdb specific structure.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: fix formatting of ldb_kv rename.
Gary Lockyer [Thu, 19 Jul 2018 19:25:32 +0000 (07:25 +1200)]
lib ldb: fix formatting of ldb_kv rename.

Clean up the code format after the rename in the previous commit.
Hopefully doing a rename commit followed by a reformat commit makes the
code easier to review.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb: Rename functions to ldb_kv
Gary Lockyer [Thu, 19 Jul 2018 19:23:10 +0000 (07:23 +1200)]
lib ldb: Rename functions to ldb_kv

Rename the ldb key value functions from ltdb_* to ldb_kv_*. The renaming
is preparation for the separation of the tdb specific code from the key
value code.  This work is a follow on from the addition of the lmdb
backend.

Note that the next commit tidies up the code formatting.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoctdb-doc: Provide an example script for migrating old configuration
Martin Schwenke [Thu, 12 Jul 2018 10:10:35 +0000 (20:10 +1000)]
ctdb-doc: Provide an example script for migrating old configuration

Include an example ctdbd.conf-style file for testing.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Jul 30 14:30:06 CEST 2018 on sn-devel-144

5 years agos3:libads: Add net ads keep-account test
Justin Stephenson [Thu, 28 Jun 2018 15:08:27 +0000 (11:08 -0400)]
s3:libads: Add net ads keep-account test

Add test for the new --keep-account net ads leave operation

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

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul 30 10:22:59 CEST 2018 on sn-devel-144

5 years agos3:libads: Add net ads leave keep-account option
Justin Stephenson [Wed, 27 Jun 2018 15:32:31 +0000 (11:32 -0400)]
s3:libads: Add net ads leave keep-account option

Add the ability to leave the domain with --keep-account argument to avoid
removal of the host machine account.

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

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agoctdb-docs: Update documentation for "ctdb event" command
Martin Schwenke [Mon, 23 Jul 2018 04:07:08 +0000 (14:07 +1000)]
ctdb-docs: Update documentation for "ctdb event" command

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

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): Sat Jul 28 20:03:52 CEST 2018 on sn-devel-144

5 years agoctdb-event: Implement event tool "script list" command
Martin Schwenke [Thu, 12 Jul 2018 03:47:51 +0000 (13:47 +1000)]
ctdb-event: Implement event tool "script list" command

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-event: Change event-tool script enable/disable to chmod file directly
Martin Schwenke [Thu, 12 Jul 2018 03:27:16 +0000 (13:27 +1000)]
ctdb-event: Change event-tool script enable/disable to chmod file directly

They no longer go over the socket to eventd to enable and disable
scripts.  Use the event script abstraction to chmod them directly.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-common: Use script abstraction in run_event
Martin Schwenke [Thu, 12 Jul 2018 03:26:27 +0000 (13:26 +1000)]
ctdb-common: Use script abstraction in run_event

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-common: Factor out basic script abstraction
Martin Schwenke [Thu, 12 Jul 2018 03:20:55 +0000 (13:20 +1000)]
ctdb-common: Factor out basic script abstraction

Provides for listing of scripts and chmod enable/disable.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-event: Fix "ctdb event status" usage message
Martin Schwenke [Thu, 12 Jul 2018 00:44:20 +0000 (10:44 +1000)]
ctdb-event: Fix "ctdb event status" usage message

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-docs: Replace obsolete reference to CTDB_DEBUG_HUNG_SCRIPT option
Martin Schwenke [Thu, 12 Jul 2018 07:38:38 +0000 (17:38 +1000)]
ctdb-docs: Replace obsolete reference to CTDB_DEBUG_HUNG_SCRIPT option

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Jul 28 07:26:24 CEST 2018 on sn-devel-144

5 years agoctdb-common: Fix the TCP packet length check
Amitay Isaacs [Thu, 26 Jul 2018 04:51:44 +0000 (14:51 +1000)]
ctdb-common: Fix the TCP packet length check

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Strip all spaces from od output
Amitay Isaacs [Thu, 19 Jul 2018 07:41:55 +0000 (17:41 +1000)]
ctdb-tests: Strip all spaces from od output

On freebsd, there are trailing spaces in od output.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Fix a typo
Amitay Isaacs [Thu, 19 Jul 2018 07:41:07 +0000 (17:41 +1000)]
ctdb-tests: Fix a typo

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Use errcode to translate ETIMEDOUT
Amitay Isaacs [Thu, 19 Jul 2018 07:40:40 +0000 (17:40 +1000)]
ctdb-tests: Use errcode to translate ETIMEDOUT

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Replace md5sum with posix cksum
Amitay Isaacs [Thu, 19 Jul 2018 06:10:15 +0000 (16:10 +1000)]
ctdb-tests: Replace md5sum with posix cksum

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Use portable wc -c instead of stat -c "%s"
Amitay Isaacs [Thu, 19 Jul 2018 05:27:51 +0000 (15:27 +1000)]
ctdb-tests: Use portable wc -c instead of stat -c "%s"

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-scripts: date "+%N" is non-portable
Amitay Isaacs [Thu, 19 Jul 2018 04:43:09 +0000 (14:43 +1000)]
ctdb-scripts: date "+%N" is non-portable

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Simplify pattern matching for ctime output
Amitay Isaacs [Thu, 19 Jul 2018 02:08:20 +0000 (12:08 +1000)]
ctdb-tests: Simplify pattern matching for ctime output

On freebsd, sed does not accept multiple pattern strings.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Do not try to match pstree output in eventd tests
Amitay Isaacs [Thu, 19 Jul 2018 04:30:17 +0000 (14:30 +1000)]
ctdb-tests: Do not try to match pstree output in eventd tests

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Add fd argument to ctdb_connection_list_read()
Amitay Isaacs [Wed, 18 Jul 2018 09:00:42 +0000 (19:00 +1000)]
ctdb-common: Add fd argument to ctdb_connection_list_read()

This makes testing easier.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-protocol: Avoid fgets in ctdb_connection_list_read
Amitay Isaacs [Wed, 11 Jul 2018 08:35:46 +0000 (18:35 +1000)]
ctdb-protocol: Avoid fgets in ctdb_connection_list_read

C library buffering API can behave in unexpected fashion if underlying
fd for stdin, stdout or stderr is closed and re-opened.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Add line based I/O
Amitay Isaacs [Wed, 18 Jul 2018 08:42:10 +0000 (18:42 +1000)]
ctdb-common: Add line based I/O

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Porting tests should ignore unsupported features
Amitay Isaacs [Wed, 11 Jul 2018 07:23:43 +0000 (17:23 +1000)]
ctdb-tests: Porting tests should ignore unsupported features

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Use sigcode to match signals
Amitay Isaacs [Tue, 10 Jul 2018 09:11:18 +0000 (19:11 +1000)]
ctdb-tests: Use sigcode to match signals

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Add signal code matching utility
Amitay Isaacs [Tue, 10 Jul 2018 09:09:00 +0000 (19:09 +1000)]
ctdb-tests: Add signal code matching utility

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Add ps output filter for freebsd
Amitay Isaacs [Tue, 10 Jul 2018 08:54:11 +0000 (18:54 +1000)]
ctdb-tests: Add ps output filter for freebsd

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-client: Switch to ETIMEDOUT instead of ETIME
Amitay Isaacs [Tue, 10 Jul 2018 08:48:53 +0000 (18:48 +1000)]
ctdb-client: Switch to ETIMEDOUT instead of ETIME

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-daemon: Switch to using ETIMEDOUT instead of ETIME
Amitay Isaacs [Tue, 10 Jul 2018 08:18:33 +0000 (18:18 +1000)]
ctdb-daemon: Switch to using ETIMEDOUT instead of ETIME

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-event: Switch to ETIMEDOUT instead of ETIME
Amitay Isaacs [Tue, 10 Jul 2018 08:34:13 +0000 (18:34 +1000)]
ctdb-event: Switch to ETIMEDOUT instead of ETIME

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-common: Switch to ETIMEDOUT from ETIME
Amitay Isaacs [Tue, 10 Jul 2018 08:19:09 +0000 (18:19 +1000)]
ctdb-common: Switch to ETIMEDOUT from ETIME

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Add required_error() to match on error codes
Amitay Isaacs [Tue, 10 Jul 2018 08:47:27 +0000 (18:47 +1000)]
ctdb-tests: Add required_error() to match on error codes

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Add errno matching utility
Amitay Isaacs [Tue, 10 Jul 2018 07:38:42 +0000 (17:38 +1000)]
ctdb-tests: Add errno matching utility

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoctdb-tests: Switch some test stubs to use /bin/sh
Martin Schwenke [Sun, 1 Jul 2018 03:39:57 +0000 (13:39 +1000)]
ctdb-tests: Switch some test stubs to use /bin/sh

They don't use any bash features.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tests: Improve portability by not using mktemp --tmpdir option
Martin Schwenke [Sun, 1 Jul 2018 03:28:40 +0000 (13:28 +1000)]
ctdb-tests: Improve portability by not using mktemp --tmpdir option

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tests: Avoid use of non-portable getopt in stubs
Martin Schwenke [Sun, 1 Jul 2018 09:58:02 +0000 (19:58 +1000)]
ctdb-tests: Avoid use of non-portable getopt in stubs

getopt is being used with non-portable options.  In most cases use
simpler, POSIX-compliant getopts instead.

In the case of the ctdb test stub command, options can appear after
other arguments, so this requires an additional nested loop.

In the case of smnotify, there are no short options, so handle the
long options manually.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tests: Avoid use of non-portable getopt in run_tests.sh
Martin Schwenke [Sun, 8 Jul 2018 11:54:40 +0000 (21:54 +1000)]
ctdb-tests: Avoid use of non-portable getopt in run_tests.sh

getopt is being used with non-portable options.  Use simpler,
POSIX-compliant getopts instead.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tools: Avoid use of non-portable getopt in onnode
Martin Schwenke [Sun, 1 Jul 2018 08:43:06 +0000 (18:43 +1000)]
ctdb-tools: Avoid use of non-portable getopt in onnode

getopt is being used with non-portable options.  Use simpler,
POSIX-compliant getopts instead.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tests: Improve portability by not using /bin/bash directly
Martin Schwenke [Sun, 1 Jul 2018 03:30:06 +0000 (13:30 +1000)]
ctdb-tests: Improve portability by not using /bin/bash directly

FreeBSD and others do not have /bin/bash, so use "/usr/bin/env bash"
for better flexibility.

There are still many integration tests that use /bin/bash but this at
least lets FreeBSD start running tests.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tools: Improve portability by not using /bin/bash directly
Martin Schwenke [Sun, 1 Jul 2018 09:47:37 +0000 (19:47 +1000)]
ctdb-tools: Improve portability by not using /bin/bash directly

FreeBSD and others do not have /bin/bash, so use "/usr/bin/env bash"
for better flexibility.

There are still many integration tests that use /bin/bash but this at
least lets FreeBSD start running tests.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoautobuild: Test with and without building bundled popt
Andrew Bartlett [Fri, 27 Jul 2018 03:50:15 +0000 (15:50 +1200)]
autobuild: Test with and without building bundled popt

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Jul 28 03:39:48 CEST 2018 on sn-devel-144

5 years agopopt: Add check for iconv library
Amitay Isaacs [Fri, 27 Jul 2018 02:52:16 +0000 (12:52 +1000)]
popt: Add check for iconv library

On glibc based systems, there is no separate iconv library.  Adding a
dependency without checking for the library breaks build on glibc based
systems.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopopt: Check for headers only if building in-tree version
Amitay Isaacs [Fri, 27 Jul 2018 02:55:47 +0000 (12:55 +1000)]
popt: Check for headers only if building in-tree version

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoselftest: run smbtorture3 SMB2-BASIC tests against additional shares
Ralph Boehme [Thu, 26 Jul 2018 16:13:44 +0000 (18:13 +0200)]
selftest: run smbtorture3 SMB2-BASIC tests against additional shares

This runs the smbtorture3 SMB2-BASIC and smb2.compound_find tests against shares
with "smbd:async dosmode" enabled.

On the vfs_aio_pthread_async_dosmode_force_sync* shares we
force a sync threadpool which ensures we test behaviour on systems that
don't support unshare(CLONE_FS) and also don't support
per-thread-credentials. This simulates the code path of non linux
systems. And makes sure that we don't regress there.

We also test with xattr_tdb and without.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Jul 27 16:04:02 CEST 2018 on sn-devel-144

5 years agoselftest: set "smbd:async dosmode = no" in the vfs_aio_pthread share
Ralph Boehme [Thu, 26 Jul 2018 16:11:22 +0000 (18:11 +0200)]
selftest: set "smbd:async dosmode = no" in the vfs_aio_pthread share

This just explicitly sets the current default, to ensure the tests that
use this share always use the same "smbd:async dosmode" setting even if
the default changes in the future.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agos4: torture: test closing dir handle with in-flight find
Ralph Boehme [Thu, 22 Mar 2018 08:22:08 +0000 (09:22 +0100)]
s4: torture: test closing dir handle with in-flight find

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: use async dos_mode_at_send in smbd_smb2_query_directory_send()
Ralph Boehme [Wed, 25 Jul 2018 17:14:25 +0000 (19:14 +0200)]
smbd: use async dos_mode_at_send in smbd_smb2_query_directory_send()

Finally: use the new dos_mode_at_send() in the directory enumeration
loop. This means that fetching the DOS attributes for directory entries
is done asynchronously with regard to the enumeration loop.

As the DOS attribute is typically read from an extended attribute in the
filesytem, this avoids sequentially blocking on IO. If the IO subsystem
is slow servicing these request, enabling async processing can result in
performance improvements.

A parametric option

  smbd:async dosmode = true | false (default: false)

can be used to enable the new async processing.

Simulating slow IO with usleep(5000) in the synchronous and asynchronous
versions of SMB_VFS_GET_DOS_ATTRIBUTES(), the results of enumerating a
directory with 10,000 files are:

    smbd:async dosmode = no:

        $ time bin/smbclient -U slow%x //localhost/test -c "ls dir\*" > /dev/null
        real    0m59.597s
        user    0m0.024s
        sys     0m0.012s

    smbd:async dosmode = yes:

        $ time bin/smbclient -U slow%x //localhost/test -c "ls dir\*" > /dev/null
        real    0m0.698s
        user    0m0.038s
        sys     0m0.025s

Performance gains in real world workloads depends on whether the actual
IO requests can be merged and parallelized by the kernel. Without such
wins at the IO layer, the async processing may even be slower then the
sync processing due to the additional overhead.

The following parameters can be used to adapt async processing behaviour
for specific workloads and systems:

        aio max threads = X (default: 100)
        smbd:max async dosmode = Y (default: "aio max threads" * 2)

By default we have at most twice the number of async requests in flight
as threads provided by the underlying threadpool. This ensures a worker
thread that finishes a job can directly pick up a new one without going
to sleep.

It may be advisable to reduce the number of threads to avoid scheduling
overhead while also increasing "smbd:max async dosmode".

Note that we disable async processing for certain VFS modules in the VFS
connect function to avoid the overhead of triggering the sync fallback
in dos_mode_at_send(). This is done for VFS modules that implement the
sync SMB_VFS_GET_DOS_ATTRIBUTES(), but not the async version (gpfs), and
for VFS modules that don't share a real filesystem where fchdir() can be
used (ceph, gluster). It is disabled for catia, because we realized that
the catia name translation macros used on
fsps (CATIA_FETCH_FSP_[PRE|POST]_NEXT) have a bug (#13547).

We use threadpool = smb_vfs_ev_glue_tp_chdir_safe() and then
pthreadpool_tevent_max_threads(threadpool) to get the number of maximum
worker threads which matches the pool used by the low level
SMB_VFS_GETXATTRAT_[SEND|RECV] implementation in vfs_default.

This is a terrible abstraction leak that should be removed in the future
by maybe making it possible to ask a VFS function which threadpool it
uses, internally suporting chaining so VFS function FOO that internally
uses BAR can forward the question to BAR.

On a hyphotetical system that had a getxattrat(dirfd, path, ...)
syscall and at the same time doesn't support per-thread current working
directories (eg FreeBSD doesn't have the latter) but has support for
per-thread-credentials, pthreadpool_tevent_max_threads() on the
tp_chdir_safe threadpool returns 1.

So when hooking the hyphotetical getxattrat() into the async
SMB_VFS_GETXATTRAT_[SEND|RECV] implementation in an VFS module, the
implementation could use the tp_path_safe threadpool, but the SMB2
layer would use the wrong threadpool in the call to
pthreadpool_tevent_max_threads(), resulting in no parallelism.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: let smbd_dirptr_lanman2_entry return smb_fname
Ralph Boehme [Thu, 15 Mar 2018 18:03:59 +0000 (19:03 +0100)]
smbd: let smbd_dirptr_lanman2_entry return smb_fname

Note that smb_fname is relative to fsp, not conn!

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: deal with fsp->aio_requests in close_directory()
Ralph Boehme [Wed, 21 Mar 2018 19:41:44 +0000 (20:41 +0100)]
smbd: deal with fsp->aio_requests in close_directory()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: fix a long line in smb2_query_directory_next_entry()
Ralph Boehme [Thu, 21 Jun 2018 10:44:42 +0000 (12:44 +0200)]
smbd: fix a long line in smb2_query_directory_next_entry()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: factor out smb2_query_directory_next_entry() from smbd_smb2_query_directory_send()
Ralph Boehme [Tue, 3 Jul 2018 09:25:57 +0000 (11:25 +0200)]
smbd: factor out smb2_query_directory_next_entry() from smbd_smb2_query_directory_send()

This paves the way for adding async functions into the enumeration loop.

Best viewed with: git show -w

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: rework error exit in smbd_dirptr_lanman2_entry()
Ralph Boehme [Thu, 15 Mar 2018 17:57:50 +0000 (18:57 +0100)]
smbd: rework error exit in smbd_dirptr_lanman2_entry()

The next commit will add code that must be run if status is NT_STATUS_OK
or STATUS_MORE_ENTRIES.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: pass get_dosmode to mode_fn in smbd_dirptr_get_entry()
Ralph Boehme [Thu, 15 Mar 2018 15:48:38 +0000 (16:48 +0100)]
smbd: pass get_dosmode to mode_fn in smbd_dirptr_get_entry()

This finally uses "get_dosmode" as passed in from the SMB2 layer, but
all callers still pass true, so no change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: pass get_dosmode to smbd_dirptr_get_entry()
Ralph Boehme [Thu, 15 Mar 2018 15:08:11 +0000 (16:08 +0100)]
smbd: pass get_dosmode to smbd_dirptr_get_entry()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: add "get_dosmode" argument to smbd_dirptr_lanman2_entry()
Ralph Boehme [Thu, 15 Mar 2018 14:50:41 +0000 (15:50 +0100)]
smbd: add "get_dosmode" argument to smbd_dirptr_lanman2_entry()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: add dos_mode_at_send/recv()
Ralph Boehme [Thu, 15 Mar 2018 14:21:53 +0000 (15:21 +0100)]
smbd: add dos_mode_at_send/recv()

Signed-off-by: Ralph Boehme <slow@samba.org>
5 years agosmbd: factor out dosmode post processing
Ralph Boehme [Wed, 25 Jul 2018 15:15:46 +0000 (17:15 +0200)]
smbd: factor out dosmode post processing

We apply some post processing to the dosmode returned from the VFS
function. Move this to a seperate function which will be reused in the
next commit in the async dos_mode_send/recv post processing.

Best viewed with: git show --histogram

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agovfs_default: implement SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV
Ralph Boehme [Thu, 15 Mar 2018 11:35:13 +0000 (12:35 +0100)]
vfs_default: implement SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agosmbd: split out public parse_dos_attribute_blob() from get_ea_dos_attribute()
Ralph Boehme [Thu, 15 Mar 2018 09:56:28 +0000 (10:56 +0100)]
smbd: split out public parse_dos_attribute_blob() from get_ea_dos_attribute()

In preperation of adding an async version of get_ea_dos_attribute() that
will then call parse_dos_attribute_blob() too.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agos3: vfs: add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV
Ralph Boehme [Thu, 15 Mar 2018 12:08:55 +0000 (13:08 +0100)]
s3: vfs: add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agovfs_xattr_tdb: implement SMB_VFS_GETXATTRAT_SEND/RECV
Ralph Boehme [Thu, 21 Jun 2018 15:04:22 +0000 (17:04 +0200)]
vfs_xattr_tdb: implement SMB_VFS_GETXATTRAT_SEND/RECV

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agovfs_default: implement SMB_VFS_GETXATTRAT_SEND/RECV
Ralph Boehme [Tue, 13 Mar 2018 15:17:27 +0000 (16:17 +0100)]
vfs_default: implement SMB_VFS_GETXATTRAT_SEND/RECV

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agos3: vfs: add SMB_VFS_GETXATTRAT_SEND/RECV
Ralph Boehme [Tue, 13 Mar 2018 07:14:53 +0000 (08:14 +0100)]
s3: vfs: add SMB_VFS_GETXATTRAT_SEND/RECV

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agopthreadpool: we need to use pthreadpool_tevent_per_thread_cwd() on the callers pool
Stefan Metzmacher [Thu, 26 Jul 2018 07:41:22 +0000 (09:41 +0200)]
pthreadpool: we need to use pthreadpool_tevent_per_thread_cwd() on the callers pool

In pthreadpool_tevent_job_send() we remember if the job will be chdir
safe. It means we means we need to ask the callers pool when calling
pthreadpool_tevent_per_thread_cwd(), as the callers pool might
be a wrapper using pthreadpool_tevent_force_per_thread_cwd().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoldb_mdb: #ifdef EBADE as it is not portable
Stefan Metzmacher [Thu, 26 Jul 2018 00:29:10 +0000 (02:29 +0200)]
ldb_mdb: #ifdef EBADE as it is not portable

E.g. FreeBSD 11.2 doesn't have it.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoctdb-common: Drop unused function mkdir_p_or_die()
Martin Schwenke [Fri, 8 Jun 2018 08:48:07 +0000 (18:48 +1000)]
ctdb-common: Drop unused function mkdir_p_or_die()

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): Fri Jul 27 08:42:20 CEST 2018 on sn-devel-144

5 years agoctdb-common: Drop function parse_ip_mask() and supporting functions
Martin Schwenke [Thu, 7 Jun 2018 21:33:32 +0000 (07:33 +1000)]
ctdb-common: Drop function parse_ip_mask() and supporting functions

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-daemon: Switch to using ctdb_sock_addr_mask_from_string()
Martin Schwenke [Thu, 7 Jun 2018 21:27:07 +0000 (07:27 +1000)]
ctdb-daemon: Switch to using ctdb_sock_addr_mask_from_string()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tools: Switch to using ctdb_sock_addr_mask_from_string()
Martin Schwenke [Thu, 7 Jun 2018 21:26:51 +0000 (07:26 +1000)]
ctdb-tools: Switch to using ctdb_sock_addr_mask_from_string()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-protocol: Add function ctdb_sock_addr_mask_from_string()
Martin Schwenke [Thu, 7 Jun 2018 21:13:25 +0000 (07:13 +1000)]
ctdb-protocol: Add function ctdb_sock_addr_mask_from_string()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-protocol: Fix compilation issue with strncpy()
Martin Schwenke [Thu, 26 Jul 2018 01:01:30 +0000 (11:01 +1000)]
ctdb-protocol: Fix compilation issue with strncpy()

When configured with --picky-developer and using -O3 with gcc 8.1:

../protocol/protocol_util.c: In function ‘ctdb_sock_addr_from_string’:
../protocol/protocol_util.c:282:2: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  strncpy(s, str, len+1);
  ^~~~~~~~~~~~~~~~~~~~~~
../protocol/protocol_util.c:277:8: note: length computed here
  len = strlen(str);
        ^~~~~~~~~~~

Use strlcpy() instead and check the result.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-common: Fix compilation issue with strncpy()
Martin Schwenke [Thu, 26 Jul 2018 01:00:28 +0000 (11:00 +1000)]
ctdb-common: Fix compilation issue with strncpy()

When configured with --picky-developer and using -O3 with gcc 8.1:

../common/system_socket.c: In function ‘parse_ip_mask’:
../common/system_socket.c:229:2: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  strncpy(s, str, len+1);
  ^~~~~~~~~~~~~~~~~~~~~~
../common/system_socket.c:223:8: note: length computed here
  len = strlen(str);
        ^~~~~~~~~~~

Use strlcpy() instead and check the result.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agosmbd: Remove "share_mode_entry->lease"
Volker Lendecke [Wed, 25 Jul 2018 15:05:34 +0000 (17:05 +0200)]
smbd: Remove "share_mode_entry->lease"

smbstatus was the only user, and this could be solved by adapting
share_entry_forall.

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): Fri Jul 27 01:42:31 CEST 2018 on sn-devel-144

5 years agosmbstatus: Use share_mode_data->leases
Volker Lendecke [Wed, 25 Jul 2018 14:59:53 +0000 (16:59 +0200)]
smbstatus: Use share_mode_data->leases

This is the only user of share_mode_entry->lease

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>