metze/samba/wip.git
7 months agoP1.6: source3/modules/vfs_io_uring.c force_async.{read,write}_threshhold
Stefan Metzmacher [Tue, 29 Sep 2020 21:09:56 +0000 (23:09 +0200)]
P1.6: source3/modules/vfs_io_uring.c force_async.{read,write}_threshhold

7 months agoP1.4: TODO FIXME io_uring:sqpoll
Stefan Metzmacher [Tue, 7 Sep 2021 22:11:56 +0000 (00:11 +0200)]
P1.4: TODO FIXME io_uring:sqpoll

7 months agoP1.3: vfs_io_uring: make use of samba_io_uring infrastructure
Stefan Metzmacher [Tue, 7 Sep 2021 15:14:48 +0000 (17:14 +0200)]
P1.3: vfs_io_uring: make use of samba_io_uring infrastructure

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agoP1.0: BUG??? vfs_io_uring: handle EINTR like EAGAIN and EBUSY
Stefan Metzmacher [Thu, 15 Apr 2021 15:33:10 +0000 (15:33 +0000)]
P1.0: BUG??? vfs_io_uring: handle EINTR like EAGAIN and EBUSY

With EINTR we should just retry as well...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agosamba_tevent_context_init try samba_io_uring_ev if available
Stefan Metzmacher [Wed, 16 Nov 2022 22:55:24 +0000 (23:55 +0100)]
samba_tevent_context_init try samba_io_uring_ev if available

7 months agosource4/torture/local/local.c call samba_io_uring_ev_register()
Stefan Metzmacher [Mon, 19 Sep 2022 23:12:11 +0000 (01:12 +0200)]
source4/torture/local/local.c call samba_io_uring_ev_register()

7 months agosamba_tevent_context_init() call samba_io_uring_ev_register()
Stefan Metzmacher [Wed, 21 Sep 2022 09:45:47 +0000 (11:45 +0200)]
samba_tevent_context_init() call samba_io_uring_ev_register()

7 months agosamba_io_uring_completion_bypass_epoll
Stefan Metzmacher [Mon, 18 Sep 2023 07:54:16 +0000 (07:54 +0000)]
samba_io_uring_completion_bypass_epoll

7 months agosamba_io_uring_completion->wait_for_poll
Stefan Metzmacher [Mon, 18 Sep 2023 07:48:39 +0000 (07:48 +0000)]
samba_io_uring_completion->wait_for_poll

7 months agolib/util/samba_io_uring.c if0 debugging code
Stefan Metzmacher [Mon, 18 Sep 2023 07:42:20 +0000 (07:42 +0000)]
lib/util/samba_io_uring.c if0 debugging code

7 months agolib/util/samba_io_uring.c syscalls as before
Stefan Metzmacher [Mon, 18 Sep 2023 07:36:38 +0000 (07:36 +0000)]
lib/util/samba_io_uring.c syscalls as before

7 months agosource4/torture/smb2/bench.c start requests after creation all connections
Stefan Metzmacher [Mon, 18 Sep 2023 06:27:33 +0000 (06:27 +0000)]
source4/torture/smb2/bench.c start requests after creation all connections

7 months agoTODO lib/util/samba_io_uring.c SAMBA_IO_URING_COMPLETION_GENERATION_SHIFT
Stefan Metzmacher [Sat, 16 Sep 2023 16:26:46 +0000 (18:26 +0200)]
TODO lib/util/samba_io_uring.c SAMBA_IO_URING_COMPLETION_GENERATION_SHIFT

7 months agosq lib/util/samba_io_uring 6.2/6.3 features
Stefan Metzmacher [Thu, 7 Sep 2023 08:50:55 +0000 (10:50 +0200)]
sq lib/util/samba_io_uring 6.2/6.3 features

7 months agosq lib/util/samba_io_uring.h
Stefan Metzmacher [Tue, 23 May 2023 05:40:21 +0000 (07:40 +0200)]
sq lib/util/samba_io_uring.h

7 months agolib/util/samba_io_uring.c _Static_assert()
Stefan Metzmacher [Wed, 8 Feb 2023 14:30:21 +0000 (15:30 +0100)]
lib/util/samba_io_uring.c _Static_assert()

7 months agolib/util/samba_io_uring.c USING_SYSTEM_TEVENT no needed
Stefan Metzmacher [Wed, 11 Jan 2023 13:47:15 +0000 (14:47 +0100)]
lib/util/samba_io_uring.c USING_SYSTEM_TEVENT no needed

