sfrench/samba-autobuild/.git
6 years agos4:client: Fix size types and loop
Andreas Schneider [Thu, 22 Mar 2018 09:28:02 +0000 (10:28 +0100)]
s4:client: Fix size types and loop

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos4:registry: Fix size type and loop
Andreas Schneider [Wed, 21 Mar 2018 15:46:49 +0000 (16:46 +0100)]
s4:registry: Fix size type and loop

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolib:util: Fix size types in fgets_slash()
Andreas Schneider [Wed, 21 Mar 2018 11:49:38 +0000 (12:49 +0100)]
lib:util: Fix size types in fgets_slash()

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agothird_party: Fix size type in cmocka
Andreas Schneider [Wed, 21 Mar 2018 13:32:49 +0000 (14:32 +0100)]
third_party: Fix size type in cmocka

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoldb: Fix overflow checks
Andreas Schneider [Wed, 21 Mar 2018 15:25:30 +0000 (16:25 +0100)]
ldb: Fix overflow checks

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoldb: Add test for ldb_qsort()
Andreas Schneider [Thu, 22 Mar 2018 08:53:03 +0000 (09:53 +0100)]
ldb: Add test for ldb_qsort()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agothird_party: Update pam_wrapper to version 1.0.6
Andreas Schneider [Wed, 21 Mar 2018 16:19:39 +0000 (17:19 +0100)]
third_party: Update pam_wrapper to version 1.0.6

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:modules: fix the build of vfs_aixacl2.c
Stefan Metzmacher [Wed, 21 Mar 2018 06:48:16 +0000 (07:48 +0100)]
s3:modules: fix the build of vfs_aixacl2.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Apr  3 20:18:58 CEST 2018 on sn-devel-144

6 years agoldb/tests: avoid 'return void_function();' which isn't portable
Stefan Metzmacher [Wed, 21 Mar 2018 06:33:16 +0000 (07:33 +0100)]
ldb/tests: avoid 'return void_function();' which isn't portable

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agolib/crypto: avoid 'return void_function();' which isn't portable
Stefan Metzmacher [Wed, 21 Mar 2018 06:33:16 +0000 (07:33 +0100)]
lib/crypto: avoid 'return void_function();' which isn't portable

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agos3:modules: make virusfilter_io_connect_path() more portable
Stefan Metzmacher [Wed, 21 Mar 2018 06:25:11 +0000 (07:25 +0100)]
s3:modules: make virusfilter_io_connect_path() more portable

We have existing utility functions to prepare a socket.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agos3:modules: fix the picky-developer build of vfs_virusfilter.c on FreeBSD 11
Stefan Metzmacher [Tue, 20 Mar 2018 11:10:01 +0000 (12:10 +0100)]
s3:modules: fix the picky-developer build of vfs_virusfilter.c on FreeBSD 11

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agonsswitch: fix the developer build of nsswitch/wins.c on freebsd 11
Stefan Metzmacher [Sat, 21 Oct 2017 12:15:12 +0000 (14:15 +0200)]
nsswitch: fix the developer build of nsswitch/wins.c on freebsd 11

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agonsswitch: add some const to _nss_winbind_initgroups_dyn() prototype
Stefan Metzmacher [Sat, 21 Oct 2017 12:14:34 +0000 (14:14 +0200)]
nsswitch: add some const to _nss_winbind_initgroups_dyn() prototype

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agonsswitch: maintain prototypes for the linux based functions only once
Stefan Metzmacher [Sat, 21 Oct 2017 12:08:15 +0000 (14:08 +0200)]
nsswitch: maintain prototypes for the linux based functions only once

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agolib/replace: define __[u]intptr_t_defined if we prove an replacement
Stefan Metzmacher [Tue, 20 Mar 2018 20:46:12 +0000 (21:46 +0100)]
lib/replace: define __[u]intptr_t_defined if we prove an replacement

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
6 years agolib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c
Stefan Metzmacher [Tue, 20 Mar 2018 15:49:30 +0000 (16:49 +0100)]
lib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agoctdb-scripts: Drop "net serverid wipe" from 50.samba event script
Amitay Isaacs [Wed, 28 Mar 2018 23:45:19 +0000 (10:45 +1100)]
ctdb-scripts: Drop "net serverid wipe" from 50.samba event script

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

