nivanova/samba-autobuild/.git
3 years agoprovision_fill: move most db accesses into transactions
Bob Campbell [Wed, 29 Jun 2016 04:54:06 +0000 (16:54 +1200)]
provision_fill: move most db accesses into transactions

Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>

3 years agoctdb-scripts: Quote some variable expansions
Martin Schwenke [Wed, 29 Jun 2016 08:11:44 +0000 (18:11 +1000)]
ctdb-scripts: Quote some variable expansions

This avoids relevant shellcheck warnings.  This is most of the
shellcheck low hanging fruit in the non-test code.  Many of the other
warnings produced by shellcheck are either false positives, are
non-trivial to fix or a fix may result in worse code.

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 Jul  6 08:15:49 CEST 2016 on sn-devel-144

3 years agoctdb-scripts: Fix incorrect variable reference
Martin Schwenke [Wed, 29 Jun 2016 10:43:18 +0000 (20:43 +1000)]
ctdb-scripts: Fix incorrect variable reference

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Use globs instead of ls to list files
Martin Schwenke [Wed, 29 Jun 2016 07:54:00 +0000 (17:54 +1000)]
ctdb-scripts: Use globs instead of ls to list files

shellcheck reports that using ls is fragile.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Fix incorrect variable reference
Martin Schwenke [Wed, 29 Jun 2016 07:49:13 +0000 (17:49 +1000)]
ctdb-scripts: Fix incorrect variable reference

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Fix incorrect variable reference
Martin Schwenke [Wed, 29 Jun 2016 07:47:12 +0000 (17:47 +1000)]
ctdb-scripts: Fix incorrect variable reference

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Update script boilerplate to avoid shellcheck warnings
Martin Schwenke [Wed, 29 Jun 2016 07:36:05 +0000 (17:36 +1000)]
ctdb-scripts: Update script boilerplate to avoid shellcheck warnings

* Assign the output of dirname to temporary variable to avoid word
  splitting when directory name contains whitespace

* Drop export of CTDB_BASE to avoid masking broken return value -
  functions file does the export anyway

* Quote path when including functions file

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Export CTDB_BASE in functions file
Martin Schwenke [Wed, 29 Jun 2016 07:33:43 +0000 (17:33 +1000)]
ctdb-scripts: Export CTDB_BASE in functions file

This avoids having to export it in every file that includes the
functions file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Drop optional argument to nfs_check_services()
Martin Schwenke [Wed, 29 Jun 2016 07:05:17 +0000 (17:05 +1000)]
ctdb-scripts: Drop optional argument to nfs_check_services()

Added so that nfs_check_services() could be run against an arbirary
directory.  However, with the function moved to the event script, this
isn't useful.  CTDB_NFS_CHECKS_DIR can be used for testing instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agogensec: Change log level for message when obtaining PAC from gss_get_name_attribute...
Christof Schmitt [Fri, 1 Jul 2016 18:52:15 +0000 (11:52 -0700)]
gensec: Change log level for message when obtaining PAC from gss_get_name_attribute failed

This is the second part for the issue from commit 8bb4fccd. A KDC that
does not return a PAC first triggers this message, then the "resorting
to local user lookup" one. Change the log level for the "obtaining PAC
via GSSAPI gss_get_name_attribute" message as well to avoid spamming the
logs during normal usage. While changing this message, also remove the
discard_const since it is no longer required.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jul  6 04:27:03 CEST 2016 on sn-devel-144

3 years agoauth: fix a memory leak in gssapi_get_session_key()
Uri Simchoni [Sun, 3 Jul 2016 19:50:22 +0000 (22:50 +0300)]
auth: fix a memory leak in gssapi_get_session_key()

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Wed Jul  6 00:40:15 CEST 2016 on sn-devel-144

3 years agos3-libads: fix a memory leak in ads_sasl_spnego_bind()
Uri Simchoni [Sun, 3 Jul 2016 19:51:56 +0000 (22:51 +0300)]
s3-libads: fix a memory leak in ads_sasl_spnego_bind()

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
3 years agoctdb-build: Exit if requested feature cannot be built
Amitay Isaacs [Mon, 27 Jun 2016 08:26:34 +0000 (18:26 +1000)]
ctdb-build: Exit if requested feature cannot be built

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

