samba.git
14 months agopthreadpool: add pthreadpool_max_threads() and pthreadpool_queued_jobs() helpers
Stefan Metzmacher [Thu, 21 Jun 2018 22:49:33 +0000 (00:49 +0200)]
pthreadpool: add pthreadpool_max_threads() and pthreadpool_queued_jobs() helpers

These can be used to implement some kind of flow control in the caller.
E.g. unless pthreadpool_queued_jobs() is lower than
pthreadpool_max_threads() is good to prepare new jobs.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: expand test_create() to check unlimited, sync and one thread pool
Stefan Metzmacher [Fri, 22 Jun 2018 06:39:36 +0000 (08:39 +0200)]
pthreadpool: expand test_create() to check unlimited, sync and one thread pool

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: fix helgrind error in pthreadpool_free()
Stefan Metzmacher [Thu, 21 Jun 2018 10:40:30 +0000 (12:40 +0200)]
pthreadpool: fix helgrind error in pthreadpool_free()

We need to pthread_mutex_lock/unlock the pool mutex
before we can destroy it.

The following test would trigger this.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: use talloc_zero() in tests_cmocka.c setup_pthreadpool_tevent()
Stefan Metzmacher [Wed, 20 Jun 2018 13:38:08 +0000 (15:38 +0200)]
pthreadpool: use talloc_zero() in tests_cmocka.c setup_pthreadpool_tevent()

This was found with valgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: use strict sync processing only with max_threads=0
Stefan Metzmacher [Thu, 21 Jun 2018 22:29:53 +0000 (00:29 +0200)]
pthreadpool: use strict sync processing only with max_threads=0

Otherwise it's an error if not at least one thread is possible.

This gives a much saner behaviour and doesn't end up with
unexpected sync processing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: consitently use unlock_res for pthread_mutex_unlock() in pthreadpool_add...
Stefan Metzmacher [Thu, 21 Jun 2018 22:27:39 +0000 (00:27 +0200)]
pthreadpool: consitently use unlock_res for pthread_mutex_unlock() in pthreadpool_add_job()

This makes further restructuring easier to implement and understand.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agos3:messages: explicitly use max_thread=unlimited for pthreadpool_tevent_init() in...
Stefan Metzmacher [Thu, 21 Jun 2018 22:10:08 +0000 (00:10 +0200)]
s3:messages: explicitly use max_thread=unlimited for pthreadpool_tevent_init() in messaging_dgm_init()

Currently 0 also means unlimited, but that will change soon,
to force no thread and strict sync processing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: explicitly use max_thread=unlimited for pthreadpool_tevent_init() tests
Stefan Metzmacher [Thu, 21 Jun 2018 22:10:08 +0000 (00:10 +0200)]
pthreadpool: explicitly use max_thread=unlimited for pthreadpool_tevent_init() tests

Currently 0 also means unlimited, but that will change soon,
to force no thread and strict sync processing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: use unsigned for num_idle, num_threads and max_threads
Stefan Metzmacher [Thu, 21 Jun 2018 22:04:48 +0000 (00:04 +0200)]
pthreadpool: use unsigned for num_idle, num_threads and max_threads

These can't get negative.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agopthreadpool: correctly handle pthreadpool_tevent_register_ev() failures
Stefan Metzmacher [Fri, 20 Apr 2018 13:05:44 +0000 (15:05 +0200)]
pthreadpool: correctly handle pthreadpool_tevent_register_ev() failures

It returns errno values instead of setting 'errno'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: remove unused change_to_root_user() from brl_timeout_fn()
Ralph Boehme [Wed, 23 May 2018 14:28:48 +0000 (16:28 +0200)]
smbd: remove unused change_to_root_user() from brl_timeout_fn()

This is handled by using the root_ev_ctx in order to register
the timer event.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: remove unused change_to_root_user() from smbd_sig_hup_handler()
Stefan Metzmacher [Wed, 18 Apr 2018 12:29:52 +0000 (14:29 +0200)]
smbd: remove unused change_to_root_user() from smbd_sig_hup_handler()

This is handled by using the root_ev_ctx in order to register
the signal event.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: avoid explicit change_to_user() in defer_rename_done() already done by imperson...
Stefan Metzmacher [Thu, 21 Jun 2018 17:20:53 +0000 (19:20 +0200)]
smbd: avoid explicit change_to_user() in defer_rename_done() already done by impersonation

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: implement smbd_impersonate_{conn_vuid,conn_sess,root,guest}_create() wrappers
Stefan Metzmacher [Fri, 11 May 2012 13:51:42 +0000 (15:51 +0200)]
smbd: implement smbd_impersonate_{conn_vuid,conn_sess,root,guest}_create() wrappers

