gd/samba-autobuild/.git
6 years agoldb tests: add cmocka tests of kv operation interactions with transactions
Gary Lockyer [Mon, 19 Mar 2018 23:15:12 +0000 (12:15 +1300)]
ldb tests: add cmocka tests of kv operation interactions with transactions

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb tests: api ensure database correctly populated
Gary Lockyer [Mon, 19 Mar 2018 23:14:10 +0000 (12:14 +1300)]
ldb tests: api ensure database correctly populated

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb_tdb: Disallow reads without a transaction or read lock
Andrew Bartlett [Wed, 4 Apr 2018 05:21:30 +0000 (17:21 +1200)]
ldb_tdb: Disallow reads without a transaction or read lock

This will ensure we match LMDB behaviour and avoid a repeat of the per-record locking
issues (compared with full DB locking) we had before Samba 4.7.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 years agoldb_tdb: Disallow TDB nested transactions and use tdb_transaction_active()
Gary Lockyer [Thu, 22 Mar 2018 22:28:18 +0000 (11:28 +1300)]
ldb_tdb: Disallow TDB nested transactions and use tdb_transaction_active()

This avoids keeping a counter, which can be error-prone.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
6 years agoldb_tdb: Do not make search or DB modifications without a lock
Gary Lockyer [Thu, 22 Mar 2018 22:27:10 +0000 (11:27 +1300)]
ldb_tdb: Do not make search or DB modifications without a lock

The ldb_cache startup code would previously not take a read lock
nor a sufficiently wide write transaction.

The new code takes a read lock, and if it needs to write takes a
write lock (transaction) and re-reads before continuing.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb: make key/value backends expose if there is an active transaction
Gary Lockyer [Mon, 19 Mar 2018 22:25:28 +0000 (11:25 +1300)]
ldb: make key/value backends expose if there is an active transaction

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
6 years agoldb_tdb: Make sure max_key_length != 0 requires a GUID index mode
Gary Lockyer [Tue, 6 Mar 2018 02:27:51 +0000 (15:27 +1300)]
ldb_tdb: Make sure max_key_length != 0 requires a GUID index mode

We need to enforce the GUID index mode so end-users do not get a supprise
in mid-operation and we enforce a max key length of 511 so that the
index key trunctation is done correctly.

Otherwise the DB will appear to work until a very long key (DN or index)
is used, after which it will be sad.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agoldb/tests: don't use TEVENT_DEPRECATED in ldb_kv_ops_test.c
Stefan Metzmacher [Thu, 12 Apr 2018 12:31:20 +0000 (14:31 +0200)]
ldb/tests: don't use TEVENT_DEPRECATED in ldb_kv_ops_test.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 years agogitlab-ci: Run samba-ad-dc-2 in the shared environment
Andrew Bartlett [Mon, 30 Apr 2018 08:38:43 +0000 (20:38 +1200)]
gitlab-ci: Run samba-ad-dc-2 in the shared environment

This will allow more AD DC tests to run for those without access
to a private gitlab runner.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agogitlab-ci: Use YAML templates to reduce duplication
Andrew Bartlett [Mon, 30 Apr 2018 08:31:19 +0000 (20:31 +1200)]
gitlab-ci: Use YAML templates to reduce duplication

Inspired by WIP patches by Jamie McClymont

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agogitlab-ci: split up gitlab-ci file
Andrew Bartlett [Mon, 30 Apr 2018 08:18:52 +0000 (20:18 +1200)]
gitlab-ci: split up gitlab-ci file

The "private" build environments are not available to most users so
remove this from the default build.  Only developers with access
to private runners (rather than a shared runner) will have a runner
tagged as "private".

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoautobuild: Extend build combinations tested to include --without-ldap
Andrew Bartlett [Tue, 1 May 2018 21:04:51 +0000 (09:04 +1200)]
autobuild: Extend build combinations tested to include --without-ldap

