From ac989eda6d981ce47c7b345d5397450a3706f4d7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Oct 2004 12:47:02 +0000 Subject: r3114: - More work on merging the various structs that describe endpoints - Add protocol sequence to dcerpc transports (will be used later on) - Add more transports to the list (This used to be commit ab110192e6e2c1e5a3b2befe7b61158744f15d18) --- source4/rpc_server/dcerpc_server.c | 35 +++++++++++++++++++----------- source4/rpc_server/dcerpc_server.h | 4 +--- source4/rpc_server/dcerpc_tcp.c | 2 +- source4/rpc_server/epmapper/rpc_epmapper.c | 8 +++---- 4 files changed, 28 insertions(+), 21 deletions(-) (limited to 'source4/rpc_server') diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index b4cf7094aa..1ccb8f4ef2 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -34,16 +34,19 @@ static BOOL endpoints_match(const struct dcesrv_ep_description *ep1, } switch (ep1->type) { - case ENDPOINT_SMB: + case NCACN_NP: if (strcasecmp(ep1->info.smb_pipe,ep2->info.smb_pipe)==0) { return True; } break; - case ENDPOINT_TCP: + case NCACN_IP_TCP: if (ep1->info.tcp_port == ep2->info.tcp_port) { return True; } break; + default: + /* Not supported yet */ + return False; } return False; @@ -164,19 +167,21 @@ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, return status; } - if (binding.transport == NCACN_IP_TCP) { - ep_description.type = ENDPOINT_TCP; + ep_description.type = binding.transport; + switch (binding.transport) { + case NCACN_IP_TCP: ep_description.info.tcp_port = 0; if (binding.options && binding.options[0]) { ep_description.info.tcp_port = atoi(binding.options[0]); } - } else if (binding.transport == NCACN_NP) { - ep_description.type = ENDPOINT_SMB; + break; + case NCACN_NP: ep_description.info.smb_pipe = binding.options[0]; - } else { - DEBUG(0, ("Unknown transport type '%d'\n", binding.transport)); - return NT_STATUS_INVALID_PARAMETER; + break; + default: + DEBUG(0, ("Unsupported transport type '%d'\n", binding.transport)); + return NT_STATUS_NOT_SUPPORTED; } /* check if this endpoint exists @@ -187,16 +192,20 @@ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, return NT_STATUS_NO_MEMORY; } ZERO_STRUCTP(ep); - if (binding.transport == NCACN_IP_TCP) { - ep->ep_description.type = ENDPOINT_TCP; + ep->ep_description.type = binding.transport; + switch (binding.transport) { + case NCACN_IP_TCP: ep->ep_description.info.tcp_port = 0; if (binding.options && binding.options[0]) { ep->ep_description.info.tcp_port = atoi(binding.options[0]); } - } else { - ep->ep_description.type = ENDPOINT_SMB; + break; + case NCACN_NP: ep->ep_description.info.smb_pipe = binding.options[0]; + break; + default: + return NT_STATUS_NOT_SUPPORTED; } add_ep = True; } diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 09e8697fa2..f04460a78b 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -31,12 +31,10 @@ /* version 1 - initial version - metze */ #define DCERPC_MODULE_VERSION 1 -enum endpoint_type {ENDPOINT_SMB, ENDPOINT_TCP}; - /* a description of a single dcerpc endpoint. Not as flexible as a full epm tower, but much easier to work with */ struct dcesrv_ep_description { - enum endpoint_type type; + enum dcerpc_transport_t type; union { const char *smb_pipe; uint16_t tcp_port; diff --git a/source4/rpc_server/dcerpc_tcp.c b/source4/rpc_server/dcerpc_tcp.c index 9cbcea5a36..ef05d74349 100644 --- a/source4/rpc_server/dcerpc_tcp.c +++ b/source4/rpc_server/dcerpc_tcp.c @@ -62,7 +62,7 @@ static void add_socket_rpc(struct server_service *service, char *ip_str = talloc_strdup(service, inet_ntoa(*ifip)); for (e=dce_ctx->endpoint_list;e;e=e->next) { - if (e->ep_description.type == ENDPOINT_TCP) { + if (e->ep_description.type == NCACN_IP_TCP) { struct server_socket *sock; struct dcesrv_socket_context *dcesrv_sock; diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c index a39dde8da2..4ee2a7b774 100644 --- a/source4/rpc_server/epmapper/rpc_epmapper.c +++ b/source4/rpc_server/epmapper/rpc_epmapper.c @@ -77,7 +77,7 @@ static BOOL fill_protocol_tower(TALLOC_CTX *mem_ctx, struct epm_tower *twr, twr->floors[2].rhs.ncacn.minor_version = 0; switch (e->ep_description.type) { - case ENDPOINT_SMB: + case NCACN_NP: /* on a SMB pipe ... */ twr->floors[3].lhs.protocol = EPM_PROTOCOL_SMB; twr->floors[3].lhs.info.lhs_data = data_blob(NULL, 0); @@ -90,7 +90,7 @@ static BOOL fill_protocol_tower(TALLOC_CTX *mem_ctx, struct epm_tower *twr, lp_netbios_name()); break; - case ENDPOINT_TCP: + case NCACN_IP_TCP: /* on a TCP connection ... */ twr->floors[3].lhs.protocol = EPM_PROTOCOL_TCP; twr->floors[3].lhs.info.lhs_data = data_blob(NULL, 0); @@ -276,13 +276,13 @@ static error_status_t epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *me continue; } switch (eps[i].ep_description.type) { - case ENDPOINT_SMB: + case NCACN_NP: if (floors[3].lhs.protocol != EPM_PROTOCOL_SMB || floors[4].lhs.protocol != EPM_PROTOCOL_NETBIOS) { continue; } break; - case ENDPOINT_TCP: + case NCACN_IP_TCP: if (floors[3].lhs.protocol != EPM_PROTOCOL_TCP || floors[4].lhs.protocol != EPM_PROTOCOL_IP) { continue; -- cgit