| 1 |
/* |
| 2 |
Unix SMB/CIFS implementation. |
| 3 |
|
| 4 |
DRSUapi tests |
| 5 |
|
| 6 |
Copyright (C) Andrew Tridgell 2003 |
| 7 |
Copyright (C) Stefan (metze) Metzmacher 2004 |
| 8 |
Copyright (C) Andrew Bartlett <[email protected]> 2005 |
| 9 |
|
| 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. |
| 14 |
|
| 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. |
| 19 |
|
| 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/>. |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "librpc/gen_ndr/drsuapi.h" |
| 25 |
|
| 26 |
/** |
| 27 |
* Data structure common for most of DRSUAPI tests |
| 28 |
*/ |
| 29 |
struct DsPrivate { |
| 30 |
struct cli_credentials *admin_credentials; |
| 31 |
struct dcerpc_pipe *drs_pipe; |
| 32 |
struct policy_handle bind_handle; |
| 33 |
struct drsuapi_DsBindInfo28 srv_bind_info; |
| 34 |
|
| 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; |
| 41 |
struct cli_credentials *dc_credentials; |
| 42 |
}; |
| 43 |
|
| 44 |
/** |
| 45 |
* Data structure of DRSUAPI W2K8 tests |
| 46 |
* W2K8 Clients use different versions of structs |
| 47 |
*/ |
| 48 |
struct DsPrivate_w2k8 { |
| 49 |
struct dcerpc_pipe *drs_pipe; |
| 50 |
struct policy_handle bind_handle; |
| 51 |
struct GUID bind_guid; |
| 52 |
struct drsuapi_DsBindInfoCtr srv_bind_info; |
| 53 |
|
| 54 |
const char *domain_obj_dn; |
| 55 |
const char *domain_guid_str; |
| 56 |
const char *domain_dns_name; |
| 57 |
struct GUID domain_guid; |
| 58 |
struct drsuapi_DsGetDCInfo3 dcinfo; |
| 59 |
struct test_join *join; |
| 60 |
}; |
| 61 |
|
| 62 |
|
| 63 |
/** |
| 64 |
* Custom torture macro to check dcerpc_drsuapi_ call |
| 65 |
* return values printing more friendly messages |
| 66 |
* \param _tctx torture context |
| 67 |
* \param _p DCERPC pipe handle |
| 68 |
* \param _ntstatus NTSTATUS for dcerpc_drsuapi_ call |
| 69 |
* \param _werr_expected Expected windows error to be returned |
| 70 |
* \param _pr in/out DCEPRC request structure - pointer |
| 71 |
* \param _msg error message prefix |
| 72 |
*/ |
| 73 |
#define torture_drsuapi_assert_call_werr(_tctx, _p, _ntstat, _werr_expected, _pr, _msg) \ |
| 74 |
do { \ |
| 75 |
NTSTATUS __nt = _ntstat; \ |
| 76 |
if (!NT_STATUS_IS_OK(__nt)) { \ |
| 77 |
const char *errstr = nt_errstr(__nt); \ |
| 78 |
torture_fail(tctx, talloc_asprintf(_tctx, "%s failed - %s", _msg, errstr)); \ |
| 79 |
} \ |
| 80 |
torture_assert_werr_equal(_tctx, (_pr)->out.result, _werr_expected, _msg); \ |
| 81 |
} while(0) |
| 82 |
|
| 83 |
/** |
| 84 |
* Custom torture macro to check dcerpc_drsuapi_ call |
| 85 |
* return values printing more friendly messages |
| 86 |
* \param _tctx torture context |
| 87 |
* \param _p DCERPC pipe handle |
| 88 |
* \param _ntstatus NTSTATUS for dcerpc_drsuapi_ call |
| 89 |
* \param _pr in/out DCEPRC request structure |
| 90 |
* \param _msg error message prefix |
| 91 |
*/ |
| 92 |
#define torture_drsuapi_assert_call(_tctx, _p, _ntstat, _pr, _msg) \ |
| 93 |
torture_drsuapi_assert_call_werr(_tctx, _p, _ntstat, WERR_OK, _pr, _msg) |
| 94 |
|