This bumps --without-ads to the samba-nt4 job so that option alone is still covered.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: Allow make test to run with --address-sanitizer
Andrew Bartlett [Thu, 3 May 2018 03:47:45 +0000 (15:47 +1200)]
selftest: Allow make test to run with --address-sanitizer

Recent GCC versions enforce that the library must be in LD_PRELOAD if linked to a plugin
(like a python module).

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agos4-lsa: Fix use-after-free in LSA server
Andrew Bartlett [Thu, 3 May 2018 04:22:19 +0000 (16:22 +1200)]
s4-lsa: Fix use-after-free in LSA server

This is a regression introduced in ab7988aa2fd1a43f576a4b73a6893c61c7ef1957.

The state variable contains the data to be returned to the client
and packed into NDR after the function returned.

This memory needs to be kept (on mem_ctx as parent) until that is
pushed and freed by the caller.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoFix some incorrect debug messages that look to be copy-paste issues.
Richard Sharpe [Wed, 2 May 2018 22:12:44 +0000 (15:12 -0700)]
Fix some incorrect debug messages that look to be copy-paste issues.

Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu May  3 08:16:26 CEST 2018 on sn-devel-144

6 years agopython.gpo.ADS_STRUCT: check type of loadparm argument
Douglas Bagnall [Fri, 13 Apr 2018 00:29:05 +0000 (12:29 +1200)]
python.gpo.ADS_STRUCT: check type of loadparm argument

And add a test showning the segfault.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agosamba_dnsupdate: Put samba.kcc import after path insert of bin/python
Garming Sam [Tue, 27 Mar 2018 02:24:44 +0000 (15:24 +1300)]
samba_dnsupdate: Put samba.kcc import after path insert of bin/python

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agos3: libsmbclient: Fix hard-coded connection error return of ETIMEDOUT.
Jeremy Allison [Wed, 2 May 2018 18:19:31 +0000 (11:19 -0700)]
s3: libsmbclient: Fix hard-coded connection error return of ETIMEDOUT.

We shouldn't hard-code the connection error as ETIMEDOUT when
we have a perfectly good NT_STATUS to map from.

Found by the ChromeOS guys trying to connect an SMB2-only client
to an SMB1-only supporting server.

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

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 May  3 02:42:20 CEST 2018 on sn-devel-144

6 years agos3: VFS: Default. Move vfs_read_data() out of source3/smbd/vfs.c to the printing...
Jeremy Allison [Mon, 30 Apr 2018 17:15:49 +0000 (10:15 -0700)]
s3: VFS: Default. Move vfs_read_data() out of source3/smbd/vfs.c to the printing code, which is the only caller.

Make static.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May  2 22:20:23 CEST 2018 on sn-devel-144

6 years agos3: VFS: default: Remove recursion into the VFS inside the default pread call.
Jeremy Allison [Mon, 30 Apr 2018 16:51:34 +0000 (09:51 -0700)]
s3: VFS: default: Remove recursion into the VFS inside the default pread call.

We already know we're at the POSIX level here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agos3: VFS: default: Remove fallback if we don't have HAVE_PREAD set. Samba doesn't...
Jeremy Allison [Mon, 30 Apr 2018 16:50:04 +0000 (09:50 -0700)]
s3: VFS: default: Remove fallback if we don't have HAVE_PREAD set. Samba doesn't work without pread.

Start of the changes to remove synchronous VFS read.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agos3: VFS: Remove fsync_fn() from the VFS and all modules. VFS ABI change.
Jeremy Allison [Sat, 28 Apr 2018 00:06:10 +0000 (17:06 -0700)]
s3: VFS: Remove fsync_fn() from the VFS and all modules. VFS ABI change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May  2 01:06:28 CEST 2018 on sn-devel-144

6 years agos3: vfs: Use the new smb_vfs_fsync_sync() call in place of SMB_VFS_FSYNC().
Jeremy Allison [Fri, 27 Apr 2018 23:59:42 +0000 (16:59 -0700)]
s3: vfs: Use the new smb_vfs_fsync_sync() call in place of SMB_VFS_FSYNC().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agos3: VFS: Add a synchronous smb_vfs_fsync_sync() call, built from async primitives.
Jeremy Allison [Fri, 27 Apr 2018 23:59:02 +0000 (16:59 -0700)]
s3: VFS: Add a synchronous smb_vfs_fsync_sync() call, built from async primitives.