3 years agoctdb-daemon: Log ctdb socket in the main daemon
Amitay Isaacs [Mon, 27 Jun 2016 08:17:38 +0000 (18:17 +1000)]
ctdb-daemon: Log ctdb socket in the main daemon

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-pmda: CTDB client code does not require ctdb->methods
Amitay Isaacs [Mon, 27 Jun 2016 08:37:27 +0000 (18:37 +1000)]
ctdb-pmda: CTDB client code does not require ctdb->methods

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-daemon: Check if method is initialized before calling
Amitay Isaacs [Mon, 27 Jun 2016 08:00:49 +0000 (18:00 +1000)]
ctdb-daemon: Check if method is initialized before calling

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-ib: Include system/wait.h for signal
Amitay Isaacs [Mon, 27 Jun 2016 07:28:59 +0000 (17:28 +1000)]
ctdb-ib: Include system/wait.h for signal

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Expose ctdb_ltdb_fetch in client API
Amitay Isaacs [Wed, 20 Apr 2016 04:18:55 +0000 (14:18 +1000)]
ctdb-client: Expose ctdb_ltdb_fetch in client API

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Add debug messages to client db api
Amitay Isaacs [Mon, 18 Apr 2016 05:56:00 +0000 (15:56 +1000)]
ctdb-client: Add debug messages to client db api

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Fix implementation of transaction cancel
Amitay Isaacs [Fri, 1 Jul 2016 07:53:17 +0000 (17:53 +1000)]
ctdb-client: Fix implementation of transaction cancel

Wrap async transaction cancel to unlock g_lock lock and free transaction
handle.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Add async version of transaction cancel
Amitay Isaacs [Thu, 21 Apr 2016 07:47:43 +0000 (17:47 +1000)]
ctdb-client: Add async version of transaction cancel

Transaction cancel should get rid of g_lock lock.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Fix implementation of transaction commit
Amitay Isaacs [Fri, 15 Apr 2016 07:44:14 +0000 (17:44 +1000)]
ctdb-client: Fix implementation of transaction commit

There is no need to explicitly check that recovery is not active before
sending TRANS33_COMMIT control.  Just try TRANS3_COMMIT control and if
recovery occurs before the control is completed, the control will fail
and it can be retried.

Make sure g_lock lock is released after the transaction is complete.
Also, add timeout to the client api.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Fix implementation of transaction start
Amitay Isaacs [Fri, 15 Apr 2016 07:44:14 +0000 (17:44 +1000)]
ctdb-client: Fix implementation of transaction start

Since g_lock checks if the process exists in case of conflicting lock,
there is no need to register srvid.

Transaction start returns a transaction handle and transaction
commit/cancel will free that handle.  Since we cannot call async code
in a talloc destructor, this avoids the use of talloc destructor for
cancelling the transaction.

If user frees the transaction handle instead of calling transaction
cancel, it will leave stale g_lock lock.  This stale g_lock lock  will
get cleaned up on next transaction attempt.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: During transaction commit fetch seqnum locally
Amitay Isaacs [Tue, 19 Apr 2016 06:24:05 +0000 (16:24 +1000)]
ctdb-client: During transaction commit fetch seqnum locally

This avoids extra controls to the server.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Release the g_lock record once the update is done
Amitay Isaacs [Tue, 19 Apr 2016 05:35:55 +0000 (15:35 +1000)]
ctdb-client: Release the g_lock record once the update is done

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Remove commented old g_lock implemention code
Amitay Isaacs [Thu, 16 Jun 2016 06:10:20 +0000 (16:10 +1000)]
ctdb-client: Remove commented old g_lock implemention code

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Release g_lock lock before retrying
Amitay Isaacs [Thu, 16 Jun 2016 06:17:39 +0000 (16:17 +1000)]
ctdb-client: Release g_lock lock before retrying

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Fix g_lock implementation
Amitay Isaacs [Wed, 20 Apr 2016 01:30:21 +0000 (11:30 +1000)]
ctdb-client: Fix g_lock implementation

If a conflicting g_lock entry is found, check if the process exists.
This matches Samba implementation.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: If g_lock lock conflicts, try again sooner
Amitay Isaacs [Tue, 19 Apr 2016 07:37:46 +0000 (17:37 +1000)]
ctdb-client: If g_lock lock conflicts, try again sooner

