abartlet/samba.git/.git
6 years agoselftest: Do not use -M single ldb-safe-locking-for-master
Andrew Bartlett [Mon, 12 Jun 2017 19:41:44 +0000 (07:41 +1200)]
selftest: Do not use -M single

Not only is this unrealistic (our users do not run Samba this way) it creates
issues as it relies on nested event loops, something that winbindd avoids
(and that we are trying to avoid elsewhere).

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoRevert "dsdb: Give LDB_ERR_OPERATIONS_ERROR if schema search gives != 1 result"
Andrew Bartlett [Mon, 12 Jun 2017 08:46:57 +0000 (20:46 +1200)]
Revert "dsdb: Give LDB_ERR_OPERATIONS_ERROR if schema search gives != 1 result"

This reverts commit 1be5f2e0fa22b07de9fbb83cc30efbee8e454199.

6 years agostream_terminate_connection: Prevent use-after-free
Garming Sam [Fri, 9 Jun 2017 02:13:25 +0000 (14:13 +1200)]
stream_terminate_connection: Prevent use-after-free

This sometimes would show up as corrupted bytes during logs. Hammering
the LDAP server enough times managed to trigger an outright segfault.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
6 years agoselftest: Add test for gss_krb5/ntlmssp -> SPNEGO
Andrew Bartlett [Mon, 12 Jun 2017 02:27:53 +0000 (14:27 +1200)]
selftest: Add test for gss_krb5/ntlmssp -> SPNEGO

These bare mechs are permitted to go direct to SPNEGO, which must cope with them

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoselftest: Add pygensec tests for GSS-SPNEGO and Win2000 emulated SPNEGO
Andrew Bartlett [Mon, 12 Jun 2017 02:12:53 +0000 (14:12 +1200)]
selftest: Add pygensec tests for GSS-SPNEGO and Win2000 emulated SPNEGO

This is to provide some unit testing coverage for these different modes of operation

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agokrb5_wrap: handle KRB5_ERR_HOST_REALM_UNKNOWN in smb_krb5_get_realm_from_hostname()
Stefan Metzmacher [Sun, 11 Jun 2017 21:19:01 +0000 (23:19 +0200)]
krb5_wrap: handle KRB5_ERR_HOST_REALM_UNKNOWN in smb_krb5_get_realm_from_hostname()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
6 years agodsdb: Give LDB_ERR_OPERATIONS_ERROR if schema search gives != 1 result
Andrew Bartlett [Sat, 10 Jun 2017 07:24:14 +0000 (19:24 +1200)]
dsdb: Give LDB_ERR_OPERATIONS_ERROR if schema search gives != 1 result

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Add comment explaining requirements on DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID
Andrew Bartlett [Sat, 10 Jun 2017 07:23:34 +0000 (19:23 +1200)]
dsdb: Add comment explaining requirements on DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoselftest: Add a test for @ATTRIBUTES and @INDEXLIST generation
Andrew Bartlett [Tue, 6 Jun 2017 23:47:15 +0000 (11:47 +1200)]
selftest: Add a test for @ATTRIBUTES and @INDEXLIST generation

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Do not run dsdb_replace() on the calculated difference between old and new...
Andrew Bartlett [Tue, 6 Jun 2017 22:44:50 +0000 (10:44 +1200)]
dsdb: Do not run dsdb_replace() on the calculated difference between old and new schema

We can set the database @INDEXLIST and @ATTRIBUTES to the full calculated
values, not the difference, and let the ldb layer work it out under the
transaction lock.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb: Lock the whole backend database for the duration of a search
Andrew Bartlett [Tue, 23 May 2017 03:14:28 +0000 (15:14 +1200)]
ldb: Lock the whole backend database for the duration of a search

We must hold locks not just for the duration of each search, but for the whole search
as our module stack may make multiple search requests to build up the whole result.

This is explains a number of replication and read corruption issues in Samba

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb_tdb: Implement OIDs LDB_EXTENDED_READ_LOCK_DB and LDB_EXTENDED_READ_UNLOCK_DB
Andrew Bartlett [Thu, 11 May 2017 23:39:08 +0000 (01:39 +0200)]
ldb_tdb: Implement OIDs LDB_EXTENDED_READ_LOCK_DB and LDB_EXTENDED_READ_UNLOCK_DB

