diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-10-18 15:18:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:01:53 -0500 |
commit | 31403d548e95ee6047009b78ed72e7144ece199a (patch) | |
tree | ed25edef604668354e5b9ffc4cf4cc75d5d1a9c1 /source4/rpc_server | |
parent | b1b8f49a5b6d57cdec663efe0d43c5e3de4abbf3 (diff) | |
download | samba-31403d548e95ee6047009b78ed72e7144ece199a.tar.gz samba-31403d548e95ee6047009b78ed72e7144ece199a.tar.bz2 samba-31403d548e95ee6047009b78ed72e7144ece199a.zip |
r3043: Use binding strings for specifying endpoints. The property for
specifying a endpoint is now also 'endpoint' instead of 'endpoints'. The
default endpoint (if none is specified) is still "ncacn_np:[\\pipe\\ifacename]",
where ifacename is the name of the interface.
Examples:
[
uuid(60a15ec5-4de8-11d7-a637-005056a20182),
endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:")
]
interface rpcecho
{
void dummy();
}
dcerpc_binding is now converted to ep_description in the server, but I hope to
completely eliminate ep_description later on.
The eventual goal of all these changes is to make it easier to add
transports as I'm going to add support for
ncalrpc (local RPC over named pipes) and ncacn_unix_stream (Unix sockets).
(This used to be commit f3da7c8b443a29b0c656c687a277384ae1353792)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 36 | ||||
-rw-r--r-- | source4/rpc_server/epmapper/rpc_epmapper.c | 3 |
2 files changed, 28 insertions, 11 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 220c730790..b4cf7094aa 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -153,17 +153,30 @@ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, struct dcesrv_ep_description ep_description; struct dcesrv_endpoint *ep; struct dcesrv_if_list *ifl; - BOOL tcp; + struct dcerpc_binding binding; BOOL add_ep = False; + NTSTATUS status; + + status = dcerpc_parse_binding(dce_ctx, ep_name, &binding); - tcp = (strncasecmp(ep_name, "TCP-", 4) == 0); + if (NT_STATUS_IS_ERR(status)) { + DEBUG(0, ("Trouble parsing binding string '%s'\n", ep_name)); + return status; + } - if (tcp) { + if (binding.transport == NCACN_IP_TCP) { ep_description.type = ENDPOINT_TCP; - ep_description.info.tcp_port = atoi(ep_name+4); - } else { + 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; - ep_description.info.smb_pipe = ep_name; + ep_description.info.smb_pipe = binding.options[0]; + } else { + DEBUG(0, ("Unknown transport type '%d'\n", binding.transport)); + return NT_STATUS_INVALID_PARAMETER; } /* check if this endpoint exists @@ -174,12 +187,16 @@ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, return NT_STATUS_NO_MEMORY; } ZERO_STRUCTP(ep); - if (tcp) { + if (binding.transport == NCACN_IP_TCP) { ep->ep_description.type = ENDPOINT_TCP; - ep->ep_description.info.tcp_port = atoi(ep_name+4); + 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; - ep->ep_description.info.smb_pipe = smb_xstrdup(ep_name); + ep->ep_description.info.smb_pipe = binding.options[0]; } add_ep = True; } @@ -508,6 +525,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) pkt.u.bind_ack.max_recv_frag = 0x2000; pkt.u.bind_ack.assoc_group_id = call->pkt.u.bind.assoc_group_id; if (call->conn->iface && call->conn->iface->ndr) { + /* FIXME: Use pipe name as specified by endpoint instead of interface name */ pkt.u.bind_ack.secondary_address = talloc_asprintf(call, "\\PIPE\\%s", call->conn->iface->ndr->name); } else { diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c index 5cf34efa7f..7de99687b7 100644 --- a/source4/rpc_server/epmapper/rpc_epmapper.c +++ b/source4/rpc_server/epmapper/rpc_epmapper.c @@ -81,8 +81,7 @@ static BOOL fill_protocol_tower(TALLOC_CTX *mem_ctx, struct epm_towers *twr, /* on a SMB pipe ... */ twr->floors[3].lhs.protocol = EPM_PROTOCOL_SMB; twr->floors[3].lhs.info.lhs_data = data_blob(NULL, 0); - twr->floors[3].rhs.smb.unc = talloc_asprintf(mem_ctx, "\\PIPE\\%s", - e->ep_description.info.smb_pipe); + twr->floors[3].rhs.smb.unc = talloc_strdup(mem_ctx, e->ep_description.info.smb_pipe); /* on an NetBIOS link ... */ twr->floors[4].lhs.protocol = EPM_PROTOCOL_NETBIOS; |