Instead of delaying for 1 second, try to get g_lock lock again after
1 milli-second.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Factor out ctdb_client_get_server_id function
Amitay Isaacs [Tue, 19 Apr 2016 05:24:11 +0000 (15:24 +1000)]
ctdb-client: Factor out ctdb_client_get_server_id function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Use async version of delete_record in g_lock unlock
Amitay Isaacs [Thu, 16 Jun 2016 06:22:43 +0000 (16:22 +1000)]
ctdb-client: Use async version of delete_record in g_lock unlock

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Fix implementation of delete_record
Amitay Isaacs [Thu, 16 Jun 2016 06:34:39 +0000 (16:34 +1000)]
ctdb-client: Fix implementation of delete_record

In delete_record, sync call to ctdb_ctrl_schedule_for_deletion will
cause nested event loops.  Instead wrap the async version.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Add async version of delete_record
Amitay Isaacs [Mon, 18 Apr 2016 06:14:05 +0000 (16:14 +1000)]
ctdb-client: Add async version of delete_record

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Fix ctdb_rec_buffer traversal routine
Amitay Isaacs [Tue, 19 Apr 2016 06:01:05 +0000 (16:01 +1000)]
ctdb-client: Fix ctdb_rec_buffer traversal routine

In commit 1ee7053180057ea526870182b5619a206b4d103b, the
ctdb_rec_buffer_traverse always passes NULL for header.  So explicitly
extract header from the data.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-client: Add sync version of sending multiple messages
Amitay Isaacs [Fri, 1 Apr 2016 05:51:47 +0000 (16:51 +1100)]
ctdb-client: Add sync version of sending multiple messages

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-daemon: Improve log message
Amitay Isaacs [Mon, 4 Jul 2016 04:38:28 +0000 (14:38 +1000)]
ctdb-daemon: Improve log message

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-recoverd: Improve election win messages
Amitay Isaacs [Mon, 4 Jul 2016 04:30:17 +0000 (14:30 +1000)]
ctdb-recoverd: Improve election win messages

Logging that node has lost election is less useful than knowing which
node has won the election.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agokerberos: Return enc data on PREAUTH_FAILED
Garming Sam [Mon, 9 May 2016 04:14:51 +0000 (16:14 +1200)]
kerberos: Return enc data on PREAUTH_FAILED

Without the enc data, Windows clients will perform two AS-REQ causing the password
lockout count to increase by two instead of one.

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

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul  5 10:52:32 CEST 2016 on sn-devel-144

3 years agopassword_hash: Make an error message clearer
Bob Campbell [Mon, 27 Jun 2016 22:34:04 +0000 (10:34 +1200)]
password_hash: Make an error message clearer

Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Tue Jul  5 03:47:52 CEST 2016 on sn-devel-144

3 years agotypo: mandetory -> mandatory
Garming Sam [Mon, 13 Jun 2016 03:42:25 +0000 (15:42 +1200)]
typo: mandetory -> mandatory

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotypo: componemt => component
Garming Sam [Mon, 30 May 2016 21:54:26 +0000 (09:54 +1200)]
typo: componemt => component

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotevent: typo in documentation
Garming Sam [Thu, 18 Feb 2016 01:17:01 +0000 (14:17 +1300)]
tevent: typo in documentation

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoparam: fix a typo emtpy -> empty
Garming Sam [Fri, 22 Jan 2016 00:55:34 +0000 (13:55 +1300)]
param: fix a typo emtpy -> empty

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agocheck_password_script: Add a DEBUG message for timeouts
Bob Campbell [Mon, 27 Jun 2016 22:33:24 +0000 (10:33 +1200)]
check_password_script: Add a DEBUG message for timeouts

Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoselftest: add check password script test
Bob Campbell [Mon, 13 Jun 2016 03:42:46 +0000 (15:42 +1200)]
selftest: add check password script test

Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agocheck-password-script: Allow AD to execute these scripts
Garming Sam [Thu, 31 Mar 2016 21:10:57 +0000 (10:10 +1300)]
check-password-script: Allow AD to execute these scripts

In contrast to source3, this is run as root and without substitution.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoctdb-tests: Link to ctdb-ipalloc instead of using ctdbd_test.c
Martin Schwenke [Thu, 26 May 2016 06:26:51 +0000 (16:26 +1000)]
ctdb-tests: Link to ctdb-ipalloc instead of using ctdbd_test.c

Less code, quicker build time, smaller binary...

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): Mon Jul  4 19:29:08 CEST 2016 on sn-devel-144

