]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_server: maintain file_type, device_state, allocation_size per endpoint
authorStefan Metzmacher <metze@samba.org>
Tue, 9 Jun 2026 16:00:27 +0000 (18:00 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 24 Jul 2026 13:33:36 +0000 (13:33 +0000)
Use the defaults for dcerpc, but in future we will have non-dcerpc
services in future...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/rpc_server/rpc_host.c

index d5c0a9f3a6b66bf49f14c5ce9af27a42bd9ef5f9..30c5f777ff138d460ba327c969584d782e538626 100644 (file)
@@ -116,6 +116,7 @@ struct rpc_host_iface_name {
 struct rpc_host_endpoint {
        struct rpc_server *server;
        struct dcerpc_binding *binding;
+       struct named_pipe_auth_rep_info8 np_info;
        struct ndr_syntax_id *interfaces;
        int *fds;
        size_t num_fds;
@@ -628,6 +629,7 @@ static void rpc_server_get_endpoints_done(struct tevent_req *subreq)
        for (i=2; i<num_lines; i++) {
                char *line = lines[i];
                struct rpc_host_endpoint *endpoint = NULL;
+               enum dcerpc_transport_t transport;
                bool ok;
 
                if (line[0] != ' ') {
@@ -658,6 +660,15 @@ static void rpc_server_get_endpoints_done(struct tevent_req *subreq)
                        continue;
                }
 
+               transport = dcerpc_binding_get_transport(endpoint->binding);
+               if (transport == NCACN_NP && endpoint->np_info.file_type == 0) {
+                       endpoint->np_info = (struct named_pipe_auth_rep_info8) {
+                               .file_type = FILE_TYPE_MESSAGE_MODE_PIPE,
+                               .device_state = 0xff | 0x0400 | 0x0100,
+                               .allocation_size = 4096,
+                       };
+               }
+
                ok = ndr_interfaces_add_unique(
                        endpoint,
                        &endpoint->interfaces,
@@ -917,12 +928,14 @@ static void rpc_host_new_client_got_bind(struct tevent_req *subreq);
 static struct tevent_req *rpc_host_new_client_send(
        TALLOC_CTX *mem_ctx,
        struct tevent_context *ev,
-       enum dcerpc_transport_t transport,
+       const struct rpc_host_endpoint *endpoint,
        int *psock,
        const struct samba_sockaddr *peer_addr)
 {
        struct tevent_req *req = NULL, *subreq = NULL;
        struct rpc_host_new_client_state *state = NULL;
+       enum dcerpc_transport_t transport =
+               dcerpc_binding_get_transport(endpoint->binding);
        int rc, sock_dup;
        NTSTATUS status;
 
@@ -971,9 +984,9 @@ static struct tevent_req *rpc_host_new_client_send(
                        state,
                        ev,
                        state->plain,
-                       FILE_TYPE_MESSAGE_MODE_PIPE,
-                       0xff | 0x0400 | 0x0100,
-                       4096);
+                       endpoint->np_info.file_type,
+                       endpoint->np_info.device_state,
+                       endpoint->np_info.allocation_size);
                if (tevent_req_nomem(subreq, req)) {
                        return tevent_req_post(req, ev);
                }
@@ -2135,7 +2148,7 @@ static void rpc_host_endpoint_accept_accepted(struct tevent_req *subreq)
        subreq = rpc_host_new_client_send(
                state,
                state->ev,
-               dcerpc_binding_get_transport(endpoint->binding),
+               endpoint,
                &sock,
                &peer_addr);
        if (tevent_req_nomem(subreq, req)) {