libcli/cldap: make use of samba_tevent_context_init()
[Samba/gebeck_regimport.git] / source4 / torture / rpc / drsuapi.h
blob6ce300900131d9b5e6cdac0ec816f9642dd7edb3
1 /*
2 Unix SMB/CIFS implementation.
4 DRSUapi tests
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Stefan (metze) Metzmacher 2004
8 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "librpc/gen_ndr/drsuapi.h"
26 /**
27 * Data structure common for most of DRSUAPI tests
29 struct DsPrivate {
30 struct dcerpc_pipe *drs_pipe;
31 struct policy_handle bind_handle;
32 struct GUID bind_guid;
33 struct drsuapi_DsBindInfo28 srv_bind_info;
35 const char *domain_obj_dn;
36 const char *domain_guid_str;
37 const char *domain_dns_name;
38 struct GUID domain_guid;
39 struct drsuapi_DsGetDCInfo2 dcinfo;
40 struct test_join *join;
44 /**
45 * Custom torture macro to check dcerpc_drsuapi_ call
46 * return values printing more friendly messages
47 * \param _tctx torture context
48 * \param _p DCERPC pipe handle
49 * \param _ntstatus NTSTATUS for dcerpc_drsuapi_ call
50 * \param _werr_expected Expected windows error to be returned
51 * \param _pr in/out DCEPRC request structure - pointer
52 * \param _msg error message prefix
54 #define torture_drsuapi_assert_call_werr(_tctx, _p, _ntstat, _werr_expected, _pr, _msg) \
55 do { \
56 NTSTATUS __nt = _ntstat; \
57 if (!NT_STATUS_IS_OK(__nt)) { \
58 const char *errstr = nt_errstr(__nt); \
59 torture_fail(tctx, talloc_asprintf(_tctx, "%s failed - %s", _msg, errstr)); \
60 } \
61 torture_assert_werr_equal(_tctx, (_pr)->out.result, _werr_expected, _msg); \
62 } while(0)
64 /**
65 * Custom torture macro to check dcerpc_drsuapi_ call
66 * return values printing more friendly messages
67 * \param _tctx torture context
68 * \param _p DCERPC pipe handle
69 * \param _ntstatus NTSTATUS for dcerpc_drsuapi_ call
70 * \param _pr in/out DCEPRC request structure
71 * \param _msg error message prefix
73 #define torture_drsuapi_assert_call(_tctx, _p, _ntstat, _pr, _msg) \
74 torture_drsuapi_assert_call_werr(_tctx, _p, _ntstat, WERR_OK, _pr, _msg)