There is no serverid database anymore.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Mar 31 08:34:00 CEST 2018 on sn-devel-144

6 years agoctdb-server: Only set destructor if required
Swen Schillig [Thu, 8 Feb 2018 11:19:09 +0000 (12:19 +0100)]
ctdb-server: Only set destructor if required

Set the detructor in ctdb_start_revoke_ro_record after the revokechild_handle
was added to the list.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Mar 31 03:45:51 CEST 2018 on sn-devel-144

6 years agoctdb-server: Add goto tag avoiding code duplication
Swen Schillig [Thu, 8 Feb 2018 11:08:45 +0000 (12:08 +0100)]
ctdb-server: Add goto tag avoiding code duplication

Introduced err_out goto tag to prevent code duplication.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb-server: Minor code cleanup
Swen Schillig [Thu, 8 Feb 2018 10:57:23 +0000 (11:57 +0100)]
ctdb-server: Minor code cleanup

Cleanup ctdb_start_revoke_ro_record to improve readability.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb-server: Replace the variable rc by something meaningful
Swen Schillig [Wed, 31 Jan 2018 12:06:30 +0000 (13:06 +0100)]
ctdb-server: Replace the variable rc by something meaningful

Replace the varibale name "rc" in ctdb_start_revoke_ro_record
to prevent a mix-up with the common meaning of rc (return code).

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb-server: Only talloc_set_destructor when required
Swen Schillig [Tue, 20 Feb 2018 16:08:59 +0000 (17:08 +0100)]
ctdb-server: Only talloc_set_destructor when required

The destructor is only needed once the state got added to the DLIST.
Therefore, move the setting of the destructor to after the addition
of state to the DLIST.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb-server: Cleanup ctdb_daemon_call_send_remote
Swen Schillig [Thu, 8 Feb 2018 10:33:08 +0000 (11:33 +0100)]
ctdb-server: Cleanup ctdb_daemon_call_send_remote

Minor code cleanup and adding a temporary variable to improve readabilty.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb: Use talloc_zero instead of zeroing attributes
Swen Schillig [Wed, 21 Feb 2018 12:52:11 +0000 (13:52 +0100)]
ctdb: Use talloc_zero instead of zeroing attributes

Zero entire structure with talloc_zero on memory allocation instead of
setting each attribute individually.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb: Use provided mem_ctx for newly allocated memory
Swen Schillig [Wed, 21 Feb 2018 12:34:28 +0000 (13:34 +0100)]
ctdb: Use provided mem_ctx for newly allocated memory

ctdb_call_local is called with a mem_ctx parameter which should be used
for newly allocated memory.

This is safe because all allocations of this context are freed before
this function returns.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb: Fixing possible memory leak in ctdb_tcp_read_cb
Swen Schillig [Tue, 13 Mar 2018 08:34:52 +0000 (09:34 +0100)]
ctdb: Fixing possible memory leak in ctdb_tcp_read_cb

In case of an error condition the further processing of the data is cancelled
and the callback returns. In such a scenario the data has to be free'd.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb: Fixing memory leak in ctdb_tcp_tnode_cb
Swen Schillig [Tue, 13 Mar 2018 08:42:24 +0000 (09:42 +0100)]
ctdb: Fixing memory leak in ctdb_tcp_tnode_cb

It is expected by the caller(queue_process) that the callback is
free'ing the memory referenced by the data pointer.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoctdb: Fixing possible memory leak in ctdb_daemon_read_cb
Swen Schillig [Tue, 13 Mar 2018 08:06:45 +0000 (09:06 +0100)]
ctdb: Fixing possible memory leak in ctdb_daemon_read_cb

In case of an error condition the further processing of the data is cancelled
and the callback returns. In such a scenario the data has to be free'd.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos4:torture: kernel oplocks. Fix assertion warning
Jones Syue [Fri, 30 Mar 2018 00:31:06 +0000 (08:31 +0800)]
s4:torture: kernel oplocks. Fix assertion warning

Simply boolean 'ret' instead of 'ret = true'.

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Mar 30 18:39:19 CEST 2018 on sn-devel-144

