summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-10-21 12:47:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:02:23 -0500
commitac989eda6d981ce47c7b345d5397450a3706f4d7 (patch)
tree8c012ac2c3b42c8fdccaf120f1da7050f4662ae6
parent18324abda7cbd206e76b4ed83ef8d6da5e24ae30 (diff)
downloadsamba-ac989eda6d981ce47c7b345d5397450a3706f4d7.tar.gz
samba-ac989eda6d981ce47c7b345d5397450a3706f4d7.tar.bz2
samba-ac989eda6d981ce47c7b345d5397450a3706f4d7.zip
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)
-rw-r--r--source4/librpc/idl/epmapper.idl14
-rw-r--r--source4/librpc/rpc/dcerpc.h4
-rw-r--r--source4/librpc/rpc/dcerpc_util.c47
-rw-r--r--source4/ntvfs/ipc/vfs_ipc.c2
-rw-r--r--source4/rpc_server/dcerpc_server.c35
-rw-r--r--source4/rpc_server/dcerpc_server.h4
-rw-r--r--source4/rpc_server/dcerpc_tcp.c2
-rw-r--r--source4/rpc_server/epmapper/rpc_epmapper.c8
8 files changed, 75 insertions, 41 deletions
diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl
index de45675c90..81f9b0976c 100644
--- a/source4/librpc/idl/epmapper.idl
+++ b/source4/librpc/idl/epmapper.idl
@@ -62,14 +62,14 @@ interface epmapper
EPM_PROTOCOL_NETBEUI = 0x12,
EPM_PROTOCOL_SPX = 0x13,
EPM_PROTOCOL_NB_IPX = 0x14, /* NetBIOS over IPX */
- EPM_PROTOCOL_ATALK_STREAM = 0x16,
- EPM_PROTOCOL_ATALK_DATAGRAM = 0x17,
+ EPM_PROTOCOL_DSP = 0x16, /* AppleTalk Data Stream Protocol */
+ EPM_PROTOCOL_DDP = 0x17, /* AppleTalk Data Datagram Protocol */
EPM_PROTOCOL_APPLETALK = 0x18, /* AppleTalk */
EPM_PROTOCOL_VINES_SPP = 0x1a,
- EPM_PROTOCOL_VINES_IPC = 0x1b,
- EPM_PROTOCOL_STREETTALK = 0x1c,
+ EPM_PROTOCOL_VINES_IPC = 0x1b, /* Inter Process Communication */
+ EPM_PROTOCOL_STREETTALK = 0x1c, /* Vines Streettalk */
EPM_PROTOCOL_HTTP = 0x1f,
- EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */
+ EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */
EPM_PROTOCOL_NULL = 0x21
} epm_protocols;
@@ -193,8 +193,8 @@ interface epmapper
[case(EPM_PROTOCOL_NETBEUI)] epm_rhs_netbeui netbeui;
[case(EPM_PROTOCOL_SPX)] epm_rhs_spx spx;
[case(EPM_PROTOCOL_NB_IPX)] epm_rhs_nb_ipx nb_ipx;
- [case(EPM_PROTOCOL_ATALK_STREAM)] epm_rhs_atalk_stream atalk_stream;
- [case(EPM_PROTOCOL_ATALK_DATAGRAM)] epm_rhs_atalk_datagram atalk_datagram;
+ [case(EPM_PROTOCOL_DSP)] epm_rhs_atalk_stream atalk_stream;
+ [case(EPM_PROTOCOL_DDP)] epm_rhs_atalk_datagram atalk_datagram;
[case(EPM_PROTOCOL_APPLETALK)] epm_rhs_appletalk appletalk;
[case(EPM_PROTOCOL_VINES_SPP)] epm_rhs_vines_spp vines_spp;
[case(EPM_PROTOCOL_VINES_IPC)] epm_rhs_vines_ipc vines_ipc;
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 3dd8143511..903759f19b 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -20,7 +20,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-enum dcerpc_transport_t {NCACN_NP, NCACN_IP_TCP};
+enum dcerpc_transport_t {
+ NCACN_NP, NCACN_IP_TCP, NCACN_IP_UDP, NCACN_VNS_IPC, NCACN_VNS_SPP,
+ NCACN_AT_DSP, NCADG_AT_DDP, NCALRPC, NCACN_UNIX_STREAM, NCADG_UNIX_DGRAM };
/*
this defines a generic security context for signed/sealed dcerpc pipes.
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index d034dd89d0..bded74c407 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -233,13 +233,34 @@ NTSTATUS dcerpc_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
+#define MAX_PROTSEQ 10
static const struct {
const char *name;
enum dcerpc_transport_t transport;
-} ncacn_transports[] = {
- {"ncacn_np", NCACN_NP},
- {"ncacn_ip_tcp", NCACN_IP_TCP}
+ int num_protocols;
+ enum epm_protocols protseq[MAX_PROTSEQ];
+} transports[] = {
+ { "ncacn_np", NCACN_NP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_PIPE }},
+ { "ncacn_ip_tcp", NCACN_IP_TCP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_IP, EPM_PROTOCOL_TCP } },
+ { "ncadg_ip_udp", NCACN_IP_UDP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_IP, EPM_PROTOCOL_UDP } },
+ { "ncalrpc", NCALRPC, 1,
+ { EPM_PROTOCOL_NCALRPC } },
+ { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } },
+ { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2,
+ { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } },
+ { "ncacn_at_dsp", NCACN_AT_DSP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } },
+ { "ncadg_at_ddp", NCADG_AT_DDP, 3,
+ { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } },
+ { "ncacn_vns_ssp", NCACN_VNS_SPP, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } },
+ { "ncacn_vns_ipc", NCACN_VNS_IPC, 3,
+ { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, },
};
static const struct {
@@ -264,9 +285,9 @@ const char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bindi
int i;
const char *t_name=NULL;
- for (i=0;i<ARRAY_SIZE(ncacn_transports);i++) {
- if (ncacn_transports[i].transport == b->transport) {
- t_name = ncacn_transports[i].name;
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (transports[i].transport == b->transport) {
+ t_name = transports[i].name;
}
}
if (!t_name) {
@@ -339,13 +360,13 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
return NT_STATUS_NO_MEMORY;
}
- for (i=0;i<ARRAY_SIZE(ncacn_transports);i++) {
- if (strcasecmp(type, ncacn_transports[i].name) == 0) {
- b->transport = ncacn_transports[i].transport;
+ for (i=0;i<ARRAY_SIZE(transports);i++) {
+ if (strcasecmp(type, transports[i].name) == 0) {
+ b->transport = transports[i].transport;
break;
}
}
- if (i==ARRAY_SIZE(ncacn_transports)) {
+ if (i==ARRAY_SIZE(transports)) {
DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
return NT_STATUS_INVALID_PARAMETER;
}
@@ -442,7 +463,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
for (i = 0; i < table->endpoints->count; i++) {
status = dcerpc_parse_binding(mem_ctx, table->endpoints->names[i], &default_binding);
- if (NT_STATUS_IS_OK(status) && default_binding.transport == ENDPOINT_SMB) {
+ if (NT_STATUS_IS_OK(status) && default_binding.transport == NCACN_NP) {
pipe_name = default_binding.options[0];
break;
@@ -603,6 +624,8 @@ NTSTATUS dcerpc_pipe_connect_b(struct dcerpc_pipe **p,
status = dcerpc_pipe_connect_ncacn_ip_tcp(p, binding, pipe_uuid, pipe_version,
domain, username, password);
break;
+ default:
+ return NT_STATUS_NOT_SUPPORTED;
}
return status;
@@ -677,6 +700,8 @@ NTSTATUS dcerpc_secondary_connection(struct dcerpc_pipe *p, struct dcerpc_pipe *
pipe_version, NULL,
NULL, NULL);
break;
+ default:
+ return NT_STATUS_NOT_SUPPORTED;
}
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c
index f4eb007235..8b1c9d2d8d 100644
--- a/source4/ntvfs/ipc/vfs_ipc.c
+++ b/source4/ntvfs/ipc/vfs_ipc.c
@@ -211,7 +211,7 @@ static NTSTATUS ipc_open_generic(struct ntvfs_module_context *ntvfs,
will need to do that once the credentials infrastructure is
finalised for Samba4
*/
- ep_description.type = ENDPOINT_SMB;
+ ep_description.type = NCACN_NP;
ep_description.info.smb_pipe = p->pipe_name;
/* tell the RPC layer the session_info */
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;