7 months agolib/util/samba_io_uring.c no tevent_set_default_backend("samba_io_uring_ev_hybrit");
Stefan Metzmacher [Wed, 16 Nov 2022 22:50:03 +0000 (23:50 +0100)]
lib/util/samba_io_uring.c no tevent_set_default_backend("samba_io_uring_ev_hybrit");

io_uring_register(5, IORING_REGISTER_PROBE) and close() take a lot of time on (at least 5.4) kernels...
It's fast on 5.15 similar to all other syscalls.

13693 23:51:10.295204 syscall_0x1a9(0x20, 0x56109f1a2c00, 0x20, 0x56109eee7010, 0, 0) = 0x5 <0.000026>
13693 23:51:10.295252 mmap(NULL, 1472, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 5, 0) = 0x7ff40f147000 <0.000011>
13693 23:51:10.295276 mmap(NULL, 2048, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 5, 0x10000000) = 0x7ff40f146000 <0.000008>
13693 23:51:10.295296 madvise(0x7ff40f146000, 2048, MADV_DONTFORK) = 0 <0.000004>
13693 23:51:10.295312 madvise(0x7ff40f147000, 1472, MADV_DONTFORK) = 0 <0.000004>
13693 23:51:10.295345 syscall_0x1ab(0x5, 0x8, 0x56109f236150, 0x100, 0x77, 0) = -1 (errno 22) <0.011981>
...

13693 23:51:10.337035 munmap(0x7ff41b88c000, 2048) = 0 <0.000009>
13693 23:51:10.337056 munmap(0x7ff41b88d000, 1472) = 0 <0.000007>
13693 23:51:10.337074 close(3)          = 0 <0.010263>

7 months agosamba_io_uring_destructor ring->self_mem_ctx = NULL;
Stefan Metzmacher [Sat, 12 Nov 2022 17:13:58 +0000 (17:13 +0000)]
samba_io_uring_destructor ring->self_mem_ctx = NULL;

7 months agoP1.2: lib/util: add samba_io_uring.* abstraction
Stefan Metzmacher [Tue, 29 Sep 2020 21:09:59 +0000 (23:09 +0200)]
P1.2: lib/util: add samba_io_uring.* abstraction

This will allow us to use io_uring also outside of
vfs_io_uring.c, which will be converted to use this new code
in the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agothird_party: import liburing-2.4
Stefan Metzmacher [Thu, 16 Sep 2021 10:46:38 +0000 (12:46 +0200)]
third_party: import liburing-2.4

This makes it much easier to cope with
pushd third_party/liburing/ && ./update.sh 2.4; popd

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agoP1.1: wafsamba: improve CHECK_SIZEOF() to have lib= and fallback to CHECK_VALUEOF()
Stefan Metzmacher [Wed, 30 Sep 2020 11:59:15 +0000 (13:59 +0200)]
P1.1: wafsamba: improve CHECK_SIZEOF() to have lib= and fallback to CHECK_VALUEOF()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agoP0.X: s3:param: add lp_parm_bytes() it's similar to lpcfg_parm_bytes()
Stefan Metzmacher [Tue, 29 Sep 2020 21:09:55 +0000 (23:09 +0200)]
P0.X: s3:param: add lp_parm_bytes() it's similar to lpcfg_parm_bytes()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/util: support SO_SNDBUFFORCE/SO_RCVBUFFORCE in "socket options"
Stefan Metzmacher [Mon, 19 Apr 2021 07:48:13 +0000 (07:48 +0000)]
lib/util: support SO_SNDBUFFORCE/SO_RCVBUFFORCE in "socket options"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agosmb2_server: monitor connections with TEVENT_FD_ERROR
Stefan Metzmacher [Thu, 12 Jan 2023 10:35:30 +0000 (11:35 +0100)]
smb2_server: monitor connections with TEVENT_FD_ERROR

By asking for TEVENT_FD_ERROR we're able to fail early
when a connection to a client is broken.

