2 Unix SMB/CIFS implementation.
3 test suite for remoteactivation operations
5 Copyright (C) Jelmer Vernooij 2004
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "torture/torture.h"
24 #include "librpc/gen_ndr/ndr_remact.h"
25 #include "librpc/gen_ndr/ndr_remact_c.h"
26 #include "librpc/gen_ndr/ndr_epmapper.h"
27 #include "librpc/gen_ndr/ndr_epmapper_c.h"
28 #include "librpc/gen_ndr/ndr_dcom.h"
29 #include "torture/rpc/rpc.h"
31 #define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9"
33 static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
35 struct RemoteActivation r;
38 uint16_t protseq[3] = { EPM_PROTOCOL_TCP, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID };
41 r.in.this.version.MajorVersion = 5;
42 r.in.this.version.MinorVersion = 1;
43 r.in.this.cid = GUID_random();
44 GUID_from_string(CLSID_IMAGEDOC, &r.in.Clsid);
45 r.in.ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY;
46 r.in.num_protseqs = 3;
47 r.in.protseq = protseq;
49 GUID_from_string(DCERPC_IUNKNOWN_UUID, &iids[0]);
52 status = dcerpc_RemoteActivation(p, mem_ctx, &r);
53 if(NT_STATUS_IS_ERR(status)) {
54 printf("RemoteActivation: %s\n", nt_errstr(status));
58 if(!W_ERROR_IS_OK(r.out.result)) {
59 printf("RemoteActivation: %s\n", win_errstr(r.out.result));
63 if(!W_ERROR_IS_OK(r.out.hr)) {
64 printf("RemoteActivation: %s\n", win_errstr(r.out.hr));
68 if(!W_ERROR_IS_OK(r.out.results[0])) {
69 printf("RemoteActivation: %s\n", win_errstr(r.out.results[0]));
73 GUID_from_string(DCERPC_ICLASSFACTORY_UUID, &iids[0]);
75 r.in.Mode = MODE_GET_CLASS_OBJECT;
77 status = dcerpc_RemoteActivation(p, mem_ctx, &r);
78 if(NT_STATUS_IS_ERR(status)) {
79 printf("RemoteActivation(GetClassObject): %s\n", nt_errstr(status));
83 if(!W_ERROR_IS_OK(r.out.result)) {
84 printf("RemoteActivation(GetClassObject): %s\n", win_errstr(r.out.result));
88 if(!W_ERROR_IS_OK(r.out.hr)) {
89 printf("RemoteActivation(GetClassObject): %s\n", win_errstr(r.out.hr));
93 if(!W_ERROR_IS_OK(r.out.results[0])) {
94 printf("RemoteActivation(GetClassObject): %s\n", win_errstr(r.out.results[0]));
101 BOOL torture_rpc_remact(void)
104 struct dcerpc_pipe *p;
108 mem_ctx = talloc_init("torture_rpc_remact");
110 status = torture_rpc_connection(mem_ctx,
112 &dcerpc_table_IRemoteActivation);
114 if (!NT_STATUS_IS_OK(status)) {
115 talloc_free(mem_ctx);
119 if(!test_RemoteActivation(p, mem_ctx))
122 talloc_free(mem_ctx);