This allows Samba to provide a consistent view of the DB
despite the use of multiple databases via the partitions module
and over multiple callbacks via a module stack.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Teach the Samba partition module how to lock all the DB backends
Andrew Bartlett [Tue, 23 May 2017 03:11:59 +0000 (15:11 +1200)]
dsdb: Teach the Samba partition module how to lock all the DB backends

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb: Add test encoding current locking behaviour during ldb_search()
Andrew Bartlett [Mon, 22 May 2017 04:18:20 +0000 (16:18 +1200)]
ldb: Add test encoding current locking behaviour during ldb_search()

Currently, a lock is not held against modifications once the final
record is returned via a callback, so modifications can be made
during the DONE callback.  This makes it hard to write modules
that interpert an ldb search result and do further processing
so will change in the future to allow the full search to be
atomic.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Allow locking requests no matter who the caller is
Andrew Bartlett [Tue, 23 May 2017 23:05:18 +0000 (11:05 +1200)]
dsdb: Allow locking requests no matter who the caller is

The LDB_EXTENDED_READ_LOCK_DB and LDB_EXTENDED_READ_UNLOCK_DB operations are not
exposed over LDAP

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb: Define OIDs LDB_EXTENDED_READ_LOCK_DB and LDB_EXTENDED_READ_UNLOCK_DB
Andrew Bartlett [Thu, 11 May 2017 23:38:14 +0000 (01:38 +0200)]
ldb: Define OIDs LDB_EXTENDED_READ_LOCK_DB and LDB_EXTENDED_READ_UNLOCK_DB

These will be used to allow Samba to provide a consistent view of the DB
despite the use of multiple databases via the partitions module

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Allocate OIDs for DB read lock and unlock
Andrew Bartlett [Thu, 11 May 2017 23:35:13 +0000 (01:35 +0200)]
dsdb: Allocate OIDs for DB read lock and unlock

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb: Rename module -> next_module for clarity
Andrew Bartlett [Tue, 30 May 2017 22:44:34 +0000 (10:44 +1200)]
ldb: Rename module -> next_module for clarity

This helps make some future commits less confusing

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Correctly call ldb_module_done in dsdb_notification
Andrew Bartlett [Wed, 31 May 2017 00:22:28 +0000 (12:22 +1200)]
dsdb: Correctly call ldb_module_done in dsdb_notification

If we just call ldb_request_done() then we never call the callback.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoTODO: ldb: version 1.1.31
Stefan Metzmacher [Tue, 11 Apr 2017 15:50:08 +0000 (17:50 +0200)]
TODO: ldb: version 1.1.31

* fix ldb_tdb locking (performance) problems
* fix ldb_tdb search inconsistencies
* add cmocka based tests for the locking issues

TODO: review...

6 years agoldb: Show that writes do not appear during an ldb_search()
Andrew Bartlett [Tue, 25 Apr 2017 10:33:53 +0000 (22:33 +1200)]
ldb: Show that writes do not appear during an ldb_search()

A modify or rename during a search must not cause a search to change
output, and attributes having an index should in particular not see
any change in behaviour in this respect

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb_tdb: Ensure we correctly decrement ltdb->read_lock_count
Garming Sam [Wed, 29 Mar 2017 23:03:17 +0000 (12:03 +1300)]
ldb_tdb: Ensure we correctly decrement ltdb->read_lock_count

If we do not do this, then we never take the all record lock, and instead do a lock
for every record as we go, which is very slow during a large search

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
6 years agoTODO: tdb: version 1.3.14
Stefan Metzmacher [Tue, 11 Apr 2017 15:27:33 +0000 (17:27 +0200)]
TODO: tdb: version 1.3.14

* allow tdb_traverse_read before tdb_transaction[_prepare]_commit()

6 years agotdb: Remove locking from tdb_traverse_read()
Andrew Bartlett [Fri, 31 Mar 2017 04:34:13 +0000 (17:34 +1300)]
tdb: Remove locking from tdb_traverse_read()

This restores the original intent of tdb_traverse_read() in
7dd31288a701d772e45b1960ac4ce4cc1be782ed

This is needed to avoid a deadlock with tdb_lockall() and the
transaction start, as ldb_tdb should take the allrecord lock during a
search (which calls tdb_traverse), and can otherwise deadlock against
a transaction starting in another process

