summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2021-01-21 15:28:31 +0100
committerVolker Lendecke <vl@samba.org>2021-12-10 14:02:30 +0000
commitda90c02b16849038a8fce4f3ab824a41c43bfea9 (patch)
tree243206c581425bccfeb7ae30e9d87832fe4299b5 /librpc
parent95659031e4519e9c9222c51737fe177eb5a56a7c (diff)
downloadsamba-da90c02b16849038a8fce4f3ab824a41c43bfea9.tar.gz
dcesrv_core: Add dcesrv_loop_next_packet()
This is used by the helpers of samba-dcerpcd: When accepting a DCERPC client, normally the server engine would read the initial bind packet. In case of samba-dcerpcd the bind packet will already be read from the socket, so we need to inject it into the rpc server engine externally. 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>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/rpc/dcesrv_core.c22
-rw-r--r--librpc/rpc/dcesrv_core.h5
2 files changed, 27 insertions, 0 deletions
diff --git a/librpc/rpc/dcesrv_core.c b/librpc/rpc/dcesrv_core.c
index c0567bb27f0..ff38bba997b 100644
--- a/librpc/rpc/dcesrv_core.c
+++ b/librpc/rpc/dcesrv_core.c
@@ -2909,6 +2909,28 @@ static void dcesrv_read_fragment_done(struct tevent_req *subreq)
return;
}
+ dcesrv_loop_next_packet(dce_conn, pkt, buffer);
+}
+
+/**
+ * @brief Start the dcesrv loop, inducing the bind as a blob
+ *
+ * Like dcesrv_connection_loop_start() but used from connections
+ * where the caller has already read the dcerpc bind packet from
+ * the socket and is available as a DATA_BLOB.
+ *
+ * @param[in] dce_conn The connection to start
+ * @param[in] pkt The parsed bind packet
+ * @param[in] buffer The full binary bind including auth data
+ */
+void dcesrv_loop_next_packet(
+ struct dcesrv_connection *dce_conn,
+ struct ncacn_packet *pkt,
+ DATA_BLOB buffer)
+{
+ struct tevent_req *subreq = NULL;
+ NTSTATUS status;
+
status = dcesrv_process_ncacn_packet(dce_conn, pkt, buffer);
if (!NT_STATUS_IS_OK(status)) {
dcesrv_terminate_connection(dce_conn, nt_errstr(status));
diff --git a/librpc/rpc/dcesrv_core.h b/librpc/rpc/dcesrv_core.h
index 289cdebaa19..1c0d346bfe4 100644
--- a/librpc/rpc/dcesrv_core.h
+++ b/librpc/rpc/dcesrv_core.h
@@ -640,6 +640,11 @@ _PUBLIC_ void dcesrv_sock_report_output_data(struct dcesrv_connection *dce_conn)
_PUBLIC_ NTSTATUS dcesrv_connection_loop_start(struct dcesrv_connection *conn);
+_PUBLIC_ void dcesrv_loop_next_packet(
+ struct dcesrv_connection *dce_conn,
+ struct ncacn_packet *pkt,
+ DATA_BLOB buffer);
+
_PUBLIC_ NTSTATUS dcesrv_call_dispatch_local(struct dcesrv_call_state *call);
_PUBLIC_ const struct dcesrv_interface *find_interface_by_syntax_id(