3 years agoctdb-ipalloc: Drop implicit dependency on ctdb-common
Martin Schwenke [Thu, 26 May 2016 05:31:47 +0000 (15:31 +1000)]
ctdb-ipalloc: Drop implicit dependency on ctdb-common

Use new functions from protocol API instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Allow takeover tests to be run under valgrind
Martin Schwenke [Thu, 26 May 2016 05:03:51 +0000 (15:03 +1000)]
ctdb-tests: Allow takeover tests to be run under valgrind

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Drop use of CTDB context from takeover test
Martin Schwenke [Mon, 23 May 2016 10:43:46 +0000 (20:43 +1000)]
ctdb-tests: Drop use of CTDB context from takeover test

The ipalloc code doesn't need a CTDB context so neither should the
code that tests it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: IP allocation state is now an opaque structure
Martin Schwenke [Wed, 22 Jun 2016 04:23:38 +0000 (14:23 +1000)]
ctdb-ipalloc: IP allocation state is now an opaque structure

It is private to the IP allocation module.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: ipalloc() returns public IP list
Martin Schwenke [Wed, 22 Jun 2016 04:22:02 +0000 (14:22 +1000)]
ctdb-ipalloc: ipalloc() returns public IP list

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Move set_ipflags_internal() to ipalloc
Martin Schwenke [Wed, 22 Jun 2016 03:18:04 +0000 (13:18 +1000)]
ctdb-ipalloc: Move set_ipflags_internal() to ipalloc

Rename it ipalloc_set_node_flags().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Switch set_ipflags_internal() to use a new-style node map
Martin Schwenke [Wed, 22 Jun 2016 01:37:52 +0000 (11:37 +1000)]
ctdb-ipalloc: Switch set_ipflags_internal() to use a new-style node map

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Move ipalloc state initialisation to ipalloc.c
Martin Schwenke [Mon, 23 May 2016 04:28:33 +0000 (14:28 +1000)]
ctdb-ipalloc: Move ipalloc state initialisation to ipalloc.c

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Pass extra data to IP allocation state initialisation
Martin Schwenke [Mon, 23 May 2016 04:16:47 +0000 (14:16 +1000)]
ctdb-ipalloc: Pass extra data to IP allocation state initialisation

No longer require CTDB context but pass in number of nodes, algorithm,
no_ip_failback and force_rebalance_nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Make no_ip_failback a boolean
Martin Schwenke [Tue, 21 Jun 2016 06:34:44 +0000 (16:34 +1000)]
ctdb-ipalloc: Make no_ip_failback a boolean

No need to expose tunable values that far down.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Fix buggy short-circuit when no IPs are available
Martin Schwenke [Wed, 29 Jun 2016 06:36:28 +0000 (16:36 +1000)]
ctdb-ipalloc: Fix buggy short-circuit when no IPs are available

At the moment IP is short-circuited when there are no available IP
addresses.  However, if some IP addresses are already allocated then
"no available IP addresses" means that all the addresses should
(probably) be released.  The current short-circuit means that no
already hosted IP addresses will be released.

The short-circuit exists to avoid lots of messages saying that all IP
addresses can not be assigned at startup time.  So, add a check to
ipalloc_can_host_ips() so that it succeeds if IP addresses are already
allocated to nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: New function ipalloc_can_host_ips()
Martin Schwenke [Tue, 21 Jun 2016 11:16:27 +0000 (21:16 +1000)]
ctdb-ipalloc: New function ipalloc_can_host_ips()

Abstracts out code involving internals of IP allocation state.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Drop known public IPs from IP allocation state
Martin Schwenke [Tue, 21 Jun 2016 11:09:39 +0000 (21:09 +1000)]
ctdb-ipalloc: Drop known public IPs from IP allocation state

This is never used in the allocation algorithms.  It is only used when
building the merged IP list.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Move create_merged_ip_list() into ipalloc
Martin Schwenke [Mon, 23 May 2016 10:23:18 +0000 (20:23 +1000)]
ctdb-ipalloc: Move create_merged_ip_list() into ipalloc

How the existing IP layout is constructed and how the merged IP list is
sorted are important aspects of the IP allocation algorithm.  Construct the
merged IP list when known and available IPs are assigned.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: New function ipalloc_set_public_ips()
Martin Schwenke [Mon, 23 May 2016 10:23:18 +0000 (20:23 +1000)]
ctdb-ipalloc: New function ipalloc_set_public_ips()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Remove function ctdb_reload_remote_public_ips()
Martin Schwenke [Tue, 21 Jun 2016 10:46:50 +0000 (20:46 +1000)]
ctdb-ipalloc: Remove function ctdb_reload_remote_public_ips()

