2004-12-31 13:49:35 +03:00
/*
Unix SMB / CIFS implementation .
test suite for dssetup rpc operations
Copyright ( C ) Andrew Tridgell 2004
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 0213 9 , USA .
*/
# include "includes.h"
2006-01-03 16:41:17 +03:00
# include "torture/torture.h"
2006-03-15 02:35:30 +03:00
# include "librpc/gen_ndr/ndr_dssetup_c.h"
2006-03-14 18:02:05 +03:00
# include "torture/rpc/rpc.h"
2004-12-31 13:49:35 +03:00
2005-01-09 12:38:16 +03:00
BOOL test_DsRoleGetPrimaryDomainInformation ( struct dcerpc_pipe * p , TALLOC_CTX * mem_ctx )
2004-12-31 13:49:35 +03:00
{
2005-01-02 19:11:59 +03:00
struct dssetup_DsRoleGetPrimaryDomainInformation r ;
2004-12-31 13:49:35 +03:00
NTSTATUS status ;
2005-01-01 04:32:01 +03:00
BOOL ret = True ;
int i ;
2004-12-31 13:49:35 +03:00
2005-01-02 19:11:59 +03:00
printf ( " \n testing DsRoleGetPrimaryDomainInformation \n " ) ;
2004-12-31 13:49:35 +03:00
2005-01-02 19:11:59 +03:00
for ( i = DS_ROLE_BASIC_INFORMATION ; i < = DS_ROLE_OP_STATUS ; i + + ) {
2005-01-01 04:32:01 +03:00
r . in . level = i ;
2004-12-31 13:49:35 +03:00
2005-01-02 19:11:59 +03:00
status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation ( p , mem_ctx , & r ) ;
2005-01-01 04:32:01 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
2005-01-02 19:11:59 +03:00
const char * errstr = nt_errstr ( status ) ;
if ( NT_STATUS_EQUAL ( status , NT_STATUS_NET_WRITE_FAULT ) ) {
errstr = dcerpc_errstr ( mem_ctx , p - > last_fault_code ) ;
}
printf ( " dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d failed - %s \n " ,
i , errstr ) ;
ret = False ;
} else if ( ! W_ERROR_IS_OK ( r . out . result ) ) {
printf ( " DsRoleGetPrimaryDomainInformation level %d failed - %s \n " ,
i , win_errstr ( r . out . result ) ) ;
2005-01-01 04:32:01 +03:00
ret = False ;
}
2004-12-31 13:49:35 +03:00
}
2005-01-01 04:32:01 +03:00
return ret ;
2004-12-31 13:49:35 +03:00
}
2006-03-25 19:01:28 +03:00
BOOL torture_rpc_dssetup ( struct torture_context * torture )
2004-12-31 13:49:35 +03:00
{
NTSTATUS status ;
struct dcerpc_pipe * p ;
TALLOC_CTX * mem_ctx ;
BOOL ret = True ;
mem_ctx = talloc_init ( " torture_rpc_dssetup " ) ;
2005-12-27 17:28:01 +03:00
status = torture_rpc_connection ( mem_ctx , & p , & dcerpc_table_dssetup ) ;
2004-12-31 13:49:35 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
2005-03-22 11:00:45 +03:00
talloc_free ( mem_ctx ) ;
2004-12-31 13:49:35 +03:00
return False ;
}
2005-01-02 19:11:59 +03:00
ret & = test_DsRoleGetPrimaryDomainInformation ( p , mem_ctx ) ;
2004-12-31 13:49:35 +03:00
2005-01-27 10:08:20 +03:00
talloc_free ( mem_ctx ) ;
2004-12-31 13:49:35 +03:00
return ret ;
}