diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-03-14 15:02:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:57:16 -0500 |
commit | eefe30b7d8e17ed744318417954669bacf2b3ac0 (patch) | |
tree | 04fe23ee9d94980251efd3c2ad6bdc03109616f5 /source4/torture | |
parent | 9b8717edecc761e5be06e6f67a6246b1e20d24dd (diff) | |
download | samba-eefe30b7d8e17ed744318417954669bacf2b3ac0.tar.gz samba-eefe30b7d8e17ed744318417954669bacf2b3ac0.tar.bz2 samba-eefe30b7d8e17ed744318417954669bacf2b3ac0.zip |
r14379: Build torture/rpc/ as a seperate smbtorture module. Move helper
functions for rpc out of torture/torture.c
(This used to be commit 1d2d970f3b8aef3f36c2befb94b5dd72c0086639)
Diffstat (limited to 'source4/torture')
51 files changed, 247 insertions, 140 deletions
diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c index 104fdc1933..142899ba8d 100644 --- a/source4/torture/basic/aliases.c +++ b/source4/torture/basic/aliases.c @@ -19,10 +19,9 @@ */ #include "includes.h" -#include "torture/torture.h" #include "dlinklist.h" #include "libcli/raw/libcliraw.h" -#include "libcli/libcli.h" +#include "torture/torture.h" int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname); diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index 307bb0fafc..9a00ab3efa 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -22,9 +22,9 @@ */ #include "includes.h" -#include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/torture.h" #include "system/time.h" #include "system/filesys.h" diff --git a/source4/torture/config.mk b/source4/torture/config.mk index cd6c896475..b6381af3f9 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -73,9 +73,9 @@ OBJ_FILES = \ REQUIRED_SUBSYSTEMS = \ com dcom -################################# -# Start SUBSYSTEM TORTURE_RPC -[SUBSYSTEM::TORTURE_RPC] +[MODULE::torture_rpc] +SUBSYSTEM = smbtorture +INIT_FUNCTION = torture_rpc_init PRIVATE_PROTO_HEADER = \ rpc/proto.h OBJ_FILES = \ @@ -115,7 +115,8 @@ OBJ_FILES = \ rpc/bind.o \ rpc/dssetup.o \ rpc/alter_context.o \ - rpc/bench.o + rpc/bench.o \ + rpc/rpc.o REQUIRED_SUBSYSTEMS = \ NDR_TABLE RPC_NDR_UNIXINFO RPC_NDR_SAMR RPC_NDR_WINREG RPC_NDR_INITSHUTDOWN \ RPC_NDR_OXIDRESOLVER RPC_NDR_EVENTLOG RPC_NDR_ECHO RPC_NDR_SVCCTL \ @@ -123,8 +124,6 @@ REQUIRED_SUBSYSTEMS = \ RPC_NDR_LSA RPC_NDR_EPMAPPER RPC_NDR_DFS RPC_NDR_SPOOLSS \ RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_ROT RPC_NDR_DSSETUP \ RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER WB_HELPER -# End SUBSYSTEM TORTURE_RPC -################################# ################################# # Start SUBSYSTEM TORTURE_RAP @@ -219,7 +218,7 @@ REQUIRED_SUBSYSTEMS = \ # Start BINARY smbtorture [BINARY::smbtorture] INSTALLDIR = BINDIR -PRIVATE_PROTO_HEADER = torture.h +PRIVATE_PROTO_HEADER = proto.h OBJ_FILES = \ torture.o \ torture_util.o @@ -227,7 +226,6 @@ REQUIRED_SUBSYSTEMS = \ TORTURE_BASIC \ TORTURE_RAW \ TORTURE_SMB2 \ - TORTURE_RPC \ TORTURE_RAP \ TORTURE_AUTH \ TORTURE_LOCAL \ diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c index 79c3ccd9fd..439561e3d0 100644 --- a/source4/torture/libnet/domain.c +++ b/source4/torture/libnet/domain.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "libnet/libnet.h" static BOOL test_domainopen(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index 93919a4129..25a86a7072 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -21,7 +21,7 @@ */ #include "includes.h" -#include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "libnet/libnet.h" #include "lib/cmdline/popt_common.h" diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index 589b2ee288..cf5dc2e410 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "libnet/libnet.h" #include "libnet/userinfo.h" #include "libcli/security/proto.h" diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index e9528f4598..f4d988e1b9 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "libnet/userman.h" #include "libnet/libnet.h" diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index 8e6ec290fa..0de5554393 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -25,8 +25,7 @@ #include "librpc/gen_ndr/ndr_samr.h" #include "lib/socket/socket.h" #include "lib/events/events.h" -#include "auth/credentials/credentials.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" #include "libcli/resolve/resolve.h" #include "system/network.h" #include "netif/netif.h" diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c index 5583178f3e..7a7780c01c 100644 --- a/source4/torture/raw/acls.c +++ b/source4/torture/raw/acls.c @@ -24,6 +24,7 @@ #include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "librpc/gen_ndr/lsa.h" #include "libcli/util/clilsa.h" #include "libcli/security/proto.h" diff --git a/source4/torture/rpc/alter_context.c b/source4/torture/rpc/alter_context.c index b76cf605b2..62cfcf758d 100644 --- a/source4/torture/rpc/alter_context.c +++ b/source4/torture/rpc/alter_context.c @@ -24,8 +24,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_lsa.h" #include "librpc/gen_ndr/ndr_dssetup.h" -#include "auth/credentials/credentials.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" BOOL torture_rpc_alter_context(void) { diff --git a/source4/torture/rpc/atsvc.c b/source4/torture/rpc/atsvc.c index 7a282dd1be..bfc44a4bb1 100644 --- a/source4/torture/rpc/atsvc.c +++ b/source4/torture/rpc/atsvc.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_atsvc.h" +#include "torture/rpc/rpc.h" static BOOL test_JobGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint32_t job_id) { diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c index 32bee5c363..cc9d8a1641 100644 --- a/source4/torture/rpc/autoidl.c +++ b/source4/torture/rpc/autoidl.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/ndr_drsuapi.h" #include "librpc/gen_ndr/ndr_misc.h" #include "librpc/rpc/dcerpc_table.h" +#include "torture/rpc/rpc.h" #if 1 diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c index b0605649c3..c4a0859725 100644 --- a/source4/torture/rpc/bench.c +++ b/source4/torture/rpc/bench.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_srvsvc.h" +#include "torture/rpc/rpc.h" /**************************/ /* srvsvc_NetShare */ diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c index a1fd3d65b2..2a6cb53979 100644 --- a/source4/torture/rpc/bind.c +++ b/source4/torture/rpc/bind.c @@ -25,6 +25,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_lsa.h" #include "lib/cmdline/popt_common.h" +#include "torture/rpc/rpc.h" /* This test is 'bogus' in that it doesn't actually perform to the diff --git a/source4/torture/rpc/countcalls.c b/source4/torture/rpc/countcalls.c index 9da8e54a91..8ad5241ada 100644 --- a/source4/torture/rpc/countcalls.c +++ b/source4/torture/rpc/countcalls.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/rpc/dcerpc_table.h" +#include "torture/rpc/rpc.h" BOOL torture_rpc_countcalls(void) diff --git a/source4/torture/rpc/dcom.c b/source4/torture/rpc/dcom.c index 71a7c8d0aa..b9ff5adffe 100644 --- a/source4/torture/rpc/dcom.c +++ b/source4/torture/rpc/dcom.c @@ -21,6 +21,7 @@ #include "includes.h" #include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "librpc/gen_ndr/ndr_oxidresolver.h" BOOL torture_rpc_dcom(void) diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index 3e600a4f44..14261c4123 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -21,6 +21,7 @@ #include "includes.h" #include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "librpc/gen_ndr/ndr_dfs.h" diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index f23bb5586b..0b700a7ac4 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -25,9 +25,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_drsuapi.h" -#include "auth/credentials/credentials.h" -#include "torture/rpc/drsuapi.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" BOOL test_DsBind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) diff --git a/source4/torture/rpc/drsuapi.h b/source4/torture/rpc/drsuapi.h index 25bbc7ebed..4914d0a272 100644 --- a/source4/torture/rpc/drsuapi.h +++ b/source4/torture/rpc/drsuapi.h @@ -22,6 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "librpc/gen_ndr/drsuapi.h" struct DsPrivate { struct policy_handle bind_handle; diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c index 0a44084dde..ef8a5cc45d 100644 --- a/source4/torture/rpc/drsuapi_cracknames.c +++ b/source4/torture/rpc/drsuapi_cracknames.c @@ -25,9 +25,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_drsuapi.h" -#include "auth/credentials/credentials.h" -#include "torture/rpc/drsuapi.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" #include "ldb/include/ldb.h" static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index ea5925db0c..70f8c99dde 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_dssetup.h" +#include "torture/rpc/rpc.h" BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 3731f19c61..d334f162bc 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -25,6 +25,7 @@ #include "lib/cmdline/popt_common.h" #include "librpc/gen_ndr/ndr_drsuapi.h" #include "libcli/cldap/cldap.h" +#include "libcli/ldap/ldap_client.h" #include "torture/ldap/proto.h" struct DsSyncBindInfo { diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index 02631d0b44..49752665e4 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "lib/events/events.h" #include "librpc/gen_ndr/ndr_echo.h" diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index bf5747eb93..4f6cb122a8 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -23,6 +23,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_epmapper.h" #include "librpc/rpc/dcerpc_table.h" +#include "torture/rpc/rpc.h" /* diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 64c2b0b4ad..8de099d215 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -24,6 +24,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_eventlog.h" #include "librpc/gen_ndr/ndr_lsa.h" +#include "torture/rpc/rpc.h" static void init_lsa_String(struct lsa_String *name, const char *s) { diff --git a/source4/torture/rpc/initshutdown.c b/source4/torture/rpc/initshutdown.c index 4b754acf74..efd320052d 100644 --- a/source4/torture/rpc/initshutdown.c +++ b/source4/torture/rpc/initshutdown.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_initshutdown.h" +#include "torture/rpc/rpc.h" static void init_initshutdown_String(TALLOC_CTX *mem_ctx, struct initshutdown_String *name, const char *s) { diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c index 7dea5cdb26..2a3c26087f 100644 --- a/source4/torture/rpc/join.c +++ b/source4/torture/rpc/join.c @@ -2,7 +2,7 @@ #include "libnet/libnet.h" #include "auth/credentials/credentials.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" #define TORTURE_NETBIOS_NAME "smbtorturejoin" diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index eaced4b3d3..980c9b36e6 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -25,8 +25,8 @@ #include "librpc/gen_ndr/ndr_lsa.h" #include "lib/events/events.h" #include "libcli/security/proto.h" -#include "auth/credentials/credentials.h" -#include "libcli/auth/proto.h" +#include "libcli/auth/libcli_auth.h" +#include "torture/rpc/rpc.h" static void init_lsa_String(struct lsa_String *name, const char *s) { diff --git a/source4/torture/rpc/lsa_lookup.c b/source4/torture/rpc/lsa_lookup.c index aa36c63f29..c009f89f58 100644 --- a/source4/torture/rpc/lsa_lookup.c +++ b/source4/torture/rpc/lsa_lookup.c @@ -24,6 +24,8 @@ #include "librpc/gen_ndr/ndr_lsa.h" #include "lib/events/events.h" #include "libcli/security/proto.h" +#include "libnet/libnet_join.h" +#include "torture/rpc/rpc.h" static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle **handle) diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c index 5e6f0e366e..d94c65e1d9 100644 --- a/source4/torture/rpc/mgmt.c +++ b/source4/torture/rpc/mgmt.c @@ -24,6 +24,7 @@ #include "librpc/gen_ndr/ndr_mgmt.h" #include "auth/gensec/gensec.h" #include "librpc/rpc/dcerpc_table.h" +#include "torture/rpc/rpc.h" /* diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index e786dd3898..a64df0f5bb 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -28,8 +28,8 @@ #include "auth/auth.h" #include "smb.h" #include "lib/cmdline/popt_common.h" -#include "torture/rpc/proto.h" -#include "libcli/auth/proto.h" +#include "torture/rpc/rpc.h" +#include "libcli/auth/libcli_auth.h" static const char *machine_password; diff --git a/source4/torture/rpc/oxidresolve.c b/source4/torture/rpc/oxidresolve.c index 837d64cc52..e3070fa6ee 100644 --- a/source4/torture/rpc/oxidresolve.c +++ b/source4/torture/rpc/oxidresolve.c @@ -24,6 +24,7 @@ #include "librpc/gen_ndr/ndr_oxidresolver.h" #include "librpc/gen_ndr/ndr_remact.h" #include "librpc/gen_ndr/ndr_epmapper.h" +#include "torture/rpc/rpc.h" #define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9" diff --git a/source4/torture/rpc/remact.c b/source4/torture/rpc/remact.c index 62d1d2e0d6..69c31fc642 100644 --- a/source4/torture/rpc/remact.c +++ b/source4/torture/rpc/remact.c @@ -23,6 +23,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_remact.h" #include "librpc/gen_ndr/ndr_epmapper.h" +#include "torture/rpc/rpc.h" #define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9" diff --git a/source4/torture/rpc/rot.c b/source4/torture/rpc/rot.c index ccddab086e..48a8717fa5 100644 --- a/source4/torture/rpc/rot.c +++ b/source4/torture/rpc/rot.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_rot.h" +#include "torture/rpc/rpc.h" BOOL torture_rpc_rot(void) { diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c new file mode 100644 index 0000000000..4fe35a5cf7 --- /dev/null +++ b/source4/torture/rpc/rpc.c @@ -0,0 +1,125 @@ +/* + Unix SMB/CIFS implementation. + SMB torture tester + Copyright (C) Andrew Tridgell 1997-2003 + Copyright (C) Jelmer Vernooij 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "auth/credentials/credentials.h" +#include "lib/cmdline/popt_common.h" +#include "torture/rpc/rpc.h" +#include "torture/torture.h" + +/* open a rpc connection to the chosen binding string */ +NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx, + struct dcerpc_pipe **p, + const struct dcerpc_interface_table *table) +{ + NTSTATUS status; + const char *binding = lp_parm_string(-1, "torture", "binding"); + + if (!binding) { + printf("You must specify a ncacn binding string\n"); + return NT_STATUS_INVALID_PARAMETER; + } + + status = dcerpc_pipe_connect(parent_ctx, + p, binding, table, + cmdline_credentials, NULL); + + return status; +} + +/* open a rpc connection to a specific transport */ +NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx, + struct dcerpc_pipe **p, + const struct dcerpc_interface_table *table, + enum dcerpc_transport_t transport) +{ + NTSTATUS status; + const char *binding = lp_parm_string(-1, "torture", "binding"); + struct dcerpc_binding *b; + TALLOC_CTX *mem_ctx = talloc_named(parent_ctx, 0, "torture_rpc_connection_smb"); + + if (!binding) { + printf("You must specify a ncacn binding string\n"); + talloc_free(mem_ctx); + return NT_STATUS_INVALID_PARAMETER; + } + + status = dcerpc_parse_binding(mem_ctx, binding, &b); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to parse dcerpc binding '%s'\n", binding)); + talloc_free(mem_ctx); + return status; + } + + b->transport = transport; + + status = dcerpc_pipe_connect_b(mem_ctx, p, b, table, + cmdline_credentials, NULL); + + if (NT_STATUS_IS_OK(status)) { + *p = talloc_reference(parent_ctx, *p); + } else { + *p = NULL; + } + talloc_free(mem_ctx); + return status; +} + +NTSTATUS torture_rpc_init(void) +{ + register_torture_op("RPC-LSA", torture_rpc_lsa, 0); + register_torture_op("RPC-LSALOOKUP", torture_rpc_lsa_lookup, 0); + register_torture_op("RPC-SECRETS", torture_rpc_lsa_secrets, 0); + register_torture_op("RPC-ECHO", torture_rpc_echo, 0); + register_torture_op("RPC-DFS", torture_rpc_dfs, 0); + register_torture_op("RPC-SPOOLSS", torture_rpc_spoolss, 0); + register_torture_op("RPC-SAMR", torture_rpc_samr, 0); + register_torture_op("RPC-UNIXINFO", torture_rpc_unixinfo, 0); + register_torture_op("RPC-NETLOGON", torture_rpc_netlogon, 0); + register_torture_op("RPC-SAMLOGON", torture_rpc_samlogon, 0); + register_torture_op("RPC-SAMSYNC", torture_rpc_samsync, 0); + register_torture_op("RPC-SCHANNEL", torture_rpc_schannel, 0); + register_torture_op("RPC-WKSSVC", torture_rpc_wkssvc, 0); + register_torture_op("RPC-SRVSVC", torture_rpc_srvsvc, 0); + register_torture_op("RPC-SVCCTL", torture_rpc_svcctl, 0); + register_torture_op("RPC-ATSVC", torture_rpc_atsvc, 0); + register_torture_op("RPC-EVENTLOG", torture_rpc_eventlog, 0); + register_torture_op("RPC-EPMAPPER", torture_rpc_epmapper, 0); + register_torture_op("RPC-WINREG", torture_rpc_winreg, 0); + register_torture_op("RPC-INITSHUTDOWN", torture_rpc_initshutdown, 0); + register_torture_op("RPC-OXIDRESOLVE", torture_rpc_oxidresolve, 0); + register_torture_op("RPC-REMACT", torture_rpc_remact, 0); + register_torture_op("RPC-MGMT", torture_rpc_mgmt, 0); + register_torture_op("RPC-SCANNER", torture_rpc_scanner, 0); + register_torture_op("RPC-AUTOIDL", torture_rpc_autoidl, 0); + register_torture_op("RPC-COUNTCALLS", torture_rpc_countcalls, 0); + register_torture_op("RPC-MULTIBIND", torture_multi_bind, 0); + register_torture_op("RPC-DRSUAPI", torture_rpc_drsuapi, 0); + register_torture_op("RPC-CRACKNAMES", torture_rpc_drsuapi_cracknames, 0); + register_torture_op("RPC-ROT", torture_rpc_rot, 0); + register_torture_op("RPC-DSSETUP", torture_rpc_dssetup, 0); + register_torture_op("RPC-ALTERCONTEXT", torture_rpc_alter_context, 0); + register_torture_op("RPC-JOIN", torture_rpc_join, 0); + register_torture_op("RPC-DSSYNC", torture_rpc_dssync, 0); + register_torture_op("BENCH-RPC", torture_bench_rpc, 0); + + return NT_STATUS_OK; +} diff --git a/source4/torture/rpc/rpc.h b/source4/torture/rpc/rpc.h new file mode 100644 index 0000000000..e851287218 --- /dev/null +++ b/source4/torture/rpc/rpc.h @@ -0,0 +1,30 @@ +/* + Unix SMB/CIFS implementation. + SMB torture tester + Copyright (C) Andrew Tridgell 1997-2003 + Copyright (C) Jelmer Vernooij 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __TORTURE_RPC_H__ +#define __TORTURE_RPC_H__ + +#include "auth/credentials/credentials.h" +#include "torture/rpc/drsuapi.h" +#include "libnet/libnet_join.h" +#include "torture/rpc/proto.h" + +#endif /* __TORTURE_RPC_H__ */ diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 9965e5ddbd..ecca8418b8 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -27,9 +27,9 @@ #include "auth/auth.h" #include "lib/crypto/crypto.h" #include "lib/cmdline/popt_common.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" #include "auth/gensec/schannel_proto.h" -#include "libcli/auth/proto.h" +#include "libcli/auth/libcli_auth.h" #define TEST_MACHINE_NAME "samlogontest" #define TEST_USER_NAME "samlogontestuser" diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index f5bbed1805..e518a0782e 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -26,9 +26,9 @@ #include "librpc/gen_ndr/ndr_samr.h" #include "smb.h" #include "lib/crypto/crypto.h" -#include "auth/credentials/credentials.h" -#include "libcli/auth/proto.h" +#include "libcli/auth/libcli_auth.h" #include "libcli/security/proto.h" +#include "torture/rpc/rpc.h" #define TEST_ACCOUNT_NAME "samrtorturetest" #define TEST_ALIASNAME "samrtorturetestalias" diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 6155b7ac1e..75a90b8b55 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -28,9 +28,9 @@ #include "dlinklist.h" #include "lib/crypto/crypto.h" #include "system/time.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" #include "auth/gensec/schannel_proto.h" -#include "libcli/auth/proto.h" +#include "libcli/auth/libcli_auth.h" #include "libcli/security/proto.h" #define TEST_MACHINE_NAME "samsynctest" diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index 7016043807..d714fe5427 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -24,6 +24,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_mgmt.h" #include "librpc/rpc/dcerpc_table.h" +#include "torture/rpc/rpc.h" /* work out how many calls there are for an interface diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 41ad88d109..f48e4c2a08 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -23,10 +23,10 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_netlogon.h" #include "auth/credentials/credentials.h" -#include "torture/rpc/proto.h" +#include "torture/rpc/rpc.h" #include "lib/cmdline/popt_common.h" #include "auth/gensec/schannel_proto.h" -#include "libcli/auth/proto.h" +#include "libcli/auth/libcli_auth.h" #include "libcli/security/proto.h" #define TEST_MACHINE_NAME "schannel" diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c index 448c85c202..9656eda054 100644 --- a/source4/torture/rpc/session_key.c +++ b/source4/torture/rpc/session_key.c @@ -24,9 +24,8 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_lsa.h" -#include "auth/credentials/credentials.h" -#include "torture/rpc/proto.h" -#include "libcli/auth/proto.h" +#include "libcli/auth/libcli_auth.h" +#include "torture/rpc/rpc.h" static void init_lsa_String(struct lsa_String *name, const char *s) { diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index fa2b7df418..9cc438d9b8 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "librpc/gen_ndr/ndr_spoolss.h" struct test_spoolss_context { diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 2e4f158070..e5e9221760 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_srvsvc.h" +#include "torture/rpc/rpc.h" /**************************/ /* srvsvc_NetCharDev */ diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c index 5f1514419e..dddfea961b 100644 --- a/source4/torture/rpc/svcctl.c +++ b/source4/torture/rpc/svcctl.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_svcctl.h" +#include "torture/rpc/rpc.h" static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *h) { diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index 02b6366b1e..4df25d2aea 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -34,10 +34,9 @@ #include "smb.h" #include "lib/ldb/include/ldb.h" -#include "auth/credentials/credentials.h" -#include "torture/rpc/proto.h" +#include "libcli/auth/libcli_auth.h" +#include "torture/rpc/rpc.h" #include "libcli/security/proto.h" -#include "libcli/auth/proto.h" struct test_join { struct dcerpc_pipe *p; diff --git a/source4/torture/rpc/unixinfo.c b/source4/torture/rpc/unixinfo.c index 836e5060df..946d5e1803 100644 --- a/source4/torture/rpc/unixinfo.c +++ b/source4/torture/rpc/unixinfo.c @@ -21,6 +21,7 @@ #include "includes.h" #include "torture/torture.h" +#include "torture/rpc/rpc.h" #include "librpc/gen_ndr/ndr_unixinfo.h" diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c index 293cba0ee1..88d50f73d7 100644 --- a/source4/torture/rpc/winreg.c +++ b/source4/torture/rpc/winreg.c @@ -24,6 +24,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_winreg.h" #include "libcli/security/proto.h" +#include "torture/rpc/rpc.h" #define TEST_KEY_BASE "smbtorture test" #define TEST_KEY1 TEST_KEY_BASE "\\spottyfoot" diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c index 6adda319bb..01e81a8de7 100644 --- a/source4/torture/rpc/wkssvc.c +++ b/source4/torture/rpc/wkssvc.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_wkssvc.h" +#include "torture/rpc/rpc.h" static BOOL test_NetWkstaGetInfo(struct dcerpc_pipe *p, diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 3236bbb89c..0008d348e0 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2,6 +2,7 @@ Unix SMB/CIFS implementation. SMB torture tester Copyright (C) Andrew Tridgell 1997-2003 + Copyright (C) Jelmer Vernooij 2006 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,15 +28,15 @@ #include "libcli/raw/ioctl.h" #include "libcli/libcli.h" #include "lib/ldb/include/ldb.h" -#include "librpc/rpc/dcerpc_table.h" #include "lib/events/events.h" #include "libcli/resolve/resolve.h" #include "auth/credentials/credentials.h" +#include "librpc/rpc/dcerpc_table.h" +#include "libcli/ldap/ldap_client.h" #include "torture/basic/proto.h" #include "torture/raw/proto.h" #include "torture/smb2/proto.h" -#include "torture/rpc/proto.h" #include "torture/rap/proto.h" #include "torture/auth/proto.h" #include "torture/local/proto.h" @@ -140,63 +141,6 @@ BOOL torture_close_connection(struct smbcli_state *c) return ret; } -/* open a rpc connection to the chosen binding string */ -NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx, - struct dcerpc_pipe **p, - const struct dcerpc_interface_table *table) -{ - NTSTATUS status; - const char *binding = lp_parm_string(-1, "torture", "binding"); - - if (!binding) { - printf("You must specify a ncacn binding string\n"); - return NT_STATUS_INVALID_PARAMETER; - } - - status = dcerpc_pipe_connect(parent_ctx, - p, binding, table, - cmdline_credentials, NULL); - - return status; -} - -/* open a rpc connection to a specific transport */ -NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx, - struct dcerpc_pipe **p, - const struct dcerpc_interface_table *table, - enum dcerpc_transport_t transport) -{ - NTSTATUS status; - const char *binding = lp_parm_string(-1, "torture", "binding"); - struct dcerpc_binding *b; - TALLOC_CTX *mem_ctx = talloc_named(parent_ctx, 0, "torture_rpc_connection_smb"); - - if (!binding) { - printf("You must specify a ncacn binding string\n"); - talloc_free(mem_ctx); - return NT_STATUS_INVALID_PARAMETER; - } - - status = dcerpc_parse_binding(mem_ctx, binding, &b); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Failed to parse dcerpc binding '%s'\n", binding)); - talloc_free(mem_ctx); - return status; - } - - b->transport = transport; - - status = dcerpc_pipe_connect_b(mem_ctx, p, b, table, - cmdline_credentials, NULL); - - if (NT_STATUS_IS_OK(status)) { - *p = talloc_reference(parent_ctx, *p); - } else { - *p = NULL; - } - talloc_free(mem_ctx); - return status; -} /* check if the server produced the expected error code */ BOOL check_error(const char *location, struct smbcli_state *c, @@ -2242,7 +2186,6 @@ static struct { {"BENCH-TORTURE", NULL, run_torture}, {"BENCH-NBT", torture_bench_nbt, 0}, {"BENCH-WINS", torture_bench_wins, 0}, - {"BENCH-RPC", torture_bench_rpc, 0}, {"BENCH-CLDAP", torture_bench_cldap, 0}, /* RAW smb tests */ @@ -2295,42 +2238,6 @@ static struct { {"SCAN-IOCTL", torture_ioctl_test, 0}, {"SCAN-RAP", torture_rap_scan, 0}, - /* rpc testers */ - {"RPC-LSA", torture_rpc_lsa, 0}, - {"RPC-LSALOOKUP", torture_rpc_lsa_lookup, 0}, - {"RPC-SECRETS", torture_rpc_lsa_secrets, 0}, - {"RPC-ECHO", torture_rpc_echo, 0}, - {"RPC-DFS", torture_rpc_dfs, 0}, - {"RPC-SPOOLSS", torture_rpc_spoolss, 0}, - {"RPC-SAMR", torture_rpc_samr, 0}, - {"RPC-UNIXINFO", torture_rpc_unixinfo, 0}, - {"RPC-NETLOGON", torture_rpc_netlogon, 0}, - {"RPC-SAMLOGON", torture_rpc_samlogon, 0}, - {"RPC-SAMSYNC", torture_rpc_samsync, 0}, - {"RPC-SCHANNEL", torture_rpc_schannel, 0}, - {"RPC-WKSSVC", torture_rpc_wkssvc, 0}, - {"RPC-SRVSVC", torture_rpc_srvsvc, 0}, - {"RPC-SVCCTL", torture_rpc_svcctl, 0}, - {"RPC-ATSVC", torture_rpc_atsvc, 0}, - {"RPC-EVENTLOG", torture_rpc_eventlog, 0}, - {"RPC-EPMAPPER", torture_rpc_epmapper, 0}, - {"RPC-WINREG", torture_rpc_winreg, 0}, - {"RPC-INITSHUTDOWN", torture_rpc_initshutdown, 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}, - {"RPC-COUNTCALLS", torture_rpc_countcalls, 0}, - {"RPC-MULTIBIND", torture_multi_bind, 0}, - {"RPC-DRSUAPI", torture_rpc_drsuapi, 0}, - {"RPC-CRACKNAMES", torture_rpc_drsuapi_cracknames, 0}, - {"RPC-ROT", torture_rpc_rot, 0}, - {"RPC-DSSETUP", torture_rpc_dssetup, 0}, - {"RPC-ALTERCONTEXT", torture_rpc_alter_context, 0}, - {"RPC-JOIN", torture_rpc_join, 0}, - {"RPC-DSSYNC", torture_rpc_dssync, 0}, - /* local (no server) testers */ {"LOCAL-NTLMSSP", torture_ntlmssp_self_check, 0}, {"LOCAL-ICONV", torture_local_iconv, 0}, diff --git a/source4/torture/torture.h b/source4/torture/torture.h new file mode 100644 index 0000000000..689ff04774 --- /dev/null +++ b/source4/torture/torture.h @@ -0,0 +1,28 @@ +/* + Unix SMB/CIFS implementation. + SMB torture tester + Copyright (C) Andrew Tridgell 1997-2003 + Copyright (C) Jelmer Vernooij 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __TORTURE_H__ +#define __TORTURE_H__ + +#include "libcli/libcli.h" +#include "torture/proto.h" + +#endif /* __TORTURE_H__ */ |