Use ctdb_fetch_remote_public_ips() inline to fetch each list.  Assign
them into the IP allocation state separately.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Clean up reloading of remote public IPs
Martin Schwenke [Mon, 20 Jun 2016 11:27:40 +0000 (21:27 +1000)]
ctdb-ipalloc: Clean up reloading of remote public IPs

Factor out new function ctdb_fetch_remote_public_ips() to fetch known
or available public IP addresses, according to flags.

This also drops the hack where the array from a
ctdb_public_ip_list_old was assigned to a pointer in a
ctdb_public_ip_list.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Don't build a global IP tree
Martin Schwenke [Mon, 20 Jun 2016 10:53:58 +0000 (20:53 +1000)]
ctdb-ipalloc: Don't build a global IP tree

It isn't used outside this function, so just use a local variable.

This makes create_merged_ip_list() independent of the CTDB context.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Drop code to update IP assignment tree
Martin Schwenke [Mon, 20 Jun 2016 10:47:17 +0000 (20:47 +1000)]
ctdb-ipalloc: Drop code to update IP assignment tree

This code is not used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tools: Don't bother sending CTDB_SRVID_RECD_UPDATE_IP
Martin Schwenke [Mon, 20 Jun 2016 20:25:17 +0000 (06:25 +1000)]
ctdb-tools: Don't bother sending CTDB_SRVID_RECD_UPDATE_IP

Nothing is listening.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-recoverd: Drop code to change the IP assignment tree
Martin Schwenke [Mon, 20 Jun 2016 10:45:28 +0000 (20:45 +1000)]
ctdb-recoverd: Drop code to change the IP assignment tree

The tree is no longer used in verification.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Drop remote IP verification
Martin Schwenke [Mon, 20 Jun 2016 10:41:05 +0000 (20:41 +1000)]
ctdb-ipalloc: Drop remote IP verification

It is only run during a takeover run and only logs errors.  It doesn't
actually do anything to fix potential errors.  The takeover run should
fix any inconsistencies anyway.

Instead, leave a comment in the recovery daemon's monitoring loop to
add proper remote IP verification later.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Drop a use of CTDB_NO_MEMORY_NULL()
Martin Schwenke [Mon, 23 May 2016 06:44:05 +0000 (16:44 +1000)]
ctdb-ipalloc: Drop a use of CTDB_NO_MEMORY_NULL()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Do not use node count or PNNs from CTDB context
Martin Schwenke [Mon, 23 May 2016 04:50:14 +0000 (14:50 +1000)]
ctdb-ipalloc: Do not use node count or PNNs from CTDB context

This is unnecessary.  IP allocation state already has a node count and
"i" is already a PNN.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Drop an unnecessary check
Martin Schwenke [Mon, 23 May 2016 04:46:18 +0000 (14:46 +1000)]
ctdb-ipalloc: Drop an unnecessary check

Deleted (and other inactive) nodes will have an empty list of known
IP addresses.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: Move if-statement with broken condition
Martin Schwenke [Mon, 23 May 2016 04:41:43 +0000 (14:41 +1000)]
ctdb-ipalloc: Move if-statement with broken condition

This pointer is for an array that is always allocated.  The check is
meant to skip a node that has no IP addresses.  However, when there
are no IP addresses the loop below will not do anything anyway.

Add this as a check at the beginning of the function instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Drop CTDB_TEST_MAX_NODES
Martin Schwenke [Wed, 22 Jun 2016 01:02:36 +0000 (11:02 +1000)]
ctdb-tests: Drop CTDB_TEST_MAX_NODES

The node map is dynamically constructed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Build a node map instead of a hacky node flags array
Martin Schwenke [Wed, 22 Jun 2016 01:00:43 +0000 (11:00 +1000)]
ctdb-tests: Build a node map instead of a hacky node flags array

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Assign known and available arrays via pointers.
Martin Schwenke [Tue, 21 Jun 2016 05:26:05 +0000 (15:26 +1000)]
ctdb-tests: Assign known and available arrays via pointers.