This makes sure we're doing the correct impersonation for async
requests, which is a requirement to start adding path based
async SMB_VFS calls.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: make use of smbd_impersonate_{conn_vuid,conn_sess,root,guest}_create() wrappers
Stefan Metzmacher [Thu, 22 Mar 2018 09:54:41 +0000 (10:54 +0100)]
smbd: make use of smbd_impersonate_{conn_vuid,conn_sess,root,guest}_create() wrappers

For now they just add debugging, but that will change shortly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: add simple noop smbd_impersonate_{conn_vuid,conn_sess,root,guest}_create()...
Stefan Metzmacher [Thu, 22 Mar 2018 09:54:41 +0000 (10:54 +0100)]
smbd: add simple noop smbd_impersonate_{conn_vuid,conn_sess,root,guest}_create() wrappers

As a start these are just wrappers arround
smbd_impersonate_debug_create(), without any real impersonation.
But this will change shortly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: add smbd_impersonate_debug_create() helper
Stefan Metzmacher [Fri, 23 Mar 2018 06:47:38 +0000 (07:47 +0100)]
smbd: add smbd_impersonate_debug_create() helper

This will be used to implement no-op impersonation
for the create_conn_struct_as_root() case were we
don't really have other unrelated events in the loop
and only need a valid tevent wrapper context to avoid
double free on the raw event context on teardown.

This also adds useful debugging instead of being
a full no-op wrapper.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agosmbd: add [un]become_guest() helper functions
Stefan Metzmacher [Fri, 25 May 2018 14:22:33 +0000 (16:22 +0200)]
smbd: add [un]become_guest() helper functions

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agoWHATSNEW: Start release notes for Samba 4.10.
Karolin Seeger [Thu, 12 Jul 2018 08:15:44 +0000 (10:15 +0200)]
WHATSNEW: Start release notes for Samba 4.10.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agoVERSION: Bump version up to 4.10.0pre1...
Karolin Seeger [Thu, 12 Jul 2018 08:11:01 +0000 (10:11 +0200)]
VERSION: Bump version up to 4.10.0pre1...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agoVERSION: Bump version up to 4.9.0rc1... samba-4.9.0rc1
Karolin Seeger [Thu, 12 Jul 2018 08:08:13 +0000 (10:08 +0200)]
VERSION: Bump version up to 4.9.0rc1...

and disable GIT_SNAPSHOT for the release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agoWHATSNEW: Add release notes for Samba 4.9.0rc1.
Karolin Seeger [Thu, 12 Jul 2018 08:07:36 +0000 (10:07 +0200)]
WHATSNEW: Add release notes for Samba 4.9.0rc1.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agoWHATSNEW: Add information on new GPO features
Andrew Bartlett [Thu, 12 Jul 2018 04:14:27 +0000 (16:14 +1200)]
WHATSNEW: Add information on new GPO features

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agoWHATSNEW.txt: CTDB updates for 4.9
Martin Schwenke [Mon, 26 Mar 2018 04:37:25 +0000 (15:37 +1100)]
WHATSNEW.txt: CTDB updates for 4.9

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agoldb: version 1.4.1 ldb-1.4.1
Stefan Metzmacher [Wed, 11 Jul 2018 20:21:32 +0000 (22:21 +0200)]
ldb: version 1.4.1