We add a test to show that a transaction can now start while a read
traverse is in progress

This allows more operations to happen in parallel.  The blocking point
is moved to the prepare commit.

This in turn permits a roughly doubling of unindexed search
performance, because currently ldb_tdb omits to take the lock due to
an unrelated bug, but taking the allrecord lock triggers the
above-mentioned deadlock.

This behaviour was added in 251aaafe3a9213118ac3a92def9ab2104c40d12a for
Solaris 10 in 2005. But the run-fcntl-deadlock test works also on Solaris 10,
see https://lists.samba.org/archive/samba-technical/2017-April/119876.html.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agotdb: add run-fcntl-deadlock test
Stefan Metzmacher [Tue, 11 Apr 2017 15:21:20 +0000 (17:21 +0200)]
tdb: add run-fcntl-deadlock test

This verifies the F_RDLCK => F_WRLCK upgrade logic in the kernel
for conflicting locks.

This is a standalone test to check the traverse_read vs.
allrecord_lock/prepare_commit interaction.

This is based on the example from
https://lists.samba.org/archive/samba-technical/2017-April/119861.html
from Douglas Bagnall <douglas.bagnall@catalyst.net.nz> and Volker Lendecke <vl@samba.org>.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
6 years agoldb_tdb: Improve logging on unique index violation
Andrew Bartlett [Fri, 9 Jun 2017 02:15:19 +0000 (14:15 +1200)]
ldb_tdb: Improve logging on unique index violation

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb_tdb: Remove the idxptr DB before we re-index
Andrew Bartlett [Fri, 9 Jun 2017 02:09:30 +0000 (14:09 +1200)]
ldb_tdb: Remove the idxptr DB before we re-index

We do not want the cache or any of the values in it, we want to read the real DB
@INDEX: records.

This matters if a re-index is tiggered in the same transaction
as the modify of the values in the index.  Otherwise we won't see
the old index record (it will not show up in the tdb_traverse)
and so fail to remove it.

That in turn can cause a spurious unqiue index violation.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb_tdb: Check for memory allocation failure in ltdb_index_transaction_start()
Andrew Bartlett [Fri, 9 Jun 2017 02:07:40 +0000 (14:07 +1200)]
ldb_tdb: Check for memory allocation failure in ltdb_index_transaction_start()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Provide proper errors when dsdb_schema_set_indices_and_attributes fails
Andrew Bartlett [Fri, 9 Jun 2017 00:06:37 +0000 (12:06 +1200)]
dsdb: Provide proper errors when dsdb_schema_set_indices_and_attributes fails

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Do not prevent searches for @ATTRIBUTES because the DB is not set up yet
Andrew Bartlett [Thu, 8 Jun 2017 11:17:20 +0000 (23:17 +1200)]
dsdb: Do not prevent searches for @ATTRIBUTES because the DB is not set up yet

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agodsdb: Rework schema_init module to avoid database write and use valid memory
Andrew Bartlett [Thu, 8 Jun 2017 11:05:26 +0000 (23:05 +1200)]
dsdb: Rework schema_init module to avoid database write and use valid memory

The schema can go away unless the second argument (the memory context) is supplied

There is no need to write the @ATTRIBUTES and @INDEXLIST on every DB load
we only need to write it if the schema is changed, and the repl_meta_data module
will notice if that happens and trigger the DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID
extended operation.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agotevent: Fix a race condition in tevent context rundown
Volker Lendecke [Wed, 24 May 2017 14:22:34 +0000 (16:22 +0200)]
tevent: Fix a race condition in tevent context rundown

We protect setting tctx->event_ctx=NULL with tctx->event_ctx_mutex.
But in _tevent_threaded_schedule_immediate we have the classic
TOCTOU race: After we checked "ev==NULL", looking at
tevent_common_context_destructor the event context can go after
_tevent_threaded_schedule_immediate checked. We need to serialize
things a bit by keeping tctx->event_ctx_mutex locked while we
reference "ev", in particular in the

DLIST_ADD_END(ev->scheduled_immediates,im);

I think the locking hierarchy is still maintained, tevent_atfork_prepare()
first locks all the tctx locks, and then the scheduled_mutex.  Also,
I don't think this will impact parallelism too badly: event_ctx_mutex
is only used to protect setting tctx->ev.