Will be used in the next commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agoctdb-scripts: Remove function rewrite_ctdb_options()
Martin Schwenke [Thu, 19 Apr 2018 11:57:07 +0000 (21:57 +1000)]
ctdb-scripts: Remove function rewrite_ctdb_options()

This is no longer necessary after the removal of support for
CTDB_DBDIR=tmpfs.

File-local variable ctdb_rundir is no longer used, so drop it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue May  1 16:20:37 CEST 2018 on sn-devel-144

6 years agoctdb-scripts: Drop support for CTDB_DBDIR=tmpfs
Martin Schwenke [Thu, 19 Apr 2018 11:54:11 +0000 (21:54 +1000)]
ctdb-scripts: Drop support for CTDB_DBDIR=tmpfs

CTDB has no business mounting filesystems.  Instead, documentation
for the new configuration system will include a recommendation that a
tmpfs be mounted on the volatile database directory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Change default volatile database directory
Martin Schwenke [Thu, 26 Apr 2018 01:58:13 +0000 (11:58 +1000)]
ctdb-daemon: Change default volatile database directory

Volatile databases now have their own subdirectory.  This makes things
easier if we later recommend mounting a tmpfs on the volatile database
directory, rather than supporting the current CTDB_DBDIR=tmpfs magic.

No need to create database directories for local daemon tests.  ctdbd
will do that.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: CTDB_DBDIR_PERSISTENT should not depend on CTDB_DBDIR
Martin Schwenke [Mon, 30 Apr 2018 10:44:36 +0000 (20:44 +1000)]
ctdb-tests: CTDB_DBDIR_PERSISTENT should not depend on CTDB_DBDIR

Add new variable CTDB_DBDIR_BASE, just for event script unit tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Fix location of persistent databases
Martin Schwenke [Mon, 30 Apr 2018 10:26:20 +0000 (20:26 +1000)]
ctdb-scripts: Fix location of persistent databases

If CTDB_DBDIR_PERSISTENT is not set then set the default relative to
CTDB_VARDIR.  The persistent database directory is not (necessarily)
relative to the volatile one.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Fix location of persistent databases
Martin Schwenke [Mon, 30 Apr 2018 10:24:40 +0000 (20:24 +1000)]
ctdb-tests: Fix location of persistent databases

Always use CTDB_DBDIR_PERSISTENT, which is setup by the test
infrastructure.  The persistent database directory is
not (necessarily) relative to the volatile one.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Drop UDP/file logging warning from ctdbd_wrapper
Martin Schwenke [Mon, 16 Apr 2018 09:08:20 +0000 (19:08 +1000)]
ctdb-scripts: Drop UDP/file logging warning from ctdbd_wrapper

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Log the logging location when not logging via syslog()
Martin Schwenke [Mon, 16 Apr 2018 09:05:54 +0000 (19:05 +1000)]
ctdb-daemon: Log the logging location when not logging via syslog()

A variant of this is currently done by the wrapper but will be removed
from there because the wrapper will no longer see the CTDB_LOGGING
option.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Drop warning when there is no recovery lock
Martin Schwenke [Sat, 14 Apr 2018 11:38:32 +0000 (21:38 +1000)]
ctdb-scripts: Drop warning when there is no recovery lock

After configuration changes ctdbd_wrapper will no longer see the
CTDB_RECOVERY_LOCK option.  The daemon already logs a warning if the
recovery lock is not set, so simply drop this extra warning.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Reorder main() to improve the structure
Martin Schwenke [Wed, 18 Apr 2018 00:57:54 +0000 (10:57 +1000)]
ctdb-daemon: Reorder main() to improve the structure