* add some missing return value checks
* Fix several mem leaks in ldb_index ldb_search ldb_tdb (bug#13475)
* ldb_tdb: Use mem_ctx and so avoid leak onto long-term memory
  on duplicated add. (bug#13471)
* ldb: Fix memory leak on module context (bug#13459)
* Refused build of Samba 4.8 with ldb 1.4 (bug #13519)
* Prevent similar issues in the future at configure time (bug #13519)

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 Jul 12 07:43:22 CEST 2018 on sn-devel-144

14 months agotalloc: version 2.1.14 talloc-2.1.14
Stefan Metzmacher [Wed, 11 Jul 2018 20:19:26 +0000 (22:19 +0200)]
talloc: version 2.1.14

* Fix some typos in the comments
* Remove extra 0x prefix for the "%p" format specifiers,
  avoiding 0x0x0 strings in the output.
* make sure we link extra-python versions of libraries

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotdb: version 1.3.16 tdb-1.3.16
Stefan Metzmacher [Wed, 11 Jul 2018 20:15:30 +0000 (22:15 +0200)]
tdb: version 1.3.16

* Fix build on AIX
* Python3 compatibility fixes
* Use tdb_wipe_all in "erase" command
* Harden allocating the tdb recovery area
* Make sure the hash size fits
* Harden tdb_check_used_record against overflow
* Harden tdb_rec_read
* Handle TDB_NEXT_LOCK_ERR in tdb_traverse_internal
* Fix build warnings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agoldb: Refuse to build Samba against a newer minor version of ldb
Andrew Bartlett [Thu, 12 Jul 2018 00:34:56 +0000 (12:34 +1200)]
ldb: Refuse to build Samba against a newer minor version of ldb

Samba is not compatible with new versions of ldb (except release versions)

Other users would not notice the breakages, but Samba makes many
more assuptions about the LDB internals than any other package.

(Specifically, LDB 1.2 and 1.4 broke builds against released
Samba versions)

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agoldb: Ban ldb 1.4.x with Samba 4.8 and earlier
Andrew Bartlett [Wed, 11 Jul 2018 01:41:58 +0000 (13:41 +1200)]
ldb: Ban ldb 1.4.x with Samba 4.8 and earlier

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agodocs: Remove mention of --without-json-audit from the AD DC
Andrew Bartlett [Wed, 11 Jul 2018 23:56:40 +0000 (11:56 +1200)]
docs: Remove mention of --without-json-audit from the AD DC

This is no longer optional for the AD DC.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agoWHATSNEW: Explain that Jansson is requied for AD DC, mention --without-json-audit
Andrew Bartlett [Wed, 11 Jul 2018 23:54:56 +0000 (11:54 +1200)]
WHATSNEW: Explain that Jansson is requied for AD DC, mention --without-json-audit

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agoWHATSNEW: document sysvolreset improvement
Andrew Bartlett [Wed, 11 Jul 2018 04:12:53 +0000 (16:12 +1200)]
WHATSNEW: document sysvolreset improvement

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agotests/posixacl: Test with and without filling in the unix_token
Andrew Bartlett [Wed, 11 Jul 2018 05:08:34 +0000 (17:08 +1200)]
tests/posixacl: Test with and without filling in the unix_token

Sadly the unix token cannot be created without a running winbindd,
which is not available during provision and a domain restore.

(Internally in smbd a backup API via passdb is used, but this
is not connected to this function at this time)

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agopython: Add samba.auth.session_info_fill_unix()
Andrew Bartlett [Wed, 11 Jul 2018 04:48:40 +0000 (16:48 +1200)]
python: Add samba.auth.session_info_fill_unix()

This fills in the unix portions of the token needed by smbd and the pysmbd bindings

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-programmed-with: Joe Guo <joeg@catalyst.net.nz>
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agoselftest: Add tests for samba.auth.admin_session()
Andrew Bartlett [Wed, 11 Jul 2018 04:48:07 +0000 (16:48 +1200)]
selftest: Add tests for samba.auth.admin_session()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Pair-programmed-with: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agoWHATSNEW: Fix spelling
Andrew Bartlett [Wed, 11 Jul 2018 10:01:29 +0000 (22:01 +1200)]
WHATSNEW: Fix spelling

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agodocs: Explain that "max xmit" is SMB1 only
Andrew Bartlett [Fri, 6 Jul 2018 20:51:59 +0000 (08:51 +1200)]
docs: Explain that "max xmit" is SMB1 only

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agoWHATSNEW: Add note about defaults changes for the vfs_full_audit and acceptance of...
Timur I. Bakeyev [Sun, 8 Jul 2018 14:09:59 +0000 (16:09 +0200)]
WHATSNEW: Add note about defaults changes for the vfs_full_audit and acceptance of all syslog facilities for all audit modules.

Signed-off-by: Timur I. Bakeyev <timur@iXsystems.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
14 months agotests/posixacl: derive a new testcase to run same tests with session
Joe Guo [Thu, 5 Jul 2018 22:36:54 +0000 (10:36 +1200)]
tests/posixacl: derive a new testcase to run same tests with session

1. existing tests still run with session_info=None
2. new class override `get_session_info` to return a session, so same
set of tests will run again, but with session.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agotests/posixacl: move setUp and tearDown to top
Joe Guo [Thu, 5 Jul 2018 22:32:17 +0000 (10:32 +1200)]
tests/posixacl: move setUp and tearDown to top

Make it clear to find out what we have in test.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agotests/posixacl: rm duplicated test
Joe Guo [Wed, 4 Jul 2018 03:50:40 +0000 (15:50 +1200)]
tests/posixacl: rm duplicated test

There are 2 copy of `test_setposixacl_getposixacl`, this patch removed
the first copy, which was overwritten by the second one.

They are 99% the same except in the last line a_perm is 6 vs 7, and 7 is
the correct number.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agotests/posixacl: use assertRaises to simplify code
Joe Guo [Wed, 4 Jul 2018 03:35:14 +0000 (15:35 +1200)]
tests/posixacl: use assertRaises to simplify code

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agotests/posixacl: remove unused imports
Joe Guo [Wed, 4 Jul 2018 03:28:16 +0000 (15:28 +1200)]
tests/posixacl: remove unused imports

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agotests/posixacl: define global ACL to make code DRY
Joe Guo [Wed, 4 Jul 2018 03:25:56 +0000 (15:25 +1200)]
tests/posixacl: define global ACL to make code DRY

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agotests/posixacl: define global DOM_SID to make code DRY
Joe Guo [Wed, 4 Jul 2018 03:18:26 +0000 (15:18 +1200)]
tests/posixacl: define global DOM_SID to make code DRY

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agotests/posixacl: rm commented code
Joe Guo [Wed, 4 Jul 2018 02:52:02 +0000 (14:52 +1200)]
tests/posixacl: rm commented code

The example is already in code, no need to keep it here.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agoprovision/setsysvolacl: create helper function to simplify code
Joe Guo [Wed, 4 Jul 2018 01:03:44 +0000 (13:03 +1200)]
provision/setsysvolacl: create helper function to simplify code

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agoprovision/setsysvolacl: build session_info and pass down to setntacl
Joe Guo [Wed, 4 Jul 2018 00:07:25 +0000 (12:07 +1200)]
provision/setsysvolacl: build session_info and pass down to setntacl

Get the admin session info, and pass it down to setntacl.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agontacls: add session_info arg to setntacl and pass down to set_nt_acl api
Joe Guo [Tue, 3 Jul 2018 22:27:23 +0000 (10:27 +1200)]
ntacls: add session_info arg to setntacl and pass down to set_nt_acl api

Then underneath code can reuse the authentication info in session to
improve performance.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agontacls: reuse predefined SECURITY_SECINFO_FLAGS
Joe Guo [Mon, 2 Jul 2018 22:20:39 +0000 (10:20 +1200)]
ntacls: reuse predefined SECURITY_SECINFO_FLAGS

Use predefined SECURITY_SECINFO_FLAGS to replace bitwise or operations
on flag list.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agosmbd/posix_acls: reuse secutiry token from session info if exist
Joe Guo [Tue, 3 Jul 2018 23:09:50 +0000 (11:09 +1200)]
smbd/posix_acls: reuse secutiry token from session info if exist

If session info was passed down from upstream, then try to use it to get
security token, other then creating token every time.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agosmbd/msdfs: add null check for session_info.unix_info
Joe Guo [Tue, 3 Jul 2018 23:03:42 +0000 (11:03 +1200)]
smbd/msdfs: add null check for session_info.unix_info

When a session_info passed down to here, the unix_info could be NULL.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agopysmbd: add session_info arg to py_smbd_set_nt_acl
Joe Guo [Tue, 3 Jul 2018 22:18:30 +0000 (10:18 +1200)]
pysmbd: add session_info arg to py_smbd_set_nt_acl

Add session_info arg as optional and pass it down to get_conn_tos.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agopysmbd: add session_info arg to get_conn_tos
Joe Guo [Tue, 3 Jul 2018 22:05:50 +0000 (10:05 +1200)]
pysmbd: add session_info arg to get_conn_tos

Add session_info arg, so caller can pass it in to reuse authentication info
later. This will improve performance a lot while doing ntacl operations
on large amount of files, e.g.: sysvolreset.

Modification for upstream caller will come in following patches.

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

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agoWHATSNEW: Add entry for "Dynamic DNS record scavenging support"
Andrew Bartlett [Tue, 10 Jul 2018 05:13:48 +0000 (17:13 +1200)]
WHATSNEW: Add entry for "Dynamic DNS record scavenging support"

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
14 months agopython/tests: check setting values on dnsRecord attributes
Bob Campbell [Thu, 8 Dec 2016 20:13:11 +0000 (09:13 +1300)]
python/tests: check setting values on dnsRecord attributes

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

Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotests dns: dns_base.py remove flake8 warnings
Gary Lockyer [Tue, 3 Jul 2018 05:03:38 +0000 (17:03 +1200)]
tests dns: dns_base.py remove flake8 warnings

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotests dns: dns.py remove flake8 warnings
Gary Lockyer [Mon, 2 Jul 2018 04:51:00 +0000 (16:51 +1200)]
tests dns: dns.py remove flake8 warnings

Remove flake8 warnings from the code, this highlighted the issue with
test_update_add_null_char_rpc_to_dns fixed in the preceding commit.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agotests dns: fix rpc null byte test
Gary Lockyer [Mon, 2 Jul 2018 04:47:16 +0000 (16:47 +1200)]
tests dns: fix rpc null byte test

Fix update_add_null_char_rpc_to_dns so that the test matches the name.
It was not passing the embedded null to the rpc call.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: static records
Aaron Haslett [Thu, 7 Jun 2018 04:51:37 +0000 (16:51 +1200)]
dns: static records

Modifies bind9 and internal dns to match windows static records behaviour.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: update tool changed for scavenging
Aaron Haslett [Tue, 10 Jul 2018 01:14:18 +0000 (13:14 +1200)]
dns: update tool changed for scavenging

Now that scavenging is implemented, the DNS update tool needs to be changed so
that it always updates every name required by the DC.  Otherwise, the records
might be scavenged.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns+kcc: adding dns scavenging to kcc periodic run
Aaron Haslett [Tue, 29 May 2018 03:50:19 +0000 (15:50 +1200)]
dns+kcc: adding dns scavenging to kcc periodic run

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Pair-Programmed-With: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: dns record scavenging function (without task)
Aaron Haslett [Fri, 1 Jun 2018 04:07:46 +0000 (16:07 +1200)]
dns: dns record scavenging function (without task)

DNS record scavenging function with testing.  The logic of the custom match rule
in previous commit is inverted so that calculations using zone properties can
be taken out of the function's inner loop. Periodic task to come.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: Use ldb.SCOPE_SUBTREE in ldap_get_records() routine in tests/dns.py
Aaron Haslett [Tue, 10 Jul 2018 01:23:42 +0000 (13:23 +1200)]
dns: Use ldb.SCOPE_SUBTREE in ldap_get_records() routine in tests/dns.py

DNS records have the odd property that the DN can be reliably determined by the
name only, so we do not need a subtree search.

However by using a subtree search under the zone we can without
trapping exceptions confirm if the record exists or not in the tests.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agodns: custom match rule for DNS records to be tombstoned
Aaron Haslett [Mon, 2 Jul 2018 01:48:06 +0000 (13:48 +1200)]
dns: custom match rule for DNS records to be tombstoned

A custom match rule for records to be tombstoned by the scavenging process.
Needed because DNS records are a multi-valued attribute on name records, so
without a custom match rule we'd have entire zones into memory to search for
expired records.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: server side implementation of record aging
Aaron Haslett [Mon, 2 Jul 2018 01:43:33 +0000 (13:43 +1200)]
dns: server side implementation of record aging

Code for retrieving aging properties from a zone and using them for timestamp
setting logic during processing of DNS requests.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: moving name_equal func into common
Aaron Haslett [Tue, 5 Jun 2018 05:12:44 +0000 (17:12 +1200)]
dns: moving name_equal func into common

This function is duplicated in the BIND9 and RPC DNS servers.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agorpc dns: reset dword aging related zone properties
Aaron Haslett [Tue, 3 Jul 2018 03:34:32 +0000 (15:34 +1200)]
rpc dns: reset dword aging related zone properties

This allows a user to set zone properties relevant to DNS record aging over RPC.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agorpc dns: reading zone properties from LDB
Aaron Haslett [Tue, 3 Jul 2018 03:33:06 +0000 (15:33 +1200)]
rpc dns: reading zone properties from LDB

Reading zone properties from LDB on server connection initialisation, instead
of them being volatile fields.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: Reformat DNS with clang-format
Gary Lockyer [Tue, 10 Jul 2018 01:37:18 +0000 (13:37 +1200)]
dns: Reformat DNS with clang-format

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agorpc dns: setting timestamp to 0 on RPC processed records
Aaron Haslett [Wed, 30 May 2018 06:56:16 +0000 (18:56 +1200)]
rpc dns: setting timestamp to 0 on RPC processed records

All records created by RPC DNS server calls should have timestamp set to 0
according to [MS-DNSP]

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

Signed-off-by: Aaron Haslett<aaronhaslett@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agodns: record aging tests
Aaron Haslett [Wed, 9 May 2018 06:02:28 +0000 (18:02 +1200)]
dns: record aging tests

First basic DNS record aging tests.  These check that we can
turn aging on and off, and that timestamps are written on DNS
add and update calls, but not RPC calls.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
14 months agosmb.conf: add dns_zone_scavenging
Gary Lockyer [Wed, 11 Jul 2018 04:30:38 +0000 (16:30 +1200)]
smb.conf: add dns_zone_scavenging

Add parameter dns_zone_scavenging to control dns zone scavenging.
Scavenging is disabled by default, as due to
https://bugzilla.samba.org/show_bug.cgi?id=12451 the ageing properties of
existing DNS entries are incorrect.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
14 months agos4:messaging: make sure only imessaging_client_init() can be used with a wrapper...
Stefan Metzmacher [Fri, 18 May 2018 14:28:47 +0000 (16:28 +0200)]
s4:messaging: make sure only imessaging_client_init() can be used with a wrapper tevent_context wrapper

imessaging_client_init() can be used with a wrapper tevent_context,
but only if a global messaging_dgm_ref() already exist.

All other uses of imessaging_init() and imessaging_client_init()
require a raw tevent_context.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph B√∂hme <slow@samba.org>
Autobuild-Date(master): Thu Jul 12 02:23:37 CEST 2018 on sn-devel-144

14 months agos4:messaging: allow imessaging_post_handler() to free the messaging context from...
Stefan Metzmacher [Sat, 19 May 2018 08:14:25 +0000 (10:14 +0200)]
s4:messaging: allow imessaging_post_handler() to free the messaging context from a handler

In usecases like using messaging_client_init() with irpc processing we may
free the imessaging_context during the messaging handler.
imessaging_post_handler() is not yet really used, but it will change in
the next commits. imessaging_post_state is a child of imessaging_context
and might be implicitly free'ed before the explicit TALLOC_FREE(state).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agos3:messages: allow messaging_filtered_read_send() to use wrapper tevent_context
Stefan Metzmacher [Fri, 23 Mar 2018 13:48:46 +0000 (14:48 +0100)]
s3:messages: allow messaging_filtered_read_send() to use wrapper tevent_context

As it gets 'messaging_context' as argument, we're sure a messaging context
with a raw tevent context already exist.

It means we can allow a wrapper tevent context that wrapps the main tevent
context of the messaging context.

The use of tevent_req_defer_callback() makes sure that the callers
callback function calls messaging_filtered_read_recv() from the
correct "wrapped" environment.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agos3:messages: allow messaging_dgm_ref() to use wrapper tevent_context
Stefan Metzmacher [Fri, 23 Mar 2018 13:48:46 +0000 (14:48 +0100)]
s3:messages: allow messaging_dgm_ref() to use wrapper tevent_context

This is only allowed if the raw tevent context is already registered.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agos3:messages: allow messaging_{dgm,ctdb}_register_tevent_context() to use wrapper...
Stefan Metzmacher [Fri, 23 Mar 2018 13:48:46 +0000 (14:48 +0100)]
s3:messages: allow messaging_{dgm,ctdb}_register_tevent_context() to use wrapper tevent_context

This is only allowed if the raw tevent context is already registered.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agos3:messages: protect against usage of wrapper tevent_context objects for messaging
Stefan Metzmacher [Fri, 18 May 2018 14:28:47 +0000 (16:28 +0200)]
s3:messages: protect against usage of wrapper tevent_context objects for messaging

This makes a lot of assumtion easier to understand and the introduction
of wrapper tevent contexts will not change the existing behaviour.

We'll relax this a bit in the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agowinbindd: Do request profiling
Volker Lendecke [Tue, 19 Jun 2018 09:13:19 +0000 (11:13 +0200)]
winbindd: Do request profiling

By default we log a request that takes more than 60 seconds. This can be
changed by setting

winbind:request profile threshold = <seconds>

Another parameter controls the depth of the request hierarchy printed:

winbind:request profile depth = <n>

The default request logged to syslog via DEBUG(0) looks like the
following for a wbinfo -P:

[struct process_request_state] ../source3/winbindd/winbindd.c:683 [2018/06/19 13:33:14.190365] ../source3/winbindd/winbindd.c:853 [2018/06/19 13:33:14.192737] [0.002372] -> TEVENT_REQ_DONE (2 0))
 [struct winbindd_ping_dc_state] ../source3/winbindd/winbindd_ping_dc.c:41 [2018/06/19 13:33:14.190369] ../source3/winbindd/winbindd_ping_dc.c:112 [2018/06/19 13:33:14.192681] [0.002312] -> TEVENT_REQ_DONE (2 0))
  [struct dcerpc_wbint_PingDc_state] default/librpc/gen_ndr/ndr_winbind_c.c:4335 [2018/06/19 13:33:14.190383] default/librpc/gen_ndr/ndr_winbind_c.c:4396 [2018/06/19 13:33:14.192680] [0.002297] -> TEVENT_REQ_DONE (2 0))
   [struct dcerpc_wbint_PingDc_r_state] default/librpc/gen_ndr/ndr_winbind_c.c:4251 [2018/06/19 13:33:14.190385] default/librpc/gen_ndr/ndr_winbind_c.c:4285 [2018/06/19 13:33:14.192678] [0.002293] -> TEVENT_REQ_DONE (2 0))
    [struct dcerpc_binding_handle_call_state] ../librpc/rpc/binding_handle.c:371 [2018/06/19 13:33:14.190387] ../librpc/rpc/binding_handle.c:520 [2018/06/19 13:33:14.192675] [0.002288] -> TEVENT_REQ_DONE (2 0))
     [struct dcerpc_binding_handle_raw_call_state] ../librpc/rpc/binding_handle.c:149 [2018/06/19 13:33:14.190400] ../librpc/rpc/binding_handle.c:203 [2018/06/19 13:33:14.192646] [0.002246] -> TEVENT_REQ_DONE (2 0))
      [struct wbint_bh_raw_call_state] ../source3/winbindd/winbindd_dual_ndr.c:89 [2018/06/19 13:33:14.190402] ../source3/winbindd/winbindd_dual_ndr.c:204 [2018/06/19 13:33:14.192644] [0.002242] -> TEVENT_REQ_DONE (2 0))
       [struct wb_domain_request_state] ../source3/winbindd/winbindd_dual.c:473 [2018/06/19 13:33:14.190404] ../source3/winbindd/winbindd_dual.c:708 [2018/06/19 13:33:14.192640] [0.002236] -> TEVENT_REQ_DONE (2 0))
        [struct wb_child_request_state] ../source3/winbindd/winbindd_dual.c:198 [2018/06/19 13:33:14.190411] ../source3/winbindd/winbindd_dual.c:273 [2018/06/19 13:33:14.192638] [0.002227] -> TEVENT_REQ_DONE (2 0))
         [struct tevent_queue_wait_state] ../lib/tevent/tevent_queue.c:336 [2018/06/19 13:33:14.190412] ../lib/tevent/tevent_queue.c:355 [2018/06/19 13:33:14.190415] [0.000003] -> TEVENT_REQ_DONE (2 0))
         [struct wb_simple_trans_state] ../nsswitch/wb_reqtrans.c:375 [2018/06/19 13:33:14.190424] ../nsswitch/wb_reqtrans.c:432 [2018/06/19 13:33:14.192630] [0.002206] -> TEVENT_REQ_DONE (2 0))
          [struct req_write_state] ../nsswitch/wb_reqtrans.c:158 [2018/06/19 13:33:14.190425] ../nsswitch/wb_reqtrans.c:194 [2018/06/19 13:33:14.190472] [0.000047] -> TEVENT_REQ_DONE (2 0))
           [struct writev_state] ../lib/async_req/async_sock.c:263 [2018/06/19 13:33:14.190432] ../lib/async_req/async_sock.c:412 [2018/06/19 13:33:14.190470] [0.000038] -> TEVENT_REQ_DONE (2 0))
          [struct resp_read_state] ../nsswitch/wb_reqtrans.c:222 [2018/06/19 13:33:14.190475] ../nsswitch/wb_reqtrans.c:275 [2018/06/19 13:33:14.192629] [0.002154] -> TEVENT_REQ_DONE (2 0))
           [struct read_packet_state] ../lib/async_req/async_sock.c:458 [2018/06/19 13:33:14.190476] ../lib/async_req/async_sock.c:546 [2018/06/19 13:33:14.192626] [0.002150] -> TEVENT_REQ_DONE (2 0))
 [struct resp_write_state] ../nsswitch/wb_reqtrans.c:307 [2018/06/19 13:33:14.192693] ../nsswitch/wb_reqtrans.c:344 [2018/06/19 13:33:14.192734] [0.000041] -> TEVENT_REQ_DONE (2 0))
  [struct writev_state] ../lib/async_req/async_sock.c:263 [2018/06/19 13:33:14.192694] ../lib/async_req/async_sock.c:412 [2018/06/19 13:33:14.192732] [0.000038] -> TEVENT_REQ_DONE (2 0))

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agowinbindd: Convert process_request() to tevent_req
Volker Lendecke [Thu, 3 May 2018 13:12:55 +0000 (15:12 +0200)]
winbindd: Convert process_request() to tevent_req