In that case it does not make any sense to process
pending requests in the recv queue as it's not
possible to deliver the response to the client anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos3:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:49:13 +0000 (10:49 +0100)]
s3:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:48:22 +0000 (10:48 +0100)]
s4:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:service_named_pipe: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:46:56 +0000 (10:46 +0100)]
s4:service_named_pipe: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolibcli/named_pipe_auth: let tstream_npa_existing_socket use tstream_bsd_fail_readv_fi...
Stefan Metzmacher [Thu, 12 Jan 2023 09:44:25 +0000 (10:44 +0100)]
libcli/named_pipe_auth: let tstream_npa_existing_socket use tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:wrepl_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:46:20 +0000 (10:46 +0100)]
s4:wrepl_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:libcli/wrepl: make use of tstream_bsd_fail_readv_first_error(false)
Stefan Metzmacher [Thu, 12 Jan 2023 09:43:21 +0000 (10:43 +0100)]
s4:libcli/wrepl: make use of tstream_bsd_fail_readv_first_error(false)

As a client we want recv pending responses even if the server
already closed the connection.

While tstream_bsd_fail_readv_first_error(false) is the default for
tstream_bsd, the wins replication protocol is special as it has
a way to switch server and client roles on an existing tcp connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:ntp_signd: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:42:14 +0000 (10:42 +0100)]
s4:ntp_signd: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos3:libsmb: the unexpected handler use tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:41:04 +0000 (10:41 +0100)]
s3:libsmb: the unexpected handler use tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:dns_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:40:13 +0000 (10:40 +0100)]
s4:dns_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:ldap_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:39:48 +0000 (10:39 +0100)]
s4:ldap_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4:kdc: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:38:53 +0000 (10:38 +0100)]
s4:kdc: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/tsocket: add tstream_bsd_fail_readv_first_error()
Stefan Metzmacher [Thu, 12 Jan 2023 09:08:56 +0000 (10:08 +0100)]
lib/tsocket: add tstream_bsd_fail_readv_first_error()

This gives the caller the option to fail immediately if
TEVENT_FD_ERROR appear even with pending bytes in the
recv queue.

Servers typically want to activate this in order to avoid
pointless work, while clients typically want to read
pending responses from the recv queue.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/tsocket: make use of TEVENT_FD_ERROR in tstream_bsd_fde_handler()
Stefan Metzmacher [Wed, 11 Jan 2023 19:17:06 +0000 (20:17 +0100)]
lib/tsocket: make use of TEVENT_FD_ERROR in tstream_bsd_fde_handler()

This makes the logic introduced to fix bug #15202 simpler.

While developing this I noticed that a lot of callers
rely on the fact that they can read the pending bytes out
of the recv queue before EOF is reported.

So I changed the code handle TEVENT_FD_ERROR together with
TEVENT_FD_READ in a way that keep the existing callers happy.

In the next step we'll add a way to let callers opt-in in order
to fail immediately if TEVENT_FD_ERROR appears (even if there
are pending bytes remaining in the recv queue).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/tsocket: let tstream_bsd_connect_send() use TEVENT_FD_ERROR instead of TEVENT_FD_READ
Stefan Metzmacher [Wed, 11 Jan 2023 19:15:33 +0000 (20:15 +0100)]
lib/tsocket: let tstream_bsd_connect_send() use TEVENT_FD_ERROR instead of TEVENT_FD_READ

This mostly cosmetic, but now that we have TEVENT_FD_ERROR we should use it.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/async_req: let writev_send/recv use TEVENT_FD_ERROR
Stefan Metzmacher [Thu, 12 Jan 2023 11:54:33 +0000 (12:54 +0100)]
lib/async_req: let writev_send/recv use TEVENT_FD_ERROR

Unless err_on_readability is true, we use TEVENT_FD_READ only
to detect errors. Now that we have TEVENT_FD_ERROR we should use it.

As a side effect it makes the code much simpler and clearer, as
we can directly map TEVENT_FD_ERROR to EPIPE.

In addition the err_on_readability=true case is now also
clearer, where we just map TEVENT_FD_READ to EPIPE.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/async_req: let async_connect_send use TEVENT_FD_ERROR instead of TEVENT_FD_READ
Stefan Metzmacher [Wed, 11 Jan 2023 19:04:26 +0000 (20:04 +0100)]
lib/async_req: let async_connect_send use TEVENT_FD_ERROR instead of TEVENT_FD_READ

This mostly cosmetic, but now that we have TEVENT_FD_ERROR we should use it.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/tsocket: make use of samba_socket_sock_error()
Stefan Metzmacher [Thu, 12 Jan 2023 10:35:11 +0000 (11:35 +0100)]
lib/tsocket: make use of samba_socket_sock_error()