Move code into clearly defined sections.  Add a fail label for fatal
errors to ensure memory is freed.  Modernise debug messages.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Consolidate basic CTDB context initialisation
Martin Schwenke [Wed, 18 Apr 2018 04:44:01 +0000 (14:44 +1000)]
ctdb-daemon: Consolidate basic CTDB context initialisation

None of this initialisation needs configuration options, so centralise
it with the context initialisation.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Drop duplicate initialisation of request ID context
Martin Schwenke [Wed, 18 Apr 2018 00:51:26 +0000 (10:51 +1000)]
ctdb-daemon: Drop duplicate initialisation of request ID context

This doesn't require configuration options so keep the instance in
ctdb_init().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Move ctdb_init() to the only place it is used
Martin Schwenke [Wed, 18 Apr 2018 00:36:05 +0000 (10:36 +1000)]
ctdb-daemon: Move ctdb_init() to the only place it is used

This used to be used by client code but not anymore, so move it to
where it is used.  Drop the comment because it is wrong.  Modernise
logging.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-docs: Move remaining test options to README
Martin Schwenke [Thu, 5 Apr 2018 06:12:31 +0000 (16:12 +1000)]
ctdb-docs: Move remaining test options to README

Test options do not belong in the user documentation.  Move them to
the README file in the tests/ subdirectory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Drop ctdbd --torture and --valgrinding options
Martin Schwenke [Wed, 18 Apr 2018 00:21:20 +0000 (10:21 +1000)]
ctdb-daemon: Drop ctdbd --torture and --valgrinding options

These haven't been used by anyone in a long time.  --valgrinding is
less use with CTDB_VALGRINDING now gone.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Drop CTDB_VALGRIND testing option
Martin Schwenke [Mon, 30 Apr 2018 06:01:57 +0000 (16:01 +1000)]
ctdb-scripts: Drop CTDB_VALGRIND testing option

This is too inflexible for general use.  There is no use finding a new
home for this in the new configuration scheme.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Drop ctdbd --sloppy-start and --nopublicipcheck options
Martin Schwenke [Thu, 5 Apr 2018 06:25:14 +0000 (16:25 +1000)]
ctdb-daemon: Drop ctdbd --sloppy-start and --nopublicipcheck options

CTDB_LOCAL_DAEMON_MODE=yes is used instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Make local daemon tests depend on CTDB_TEST_MODE
Martin Schwenke [Thu, 5 Apr 2018 05:46:53 +0000 (15:46 +1000)]
ctdb-tests: Make local daemon tests depend on CTDB_TEST_MODE

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Add testing environment variable CTDB_TEST_MODE
Martin Schwenke [Thu, 5 Apr 2018 05:37:42 +0000 (15:37 +1000)]
ctdb-daemon: Add testing environment variable CTDB_TEST_MODE

This is a generic indicator that tests are being run.

For local daemons, this will replace --sloppy-start and
--nopublicipcheck - it also does --nosetsched, which isn't being
removed at this point.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Drop ctdbd --notification-script command-line option
Martin Schwenke [Thu, 29 Mar 2018 04:25:47 +0000 (15:25 +1100)]
ctdb-daemon: Drop ctdbd --notification-script command-line option

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Drop CTDB_NOTIFY_SCRIPT configuration option
Martin Schwenke [Thu, 29 Mar 2018 04:11:04 +0000 (15:11 +1100)]
ctdb-scripts: Drop CTDB_NOTIFY_SCRIPT configuration option

Notification scripts are installed into $CTDB_BASE/notify.d/ and are
always run by notify.sh.  Leave notify.sh where it is for now but no
longer consider it a configuration file.  This is an interim measure
and will be changed again soon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tests: Ensure notify.sh is available to local daemons
Martin Schwenke [Fri, 30 Mar 2018 09:46:41 +0000 (20:46 +1100)]
ctdb-tests: Ensure notify.sh is available to local daemons

Changes to notification configuration are coming, so ensure notify.sh
is always "installed" for local daemons.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Provide a default location for the notification script
Martin Schwenke [Thu, 29 Mar 2018 03:58:49 +0000 (14:58 +1100)]
ctdb-daemon: Provide a default location for the notification script

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Use a local variable instead of repeating getenv()
Martin Schwenke [Thu, 26 Apr 2018 10:32:30 +0000 (20:32 +1000)]
ctdb-daemon: Use a local variable instead of repeating getenv()