Having a central tevent_req per winbind child request is prerequisite
for request profiling

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotorture: Test tevent_req_profile
Volker Lendecke [Wed, 2 May 2018 12:02:18 +0000 (14:02 +0200)]
torture: Test tevent_req_profile

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agolib: Add tevent_req_profile helpers
Volker Lendecke [Wed, 2 May 2018 11:59:57 +0000 (13:59 +0200)]
lib: Add tevent_req_profile helpers

Print and marshall/unmarshall tevent_req_profile structs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agolib: Multi-line a long line in wscript_build
Volker Lendecke [Wed, 2 May 2018 11:54:42 +0000 (13:54 +0200)]
lib: Multi-line a long line in wscript_build

Why? I'll add another file in a later commit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agotevent: version 0.9.37 tevent-0.9.37
Stefan Metzmacher [Thu, 14 Aug 2014 19:51:09 +0000 (21:51 +0200)]
tevent: version 0.9.37

* simplify "poll" and "poll_mt" backends
* make tevent_abort() reachable for backends
* add tevent_common_invoke_*_handler() functions
* add tevent_context_same_loop() function
* add tevent_context_wrapper_create() infrastructure
* add tevent_req_profile infrastructure

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: Add tevent_req_profile
Volker Lendecke [Wed, 2 May 2018 12:01:56 +0000 (14:01 +0200)]
tevent: Add tevent_req_profile

