1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

32 Commits

Author SHA1 Message Date
Volker Lendecke
730f7dfd61 s3:rpc_server: Delete unused code and doc references
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-12-10 14:02:30 +00:00
Volker Lendecke
a7c65958a1 s3:rpc_server: Activate samba-dcerpcd
This is the big switch to use samba-dcerpcd for the RPC services in
source3/. It is a pretty big and unordered patch, but I don't see a
good way to split this up into more manageable pieces without
sacrificing bisectability even more. Probably I could cut out a few
small ones, but a major architechtural switch like this will always be
messy.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-12-10 14:02:30 +00:00
Volker Lendecke
aa147153c1 rpc_server: Don't rely on TCP-bind() to return EADDRINUSE
socket_wrapper can't do EADDRINUSE because unix domain sockets don't
do it.

This currently works correctly because right now all RPC servers
either use explicit ports or all listen on the same socket.

The new code uses a static variable, so it only helps if a single
process listens for multiple RPC sockets. It won't work if multiple
processes start listening. But in case samba-dcerpcd goes in this will
be exactly the right thing to do.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-06-15 18:11:35 +00:00
Volker Lendecke
7f967589ea rpc_server: Use correct PRIu16 for printf of a uint16
Don't rely on correct casting

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-06-04 16:47:34 +00:00
Volker Lendecke
72540222c2 lib: Properly return errno from open_socket_in()
Before this patch, open_socket_in() relied on quite a bit of code to
not touch errno after for example socket() returned -1. Change this to
explicitly save errno in "ret", such that a later DEBUG() with all its
formatting code can mess it up.

While there, remove the debuglevel parameter. I don't think this
actually useful.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-19 07:09:37 +00:00
Volker Lendecke
9e3f0fa34b rpc_server: Fix a -Werror=format-truncation error
gcc gets this wrong, it believes %u can write up to
"2147483647" (2^31-1). Silence this with an easy patch.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-16 17:09:32 +00:00
Volker Lendecke
17a8fa6d24 rpc_server: Add CLOEXEC to the listening sockets
We don't want to leak them into exec'ed processes.

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 Jan 26 01:13:53 UTC 2021 on sn-devel-184
2021-01-26 01:13:53 +00:00
Volker Lendecke
d4e46cae4c rpc_server: Consolidate transport-specific socket creation
We had the transport switch in two places, put them together into
dcesrv_create_binding_sockets(). This makes the transport-specific
socket creation functions static to rpc_sock_helper.c.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
125c605ea5 rpc_server: Move socket creation to rpc_sock_helper.[ch]
dcesrv_create_ncacn_ip_tcp_sockets() already was there, move the rest
as well. This makes dcesrv_create_ncacn_np_socket() static to
rpc_sock_helper.c.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
e74d520855 rpc_server: Pass dcerpc_binding to dcesrv_create_ncacn_ip_tcp_sockets()
It does not need a dcesrv_endpoint.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
9bb5b32621 rpc_server: Remove protocol-specific dcerpc_setup_ routines
These are all just stream sockets, being taken care of by
dcesrv_setup_ncacn_listener()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 14 14:35:58 UTC 2021 on sn-devel-184
2021-01-14 14:35:58 +00:00
Volker Lendecke
a00e3e8af3 rpc_server: Lift logic to fill in pf_listen_fd one level
dcesrv_create_ncacn_ip_tcp_sockets() now returns a struct of fd's
instead of filling a preallocated array: Its only function beyond
dcesrv_open_ncacn_ip_tcp_sockets() is thus gone.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-11 13:19:32 +00:00
Volker Lendecke
666fc24a90 rpc_server: Use dcesrv_open_ncacn_ip_tcp_sockets() in dcesrv_setup_ncacn_ip_tcp_sockets()
Avoid duplication of logic with "lp_interfaces_only()"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-01-11 13:19:32 +00:00
Volker Lendecke
276b9bc20a rpc_server: Factor out dcesrv_open_ncacn_ip_tcp_sockets()
The main change is to return an allocated array of file descriptors in
dcesrv_open_ncacn_ip_tcp_sockets() instead of filling a preallocated
array of pf_listen_fd structures.