Makes the error handling easier and the code more compact.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Drop unused function ctdb_set_notification_script()
Martin Schwenke [Thu, 29 Mar 2018 04:32:53 +0000 (15:32 +1100)]
ctdb-daemon: Drop unused function ctdb_set_notification_script()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Set ctdb->notification_script directly
Martin Schwenke [Thu, 29 Mar 2018 03:50:17 +0000 (14:50 +1100)]
ctdb-daemon: Set ctdb->notification_script directly

This doesn't need a wrapper function.  It gets in the way if building
a value involves allocating memory (e.g. talloc_asprintf()) and then
ctdb_set_notification_script() duplicates that memory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-docs: Move some configuration options out of the debug section
Martin Schwenke [Tue, 1 May 2018 04:05:32 +0000 (14:05 +1000)]
ctdb-docs: Move some configuration options out of the debug section

These aren't test options so improve their visibility.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-docs: Move some ctdbd options out of the debug section
Martin Schwenke [Thu, 5 Apr 2018 06:11:48 +0000 (16:11 +1000)]
ctdb-docs: Move some ctdbd options out of the debug section

ctdbd -i might be useful with systemd or similar, so should be
documented.

--nosetsched and --script-log-level options are valid user-level
options.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-build: Rename ctdb-client2 subsystem to ctdb-client
Amitay Isaacs [Mon, 30 Apr 2018 09:38:47 +0000 (19:38 +1000)]
ctdb-build: Rename ctdb-client2 subsystem to ctdb-client

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-daemon: Move ctdb_client.c to server/ subdir
Amitay Isaacs [Mon, 30 Apr 2018 09:36:43 +0000 (19:36 +1000)]
ctdb-daemon: Move ctdb_client.c to server/ subdir

It is used only by the code in the server directory.  It's mainly used
in recovery daemon and vacuuming child process.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-build: Drop unnessary dependency on ctdb-client
Amitay Isaacs [Mon, 30 Apr 2018 09:37:04 +0000 (19:37 +1000)]
ctdb-build: Drop unnessary dependency on ctdb-client

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Remove ununsed functions from old client code
Amitay Isaacs [Mon, 30 Apr 2018 09:32:13 +0000 (19:32 +1000)]
ctdb-client: Remove ununsed functions from old client code

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoceph: VFS: Add asynchronous fsync to ceph module, fake using synchronous call.
Jeremy Allison [Fri, 27 Apr 2018 21:25:54 +0000 (14:25 -0700)]
ceph: VFS: Add asynchronous fsync to ceph module, fake using synchronous call.

This will allow me to ultimately simplify the VFS by removing the synchronous
fsync VFS call.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Apr 30 21:48:55 CEST 2018 on sn-devel-144

6 years agopython/samba: Py2/Py3 compat change '/' to '//' to ensure int result
Noel Power [Fri, 27 Apr 2018 07:15:28 +0000 (08:15 +0100)]
python/samba: Py2/Py3 compat change '/' to '//' to ensure int result

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Apr 30 18:25:25 CEST 2018 on sn-devel-144

6 years agopython/samba: port some isinstance str checks (to cater for unicode)
Noel Power [Thu, 26 Apr 2018 09:38:57 +0000 (10:38 +0100)]
python/samba: port some isinstance str checks (to cater for unicode)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agopython: Bulk conversion callers of ldb.Dn second param
Noel Power [Wed, 25 Apr 2018 19:01:49 +0000 (20:01 +0100)]
python: Bulk conversion callers of ldb.Dn second param

Convert second param passed to ldb.Dn to be unicode so py2 & py3 code
will work

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agopython/samba: bulk conversion of caller to dsdb_Dn 2nd param.
Noel Power [Wed, 25 Apr 2018 17:28:30 +0000 (18:28 +0100)]
python/samba: bulk conversion of caller to dsdb_Dn 2nd param.