This allows detailed reporting where a tevent_req spends its time

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agotevent: add a test that frees wrapper_ev with pending events
Ralph Boehme [Sat, 16 Jun 2018 14:55:44 +0000 (16:55 +0200)]
tevent: add a test that frees wrapper_ev with pending events

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agotevent: add a simple wrapper test
Ralph Boehme [Sat, 16 Jun 2018 12:12:01 +0000 (14:12 +0200)]
tevent: add a simple wrapper test

This checks that for all supported event types the before and after
handlers are called.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
14 months agotevent: add tevent_context_wrapper_create() infrastructure
Stefan Metzmacher [Tue, 22 Jul 2014 14:51:38 +0000 (16:51 +0200)]
tevent: add tevent_context_wrapper_create() infrastructure

This allows to specify wrapper tevent_contexts, which adds the ability
to run functions before and after the event handler functions.

This can be used to implement impersonation hooks
or advanced debugging/profiling hooks.

We'll undo the 0.9.36 ABI change on the 0.9.37 release
at the end of this patchset.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: make use of #include "system/threads.h"
Stefan Metzmacher [Tue, 22 May 2018 13:43:12 +0000 (15:43 +0200)]
tevent: make use of #include "system/threads.h"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: split out tevent_common_invoke_fd_handler()
Stefan Metzmacher [Tue, 22 Jul 2014 12:45:33 +0000 (14:45 +0200)]
tevent: split out tevent_common_invoke_fd_handler()