Found by staring at code while fixing the FreeBSD memleak due to
not destroying scheduled_mutex.

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 Jun  9 00:45:26 CEST 2017 on sn-devel-144

6 years agotevent: Fix a memleak on FreeBSD
Volker Lendecke [Wed, 24 May 2017 14:21:40 +0000 (16:21 +0200)]
tevent: Fix a memleak on FreeBSD

FreeBSD has malloc'ed memory attached to mutexes. We need to clean this up.

valgrind really helped here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotevent: Add tevent_re_initialise to threaded test
Volker Lendecke [Mon, 5 Jun 2017 05:29:11 +0000 (07:29 +0200)]
tevent: Add tevent_re_initialise to threaded test

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotevent: Re-init threading in tevent_re_initialise
Volker Lendecke [Mon, 5 Jun 2017 05:16:17 +0000 (07:16 +0200)]
tevent: Re-init threading in tevent_re_initialise

Without this threading is not usable after that call

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotevent: Factor out context initialization
Volker Lendecke [Mon, 5 Jun 2017 04:58:37 +0000 (06:58 +0200)]
tevent: Factor out context initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotevent: Fix a typo
Volker Lendecke [Mon, 5 Jun 2017 05:23:27 +0000 (07:23 +0200)]
tevent: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agomessaging: fix net command failure due to unhandled return code
David Mulder via samba-technical [Wed, 7 Jun 2017 12:43:07 +0000 (06:43 -0600)]
messaging: fix net command failure due to unhandled return code

messaging_init_internal() blanket returned NT_STATUS_INTERNAL_ERROR
instead of correctly changing the return code to an NTSTATUS code. Also
return more appropriate mem error.

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

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Thu Jun  8 08:04:05 CEST 2017 on sn-devel-144

6 years agoWHATSNEW: Add Dynamic RPC port range
Andreas Schneider [Wed, 7 Jun 2017 14:18:11 +0000 (16:18 +0200)]
WHATSNEW: Add Dynamic RPC port range

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jun  8 00:27:24 CEST 2017 on sn-devel-144

6 years agoctdb-client: Document ctdb client API
Amitay Isaacs [Thu, 1 Jun 2017 06:03:43 +0000 (16:03 +1000)]
ctdb-client: Document ctdb client API

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): Wed Jun  7 20:19:06 CEST 2017 on sn-devel-144

6 years agoctdb-client: Move eventd API to a separate header
Amitay Isaacs [Thu, 1 Jun 2017 04:22:03 +0000 (14:22 +1000)]
ctdb-client: Move eventd API to a separate header

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Move sync API to a separate header
Amitay Isaacs [Sat, 6 May 2017 10:01:30 +0000 (20:01 +1000)]
ctdb-client: Move sync API to a separate header

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Move ctdb_ctrl_modflags() to ctdb tool
Amitay Isaacs [Wed, 19 Apr 2017 01:46:48 +0000 (11:46 +1000)]
ctdb-client: Move ctdb_ctrl_modflags() to ctdb tool

This function is only required by the tool.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Add async api for detaching a database
Amitay Isaacs [Tue, 18 Apr 2017 06:44:29 +0000 (16:44 +1000)]
ctdb-client: Add async api for detaching a database

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Create sync wrappers for managing message handlers
Amitay Isaacs [Tue, 18 Apr 2017 06:22:12 +0000 (16:22 +1000)]
ctdb-client: Create sync wrappers for managing message handlers

This wraps the entire async computation for setting and removing message
handlers instead of calling multiple sync calls.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-tools: Use traverse api to re-implement ctdb catdb command
Amitay Isaacs [Tue, 4 Apr 2017 08:30:01 +0000 (18:30 +1000)]
ctdb-tools: Use traverse api to re-implement ctdb catdb command

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Refactor cluster-wide database traverse api
Amitay Isaacs [Tue, 4 Apr 2017 08:25:28 +0000 (18:25 +1000)]
ctdb-client: Refactor cluster-wide database traverse api

