r19293: Add RPC-SAMBA3-WINREG, the start of a test of what Samba3 is able to perform
[Samba.git] / source4 / torture / rpc / rpc.c
blob754633e51bb20e70af1b69d3a97456b4d9b455aa
1 /*
2 Unix SMB/CIFS implementation.
3 SMB torture tester
4 Copyright (C) Andrew Tridgell 1997-2003
5 Copyright (C) Jelmer Vernooij 2006
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"
23 #include "auth/credentials/credentials.h"
24 #include "lib/cmdline/popt_common.h"
25 #include "librpc/rpc/dcerpc.h"
26 #include "torture/rpc/rpc.h"
27 #include "torture/torture.h"
28 #include "librpc/rpc/dcerpc_table.h"
30 /* open a rpc connection to the chosen binding string */
31 _PUBLIC_ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
32 struct dcerpc_pipe **p,
33 const struct dcerpc_interface_table *table)
35 NTSTATUS status;
36 const char *binding = lp_parm_string(-1, "torture", "binding");
38 if (!binding) {
39 printf("You must specify a ncacn binding string\n");
40 return NT_STATUS_INVALID_PARAMETER;
43 status = dcerpc_pipe_connect(parent_ctx,
44 p, binding, table,
45 cmdline_credentials, NULL);
47 if (!NT_STATUS_IS_OK(status)) {
48 printf("Failed to connect to remote server: %s %s\n", binding, nt_errstr(status));
51 return status;
54 /* open a rpc connection to a specific transport */
55 NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
56 struct dcerpc_pipe **p,
57 const struct dcerpc_interface_table *table,
58 enum dcerpc_transport_t transport)
60 NTSTATUS status;
61 const char *binding = lp_parm_string(-1, "torture", "binding");
62 struct dcerpc_binding *b;
63 TALLOC_CTX *mem_ctx = talloc_named(parent_ctx, 0, "torture_rpc_connection_smb");
65 if (!binding) {
66 printf("You must specify a ncacn binding string\n");
67 talloc_free(mem_ctx);
68 return NT_STATUS_INVALID_PARAMETER;
71 status = dcerpc_parse_binding(mem_ctx, binding, &b);
72 if (!NT_STATUS_IS_OK(status)) {
73 DEBUG(0,("Failed to parse dcerpc binding '%s'\n", binding));
74 talloc_free(mem_ctx);
75 return status;
78 b->transport = transport;
80 status = dcerpc_pipe_connect_b(mem_ctx, p, b, table,
81 cmdline_credentials, NULL);
83 if (NT_STATUS_IS_OK(status)) {
84 *p = talloc_reference(parent_ctx, *p);
85 } else {
86 *p = NULL;
88 talloc_free(mem_ctx);
89 return status;
92 NTSTATUS torture_rpc_init(void)
94 dcerpc_init();
96 dcerpc_table_init();
98 register_torture_op("RPC-LSA", torture_rpc_lsa);
99 register_torture_op("RPC-LSALOOKUP", torture_rpc_lsa_lookup);
100 register_torture_op("RPC-LSA-GETUSER", torture_rpc_lsa_get_user);
101 register_torture_op("RPC-SECRETS", torture_rpc_lsa_secrets);
102 register_torture_op("RPC-ECHO", torture_rpc_echo);
103 register_torture_op("RPC-DFS", torture_rpc_dfs);
104 register_torture_op("RPC-SPOOLSS", torture_rpc_spoolss);
105 register_torture_op("RPC-SAMR", torture_rpc_samr);
106 register_torture_op("RPC-SAMR-USERS", torture_rpc_samr_users);
107 register_torture_op("RPC-SAMR-PASSWORDS", torture_rpc_samr_passwords);
108 register_torture_op("RPC-UNIXINFO", torture_rpc_unixinfo);
109 register_torture_op("RPC-NETLOGON", torture_rpc_netlogon);
110 register_torture_op("RPC-SAMLOGON", torture_rpc_samlogon);
111 register_torture_op("RPC-SAMSYNC", torture_rpc_samsync);
112 register_torture_op("RPC-SCHANNEL", torture_rpc_schannel);
113 register_torture_op("RPC-WKSSVC", torture_rpc_wkssvc);
114 register_torture_op("RPC-SRVSVC", torture_rpc_srvsvc);
115 register_torture_op("RPC-SVCCTL", torture_rpc_svcctl);
116 register_torture_op("RPC-ATSVC", torture_rpc_atsvc);
117 register_torture_op("RPC-EVENTLOG", torture_rpc_eventlog);
118 register_torture_op("RPC-EPMAPPER", torture_rpc_epmapper);
119 register_torture_op("RPC-WINREG", torture_rpc_winreg);
120 register_torture_op("RPC-INITSHUTDOWN", torture_rpc_initshutdown);
121 register_torture_op("RPC-OXIDRESOLVE", torture_rpc_oxidresolve);
122 register_torture_op("RPC-REMACT", torture_rpc_remact);
123 register_torture_op("RPC-MGMT", torture_rpc_mgmt);
124 register_torture_op("RPC-SCANNER", torture_rpc_scanner);
125 register_torture_op("RPC-AUTOIDL", torture_rpc_autoidl);
126 register_torture_op("RPC-COUNTCALLS", torture_rpc_countcalls);
127 register_torture_op("RPC-MULTIBIND", torture_multi_bind);
128 register_torture_op("RPC-AUTHCONTEXT", torture_bind_authcontext);
129 register_torture_op("RPC-BINDSAMBA3", torture_bind_samba3);
130 register_torture_op("RPC-NETLOGSAMBA3", torture_netlogon_samba3);
131 register_torture_op("RPC-SAMBA3SESSIONKEY", torture_samba3_sessionkey);
132 register_torture_op("RPC-SAMBA3-SRVSVC", torture_samba3_rpc_srvsvc);
133 register_torture_op("RPC-SAMBA3-SHARESEC",
134 torture_samba3_rpc_sharesec);
135 register_torture_op("RPC-SAMBA3-GETUSERNAME",
136 torture_samba3_rpc_getusername);
137 register_torture_op("RPC-SAMBA3-LSA", torture_samba3_rpc_lsa);
138 register_torture_op("RPC-SAMBA3-SPOOLSS", torture_samba3_rpc_spoolss);
139 register_torture_op("RPC-SAMBA3-WKSSVC", torture_samba3_rpc_wkssvc);
140 register_torture_op("RPC-SAMBA3-WINREG", torture_samba3_rpc_winreg);
141 register_torture_op("RPC-DRSUAPI", torture_rpc_drsuapi);
142 register_torture_op("RPC-CRACKNAMES", torture_rpc_drsuapi_cracknames);
143 register_torture_op("RPC-ROT", torture_rpc_rot);
144 register_torture_op("RPC-DSSETUP", torture_rpc_dssetup);
145 register_torture_op("RPC-ALTERCONTEXT", torture_rpc_alter_context);
146 register_torture_op("RPC-JOIN", torture_rpc_join);
147 register_torture_op("RPC-DSSYNC", torture_rpc_dssync);
148 register_torture_op("BENCH-RPC", torture_bench_rpc);
149 register_torture_op("RPC-ASYNCBIND", torture_async_bind);
151 return NT_STATUS_OK;