From ad4c40b9278522e36c3d50d80658f03d9f8da805 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 31 Oct 2004 18:37:59 +0000 Subject: r3413: RemoteActivation updates and fixes Add torture test for RemoteActivation The request is now send correctly and we get back a valid response from Windows but r->in.Interfaces is set to 0 somewhere while parsing the response... (This used to be commit cabec03422f0c7140b56b2d5c4ec8ca663b406fc) --- source4/librpc/idl/dcom.idl | 10 ------ source4/librpc/idl/remact.idl | 28 +++++++++-------- source4/torture/config.mk | 1 + source4/torture/rpc/epmapper.c | 71 ++++++++++++++---------------------------- source4/torture/torture.c | 1 + 5 files changed, 41 insertions(+), 70 deletions(-) (limited to 'source4') diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl index d51d9ccaa3..864a764705 100644 --- a/source4/librpc/idl/dcom.idl +++ b/source4/librpc/idl/dcom.idl @@ -479,16 +479,6 @@ object, [out] uint16 *puArgErr); } -[ -object, - uuid("330E9E75-DF48-11CF-8E2C-00A0C90DC94B"), - pointer_default(unique) - ] - interface IDcomEchoServ : IDispatch -{ - HRESULT EchoPlusOne([in] uint32 x, [out] uint32 *y); -} - [ object, uuid("00000003-0000-0000-C000-000000000046") diff --git a/source4/librpc/idl/remact.idl b/source4/librpc/idl/remact.idl index 1756ed3c8b..b9e73a2b14 100644 --- a/source4/librpc/idl/remact.idl +++ b/source4/librpc/idl/remact.idl @@ -14,17 +14,19 @@ ] interface IRemoteActivation { - typedef struct { - /* Looks very much like a protocol tower to me, but it appears - to be aligned differently then it is in epmapper -jelmer - */ - uint8 FIXME[12]; - } floor_tmp; + typedef enum + { + RPC_C_IMP_LEVEL_DEFAULT = 0, + RPC_C_IMP_LEVEL_ANONYMOUS = 1, + RPC_C_IMP_LEVEL_IDENTIFY = 2, + RPC_C_IMP_LEVEL_IMPERSONATE = 3, + RPC_C_IMP_LEVEL_DELEGATE = 4 + } imp_levels; const uint32 MODE_GET_CLASS_OBJECT = 0xffffffff; - HRESULT RemoteActivation ( - [in] ORPCTHIS ORPCthis, - [out] ORPCTHAT ORPCthat, + WERROR RemoteActivation ( + [in] ORPCTHIS this, + [out] ORPCTHAT that, [in] GUID Clsid, [in, unique] unistr *pwszObjectName, [in, unique] MInterfacePointer *pObjectStorage, @@ -33,13 +35,13 @@ interface IRemoteActivation [in] uint32 Interfaces, [in, unique,size_is(Interfaces)] GUID *pIIDs, [in] uint16 num_protseqs, - [in, size_is(num_protseqs)] floor_tmp protseq[], + [in, size_is(num_protseqs)] uint16 protseq[], [out] HYPER_T pOxid, [out] DUALSTRINGARRAY *pdsaOxidBindings, [out] IPID ipidRemUnknown, - [out] uint32 pAuthnHint, - [out] COMVERSION pServerVersion, - [out] HRESULT phr, + [out] uint32 AuthnHint, + [out] COMVERSION ServerVersion, + [out] HRESULT hr, [out,size_is(Interfaces)] MInterfacePointer ifaces[], [out,size_is(Interfaces)] HRESULT results[] ); diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 20f0f7bbc5..1c22506b07 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -68,6 +68,7 @@ ADD_OBJ_FILES = \ torture/rpc/epmapper.o \ torture/rpc/winreg.o \ torture/rpc/oxidresolve.o \ + torture/rpc/remact.o \ torture/rpc/mgmt.o \ torture/rpc/scanner.o \ torture/rpc/autoidl.o \ diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index b1076e64c6..6382800cec 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -130,7 +130,8 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct GUID uuid; const char *uuid_str; struct policy_handle handle; - int i; + int i, j; + const char *test_bindings[] = { "ncacn_np:", "ncacn_ip_tcp:", "ncalrpc:", "ncadg_ip_udp:" }; ZERO_STRUCT(uuid); ZERO_STRUCT(handle); @@ -146,58 +147,34 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("epm_Map results for '%s':\n", idl_pipe_name(uuid_str, twr->tower.floors[0].lhs.info.uuid.version)); - 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->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; + for (i = 0; i < ARRAY_SIZE(test_bindings); i++) + { + struct dcerpc_binding binding; + status = dcerpc_parse_binding(mem_ctx, test_bindings[i], &binding); - 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;itower); - } + if (NT_STATUS_IS_ERR(status)) { + printf("Error parsing binding string '%s'\n", test_bindings[i]); + return False; } - } - - 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;itower); + binding.object = twr->tower.floors[0].lhs.info.uuid.uuid; + binding.object_version = twr->tower.floors[0].lhs.info.uuid.version; + + status = dcerpc_binding_build_tower(mem_ctx, &binding, &twr->tower); + if (NT_STATUS_IS_ERR(status)) { + printf("Error parsing binding string '%s'\n", test_bindings[i]); + return False; + } + + status = dcerpc_epm_Map(p, mem_ctx, &r); + if (NT_STATUS_IS_OK(status) && r.out.result == 0) { + for (j=0;jtower); + } } } } - - 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->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;itower); - } - } - } - - /* FIXME: Extend to do other protocols as well (ncacn_unix_stream, ncalrpc) */ return True; } diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 3aa74ac59b..462a46fbf1 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2493,6 +2493,7 @@ static struct { {"RPC-EPMAPPER", torture_rpc_epmapper, 0}, {"RPC-WINREG", torture_rpc_winreg, 0}, {"RPC-OXIDRESOLVE", torture_rpc_oxidresolve, 0}, + {"RPC-REMACT", torture_rpc_remact, 0}, {"RPC-MGMT", torture_rpc_mgmt, 0}, {"RPC-SCANNER", torture_rpc_scanner, 0}, {"RPC-AUTOIDL", torture_rpc_autoidl, 0}, -- cgit