This is nicer than calling getsockopt(state->fd, SOL_SOCKET, SO_ERROR)
directly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/tsocket: make use of samba_socket_poll_or_sock_error()
Stefan Metzmacher [Thu, 12 Jan 2023 10:35:11 +0000 (11:35 +0100)]
lib/tsocket: make use of samba_socket_poll_or_sock_error()

This is just a copy of the existing code...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agolib/util: add samba_socket_{poll,sock,poll_or_sock}_error()
Stefan Metzmacher [Thu, 12 Jan 2023 10:14:06 +0000 (11:14 +0100)]
lib/util: add samba_socket_{poll,sock,poll_or_sock}_error()

These are copies of the static functions in lib/tsocket/tsocket_bsd.c,
which we will replace in the next commit.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 months agos4/torture: fix exit status of raw.bench-lookup
Oleg Kravtsov [Fri, 6 Oct 2023 09:20:05 +0000 (12:20 +0300)]
s4/torture: fix exit status of raw.bench-lookup

Use correct value of 'result' when the test passes.

Signed-off-by: Oleg Kravtsov <oleg@tuxera.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Oct 16 02:01:17 UTC 2023 on atb-devel-224

7 months agogpdupate: Implement Drive Maps Client Side Extension
David Mulder [Fri, 10 Mar 2023 21:30:17 +0000 (14:30 -0700)]
gpdupate: Implement Drive Maps Client Side Extension

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agogpupdate: Test Drive Maps Client Side Extension
David Mulder [Fri, 10 Mar 2023 21:29:24 +0000 (14:29 -0700)]
gpupdate: Test Drive Maps Client Side Extension

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agotevent: version 0.16.0 samba-upstream/tags/tevent-0.16.0
Stefan Metzmacher [Wed, 19 Jul 2023 21:04:01 +0000 (23:04 +0200)]
tevent: version 0.16.0

- the epoll backend is no longer limited to 2 event handlers
  per low level fd.
- finally add support for TEVENT_FD_ERROR

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): Fri Oct 13 10:45:51 UTC 2023 on atb-devel-224

7 months agotevent: add support for TEVENT_FD_ERROR
Stefan Metzmacher [Wed, 13 Jul 2011 07:46:26 +0000 (09:46 +0200)]
tevent: add support for TEVENT_FD_ERROR

After 12 years we finally got TEVENT_FD_ERROR support :-)

TEVENT_FD_WRITE event handlers never get errors reported
instead the event handler is silently disabled.
There are likely callers relying on that behavior, so
we are not able to chance it.

Now TEVENT_FD_WRITE can be used together with TEVENT_FD_ERROR
in order to get errors reported without waiting for TEVENT_FD_READ.

TEVENT_FD_ERROR can also be used alone in order to detect errors
on sockets in order to cleanup resources.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agotevent: add test_event_fd3
Stefan Metzmacher [Wed, 28 Dec 2022 15:54:24 +0000 (16:54 +0100)]
tevent: add test_event_fd3

The tests the interaction of multiple event handlers on
the same low level fd.

It shows that poll and epoll backends behave in the
same fair way.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agotevent: add test_fd_speed3
Stefan Metzmacher [Mon, 24 Apr 2023 14:37:38 +0000 (14:37 +0000)]
tevent: add test_fd_speed3

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agotevent: let tevent_epoll.c use new generic mpx infrastructure
Stefan Metzmacher [Fri, 11 Nov 2022 21:30:35 +0000 (22:30 +0100)]
tevent: let tevent_epoll.c use new generic mpx infrastructure

This allows any number of event handlers per low level fd.

It means the epoll backend behaves like the poll backend now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agotevent: add tevent_common_fd_mpx infrastructure
Stefan Metzmacher [Wed, 9 Nov 2022 21:48:10 +0000 (22:48 +0100)]
tevent: add tevent_common_fd_mpx infrastructure

Backends may require to map individual tevent_fd instances to
a single low level kernel state (e.g. for epoll).

This generic infrastructure adds helper functions using
a generic (sub)part of struct tevent_fd.

The new code will allow us to support more than 2 tevent_fd
instances per fd, which makes sure all backends can provide
a similar behavior. This will be important when we add
TEVENT_FD_ERROR as a 3rd kind of fd event.

The aim is to use this in order to replace the limited implementation
we already have in tevent_epoll.c.

As these helpers are typically called from within
'void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags)'
there's no way to report errors. So in order avoid additional
error handling complexity the helpers try to avoid
any allocations which may fail. It also means the logic in
tevent_epoll.c doesn't have to change much.