This implements the async version of the traverse code in the ctdb tool
for catdb command.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-protocol: Allocate SRVID range for ctdb client
Amitay Isaacs [Thu, 1 Jun 2017 06:43:55 +0000 (16:43 +1000)]
ctdb-protocol: Allocate SRVID range for ctdb client

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Rename ctdb_db_travese to ctdb_db_traverse_local
Amitay Isaacs [Tue, 4 Apr 2017 07:31:11 +0000 (17:31 +1000)]
ctdb-client: Rename ctdb_db_travese to ctdb_db_traverse_local

This function only traverses the database on local node.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoLog the actual error returned when creating a pipe for client logging in CTDB fails...
Richard Sharpe [Tue, 6 Jun 2017 20:34:51 +0000 (13:34 -0700)]
Log the actual error returned when creating a pipe for client logging in CTDB fails. Helps with debugging issues.

Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun  7 09:22:29 CEST 2017 on sn-devel-144

6 years agos3:tests: Add a test which checks that the smbclient session setup works
Andreas Schneider [Tue, 6 Jun 2017 15:54:18 +0000 (17:54 +0200)]
s3:tests: Add a test which checks that the smbclient session setup works

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:libsmb: Fix printing the session setup information
Andreas Schneider [Tue, 6 Jun 2017 15:29:16 +0000 (17:29 +0200)]
s3:libsmb: Fix printing the session setup information

This fixes a regression and prints the session setup on connect again:

Domain=[SAMBA-TEST] OS=[Windows 6.1] Server=[Samba 4.7.0pre1-DEVELOPERBUILD]
smb: \>

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibcli:smb: Fix pulling strings from the wire
Andreas Schneider [Tue, 6 Jun 2017 15:27:44 +0000 (17:27 +0200)]
libcli:smb: Fix pulling strings from the wire

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibcli:util: Update werror table
Andreas Schneider [Tue, 6 Jun 2017 14:07:10 +0000 (16:07 +0200)]
libcli:util: Update werror table

This adds ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED for MS-PAR.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoselftest/rodc: Do not run in single mode, this causes deadlocks
Garming Sam [Wed, 15 Mar 2017 03:40:16 +0000 (16:40 +1300)]
selftest/rodc: Do not run in single mode, this causes deadlocks

Attempting to 'ls' the file server against a single process AD will get
stuck. This also appears as the KDC being busy.

Signed-off-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): Wed Jun  7 05:14:17 CEST 2017 on sn-devel-144

6 years agos3/utils: Add warning to testparm for "client ipc signing" param values
Noel Power [Fri, 2 Jun 2017 14:50:48 +0000 (15:50 +0100)]
s3/utils: Add warning to testparm for "client ipc signing" param values

We should warn about security sensitive settings where we can,
client ipc signing has 2 values that can allow connections to proceed
without SMB signing. This may be unavoidable (e.g. connecting to legacy
systems) but nevertheless it is worthwhile to warn.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun  6 22:40:12 CEST 2017 on sn-devel-144

6 years agounittest: Add testsuite for smb_probe_module()
Andreas Schneider [Fri, 12 May 2017 12:13:42 +0000 (14:13 +0200)]
unittest: Add testsuite for smb_probe_module()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolib:util: Make loading of modules more secure
Andreas Schneider [Mon, 15 May 2017 09:08:19 +0000 (11:08 +0200)]
lib:util: Make loading of modules more secure

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolib:util: Make probing of modules more secure
Andreas Schneider [Mon, 15 May 2017 09:05:59 +0000 (11:05 +0200)]
lib:util: Make probing of modules more secure

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolib:util: Rename smb_load_modules()
Andreas Schneider [Mon, 15 May 2017 08:49:07 +0000 (10:49 +0200)]
lib:util: Rename smb_load_modules()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolib:util: Add new function to load modules from absolute path
Andreas Schneider [Mon, 15 May 2017 07:06:51 +0000 (09:06 +0200)]
lib:util: Add new function to load modules from absolute path

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agounittest: Add testsuite for is_known_pipename()
Andreas Schneider [Thu, 11 May 2017 09:29:25 +0000 (11:29 +0200)]
unittest: Add testsuite for is_known_pipename()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agowafsamba: Pass down the install argument for samba modules
Andreas Schneider [Thu, 11 May 2017 09:29:50 +0000 (11:29 +0200)]
wafsamba: Pass down the install argument for samba modules

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolib: Fix illegal use of 0-length arrays
Volker Lendecke [Mon, 29 May 2017 19:13:16 +0000 (21:13 +0200)]
lib: Fix illegal use of 0-length arrays

