2005-10-07 12:56:01 +04:00
/*
Unix SMB / CIFS implementation .
DRSUapi tests
Copyright ( C ) Andrew Tridgell 2003
Copyright ( C ) Stefan ( metze ) Metzmacher 2004
Copyright ( C ) Andrew Bartlett < abartlet @ samba . org > 2005
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
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2005-10-07 12:56:01 +04:00
( 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
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2005-10-07 12:56:01 +04:00
*/
2006-03-14 18:02:05 +03:00
# include "librpc/gen_ndr/drsuapi.h"
2005-10-07 12:56:01 +04:00
2009-09-11 00:44:00 +04:00
/**
* Data structure common for most of DRSUAPI tests
*/
2005-10-07 12:56:01 +04:00
struct DsPrivate {
2009-11-14 04:56:21 +03:00
struct dcerpc_pipe * drs_pipe ;
2005-10-07 12:56:01 +04:00
struct policy_handle bind_handle ;
struct GUID bind_guid ;
2009-09-18 20:04:22 +04:00
struct drsuapi_DsBindInfo28 srv_bind_info ;
2005-10-07 12:56:01 +04:00
const char * domain_obj_dn ;
const char * domain_guid_str ;
const char * domain_dns_name ;
struct GUID domain_guid ;
struct drsuapi_DsGetDCInfo2 dcinfo ;
2006-11-17 14:19:15 +03:00
struct test_join * join ;
2005-10-07 12:56:01 +04:00
} ;
2016-05-25 02:50:09 +03:00
/**
* Data structure of DRSUAPI W2K8 tests
* W2K8 Clients use different versions of structs
*/
struct DsPrivate_w2k8 {
struct dcerpc_pipe * drs_pipe ;
struct policy_handle bind_handle ;
struct GUID bind_guid ;
struct drsuapi_DsBindInfoCtr srv_bind_info ;
const char * domain_obj_dn ;
const char * domain_guid_str ;
const char * domain_dns_name ;
struct GUID domain_guid ;
struct drsuapi_DsGetDCInfo3 dcinfo ;
struct test_join * join ;
} ;
2009-09-11 00:44:00 +04:00
/**
* Custom torture macro to check dcerpc_drsuapi_ call
* return values printing more friendly messages
* \ param _tctx torture context
* \ param _p DCERPC pipe handle
* \ param _ntstatus NTSTATUS for dcerpc_drsuapi_ call
2009-09-18 19:11:56 +04:00
* \ param _werr_expected Expected windows error to be returned
* \ param _pr in / out DCEPRC request structure - pointer
2009-09-11 00:44:00 +04:00
* \ param _msg error message prefix
*/
2009-09-18 19:11:56 +04:00
# define torture_drsuapi_assert_call_werr(_tctx, _p, _ntstat, _werr_expected, _pr, _msg) \
2009-09-11 00:44:00 +04:00
do { \
NTSTATUS __nt = _ntstat ; \
if ( ! NT_STATUS_IS_OK ( __nt ) ) { \
const char * errstr = nt_errstr ( __nt ) ; \
torture_fail ( tctx , talloc_asprintf ( _tctx , " %s failed - %s " , _msg , errstr ) ) ; \
} \
2009-09-18 19:11:56 +04:00
torture_assert_werr_equal ( _tctx , ( _pr ) - > out . result , _werr_expected , _msg ) ; \
2009-09-11 00:44:00 +04:00
} while ( 0 )
2009-09-18 19:11:56 +04:00
/**
* Custom torture macro to check dcerpc_drsuapi_ call
* return values printing more friendly messages
* \ param _tctx torture context
* \ param _p DCERPC pipe handle
* \ param _ntstatus NTSTATUS for dcerpc_drsuapi_ call
* \ param _pr in / out DCEPRC request structure
* \ param _msg error message prefix
*/
# define torture_drsuapi_assert_call(_tctx, _p, _ntstat, _pr, _msg) \
torture_drsuapi_assert_call_werr ( _tctx , _p , _ntstat , WERR_OK , _pr , _msg )