We'll undo the 0.9.36 ABI change on the 0.9.37 release
at the end of this patchset.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: split out tevent_common_invoke_immediate_handler()
Stefan Metzmacher [Tue, 22 Jul 2014 11:08:42 +0000 (13:08 +0200)]
tevent: split out tevent_common_invoke_immediate_handler()

We'll undo the 0.9.36 ABI change on the 0.9.37 release
at the end of this patchset.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: split out tevent_common_invoke_timer_handler()
Stefan Metzmacher [Tue, 22 Jul 2014 11:08:42 +0000 (13:08 +0200)]
tevent: split out tevent_common_invoke_timer_handler()

As side effect this avoids tricks with an extra
tevent_common_timed_deny_destructor().

We'll undo the 0.9.36 ABI change on the 0.9.37 release
at the end of this patchset.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: split out tevent_common_invoke_signal_handler()
Stefan Metzmacher [Tue, 22 Jul 2014 11:01:01 +0000 (13:01 +0200)]
tevent: split out tevent_common_invoke_signal_handler()

As side effect this avoids tricks with tevent_se_exists_destructor() to
figure out if the event handler removed itself.

We'll undo the 0.9.36 ABI change on the 0.9.37 release
at the end of this patchset.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: simplify tevent_signal_destructor()
Stefan Metzmacher [Tue, 17 Apr 2018 14:43:54 +0000 (16:43 +0200)]
tevent: simplify tevent_signal_destructor()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: use talloc_zero() in tevent_signal.c
Stefan Metzmacher [Tue, 27 Mar 2018 12:30:20 +0000 (14:30 +0200)]
tevent: use talloc_zero() in tevent_signal.c

