| 1 |
/* |
| 2 |
Unix SMB/CIFS implementation. |
| 3 |
SMB torture tester |
| 4 |
Copyright (C) Andrew Tridgell 1997-2003 |
| 5 |
Copyright (C) Jelmer Vernooij 2006 |
| 6 |
|
| 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 3 of the License, or |
| 10 |
(at your option) any later version. |
| 11 |
|
| 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. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef __TORTURE_RPC_H__ |
| 22 |
#define __TORTURE_RPC_H__ |
| 23 |
|
| 24 |
#include "lib/torture/torture.h" |
| 25 |
#include "auth/credentials/credentials.h" |
| 26 |
#include "torture/rpc/drsuapi.h" |
| 27 |
#include "libnet/libnet_join.h" |
| 28 |
#include "librpc/rpc/dcerpc.h" |
| 29 |
#include "libcli/raw/libcliraw.h" |
| 30 |
#include "librpc/gen_ndr/ndr_spoolss.h" |
| 31 |
#include "torture/rpc/proto.h" |
| 32 |
|
| 33 |
struct torture_rpc_tcase { |
| 34 |
struct torture_tcase tcase; |
| 35 |
const struct ndr_interface_table *table; |
| 36 |
const char *machine_name; |
| 37 |
bool (*setup_fn)(struct torture_context *, |
| 38 |
struct dcerpc_pipe *, |
| 39 |
void *); |
| 40 |
bool (*teardown_fn)(struct torture_context *, |
| 41 |
struct dcerpc_pipe *, |
| 42 |
void *); |
| 43 |
}; |
| 44 |
|
| 45 |
struct torture_rpc_tcase_data { |
| 46 |
struct test_join *join_ctx; |
| 47 |
struct dcerpc_pipe *pipe; |
| 48 |
struct cli_credentials *credentials; |
| 49 |
}; |
| 50 |
|
| 51 |
NTSTATUS torture_rpc_connection(struct torture_context *tctx, |
| 52 |
struct dcerpc_pipe **p, |
| 53 |
const struct ndr_interface_table *table); |
| 54 |
NTSTATUS torture_rpc_connection_with_binding(struct torture_context *tctx, |
| 55 |
struct dcerpc_binding *binding, |
| 56 |
struct dcerpc_pipe **p, |
| 57 |
const struct ndr_interface_table *table); |
| 58 |
|
| 59 |
struct test_join *torture_join_domain(struct torture_context *tctx, |
| 60 |
const char *machine_name, |
| 61 |
uint32_t acct_flags, |
| 62 |
struct cli_credentials **machine_credentials); |
| 63 |
const struct dom_sid *torture_join_sid(struct test_join *join); |
| 64 |
void torture_leave_domain(struct torture_context *tctx, struct test_join *join); |
| 65 |
struct torture_rpc_tcase *torture_suite_add_rpc_iface_tcase(struct torture_suite *suite, |
| 66 |
const char *name, |
| 67 |
const struct ndr_interface_table *table); |
| 68 |
struct torture_rpc_tcase *torture_suite_add_rpc_setup_tcase( |
| 69 |
struct torture_suite *suite, |
| 70 |
const char *name, |
| 71 |
const struct ndr_interface_table *table, |
| 72 |
bool (*setup_fn)(struct torture_context *, |
| 73 |
struct dcerpc_pipe *, |
| 74 |
void *), |
| 75 |
bool (*teardown_fn)(struct torture_context *, |
| 76 |
struct dcerpc_pipe *, |
| 77 |
void *)); |
| 78 |
|
| 79 |
struct torture_test *torture_rpc_tcase_add_test( |
| 80 |
struct torture_rpc_tcase *tcase, |
| 81 |
const char *name, |
| 82 |
bool (*fn) (struct torture_context *, struct dcerpc_pipe *)); |
| 83 |
struct torture_rpc_tcase *torture_suite_add_anon_rpc_iface_tcase(struct torture_suite *suite, |
| 84 |
const char *name, |
| 85 |
const struct ndr_interface_table *table); |
| 86 |
|
| 87 |
struct torture_test *torture_rpc_tcase_add_test_join( |
| 88 |
struct torture_rpc_tcase *tcase, |
| 89 |
const char *name, |
| 90 |
bool (*fn) (struct torture_context *, struct dcerpc_pipe *, |
| 91 |
struct cli_credentials *, struct test_join *)); |
| 92 |
_PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_setup( |
| 93 |
struct torture_rpc_tcase *tcase, |
| 94 |
const char *name, |
| 95 |
bool (*fn)(struct torture_context *, |
| 96 |
struct dcerpc_pipe *, |
| 97 |
void *), |
| 98 |
void *userdata); |
| 99 |
struct torture_test *torture_rpc_tcase_add_test_ex( |
| 100 |
struct torture_rpc_tcase *tcase, |
| 101 |
const char *name, |
| 102 |
bool (*fn) (struct torture_context *, struct dcerpc_pipe *, |
| 103 |
void *), |
| 104 |
void *userdata); |
| 105 |
struct torture_rpc_tcase *torture_suite_add_machine_bdc_rpc_iface_tcase( |
| 106 |
struct torture_suite *suite, |
| 107 |
const char *name, |
| 108 |
const struct ndr_interface_table *table, |
| 109 |
const char *machine_name); |
| 110 |
struct torture_rpc_tcase *torture_suite_add_machine_workstation_rpc_iface_tcase( |
| 111 |
struct torture_suite *suite, |
| 112 |
const char *name, |
| 113 |
const struct ndr_interface_table *table, |
| 114 |
const char *machine_name); |
| 115 |
struct torture_test *torture_rpc_tcase_add_test_creds( |
| 116 |
struct torture_rpc_tcase *tcase, |
| 117 |
const char *name, |
| 118 |
bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct cli_credentials *)); |
| 119 |
bool torture_suite_init_rpc_tcase(struct torture_suite *suite, |
| 120 |
struct torture_rpc_tcase *tcase, |
| 121 |
const char *name, |
| 122 |
const struct ndr_interface_table *table); |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
#endif /* __TORTURE_RPC_H__ */ |