These are implemented as static line functions in order to avoid
the function call overhead, which showed up in profiles of the
early implementation.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agotevent: split out a tevent_common_fd_disarm() helper
Stefan Metzmacher [Thu, 31 Aug 2023 16:09:28 +0000 (18:09 +0200)]
tevent: split out a tevent_common_fd_disarm() helper

It means tevent_trace_fd_callback(TEVENT_EVENT_TRACE_DETACH)
is always called and similar future changes are only
needed in one place.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agoldb: sync DLIST_DEMOTE_SHORT() changes to include/dlinklist.h
Stefan Metzmacher [Mon, 30 Jan 2023 15:10:07 +0000 (16:10 +0100)]
ldb: sync DLIST_DEMOTE_SHORT() changes to include/dlinklist.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agolib/util: sync DLIST_DEMOTE_SHORT() changes to dlinklist.h
Stefan Metzmacher [Mon, 30 Jan 2023 15:10:07 +0000 (16:10 +0100)]
lib/util: sync DLIST_DEMOTE_SHORT() changes to dlinklist.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agotevent: introduce DLIST_DEMOTE_SHORT()
Stefan Metzmacher [Mon, 30 Jan 2023 15:10:07 +0000 (16:10 +0100)]
tevent: introduce DLIST_DEMOTE_SHORT()

It turns out that the overhead of DLIST_DEMOTE() implemented
as DLIST_REMOVE();DLIST_ADD_END(), is very high if the list
contains only 1 or 2 elements.

The next commits will make use of DLIST_DEMOTE_SHORT() for
multiplexing multiple tevent_fd structures for a single fd
and the most important and common case is a list with just
one element.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 months agowintest: Fix invalid escape sequences
Joseph Sutton [Sun, 10 Sep 2023 23:59:55 +0000 (11:59 +1200)]
wintest: Fix invalid escape sequences

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Oct 13 04:55:06 UTC 2023 on atb-devel-224

7 months agoselftest: Use now() instead of utcnow()
Joseph Sutton [Mon, 2 Oct 2023 00:58:18 +0000 (13:58 +1300)]
selftest: Use now() instead of utcnow()

utcnow() is deprecated and will be removed in a future version of Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:torture: Use assertEqual() instead of assertEquals()
Joseph Sutton [Mon, 2 Oct 2023 00:35:32 +0000 (13:35 +1300)]
s4:torture: Use assertEqual() instead of assertEquals()

assertEquals() was removed in Python 3.12.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb:tests: Use loadTestsFromTestCase() instead of makeSuite()
Joseph Sutton [Mon, 2 Oct 2023 02:07:54 +0000 (15:07 +1300)]
s4:dsdb:tests: Use loadTestsFromTestCase() instead of makeSuite()

makeSuite() is deprecated and will be removed in Python 3.13.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb:tests: Fix assertion messages
Joseph Sutton [Mon, 2 Oct 2023 01:25:52 +0000 (14:25 +1300)]
s4:dsdb:tests: Fix assertion messages

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb:tests: Remove unused variables
Joseph Sutton [Mon, 2 Oct 2023 01:25:16 +0000 (14:25 +1300)]
s4:dsdb:tests: Remove unused variables

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb:tests: Remove unused imports
Joseph Sutton [Mon, 2 Oct 2023 01:24:49 +0000 (14:24 +1300)]
s4:dsdb:tests: Remove unused imports

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos3:script: Remove semicolons
Joseph Sutton [Wed, 16 Aug 2023 23:20:40 +0000 (11:20 +1200)]
s3:script: Remove semicolons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agotests/krb5: Fix assertion messages
Joseph Sutton [Mon, 2 Oct 2023 02:06:45 +0000 (15:06 +1300)]
tests/krb5: Fix assertion messages

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agotests/krb5: Use assertEqual() instead of assertEquals()
Joseph Sutton [Mon, 2 Oct 2023 00:32:10 +0000 (13:32 +1300)]
tests/krb5: Use assertEqual() instead of assertEquals()

assertEquals() was removed in Python 3.12.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:tests: Use now() instead of utcnow()
Joseph Sutton [Mon, 2 Oct 2023 00:58:00 +0000 (13:58 +1300)]
python:tests: Use now() instead of utcnow()