This might not be strictly required, but it might
avoid problems in future...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: simplify tevent_cleanup_pending_signal_handlers()
Stefan Metzmacher [Tue, 22 Jul 2014 10:02:45 +0000 (12:02 +0200)]
tevent: simplify tevent_cleanup_pending_signal_handlers()

Calling tevent_signal_destructor() does the same as se->event_ctx is already
NULL.

This also makes sure we correctly cleanup the SA_SIGINFO array.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: add tevent_common_check_double_free() helper function
Stefan Metzmacher [Tue, 17 Apr 2018 14:33:47 +0000 (16:33 +0200)]
tevent: add tevent_common_check_double_free() helper function

This will be used to generically support TALLOC_FREE() on
event which are currently running.

It aborts on every explicit talloc_free(), but ignores implicit
cleanup when the talloc parent is about to go.

We'll undo the 0.9.36 ABI change on the 0.9.37 release
at the end of this patchset.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: add tevent_threaded_schedule_immediate_destructor that just aborts
Stefan Metzmacher [Fri, 23 Mar 2018 09:32:15 +0000 (10:32 +0100)]
tevent: add tevent_threaded_schedule_immediate_destructor that just aborts

This will be active while the event is part of the ev->scheduled_immediates
list.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
14 months agotevent: use _tevent_schedule_immediate() to move events from a thread to the main_ev
Stefan Metzmacher [Fri, 23 Mar 2018 09:25:27 +0000 (10:25 +0100)]
tevent: use _tevent_schedule_immediate() to move events from a thread to the main_ev

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