6 years agos3:smbd: don't use the directory cache for SMB2/3
Ralph Boehme [Thu, 29 Mar 2018 18:06:47 +0000 (20:06 +0200)]
s3:smbd: don't use the directory cache for SMB2/3

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

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): Fri Mar 30 03:51:48 CEST 2018 on sn-devel-144

6 years agos4: torture: Test all combinations of directory open with existing directory to ensur...
Jeremy Allison [Wed, 28 Mar 2018 20:19:12 +0000 (13:19 -0700)]
s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 29 23:13:42 CEST 2018 on sn-devel-144

6 years agos4: torture: Test all combinations of directory create to ensure behavior is the...
Jeremy Allison [Wed, 28 Mar 2018 20:17:14 +0000 (13:17 -0700)]
s4: torture: Test all combinations of directory create to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
6 years agos4: torture: Test all combinations of file open with existing file to ensure behavior...
Jeremy Allison [Wed, 28 Mar 2018 18:44:40 +0000 (11:44 -0700)]
s4: torture: Test all combinations of file open with existing file to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
6 years agos4: torture: Test all combinations of file create to ensure behavior is the same.
Jeremy Allison [Wed, 28 Mar 2018 18:00:59 +0000 (11:00 -0700)]
s4: torture: Test all combinations of file create to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
6 years agos4: torture: Ensure a failed file create doesn't create the file.
Jeremy Allison [Wed, 28 Mar 2018 17:54:30 +0000 (10:54 -0700)]
s4: torture: Ensure a failed file create doesn't create the file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
6 years agos3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.
Jeremy Allison [Wed, 28 Mar 2018 19:42:20 +0000 (12:42 -0700)]
s3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
6 years agolibads: Fix CID 1349423 Resource leak
Volker Lendecke [Wed, 28 Mar 2018 12:27:08 +0000 (07:27 -0500)]
libads: Fix CID 1349423 Resource leak

get_sorted_dc_list should already take care, but this way it's safer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 29 03:45:00 CEST 2018 on sn-devel-144

6 years agonet: Fix CID 1128559 Dereference null return value
Volker Lendecke [Wed, 28 Mar 2018 12:24:01 +0000 (07:24 -0500)]
net: Fix CID 1128559 Dereference null return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agosmbstatus: Fix CID 1128560 Dereference null return value
Volker Lendecke [Wed, 28 Mar 2018 12:22:02 +0000 (07:22 -0500)]
smbstatus: Fix CID 1128560 Dereference null return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agovfs_fruit: Fix CID 1433613 Operands don't affect result
Volker Lendecke [Wed, 28 Mar 2018 12:17:59 +0000 (07:17 -0500)]
vfs_fruit: Fix CID 1433613 Operands don't affect result

Two changes: First, we can't check multiplication overflow after the
operation. This has to be done before with a division. Second, there
is no OFF_T_MAX, and both operands are size_t, so check for
SIZE_MAX. The result is assigned to off_t, but I'm not sure where the
automatic coercion from size_t to off_t would happen.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodsdb: Fix CID 1433614 Dereference after null check
Volker Lendecke [Wed, 28 Mar 2018 12:10:59 +0000 (07:10 -0500)]
dsdb: Fix CID 1433614 Dereference after null check

This whole routine assumes module!=NULL, both in the successful as
well as in error cases. So checking for module!=NULL is confusing both
the reader as well as Coverity.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibads: Fix 1433611 Resource leak
Volker Lendecke [Wed, 28 Mar 2018 12:00:34 +0000 (07:00 -0500)]
libads: Fix 1433611 Resource leak

Not really a memleak due to the passed-in talloc ctx, but this way it's cleaner

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolsa_server: Fix CID 1433608 Dereference after null check
Volker Lendecke [Tue, 27 Mar 2018 22:03:15 +0000 (17:03 -0500)]
lsa_server: Fix CID 1433608 Dereference after null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibads: Fix CID 1433606 Dereference before null check
Volker Lendecke [Tue, 27 Mar 2018 22:00:46 +0000 (17:00 -0500)]
libads: Fix CID 1433606 Dereference before null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agondr_string: Do overflow checks in ndr_push/pull_charset
Volker Lendecke [Mon, 26 Mar 2018 10:02:01 +0000 (12:02 +0200)]
ndr_string: Do overflow checks in ndr_push/pull_charset

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Mar 28 16:08:16 CEST 2018 on sn-devel-144