Found and confirmed to work by albert chin (china@thewrittenword.com)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agowscript: Fix some typos
Anoop C S [Mon, 5 Jun 2017 16:40:44 +0000 (22:10 +0530)]
wscript: Fix some typos

Signed-off-by: Anoop C S <anoopcs@redhat.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): Tue Jun  6 05:26:37 CEST 2017 on sn-devel-144

7 years agoselftest: use an additional directory of knownfail/flapping files
Douglas Bagnall [Thu, 1 Jun 2017 03:26:48 +0000 (15:26 +1200)]
selftest: use an additional directory of knownfail/flapping files

This makes it easier to add a temporary knownfail to cover a patch
series.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Jun  3 13:55:41 CEST 2017 on sn-devel-144

7 years agovfs_gpfs: Fix compile error in gpfsacl_sys_acl_set_fd
Christof Schmitt [Fri, 2 Jun 2017 23:16:16 +0000 (16:16 -0700)]
vfs_gpfs: Fix compile error in gpfsacl_sys_acl_set_fd

../source3/modules/vfs_gpfs.c: In function ‘gpfsacl_sys_acl_set_fd’:
../source3/modules/vfs_gpfs.c:1280:6: error: passing argument 2 of ‘gpfsacl_sys_acl_set_file’ from incompatible pointer type [-Werror]
      SMB_ACL_TYPE_ACCESS, theacl);
      ^
../source3/modules/vfs_gpfs.c:1235:12: note: expected ‘const struct smb_filename *’ but argument is of type ‘char *’
 static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jun  3 05:52:32 CEST 2017 on sn-devel-144

7 years agos4:torture: Fix comparison between pointer and zero character constant
Andreas Schneider [Thu, 1 Jun 2017 12:28:08 +0000 (14:28 +0200)]
s4:torture: Fix comparison between pointer and zero character constant

Fixes building with GCC 7.1

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun  1 23:42:58 CEST 2017 on sn-devel-144

7 years agowaf: Do not trhow a format-truncation error for test/snprintf.c
Andreas Schneider [Thu, 1 Jun 2017 12:24:42 +0000 (14:24 +0200)]
waf: Do not trhow a format-truncation error for test/snprintf.c

This fixes building with GCC 7.1

Error:
../lib/replace/test/testsuite.c:355:6: error: ‘%d’ directive output
truncated writing 1 byte into a region of size 0
[-Werror=format-truncation=]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agoreplace: Use the same size as d_name member of struct dirent
Andreas Schneider [Thu, 1 Jun 2017 12:16:56 +0000 (14:16 +0200)]
replace: Use the same size as d_name member of struct dirent

This fixes an error with GCC 7.1

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agopassword_hash: conditional compilation for crypt_r
Gary Lockyer [Tue, 30 May 2017 22:35:25 +0000 (10:35 +1200)]
password_hash: conditional compilation for crypt_r

Add check for crypt_r, and if absent fall back to crypt

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 years agodnsserver: Stop dns_name_equal doing OOB read
Garming Sam [Thu, 1 Jun 2017 02:36:07 +0000 (14:36 +1200)]
dnsserver: Stop dns_name_equal doing OOB read

This has been the cause of a large number of flakey autobuilds. Every
now and again dns_name_equal would not be equal between two empty
strings, thus causing failures.

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=12813

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  1 19:34:38 CEST 2017 on sn-devel-144

7 years agoctdb-common: Fix crash in logging initialisation
Martin Schwenke [Thu, 1 Jun 2017 04:37:40 +0000 (14:37 +1000)]
ctdb-common: Fix crash in logging initialisation

Setting CTDB_LOGGING to syslog:nonblocking or syslog:udp will cause
ctdbd to crash at startup due to NULL pointer dereference.
Refactoring in commit c9124a001f5abf7bb577a8f5341da4cc7411ed22
introduced this regression.

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

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): Thu Jun  1 15:26:19 CEST 2017 on sn-devel-144

7 years agomit_samba: Fix the MIT KDC build with the latest changes
Andreas Schneider [Tue, 30 May 2017 11:58:43 +0000 (13:58 +0200)]
mit_samba: Fix the MIT KDC build with the latest changes

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Thu Jun  1 07:12:47 CEST 2017 on sn-devel-144

