From aa1c83bdbb7fb6d218ac5965433094fe127fc173 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Oct 2004 10:52:03 +0000 Subject: r3111: Add a few more protocol identifiers, rhs for ncalrpc (This used to be commit 53567a83cbca9df60bef76a15df24d2cd89a16b0) --- source4/librpc/idl/epmapper.idl | 48 ++++++++++++++++++++----- source4/librpc/rpc/dcerpc_util.c | 44 +++++++++++------------ source4/rpc_server/epmapper/rpc_epmapper.c | 8 ++--- source4/torture/rpc/epmapper.c | 56 +++++++++++++++--------------- 4 files changed, 94 insertions(+), 62 deletions(-) diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl index eaf2b185f6..de45675c90 100644 --- a/source4/librpc/idl/epmapper.idl +++ b/source4/librpc/idl/epmapper.idl @@ -50,20 +50,24 @@ interface epmapper EPM_PROTOCOL_TCP = 0x07, EPM_PROTOCOL_UDP = 0x08, EPM_PROTOCOL_IP = 0x09, - /* These 4 are protocol identifiers, always at level 3 or lower */ EPM_PROTOCOL_NCADG = 0x0a, /* Connectionless RPC */ EPM_PROTOCOL_NCACN = 0x0b, EPM_PROTOCOL_NCALRPC = 0x0c, /* Local RPC */ EPM_PROTOCOL_UUID = 0x0d, - EPM_PROTOCOL_IPX = 0x0e, EPM_PROTOCOL_SMB = 0x0f, EPM_PROTOCOL_PIPE = 0x10, EPM_PROTOCOL_NETBIOS = 0x11, - EPM_PROTOCOL_NB_NB = 0x12, /* NetBIOS over NetBEUI */ + 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_APPLETALK = 0x18, /* AppleTalk */ + EPM_PROTOCOL_VINES_SPP = 0x1a, + EPM_PROTOCOL_VINES_IPC = 0x1b, + EPM_PROTOCOL_STREETTALK = 0x1c, EPM_PROTOCOL_HTTP = 0x1f, EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */ EPM_PROTOCOL_NULL = 0x21 @@ -127,7 +131,7 @@ interface epmapper } epm_rhs_netbios; typedef struct { - } epm_rhs_nb_nb; + } epm_rhs_netbeui; typedef struct { } epm_rhs_spx; @@ -147,8 +151,30 @@ interface epmapper } epm_rhs_null; typedef struct { + astring identifier; } epm_rhs_ncalrpc; + typedef struct { + } epm_rhs_appletalk; + + typedef struct { + } epm_rhs_atalk_stream; + + typedef struct { + } epm_rhs_atalk_datagram; + + typedef struct { + uint16 port; + } epm_rhs_vines_spp; + + typedef struct { + uint16 port; + } epm_rhs_vines_ipc; + + typedef struct { + astring streettalk; + } epm_rhs_streettalk; + typedef [flag(NDR_BIG_ENDIAN),nodiscriminant] union { [case(EPM_PROTOCOL_DNET_NSP)] epm_rhs_dnet_nsp dnet_nsp; [case(EPM_PROTOCOL_OSI_TP4)] epm_rhs_osi_tp4 osi_tp4; @@ -164,9 +190,15 @@ interface epmapper [case(EPM_PROTOCOL_SMB)] epm_rhs_smb smb; [case(EPM_PROTOCOL_PIPE)] epm_rhs_pipe pipe; [case(EPM_PROTOCOL_NETBIOS)] epm_rhs_netbios netbios; - [case(EPM_PROTOCOL_NB_NB)] epm_rhs_nb_nb nb_nb; + [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_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; + [case(EPM_PROTOCOL_STREETTALK)] epm_rhs_streettalk streettalk; [case(EPM_PROTOCOL_HTTP)] epm_rhs_http http; [case(EPM_PROTOCOL_UNIX_DS)] epm_rhs_unix_ds unix_ds; [case(EPM_PROTOCOL_NULL)] epm_rhs_null null; @@ -191,11 +223,11 @@ interface epmapper typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct { uint16 num_floors; epm_floor floors[num_floors]; - } epm_towers; + } epm_tower; typedef [gensize] struct { - [value(ndr_size_epm_towers(0, &r->towers,ndr->flags))] uint32 tower_length; - [subcontext(4)] epm_towers towers; + [value(ndr_size_epm_tower(0, &r->tower,ndr->flags))] uint32 tower_length; + [subcontext(4)] epm_tower tower; } epm_twr_t; typedef struct { diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index ccb7f126ea..d034dd89d0 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -62,37 +62,37 @@ NTSTATUS dcerpc_epm_map_tcp_port(const char *server, ZERO_STRUCT(handle); ZERO_STRUCT(guid); - twr.towers.num_floors = 5; - twr.towers.floors = talloc(p, sizeof(twr.towers.floors[0]) * 5); + twr.tower.num_floors = 5; + twr.tower.floors = talloc(p, sizeof(twr.tower.floors[0]) * 5); /* what I'd like for christmas ... */ /* an RPC interface ... */ - twr.towers.floors[0].lhs.protocol = EPM_PROTOCOL_UUID; - GUID_from_string(uuid, &twr.towers.floors[0].lhs.info.uuid.uuid); - twr.towers.floors[0].lhs.info.uuid.version = version; - twr.towers.floors[0].rhs.uuid.unknown = 0; + twr.tower.floors[0].lhs.protocol = EPM_PROTOCOL_UUID; + GUID_from_string(uuid, &twr.tower.floors[0].lhs.info.uuid.uuid); + twr.tower.floors[0].lhs.info.uuid.version = version; + twr.tower.floors[0].rhs.uuid.unknown = 0; /* encoded with NDR ... */ - twr.towers.floors[1].lhs.protocol = EPM_PROTOCOL_UUID; - GUID_from_string(NDR_GUID, &twr.towers.floors[1].lhs.info.uuid.uuid); - twr.towers.floors[1].lhs.info.uuid.version = NDR_GUID_VERSION; - twr.towers.floors[1].rhs.uuid.unknown = 0; + twr.tower.floors[1].lhs.protocol = EPM_PROTOCOL_UUID; + GUID_from_string(NDR_GUID, &twr.tower.floors[1].lhs.info.uuid.uuid); + twr.tower.floors[1].lhs.info.uuid.version = NDR_GUID_VERSION; + twr.tower.floors[1].rhs.uuid.unknown = 0; /* on an RPC connection ... */ - twr.towers.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN; - twr.towers.floors[2].lhs.info.lhs_data = data_blob(NULL, 0); - twr.towers.floors[2].rhs.ncacn.minor_version = 0; + twr.tower.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN; + twr.tower.floors[2].lhs.info.lhs_data = data_blob(NULL, 0); + twr.tower.floors[2].rhs.ncacn.minor_version = 0; /* on a TCP port ... */ - twr.towers.floors[3].lhs.protocol = EPM_PROTOCOL_TCP; - twr.towers.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); - twr.towers.floors[3].rhs.tcp.port = 0; + twr.tower.floors[3].lhs.protocol = EPM_PROTOCOL_TCP; + twr.tower.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); + twr.tower.floors[3].rhs.tcp.port = 0; /* on an IP link ... */ - twr.towers.floors[4].lhs.protocol = EPM_PROTOCOL_IP; - twr.towers.floors[4].lhs.info.lhs_data = data_blob(NULL, 0); - twr.towers.floors[4].rhs.ip.address = 0; + twr.tower.floors[4].lhs.protocol = EPM_PROTOCOL_IP; + twr.tower.floors[4].lhs.info.lhs_data = data_blob(NULL, 0); + twr.tower.floors[4].rhs.ip.address = 0; /* with some nice pretty paper around it of course */ r.in.object = &guid; @@ -117,13 +117,13 @@ NTSTATUS dcerpc_epm_map_tcp_port(const char *server, return NT_STATUS_PORT_UNREACHABLE; } - if (twr_r->towers.num_floors != 5 || - twr_r->towers.floors[3].lhs.protocol != twr.towers.floors[3].lhs.protocol) { + if (twr_r->tower.num_floors != 5 || + twr_r->tower.floors[3].lhs.protocol != twr.tower.floors[3].lhs.protocol) { dcerpc_pipe_close(p); return NT_STATUS_PORT_UNREACHABLE; } - *port = twr_r->towers.floors[3].rhs.tcp.port; + *port = twr_r->tower.floors[3].rhs.tcp.port; dcerpc_pipe_close(p); diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c index 7de99687b7..cf6b8429f0 100644 --- a/source4/rpc_server/epmapper/rpc_epmapper.c +++ b/source4/rpc_server/epmapper/rpc_epmapper.c @@ -218,7 +218,7 @@ static error_status_t epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX return EPMAPPER_STATUS_NO_MEMORY; } - if (!fill_protocol_tower(mem_ctx, &r->out.entries[i].tower->towers, &eps->e[i])) { + if (!fill_protocol_tower(mem_ctx, &r->out.entries[i].tower->tower, &eps->e[i])) { return EPMAPPER_STATUS_NO_MEMORY; } } @@ -256,11 +256,11 @@ static error_status_t epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *me } if (!r->in.map_tower || r->in.max_towers == 0 || - r->in.map_tower->towers.num_floors != 5) { + r->in.map_tower->tower.num_floors != 5) { goto failed; } - floors = r->in.map_tower->towers.floors; + floors = r->in.map_tower->tower.floors; if (floors[0].lhs.protocol != EPM_PROTOCOL_UUID || floors[1].lhs.protocol != EPM_PROTOCOL_UUID || @@ -289,7 +289,7 @@ static error_status_t epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *me } break; } - fill_protocol_tower(mem_ctx, &r->out.towers->twr->towers, &eps[i]); + fill_protocol_tower(mem_ctx, &r->out.towers->twr->tower, &eps[i]); r->out.towers->twr->tower_length = 0; return EPMAPPER_STATUS_OK; } diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index c2450c6fbf..5335fd2dac 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -85,8 +85,8 @@ static void display_tower(TALLOC_CTX *mem_ctx, struct epm_towers *twr) printf(" NetBIOS:%s", rhs->netbios.name); break; - case EPM_PROTOCOL_NB_NB: - printf(" NB_NB"); + case EPM_PROTOCOL_NETBEUI: + printf(" NETBeui"); break; case EPM_PROTOCOL_SPX: @@ -141,63 +141,63 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.out.entry_handle = &handle; r.in.max_towers = 100; - if (twr->towers.num_floors != 5) { - printf(" tower has %d floors - skipping test_Map\n", twr->towers.num_floors); + if (twr->tower.num_floors != 5) { + printf(" tower has %d floors - skipping test_Map\n", twr->tower.num_floors); return True; } - uuid_str = GUID_string(mem_ctx, &twr->towers.floors[0].lhs.info.uuid.uuid); + uuid_str = GUID_string(mem_ctx, &twr->tower.floors[0].lhs.info.uuid.uuid); printf("epm_Map results for '%s':\n", - idl_pipe_name(uuid_str, twr->towers.floors[0].lhs.info.uuid.version)); + idl_pipe_name(uuid_str, twr->tower.floors[0].lhs.info.uuid.version)); - twr->towers.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN; - twr->towers.floors[2].lhs.info.lhs_data = data_blob(NULL, 0); - twr->towers.floors[2].rhs.ncacn.minor_version = 0; + twr->tower.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN; + twr->tower.floors[2].lhs.info.lhs_data = data_blob(NULL, 0); + twr->tower.floors[2].rhs.ncacn.minor_version = 0; - twr->towers.floors[3].lhs.protocol = EPM_PROTOCOL_TCP; - twr->towers.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); - twr->towers.floors[3].rhs.tcp.port = 0; + twr->tower.floors[3].lhs.protocol = EPM_PROTOCOL_TCP; + twr->tower.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); + twr->tower.floors[3].rhs.tcp.port = 0; - twr->towers.floors[4].lhs.protocol = EPM_PROTOCOL_IP; - twr->towers.floors[4].lhs.info.lhs_data = data_blob(NULL, 0); - twr->towers.floors[4].rhs.ip.address = 0; + twr->tower.floors[4].lhs.protocol = EPM_PROTOCOL_IP; + twr->tower.floors[4].lhs.info.lhs_data = data_blob(NULL, 0); + twr->tower.floors[4].rhs.ip.address = 0; status = dcerpc_epm_Map(p, mem_ctx, &r); if (NT_STATUS_IS_OK(status) && r.out.result == 0) { for (i=0;itowers); + display_tower(mem_ctx, &r.out.towers[i].twr->tower); } } } - twr->towers.floors[3].lhs.protocol = EPM_PROTOCOL_HTTP; - twr->towers.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); - twr->towers.floors[3].rhs.http.port = 0; + twr->tower.floors[3].lhs.protocol = EPM_PROTOCOL_HTTP; + twr->tower.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); + twr->tower.floors[3].rhs.http.port = 0; status = dcerpc_epm_Map(p, mem_ctx, &r); if (NT_STATUS_IS_OK(status) && r.out.result == 0) { for (i=0;itowers); + display_tower(mem_ctx, &r.out.towers[i].twr->tower); } } } - twr->towers.floors[3].lhs.protocol = EPM_PROTOCOL_SMB; - twr->towers.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); - twr->towers.floors[3].rhs.smb.unc = ""; + twr->tower.floors[3].lhs.protocol = EPM_PROTOCOL_SMB; + twr->tower.floors[3].lhs.info.lhs_data = data_blob(NULL, 0); + twr->tower.floors[3].rhs.smb.unc = ""; - twr->towers.floors[4].lhs.protocol = EPM_PROTOCOL_NETBIOS; - twr->towers.floors[4].lhs.info.lhs_data = data_blob(NULL, 0); - twr->towers.floors[4].rhs.netbios.name = ""; + twr->tower.floors[4].lhs.protocol = EPM_PROTOCOL_NETBIOS; + twr->tower.floors[4].lhs.info.lhs_data = data_blob(NULL, 0); + twr->tower.floors[4].rhs.netbios.name = ""; status = dcerpc_epm_Map(p, mem_ctx, &r); if (NT_STATUS_IS_OK(status) && r.out.result == 0) { for (i=0;itowers); + display_tower(mem_ctx, &r.out.towers[i].twr->tower); } } } @@ -233,7 +233,7 @@ static BOOL test_Lookup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) } for (i=0;itowers); + display_tower(mem_ctx, &r.out.entries[i].tower->tower); test_Map(p, mem_ctx, r.out.entries[i].tower); } } while (NT_STATUS_IS_OK(status) && -- cgit