No need to allocate these and iterate as
read_ctdb_public_ip_info_node() now returns a usable array.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: read_ctdb_public_ip_info() reads all test input
Martin Schwenke [Tue, 21 Jun 2016 05:14:33 +0000 (15:14 +1000)]
ctdb-tests: read_ctdb_public_ip_info() reads all test input

If there is per-node data then each chunk is read in a separate call
and is cherry-picked out into known_public_ips[] for each node.  This
is confusing.

Instead, a single call now reads all data for multiple nodes and
returns complete arrays of known and available IP addresses.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Drop CTDB_TEST_MAX_IPS
Martin Schwenke [Tue, 21 Jun 2016 04:49:28 +0000 (14:49 +1000)]
ctdb-tests: Drop CTDB_TEST_MAX_IPS

Arrays are now dynamically reallocated.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Drop all_ips argument from read_ctdb_public_ip_info()
Martin Schwenke [Tue, 21 Jun 2016 04:37:53 +0000 (14:37 +1000)]
ctdb-tests: Drop all_ips argument from read_ctdb_public_ip_info()

Nothing uses the result.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Don't bother setting all_ips
Martin Schwenke [Tue, 21 Jun 2016 04:29:25 +0000 (14:29 +1000)]
ctdb-tests: Don't bother setting all_ips

It isn't used outside this function.  Instead, update k directly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Simplify read_ctdb_public_ip_info() using new function add_ip()
Martin Schwenke [Tue, 21 Jun 2016 02:27:55 +0000 (12:27 +1000)]
ctdb-tests: Simplify read_ctdb_public_ip_info() using new function add_ip()

Known public IPs array is now dynamically allocated instead of
allocated once with artificial size limit.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tests: Remove unused tests from IP takeover test harness
Martin Schwenke [Sat, 21 May 2016 15:51:44 +0000 (01:51 +1000)]
ctdb-tests: Remove unused tests from IP takeover test harness

These tests aren't run anywhere.  They were used to test internal
functions during development.

The aim is to simplify this test program so that it can be linked with
the ipalloc subsystem, allowing removal of ctdbd_test.c and all of its
complications.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agotdb: avoid many fcntl calls when incrementing seqnum
Bob Campbell [Wed, 29 Jun 2016 21:51:23 +0000 (09:51 +1200)]
tdb: avoid many fcntl calls when incrementing seqnum

Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Jul  3 18:11:30 CEST 2016 on sn-devel-144

3 years agolib: talloc: Add check for destructor protection.
Andrew Bartlett [Wed, 29 Jun 2016 23:51:26 +0000 (16:51 -0700)]
lib: talloc: Add check for destructor protection.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: As we have a struct talloc_chunk * in _talloc_free_children_internal...
Andrew Bartlett [Wed, 29 Jun 2016 23:48:42 +0000 (16:48 -0700)]
lib: talloc: As we have a struct talloc_chunk * in _talloc_free_children_internal(), use it to call _tc_free_internal() directly.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: As _tc_free_internal() takes a struct talloc_chunk *, add an extra paran...
Andrew Bartlett [Wed, 29 Jun 2016 23:44:50 +0000 (16:44 -0700)]
lib: talloc: As _tc_free_internal() takes a struct talloc_chunk *, add an extra paranoia check against destructor overwrite.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Rename the internals of _talloc_free_internal() to _tc_free_internal().
Andrew Bartlett [Wed, 29 Jun 2016 23:41:52 +0000 (16:41 -0700)]
lib: talloc: Rename the internals of _talloc_free_internal() to _tc_free_internal().

Make it use a struct talloc_chunk *tc parameter. Define _talloc_free_internal()
in terms of _tc_free_internal().

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Call talloc_chunk_from_ptr() less often in __talloc_with_prefix()
Andrew Bartlett [Wed, 29 Jun 2016 22:46:37 +0000 (15:46 -0700)]
lib: talloc: Call talloc_chunk_from_ptr() less often in __talloc_with_prefix()

Rename 'ptc' pointer to parent as it's re-used as
that name later in the function.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Rename talloc_set_name_v() to tc_set_name_v(). Make it take a struct...
Andrew Bartlett [Fri, 24 Jun 2016 00:17:20 +0000 (17:17 -0700)]
lib: talloc: Rename talloc_set_name_v() to tc_set_name_v(). Make it take a struct talloc_chunk *tc as the first argument.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Add _vasprintf_tc() which returns the struct talloc_chunk *, not the...
Andrew Bartlett [Sat, 18 Jun 2016 03:49:24 +0000 (20:49 -0700)]
lib: talloc: Add _vasprintf_tc() which returns the struct talloc_chunk *, not the talloc'ed pointer.