Signed-off-by: Volker Lendecke <vl@samba.org>
2021-01-11 13:19:32 +00:00
Samuel Cabrero
82020a3f62 s3:rpc_server: Drop dcerpc_binding_vector usage in the server side
The endpoint mapper entry is built using the dcesrv_endpoint and the
interfaces registered into it instead of using the
dcerpc_binding_vector.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-03-20 15:36:34 +00:00
Samuel Cabrero
a6b718b6ec s3:rpc_server: Create ncacn_ip_tcp sockets through enpoint init
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-03-20 15:36:34 +00:00
Samuel Cabrero
a18163a147 s3:rpc_server: Setup ncacn_ip_tcp sockets through endpoint init
The listener is created in the endpoint memory context. If the endpoint
is freed, the listener will be freed too and the socket closed.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-03-20 15:36:34 +00:00
Samuel Cabrero
6f07f46771 s3:rpc_server: Set debug class in all rpc server related files
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:15 +00:00
Samuel Cabrero
6964348bbf s3:prefork: Allow to associate private data with listening socket
Prepare for merger RPC server codebase, where it will be necessary to
stablish an association between the listening socket and the
dcesrv_endpoint that the socket is serving.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:15 +00:00
Samuel Cabrero
ae14c51080 s3:rpc_server: Return NTSTATUS for dcesrv_setup_ncacn_ip_tcp_socket
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:13 +00:00
Samuel Cabrero
a6b5899853 s3:rpc_server: Rename setup_dcerpc_ncacn_tcpip_socket
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:13 +00:00
Samuel Cabrero
3f4be0b9db s3:rpc_server: Rename rpc_create_tcpip_sockets
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:13 +00:00
Samuel Cabrero
e3999a14da s3:rpc_server: Return NTSTATUS for dcesrv_create_ncacn_ip_tcp_socket
Additionally to the fd number, check the port number has been correctly
assigned. This check was performed by the callers of this function.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:13 +00:00
Samuel Cabrero
b7817eaf3d s3:rpc_server: Rename create_tcpip_socket
Additionally move function declaration from proto.h to rpc_server.h

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-22 16:49:13 +00:00
Stefan Metzmacher
5ed7ee7279 s3:rpc_server: simplify the error checking of create_tcpip_socket() callers
create_tcpip_socket() never returns a valid fd and left port as 0.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-22 16:49:13 +00:00
Andreas Schneider
a7e10f7853 s3:rpc_server: Use #ifdef instead of #if for config.h definitions
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2018-11-28 23:19:23 +01:00
Günther Deschner
316ace66d0 s3-rpc_server: fix rpc_create_tcpip_sockets() processing of interfaces.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11245

We were supplying an empty value for the "host" binding string option, causing
dcerpc_binding_vector_add_port() call to fail.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Pair-Programmed-With: Alexander Bokovoy <ab@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Apr 30 15:14:27 CEST 2015 on sn-devel-104
2015-04-30 15:14:27 +02:00
Gregor Beck
e2d6431cd4 s3:rpc_server: rpc_create_tcpip_sockets() may leak talloc_stackframe on failure
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10241

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Nov  4 12:30:27 CET 2013 on sn-devel-104
2013-11-04 12:30:26 +01:00
Volker Lendecke
c909c0131a rpc_server3: Fix two const warnings
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-08-12 14:00:10 -07:00
Andreas Schneider
92b087182c s3-rpc_server: Make sure that fd is really closed on error.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2013-02-22 16:36:14 +01:00
Andrew Bartlett
b181a0b96b lib/param: Remove use of lp{cfg,}_socket_address outside the NBT client and server
In these other cases, control of the sockets to bind to can be obtained using
"bind interfaces only = yes" and "interfaces = ".

Andrew Bartlett
2012-07-27 17:59:51 +10:00
Andreas Schneider
498e53c220 s3-rpc_server: Add RPC socket helper functions. 2011-08-01 08:50:35 +02:00