Convert second param to dsdb_Dn to be unicode so py2 & py3 code
will work

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agopython/samba: Add binary_type for p2/p3 testing.
Noel Power [Tue, 24 Apr 2018 15:28:41 +0000 (16:28 +0100)]
python/samba: Add binary_type for p2/p3 testing.

For helping test for binary types, binary_type evaluates to 'str'
in py2, and 'bytes' in py3.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agoAdd aliases for StringIO.StringIO
Noel Power [Tue, 17 Apr 2018 12:52:58 +0000 (13:52 +0100)]
Add aliases for StringIO.StringIO

cStringIO doesn't handle unicode, StringIO does. With py2/py3
compatable code we can easily find ourselves getting passed
unicode so we don't alias cStringIO

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agopython/samba: Add some compatability PY2/PY3 functions
Noel Power [Fri, 13 Apr 2018 10:19:10 +0000 (11:19 +0100)]
python/samba: Add some compatability PY2/PY3 functions

I hope these changes are a short term interim solution for the
absence of the 'six' module/library. I also hope that soon this
module can be removed and be replaced by usage of six.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agos4/param: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:34:40 +0000 (17:34 +0100)]
s4/param: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agos4/librpc: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:34:19 +0000 (17:34 +0100)]
s4/librpc: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agos4/dsdb: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:33:47 +0000 (17:33 +0100)]
s4/dsdb: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agos4/auth: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:33:10 +0000 (17:33 +0100)]
s4/auth: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agolibcli/nbt: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:32:15 +0000 (17:32 +0100)]
libcli/nbt: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agolib/tevent: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:17:20 +0000 (17:17 +0100)]
lib/tevent: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agolib/ldb: Additionally accept unicode as string param in Py2
Noel Power [Thu, 12 Apr 2018 13:46:59 +0000 (14:46 +0100)]
lib/ldb: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agosamba-tool visualize: use correct DC in graph label
Douglas Bagnall [Thu, 19 Apr 2018 22:52:31 +0000 (10:52 +1200)]
samba-tool visualize: use correct DC in graph label

We have been using a random DC (depending to hash order, which was not
random enough on Python 2.7 to affect the tests).

Reported-by: Noel Power <noel.power@suse.com>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
6 years agoctdb-tests: Fix a typo
Martin Schwenke [Mon, 30 Apr 2018 02:07:48 +0000 (12:07 +1000)]
ctdb-tests: Fix a typo

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 Apr 30 14:26:43 CEST 2018 on sn-devel-144

6 years agoctdb-tests: Simplify a test
Martin Schwenke [Mon, 26 Feb 2018 19:40:59 +0000 (06:40 +1100)]
ctdb-tests: Simplify a test

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Drop CTDB_RC_LOCAL testing hook
Martin Schwenke [Thu, 5 Apr 2018 06:09:22 +0000 (16:09 +1000)]
ctdb-scripts: Drop CTDB_RC_LOCAL testing hook

This is not used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Apr 27 09:37:49 CEST 2018 on sn-devel-144

6 years agoctdb-scripts: Drop unused variable service_config
Martin Schwenke [Wed, 4 Apr 2018 09:00:56 +0000 (19:00 +1000)]
ctdb-scripts: Drop unused variable service_config

This was previously used by the loadconfig() function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-docs: Drop documentation for CTDB_SHUTDOWN_TIMEOUT option
Martin Schwenke [Wed, 4 Apr 2018 08:17:13 +0000 (18:17 +1000)]
ctdb-docs: Drop documentation for CTDB_SHUTDOWN_TIMEOUT option

This was recently removed but the documentation was forgotten.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-docs: Drop stale reference to unused configuration file
Martin Schwenke [Thu, 29 Mar 2018 04:42:10 +0000 (15:42 +1100)]
ctdb-docs: Drop stale reference to unused configuration file