Define talloc_vasprintf() in terms of _vasprintf_tc().
We will use _vasprintf_tc() internally later.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Change _talloc_set_name_const() to _tc_set_name_const()
Andrew Bartlett [Sat, 18 Jun 2016 03:40:56 +0000 (20:40 -0700)]
lib: talloc: Change _talloc_set_name_const() to _tc_set_name_const()

First argument is now struct talloc_chunk *tc.
Ensure all callers pass correct talloc chunk from given pointer.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Change __talloc() to return a struct talloc_chunk *.
Andrew Bartlett [Sat, 18 Jun 2016 00:06:52 +0000 (17:06 -0700)]
lib: talloc: Change __talloc() to return a struct talloc_chunk *.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Change __talloc_with_prefix() to return a struct talloc_chunk *.
Andrew Bartlett [Fri, 17 Jun 2016 23:58:34 +0000 (16:58 -0700)]
lib: talloc: Change __talloc_with_prefix() to return a struct talloc_chunk *.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib: talloc: Rename talloc_XXX() internal functions that take a 'struct talloc_chunk...
Jeremy Allison [Wed, 29 Jun 2016 23:25:30 +0000 (16:25 -0700)]
lib: talloc: Rename talloc_XXX() internal functions that take a 'struct talloc_chunk *' to tc_XXX().

We will be adding more and it ensures a consistent naming scheme.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotestprogs/blackbox: Improve the net ads dns register tests.
Richard Sharpe [Fri, 1 Jul 2016 04:07:19 +0000 (21:07 -0700)]
testprogs/blackbox: Improve the net ads dns register tests.

More tests are added that add an unprivileged user, enable their
account, and then test that they can add IP addressed but that they
cannot modify other user's IP addresses.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Sun Jul  3 14:24:59 CEST 2016 on sn-devel-144

3 years agoselftest: Add test for domain join + kerberos-only auth
Uri Simchoni [Thu, 30 Jun 2016 08:55:20 +0000 (11:55 +0300)]
selftest: Add test for domain join + kerberos-only auth

Add "net ads join/leave -k" tests to the net_ads test suite.

Shift the test suite from ad_member env to ad_dc env, because:
1. Seems more appropriate (the member server plays no role in this
   test)
2. The -k test breaks against the ntvfs file server for some reason,
   when trying to open the netlogon named pipe after having established
   the session with Kerberos (the create fails).

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jul  1 15:36:37 CEST 2016 on sn-devel-144

3 years agos3/winbindd: use == -1 instead of < 0 for error checking uid_t
Aurelien Aptel [Wed, 9 Mar 2016 12:43:09 +0000 (13:43 +0100)]
s3/winbindd: use == -1 instead of < 0 for error checking uid_t

The sign of the uid_t type is left unspecified by POSIX. It's defined as
an unsigned 32b int on Linux, therefore the < 0 check is always
false.

For unsigned version of uid_t, "uid == -1" will implicitely cast -1 to
unsigned making it a valid test for both signed and unsigned version of
uid_t.

This commit makes the cast to (uid_t) explicit anyway.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Jul  1 05:22:36 CEST 2016 on sn-devel-144

3 years agolibrpc: add decode_netlogon_samlogon_response_packet for mailslot debugging.
Günther Deschner [Tue, 28 Jun 2016 16:40:25 +0000 (18:40 +0200)]
librpc: add decode_netlogon_samlogon_response_packet for mailslot debugging.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul  1 01:29:42 CEST 2016 on sn-devel-144

3 years agokrb5pac.idl: introduce PAC_DOMAIN_GROUP_MEMBERSHIP to handle the resource groups
Stefan Metzmacher [Fri, 20 May 2016 12:16:35 +0000 (14:16 +0200)]
krb5pac.idl: introduce PAC_DOMAIN_GROUP_MEMBERSHIP to handle the resource groups

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun 30 07:16:45 CEST 2016 on sn-devel-144

3 years agonetlogon.idl: make netr_SidAttr public
Stefan Metzmacher [Fri, 20 May 2016 12:18:35 +0000 (14:18 +0200)]
netlogon.idl: make netr_SidAttr public

It will be used in krb5pac.idl soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>