6 years agondr_string: Fix a signed/unsigned glitch
Volker Lendecke [Mon, 26 Mar 2018 10:00:40 +0000 (12:00 +0200)]
ndr_string: Fix a signed/unsigned glitch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agoctdb-tests: Delete unused fake /etc/sysconfig/ctdb file
Martin Schwenke [Tue, 20 Mar 2018 09:20:55 +0000 (20:20 +1100)]
ctdb-tests: Delete unused fake /etc/sysconfig/ctdb file

The only remaining item is a setting of CTDB_DEBUGLEVEL, which is not
required.

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): Wed Mar 28 07:27:58 CEST 2018 on sn-devel-144

6 years agoctdb-scripts: Tunables are now loaded from ctdb.tunables
Martin Schwenke [Tue, 20 Feb 2018 07:22:33 +0000 (18:22 +1100)]
ctdb-scripts: Tunables are now loaded from ctdb.tunables

Using CTDB_SET_TunableVariables in the main configuration file is no
longer supported.

The only subtlety is an unexpected order change in one of the unit
test results.  This is because the old implementation implicitly
sorted the tunable variables via the set command.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Rename setup_config() to setup_tunable_config()
Martin Schwenke [Thu, 22 Mar 2018 03:39:45 +0000 (14:39 +1100)]
ctdb-tests: Rename setup_config() to setup_tunable_config()

Drop the "CTDB_SET_" prefix from variable names and add it back for
now.  When there is a better way of setting tunables then this
function will support that.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Script options into per-script file
Martin Schwenke [Mon, 19 Feb 2018 03:58:48 +0000 (14:58 +1100)]
ctdb-tests: Script options into per-script file

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Use load_script_options in event scripts
Martin Schwenke [Tue, 20 Feb 2018 01:56:42 +0000 (12:56 +1100)]
ctdb-scripts: Use load_script_options in event scripts

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Add new function load_script_options()
Martin Schwenke [Mon, 19 Feb 2018 02:13:26 +0000 (13:13 +1100)]
ctdb-scripts: Add new function load_script_options()

For now this loads the global CTDB configuration too.  This will
change in the future after things are properly modularised.

This also anticipates a future change where event scripts end with a
".script" suffix.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 91.lvs tests
Martin Schwenke [Thu, 22 Mar 2018 00:36:46 +0000 (11:36 +1100)]
ctdb-tests: Use setup_script_options() in 91.lvs tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 60.nfs (and 06.nfs) tests
Martin Schwenke [Thu, 22 Mar 2018 01:05:10 +0000 (12:05 +1100)]
ctdb-tests: Use setup_script_options() in 60.nfs (and 06.nfs) tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 50.samba tests
Martin Schwenke [Thu, 22 Mar 2018 01:03:56 +0000 (12:03 +1100)]
ctdb-tests: Use setup_script_options() in 50.samba tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 49.winbind tests
Martin Schwenke [Thu, 22 Mar 2018 00:17:47 +0000 (11:17 +1100)]
ctdb-tests: Use setup_script_options() in 49.winbind tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 41.httpd tests
Martin Schwenke [Wed, 21 Mar 2018 20:19:14 +0000 (07:19 +1100)]
ctdb-tests: Use setup_script_options() in 41.httpd tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 40.vsftpd tests
Martin Schwenke [Wed, 21 Mar 2018 20:16:02 +0000 (07:16 +1100)]
ctdb-tests: Use setup_script_options() in 40.vsftpd tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 31.clamd tests
Martin Schwenke [Wed, 21 Mar 2018 20:11:59 +0000 (07:11 +1100)]
ctdb-tests: Use setup_script_options() in 31.clamd tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 20.multipathd tests
Martin Schwenke [Wed, 21 Mar 2018 20:04:49 +0000 (07:04 +1100)]
ctdb-tests: Use setup_script_options() in 20.multipathd tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 13.per_ip_routing tests
Martin Schwenke [Wed, 21 Mar 2018 20:01:08 +0000 (07:01 +1100)]
ctdb-tests: Use setup_script_options() in 13.per_ip_routing tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 11.natgw tests
Martin Schwenke [Wed, 21 Mar 2018 19:56:18 +0000 (06:56 +1100)]
ctdb-tests: Use setup_script_options() in 11.natgw tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 10.interface tests
Martin Schwenke [Wed, 21 Mar 2018 11:21:46 +0000 (22:21 +1100)]
ctdb-tests: Use setup_script_options() in 10.interface tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Use setup_script_options() in 05.system tests
Martin Schwenke [Wed, 21 Mar 2018 11:18:56 +0000 (22:18 +1100)]
ctdb-tests: Use setup_script_options() in 05.system tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: New function setup_script_options()
Martin Schwenke [Thu, 8 Feb 2018 01:18:56 +0000 (12:18 +1100)]
ctdb-tests: New function setup_script_options()