utcnow() is deprecated and will be removed in a future version of Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:tests: Remove semicolons
Joseph Sutton [Wed, 16 Aug 2023 23:09:31 +0000 (11:09 +1200)]
python:tests: Remove semicolons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:tests: Correct search expression
Joseph Sutton [Mon, 2 Oct 2023 02:07:16 +0000 (15:07 +1300)]
python:tests: Correct search expression

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:tests: Fix comment
Joseph Sutton [Mon, 2 Oct 2023 02:07:03 +0000 (15:07 +1300)]
python:tests: Fix comment

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:tests: Fix exception message
Joseph Sutton [Mon, 2 Oct 2023 02:06:07 +0000 (15:06 +1300)]
python:tests: Fix exception message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:tests: Use assertEqual() instead of assertEquals()
Joseph Sutton [Mon, 2 Oct 2023 00:34:05 +0000 (13:34 +1300)]
python:tests: Use assertEqual() instead of assertEquals()

assertEquals() was removed in Python 3.12.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:subunit: Use now() instead of utcnow()
Joseph Sutton [Mon, 2 Oct 2023 00:57:43 +0000 (13:57 +1300)]
python:subunit: Use now() instead of utcnow()

utcnow() is deprecated and will be removed in a future version of Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agopython:colour: Fix exception message
Joseph Sutton [Mon, 2 Oct 2023 02:05:33 +0000 (15:05 +1300)]
python:colour: Fix exception message

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agoexamples: Fix invalid escape sequences
Joseph Sutton [Sun, 10 Sep 2023 23:59:08 +0000 (11:59 +1200)]
examples: Fix invalid escape sequences

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agoexamples: Don’t use deprecated method ‘has_key()’
Joseph Sutton [Sun, 10 Sep 2023 23:50:22 +0000 (11:50 +1200)]
examples: Don’t use deprecated method ‘has_key()’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agobuildtools: Remove semicolons
Joseph Sutton [Tue, 29 Aug 2023 08:47:58 +0000 (20:47 +1200)]
buildtools: Remove semicolons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4-torture: add another test to demonstrate identical functions
Günther Deschner [Thu, 28 Sep 2023 20:01:36 +0000 (22:01 +0200)]
s4-torture: add another test to demonstrate identical functions

Create a spoolss_EnumPrinters request and send it to both endpoints and
verify they deliver identical replies.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Oct 13 03:19:59 UTC 2023 on atb-devel-224

7 months agos3-iremotewinspool: check for correct object_uuid in dispatch fn.
Günther Deschner [Mon, 25 Sep 2023 18:31:24 +0000 (20:31 +0200)]
s3-iremotewinspool: check for correct object_uuid in dispatch fn.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4-torture: add testcase to iremotewinspool suite to explore object_uuid handling
Günther Deschner [Mon, 25 Sep 2023 18:28:52 +0000 (20:28 +0200)]
s4-torture: add testcase to iremotewinspool suite to explore object_uuid handling

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos3-iremotewinspool: properly map incoming PAR to RPRN requests.
Günther Deschner [Fri, 22 Sep 2023 22:29:51 +0000 (00:29 +0200)]
s3-iremotewinspool: properly map incoming PAR to RPRN requests.

Map the incoming iremotewinspool opnum to match the appropriate call in
the spoolss server in the pull path.

There is no 1:1 mapping in the opnums between the procols, only in the
corresponding functions.

Without doing the mapping we currently forward
e.g. winspool_AsyncOpenPrinter() to spoolss_EnumPrinters() leading to
all sorts of errors.

A correct mapping was in place earlier with an handsorted server call
table but it got removed with the rpc server rewrite.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos3-iremotewinspool: add PAR->RPRN mapping table
Günther Deschner [Thu, 25 Aug 2016 09:37:36 +0000 (11:37 +0200)]
s3-iremotewinspool: add PAR->RPRN mapping table

There is no 1:1 mapping between the opcodes but between the functions
(including _Ex and _2 naming extensions):