Recently removed but documentation change was forgotten.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-docs: Drop references to CTDB_BASE from the documentation
Martin Schwenke [Thu, 29 Mar 2018 04:38:13 +0000 (15:38 +1100)]
ctdb-docs: Drop references to CTDB_BASE from the documentation

CTDB_BASE should only ever be modified by test code.  It should not be
mentioned in the user documentation.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-tools: Avoid filtering stderr when onnode not running in parallel
Martin Schwenke [Tue, 17 Apr 2018 22:05:25 +0000 (08:05 +1000)]
ctdb-tools: Avoid filtering stderr when onnode not running in parallel

stderr_filter() only does anything useful when running in
parallel (i.e. with the -p option).  So, simplify the non-parallel
case by not using stderr_filter().

As a side-effect, this fixes an issue introduced in commit
85a4375788d8ef8345ec390807f18299abdadb20 where local daemon tests
would hang when trying to start daemons with VALGRIND set (to a
valgrind command that does not use --log-file).  This is because
valgrind would keep stderr open for its output so the pipeline
involving stderr_filter() would never complete.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-scripts: Avoid shellcheck SC1117: Backslash is literal in "..."
Martin Schwenke [Thu, 19 Apr 2018 01:54:26 +0000 (11:54 +1000)]
ctdb-scripts: Avoid shellcheck SC1117: Backslash is literal in "..."

This warning (apparently new in shellcheck 0.4.7) only applies to
double-quoted strings.  Change affected constant strings to use
single-quotes.  In the one example that contains a variable expansion
escape the backslash as recommended.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb: Fix some -Werror=strict-overflow issues
Martin Schwenke [Mon, 16 Apr 2018 08:32:07 +0000 (18:32 +1000)]
ctdb: Fix some -Werror=strict-overflow issues

All quite obvious.  For the LCP2 one, we're not actually counting so
use a bool instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoscript/git-hooks: add check-trailing-whitespace
Ralph Boehme [Tue, 10 Apr 2018 11:19:09 +0000 (13:19 +0200)]
script/git-hooks: add check-trailing-whitespace

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Apr 26 03:54:39 CEST 2018 on sn-devel-144

6 years agoAdd a wrapper script as git pre-commit hook
Ralph Boehme [Tue, 10 Apr 2018 11:04:27 +0000 (13:04 +0200)]
Add a wrapper script as git pre-commit hook

When developer mode is enabled, the wrapper script
"script/git-hooks/pre-commit-hook" gets installed as

  .git/hooks/pre-commit

and calls "script/git-hooks/pre-commit-script".

This way we can later modify the "script/git-hooks/pre-commit-script"
without the need to ever change the installed commit hook itself.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Jeremy Allison <jra at samba.org>
6 years agorpc_server: Fix NetSessEnum with stale sessions
Christof Schmitt [Tue, 24 Apr 2018 20:53:41 +0000 (13:53 -0700)]
rpc_server: Fix NetSessEnum with stale sessions

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

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): Wed Apr 25 22:49:07 CEST 2018 on sn-devel-144

6 years agoselftest: Add testcase for querying sessions after smbd crash
Christof Schmitt [Tue, 24 Apr 2018 20:52:59 +0000 (13:52 -0700)]
selftest: Add testcase for querying sessions after smbd crash

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agorpcclient: Print number of entries for NetSessEnum
Christof Schmitt [Tue, 24 Apr 2018 19:18:49 +0000 (12:18 -0700)]
rpcclient: Print number of entries for NetSessEnum

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos4/smbd/server.c: create /run if missing
William Brown [Wed, 18 Apr 2018 09:44:33 +0000 (19:44 +1000)]
s4/smbd/server.c: create /run if missing

In some cases (containers mainly) /var/run may not be present. Instead of
erroring, we should create it at startup.

Signed-off-by: William Brown <william@blackhats.net.au>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoprinting: return the same error code as windows does on upload failures
Björn Jacke [Thu, 19 Apr 2018 14:14:38 +0000 (16:14 +0200)]
printing: return the same error code as windows does on upload failures

