r3416: Typos
[Samba/aatanasov.git] / source / torture / rpc / remact.c
blob1136f680252009289644fcb7565e9225e0c26564
1 /*
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.
22 #include "includes.h"
24 #define CLSID_TEST "00000316-0000-0000-C000-000000000046"
25 #define CLSID_SIMPLE "5e9ddec7-5767-11cf-beab-00aa006c3606"
26 #define CLSID_COFFEEMACHINE "DB7C21F8-FE33-4C11-AEA5-CEB56F076FBB"
28 static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
30 struct RemoteActivation r;
31 NTSTATUS status;
32 struct GUID iids[2];
33 uint16 protseq[2] = { EPM_PROTOCOL_TCP, EPM_PROTOCOL_NCALRPC };
35 ZERO_STRUCT(r.in);
36 r.in.this.version.MajorVersion = 5;
37 r.in.this.version.MinorVersion = 1;
38 uuid_generate_random(&r.in.this.cid);
39 GUID_from_string(CLSID_SIMPLE, &r.in.Clsid);
40 r.in.ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY;
41 r.in.num_protseqs = 2;
42 r.in.protseq = protseq;
43 r.in.Interfaces = 1;
44 GUID_from_string(DCERPC_IUNKNOWN_UUID, &iids[0]);
45 r.in.pIIDs = iids;
47 status = dcerpc_RemoteActivation(p, mem_ctx, &r);
48 if(NT_STATUS_IS_ERR(status)) {
49 fprintf(stderr, "RemoteActivation: %s\n", nt_errstr(status));
50 return 0;
53 if(!W_ERROR_IS_OK(r.out.result)) {
54 fprintf(stderr, "RemoteActivation: %s\n", win_errstr(r.out.result));
55 return 0;
58 if(!W_ERROR_IS_OK(W_ERROR(r.out.hr))) {
59 fprintf(stderr, "RemoteActivation: %s\n", win_errstr(W_ERROR(r.out.hr)));
60 return 0;
63 return 1;
66 BOOL torture_rpc_remact(void)
68 NTSTATUS status;
69 struct dcerpc_pipe *p;
70 TALLOC_CTX *mem_ctx;
71 BOOL ret = True;
73 mem_ctx = talloc_init("torture_rpc_remact");
75 status = torture_rpc_connection(&p,
76 DCERPC_IREMOTEACTIVATION_NAME,
77 DCERPC_IREMOTEACTIVATION_UUID,
78 DCERPC_IREMOTEACTIVATION_VERSION);
80 if (!NT_STATUS_IS_OK(status)) {
81 return False;
84 if(!test_RemoteActivation(p, mem_ctx))
85 ret = False;
87 talloc_destroy(mem_ctx);
89 torture_rpc_close(p);
91 return ret;