e.g.
winspool_AsyncOpenPrinter  (0x00) -> spoolss_OpenPrinterEx (0x45)
winspool_AsyncClosePrinter (0x14) -> spoolss_ClosePrinter  (0x1d)

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:rpc_server: Check return values of gnutls functions (CID 1452111)
Joseph Sutton [Fri, 6 Oct 2023 01:24:51 +0000 (14:24 +1300)]
s4:rpc_server: Check return values of gnutls functions (CID 1452111)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:rpc_server: Check mkdir() return value (CID 1034649)
Joseph Sutton [Thu, 5 Oct 2023 22:10:25 +0000 (11:10 +1300)]
s4:rpc_server: Check mkdir() return value (CID 1034649)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:ntvfs: Correctly acknowledge PVFS_FLAG_STRICT_SYNC flag (CID 241154)
Joseph Sutton [Fri, 6 Oct 2023 03:00:46 +0000 (16:00 +1300)]
s4:ntvfs: Correctly acknowledge PVFS_FLAG_STRICT_SYNC flag (CID 241154)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:ntvfs: Remove dead code path
Joseph Sutton [Thu, 5 Oct 2023 21:10:16 +0000 (10:10 +1300)]
s4:ntvfs: Remove dead code path

‘pending’ will never be NULL.

View with ‘git show -b’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:ntvfs: Remove unneeded NULL check (CID 240771)
Joseph Sutton [Thu, 5 Oct 2023 21:07:14 +0000 (10:07 +1300)]
s4:ntvfs: Remove unneeded NULL check (CID 240771)

We’ve already dereferenced ‘pending’ in the init‐clause of the loop, and
won’t reassign it during the loop.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:messaging: Remove redundant code
Joseph Sutton [Thu, 5 Oct 2023 23:03:40 +0000 (12:03 +1300)]
s4:messaging: Remove redundant code

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:libcli: Check return value of convert_string_talloc() (CID 1272839)
Joseph Sutton [Fri, 6 Oct 2023 01:10:09 +0000 (14:10 +1300)]
s4:libcli: Check return value of convert_string_talloc() (CID 1272839)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:libcli: Remove unnecessary casts
Joseph Sutton [Wed, 9 Aug 2023 04:55:15 +0000 (16:55 +1200)]
s4:libcli: Remove unnecessary casts

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Don’t overwrite existing error code (CID 1445263)
Joseph Sutton [Fri, 6 Oct 2023 02:43:41 +0000 (15:43 +1300)]
s4:dsdb: Don’t overwrite existing error code (CID 1445263)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Log correct ldb error
Joseph Sutton [Fri, 6 Oct 2023 02:43:13 +0000 (15:43 +1300)]
s4:dsdb: Log correct ldb error

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738)
Joseph Sutton [Fri, 6 Oct 2023 01:33:16 +0000 (14:33 +1300)]
s4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738)

A ‘continue’ statement creates the misleading impression that this loop
executes more than once.

This also avoids ‘mem_ctx’ being leaked.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Check return value of ldb_msg_add_empty() (CID 1272827)
Joseph Sutton [Fri, 6 Oct 2023 01:07:41 +0000 (14:07 +1300)]
s4:dsdb: Check return value of ldb_msg_add_empty() (CID 1272827)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Fix unreachable code (CID 1435967)
Joseph Sutton [Thu, 5 Oct 2023 23:45:55 +0000 (12:45 +1300)]
s4:dsdb: Fix unreachable code (CID 1435967)

Commit ede668e8e24c86f0836dfa5740e76d8aca1e0824 removed this condition
for some unexplained reason, causing the following code to become
unreachable.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Remove unreachable code (CID 1034686)
Joseph Sutton [Thu, 5 Oct 2023 22:05:49 +0000 (11:05 +1300)]
s4:dsdb: Remove unreachable code (CID 1034686)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Check return code (CID 1444824/1444844)
Joseph Sutton [Thu, 5 Oct 2023 21:37:32 +0000 (10:37 +1300)]
s4:dsdb: Check return code (CID 1444824/1444844)

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Permit forward link to be missing in linked_attributes_fix_forward_link()
Joseph Sutton [Sun, 8 Oct 2023 22:55:10 +0000 (11:55 +1300)]
s4:dsdb: Permit forward link to be missing in linked_attributes_fix_forward_link()

We don’t care if a forward link is missing from an object being renamed
during the deletion process.

Nothing yet checks the value returned from this function, so there
should be no change in behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 months agos4:dsdb: Check whether ‘p’ is NULL before dereferencing it (CID 240875)
Joseph Sutton [Thu, 5 Oct 2023 21:27:45 +0000 (10:27 +1300)]
s4:dsdb: Check whether ‘p’ is NULL before dereferencing it (CID 240875)

Commit 6baf7608dfc3517cb3798fc53db849f49c6d157a added a NULL check in
one place, but not everywhere ‘p’ was dereferenced.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>