Some print drivers inf files are broken and cause driver installation to fail
on Samba servers. Windows returns WERR_APP_INIT_FAILURE in that case, we should
do the same. Windows machines are less unlucky with that.

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Wed Apr 25 13:55:25 CEST 2018 on sn-devel-144

6 years agolib: #include "util_event.h" only where needed
Volker Lendecke [Tue, 24 Apr 2018 12:19:48 +0000 (14:19 +0200)]
lib: #include "util_event.h" only where needed

One dependency of includes.h less

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): Tue Apr 24 22:26:22 CEST 2018 on sn-devel-144

6 years agotevent: Fix callers of tevent_req_set_endtime
Volker Lendecke [Mon, 23 Apr 2018 13:36:28 +0000 (15:36 +0200)]
tevent: Fix callers of tevent_req_set_endtime

tevent_req_set_endtime internally already calls tevent_req_nomem and thus sets
the error status correctly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotorture3: Fix CID 1435119 Error handling issues (CHECKED_RETURN)
Volker Lendecke [Tue, 24 Apr 2018 08:37:26 +0000 (10:37 +0200)]
torture3: Fix CID 1435119 Error handling issues (CHECKED_RETURN)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:util: remove reinit_after_fork_pipe_handler before sending SIGTERM
Stefan Metzmacher [Thu, 22 Mar 2018 11:32:15 +0000 (12:32 +0100)]
s3:util: remove reinit_after_fork_pipe_handler before sending SIGTERM

We should not keep the tevent_fd active when we sending us a SIGTERM,
this is not a real problem, but due to a different bug I triggered
a 100% cpu loop. I think it's safer to idle in that case instead
of waisting a lot of energy.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agowinbind: Speed up wbinfo -p
Volker Lendecke [Wed, 18 Apr 2018 15:29:51 +0000 (17:29 +0200)]
winbind: Speed up wbinfo -p

This was (possibly) used as an example in the early days of the async winbind
code we have today. It's not necessary to send this through a full tevent_req
round.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 24 17:18:23 CEST 2018 on sn-devel-144

6 years agonsswitch: Only connect to the priv socket if required
Volker Lendecke [Mon, 23 Apr 2018 10:13:40 +0000 (12:13 +0200)]
nsswitch: Only connect to the priv socket if required

This should speed up calls like "wbinfo -p"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agontlm_auth: PAM_AUTH_CRAP needs a privileged socket
Volker Lendecke [Mon, 23 Apr 2018 12:04:48 +0000 (14:04 +0200)]
ntlm_auth: PAM_AUTH_CRAP needs a privileged socket

This only works right now because wb_common always tries privileged

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agonsswitch: fix memory leak in winbind_open_pipe_sock() when the privileged pipe is...
Stefan Metzmacher [Tue, 24 Apr 2018 08:59:05 +0000 (10:59 +0200)]
nsswitch: fix memory leak in winbind_open_pipe_sock() when the privileged pipe is not accessable.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agos3:messages: improve tevent_create_immediate recycling
Ralph Boehme [Tue, 27 Mar 2018 14:04:58 +0000 (16:04 +0200)]
s3:messages: improve tevent_create_immediate recycling

We should create the immediate event at the beginning
were we have a chance to return an error, rather than
ignoring a failure later.

As a side effect this also reuses the immediate event
after the refcount went to 0 and up again.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Apr 24 14:30:20 CEST 2018 on sn-devel-144

6 years agos3:messages: check tevent_fd_get_flags() == 0 before using stale event context pointer
Ralph Boehme [Tue, 27 Mar 2018 13:27:32 +0000 (15:27 +0200)]
s3:messages: check tevent_fd_get_flags() == 0 before using stale event context pointer

If the event context got deleted, tevent_fd_get_flags() will return 0
for the stale fde.  In that case we should not use fde_ev->ev anymore.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agos3:messages: check reg->refcount == 0 before accessing other elements
Ralph Boehme [Tue, 27 Mar 2018 14:05:30 +0000 (16:05 +0200)]
s3:messages: check reg->refcount == 0 before accessing other elements

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>