7 years agos3: VFS: Change SMB_VFS_GETXATTR to use const struct smb_filename * instead of const...
Jeremy Allison [Thu, 25 May 2017 23:42:04 +0000 (16:42 -0700)]
s3: VFS: Change SMB_VFS_GETXATTR to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun  1 02:58:53 CEST 2017 on sn-devel-144

7 years agos3: VFS: Change SMB_VFS_SETXATTR to use const struct smb_filename * instead of const...
Jeremy Allison [Thu, 25 May 2017 19:41:31 +0000 (12:41 -0700)]
s3: VFS: Change SMB_VFS_SETXATTR to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agos3: VFS: Change SMB_VFS_REMOVEXATTR to use const struct smb_filename * instead of...
Jeremy Allison [Wed, 24 May 2017 18:35:50 +0000 (11:35 -0700)]
s3: VFS: Change SMB_VFS_REMOVEXATTR to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agos3: VFS: Change SMB_VFS_LISTXATTR to use const struct smb_filename * instead of const...
Jeremy Allison [Tue, 23 May 2017 20:12:29 +0000 (13:12 -0700)]
s3: VFS: Change SMB_VFS_LISTXATTR to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agos3: VFS: Change SMB_VFS_SYS_ACL_SET_FILE to use const struct smb_filename * instead...
Jeremy Allison [Wed, 24 May 2017 17:47:46 +0000 (10:47 -0700)]
s3: VFS: Change SMB_VFS_SYS_ACL_SET_FILE to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agos3: VFS: Change SMB_VFS_SYS_ACL_BLOB_GET_FILE to use const struct smb_filename *...
Jeremy Allison [Wed, 24 May 2017 00:35:59 +0000 (17:35 -0700)]
s3: VFS: Change SMB_VFS_SYS_ACL_BLOB_GET_FILE to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agos3: VFS: Change SMB_VFS_SYS_ACL_GET_FILE to use const struct smb_filename * instead...
Jeremy Allison [Wed, 24 May 2017 00:11:18 +0000 (17:11 -0700)]
s3: VFS: Change SMB_VFS_SYS_ACL_GET_FILE to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Requires a few extra cleanups in calling code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agos3: VFS: Change SMB_VFS_SYS_ACL_DELETE_DEF_FILE to use const struct smb_filename...
Jeremy Allison [Tue, 23 May 2017 22:33:31 +0000 (15:33 -0700)]
s3: VFS: Change SMB_VFS_SYS_ACL_DELETE_DEF_FILE to use const struct smb_filename * instead of const char *.

We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agos3: lib: Add new utility function cp_smb_filename_nostream().
Jeremy Allison [Tue, 30 May 2017 18:46:49 +0000 (11:46 -0700)]
s3: lib: Add new utility function cp_smb_filename_nostream().

Will be needed when we migrate lower-level VFS functions to
take an struct smb_filename *, especially the SYS_ACL and
XATTR modification modules, as these must ignore a passed-in
stream name.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agodsdb: Use ldb_handle_use_global_event_context for rootdse modifies
Andrew Bartlett [Thu, 11 May 2017 23:55:45 +0000 (01:55 +0200)]
dsdb: Use ldb_handle_use_global_event_context for rootdse modifies

The modify operations on the rootDSE turn into IRPC messages, and these need
to be handled on the global event context, not the per-operation context

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed May 31 10:47:46 CEST 2017 on sn-devel-144

7 years agoschema: Use ldb_schema_set_override_indexlist for faster index selection
Andrew Bartlett [Thu, 30 Mar 2017 00:25:35 +0000 (13:25 +1300)]
schema: Use ldb_schema_set_override_indexlist for faster index selection

This allows Samba to provide a binary tree lookup for the existance of an index on the attribute
rather than the O(n) lookup that was being done for each attribute during a search or modify

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Version 1.1.30
Andrew Bartlett [Thu, 30 Mar 2017 00:54:58 +0000 (13:54 +1300)]
ldb: Version 1.1.30