Currently exports the variable assignment on each line.  Later this
can be changed to handle actual per-script configuration.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Split CTDB configuration loading
Martin Schwenke [Tue, 6 Feb 2018 00:25:56 +0000 (11:25 +1100)]
ctdb-scripts: Split CTDB configuration loading

loadconfig() currently tries to load the CTDB configuration and also
any system configuration relevant to the current (event) script.

Instead add a new function load_system_config() to load the
distribution-specific system configuration for a component.  Call this
directly in the rare scripts that need the system configuration.

Also call load_system_config when loading the CTDB configuration to
pull in anything from the CTDB system configuration.  This is partly
for backward compatibility but also to get options that can be used
anywhere.

loadconfig() no longer takes an argument.  It simply loads the CTDB
configuration.

Drop support for falling back to /etc/ctdb/sysconfig/ctdb (or
similar).  Surely there's nobody who uses that!

Also, drop the indirection where loadconfig() calls _loadconfig().
This was used years ago as a test hook and is no longer required.

Inexplicably, this change introduces a new shellcheck test failure, so
silence this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-docs: Promote CTDB_INIT_STYLE to global options section
Martin Schwenke [Mon, 19 Feb 2018 04:32:02 +0000 (15:32 +1100)]
ctdb-docs: Promote CTDB_INIT_STYLE to global options section

Clarify that the global options should be set in the system
configuration file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Clean up function detect_init_style()
Martin Schwenke [Mon, 19 Feb 2018 04:29:43 +0000 (15:29 +1100)]
ctdb-scripts: Clean up function detect_init_style()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Remove unused functions and stubs
Martin Schwenke [Mon, 12 Feb 2018 19:55:35 +0000 (06:55 +1100)]
ctdb-tests: Remove unused functions and stubs

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: statd-callout script setup modularisation
Martin Schwenke [Tue, 13 Feb 2018 00:17:46 +0000 (11:17 +1100)]
ctdb-tests: statd-callout script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 91.lvs event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 05:46:17 +0000 (16:46 +1100)]
ctdb-tests: 91.lvs event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 60.nfs (and 06.nfs) event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 19:53:44 +0000 (06:53 +1100)]
ctdb-tests: 60.nfs (and 06.nfs) event script setup modularisation

Includes gratuitous changes to get lines below 80 columns.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 50.samba event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 05:25:15 +0000 (16:25 +1100)]
ctdb-tests: 50.samba event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 49.winbind event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 03:10:12 +0000 (14:10 +1100)]
ctdb-tests: 49.winbind event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 41.httpd event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 03:02:20 +0000 (14:02 +1100)]
ctdb-tests: 41.httpd event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 40.vsftpd event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 02:47:56 +0000 (13:47 +1100)]
ctdb-tests: 40.vsftpd event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 31.clamd event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 02:58:42 +0000 (13:58 +1100)]
ctdb-tests: 31.clamd event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 20.multipathd event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 02:40:42 +0000 (13:40 +1100)]
ctdb-tests: 20.multipathd event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 13.per_ip_routing event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 02:37:02 +0000 (13:37 +1100)]
ctdb-tests: 13.per_ip_routing event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 11.natgw event script setup modularisation
Martin Schwenke [Mon, 12 Feb 2018 00:42:04 +0000 (11:42 +1100)]
ctdb-tests: 11.natgw event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 10.interface event script setup modularisation
Martin Schwenke [Thu, 8 Feb 2018 11:01:49 +0000 (22:01 +1100)]
ctdb-tests: 10.interface event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 05.system event script setup modularisation
Martin Schwenke [Wed, 7 Feb 2018 19:54:27 +0000 (06:54 +1100)]
ctdb-tests: 05.system event script setup modularisation