* let ldbdump parse the -i option
* don't allow the reveal_internals control for ldbedit
* only allow --show-binary for ldbsearch
* don't let ldbsearch create non-existing files
* fix ldb_tdb search inconsistencies
* add cmocka based tests
* provide an interface for improved indexing for callers
  like Samba, which will allow much better performance.
* Makes ldb access to tdb:// databases use a private event context
  rather than the global event context passed in by the caller.
  This is because running other operations while locks are held
  or a search is being conducted is not safe.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Add Doxygen documentation for ldb_handle_use_global_event_context()
Andrew Bartlett [Tue, 30 May 2017 09:12:33 +0000 (21:12 +1200)]
ldb: Add Doxygen documentation for ldb_handle_use_global_event_context()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoldb: Add Doxygen docs for ldb_set_require_private_event_context()
Andrew Bartlett [Tue, 30 May 2017 09:17:57 +0000 (21:17 +1200)]
ldb: Add Doxygen docs for ldb_set_require_private_event_context()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoldb: Add Doxygen docs for ldb_handle_get_event_context()
Andrew Bartlett [Thu, 4 May 2017 09:39:21 +0000 (11:39 +0200)]
ldb: Add Doxygen docs for ldb_handle_get_event_context()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoldb: Add Doxygen docs for ldb_schema_set_override_indexlist()
Andrew Bartlett [Tue, 30 May 2017 09:04:02 +0000 (21:04 +1200)]
ldb: Add Doxygen docs for ldb_schema_set_override_indexlist()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoldb: Add Doxygen docs for ldb_schema_attribute_set_override_handler
Andrew Bartlett [Tue, 30 May 2017 09:00:34 +0000 (21:00 +1200)]
ldb: Add Doxygen docs for ldb_schema_attribute_set_override_handler

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoldb: Add Doxygen comments for ldb_req_*trusted() functions
Andrew Bartlett [Tue, 30 May 2017 08:57:23 +0000 (20:57 +1200)]
ldb: Add Doxygen comments for ldb_req_*trusted() functions

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoldb: Add test for ldb_build_search_req()
Andrew Bartlett [Tue, 30 May 2017 02:59:16 +0000 (14:59 +1200)]
ldb: Add test for ldb_build_search_req()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Add tests for new ldb handle and event context behaviour
Andrew Bartlett [Tue, 30 May 2017 02:39:49 +0000 (14:39 +1200)]
ldb: Add tests for new ldb handle and event context behaviour

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Add ldb_handle_use_global_event_context()
Andrew Bartlett [Fri, 5 May 2017 06:25:40 +0000 (08:25 +0200)]
ldb: Add ldb_handle_use_global_event_context()

This will allow the IRPC to be processed in the main event loop of the
server, not the private event context for this request

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Use the private event context in ldb_tdb and ldb_wait()
Andrew Bartlett [Fri, 12 May 2017 00:30:01 +0000 (02:30 +0200)]
ldb: Use the private event context in ldb_tdb and ldb_wait()

This enables the previous commits, and ensures that ldb_tdb is safe from operations while locks
are held

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Force use of a private event context in ldb_tdb
Andrew Bartlett [Fri, 12 May 2017 00:28:02 +0000 (02:28 +0200)]
ldb: Force use of a private event context in ldb_tdb

ldb_tdb holds locks while making callbacks, so force the use of a per-request event context

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Create private event contexts in top level requests, chain to children
Andrew Bartlett [Fri, 12 May 2017 00:26:04 +0000 (02:26 +0200)]
ldb: Create private event contexts in top level requests, chain to children

We must ensure that the ldb_request we call ldb_wait() will share an event context with all
the eventual request that the ldb backend creates events on

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Add ldb_set_require_private_event_context()
Andrew Bartlett [Fri, 12 May 2017 00:21:28 +0000 (02:21 +0200)]
ldb: Add ldb_set_require_private_event_context()

This will allow us to force use of the global event context for use when Samba
must make an IRPC call from within the ldb stack, to another part of the same
process

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldb: Add ldb_handle_get_event_context()
Andrew Bartlett [Thu, 4 May 2017 09:39:21 +0000 (11:39 +0200)]
ldb: Add ldb_handle_get_event_context()

This will allow us to obtain a private event context for use while we hold
locks in ldb_tdb, that is not shared with the global state of the application.

This will ensure we do not perform other operations while we hold the lock

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>