Do initial test setup using setup() function.  Rename usage setting
functions to make them more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 01.reclock event script setup modularisation
Martin Schwenke [Wed, 7 Feb 2018 19:24:01 +0000 (06:24 +1100)]
ctdb-tests: 01.reclock event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 00.ctdb testing setup modularisation
Martin Schwenke [Wed, 7 Feb 2018 19:04:58 +0000 (06:04 +1100)]
ctdb-tests: 00.ctdb testing setup modularisation

Switch to generic setup() function and set variables there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Define generic setup() function
Martin Schwenke [Wed, 7 Feb 2018 19:00:25 +0000 (06:00 +1100)]
ctdb-tests: Define generic setup() function

Create default setup() function that aborts.  This function will be
redefined by each support script and used to do the setup.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: statd-callout.sh simple 80 column fixups
Martin Schwenke [Tue, 20 Mar 2018 09:46:41 +0000 (20:46 +1100)]
ctdb-tests: statd-callout.sh simple 80 column fixups

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 60.nfs.sh simple 80 column fixups and reordering
Martin Schwenke [Tue, 20 Mar 2018 09:42:21 +0000 (20:42 +1100)]
ctdb-tests: 60.nfs.sh simple 80 column fixups and reordering

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 20.multipathd.sh 80 column fixups
Martin Schwenke [Tue, 20 Mar 2018 09:38:13 +0000 (20:38 +1100)]
ctdb-tests: 20.multipathd.sh 80 column fixups

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 11.natgw.sh simple 80 column fixups
Martin Schwenke [Tue, 20 Mar 2018 09:51:00 +0000 (20:51 +1100)]
ctdb-tests: 11.natgw.sh simple 80 column fixups

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 10.interface.sh simple 80 column fixups
Martin Schwenke [Tue, 20 Mar 2018 09:31:19 +0000 (20:31 +1100)]
ctdb-tests: 10.interface.sh simple 80 column fixups

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: 05.system.sh simple 80 column fixups
Martin Schwenke [Tue, 20 Mar 2018 09:28:57 +0000 (20:28 +1100)]
ctdb-tests: 05.system.sh simple 80 column fixups

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create statd-callout.sh
Martin Schwenke [Mon, 19 Mar 2018 09:57:36 +0000 (20:57 +1100)]
ctdb-tests: Create statd-callout.sh

Contains testing support used only by tests for statd-callout script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create 91.lvs.sh
Martin Schwenke [Mon, 19 Mar 2018 09:55:10 +0000 (20:55 +1100)]
ctdb-tests: Create 91.lvs.sh

Contains testing support used only by tests for 91.lvs event scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create 60.nfs.sh and 06.nfs.sh
Martin Schwenke [Mon, 19 Mar 2018 09:53:21 +0000 (20:53 +1100)]
ctdb-tests: Create 60.nfs.sh and 06.nfs.sh

Contains testing support used only by tests for 60.nfs and 06.nfs
event scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create 50.samba.sh
Martin Schwenke [Mon, 19 Mar 2018 09:49:48 +0000 (20:49 +1100)]
ctdb-tests: Create 50.samba.sh

Contains testing support used only by tests for 50.samba event script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create 49.winbind.sh
Martin Schwenke [Mon, 19 Mar 2018 09:47:48 +0000 (20:47 +1100)]
ctdb-tests: Create 49.winbind.sh

Contains testing support used only by tests for 49.winbind event
script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create 41.httpd.sh
Martin Schwenke [Mon, 19 Mar 2018 09:43:15 +0000 (20:43 +1100)]
ctdb-tests: Create 41.httpd.sh

Contains testing support used only by tests for 41.httpd event script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create 40.vsftpd.sh
Martin Schwenke [Mon, 19 Mar 2018 09:42:04 +0000 (20:42 +1100)]
ctdb-tests: Create 40.vsftpd.sh

Contains testing support used only by tests for 40.vsftpd event
script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Create 20.multipathd.sh
Martin Schwenke [Mon, 19 Mar 2018 09:40:40 +0000 (20:40 +1100)]
ctdb-tests: Create 20.multipathd.sh

Contains testing support used only by tests for 20.multipathd event
script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>