2003-11-17 15:43:18 +03:00
/*
Unix SMB / CIFS implementation .
test suite for wkssvc rpc operations
Copyright ( C ) Andrew Tridgell 2003
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"
static BOOL test_QueryInfo ( struct dcerpc_pipe * p ,
TALLOC_CTX * mem_ctx )
{
NTSTATUS status ;
2003-11-18 11:03:06 +03:00
struct wkssvc_QueryInfo r ;
2003-11-18 14:52:06 +03:00
uint16 levels [ ] = { 100 , 101 , 102 , 502 } ;
2003-11-18 04:18:24 +03:00
int i ;
2003-11-18 06:28:01 +03:00
BOOL ret = True ;
2003-11-17 15:43:18 +03:00
r . in . server_name = dcerpc_server_name ( p ) ;
2003-11-18 04:18:24 +03:00
for ( i = 0 ; i < ARRAY_SIZE ( levels ) ; i + + ) {
r . in . level = levels [ i ] ;
printf ( " testing QueryInfo level %u \n " , r . in . level ) ;
2003-11-18 11:03:06 +03:00
status = dcerpc_wkssvc_QueryInfo ( p , mem_ctx , & r ) ;
2003-11-18 04:18:24 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
printf ( " QueryInfo level %u failed - %s \n " , r . in . level , nt_errstr ( status ) ) ;
2003-11-18 06:28:01 +03:00
ret = False ;
2003-11-18 04:18:24 +03:00
}
2003-11-17 15:43:18 +03:00
}
2003-11-18 06:28:01 +03:00
return ret ;
2003-11-17 15:43:18 +03:00
}
2003-11-18 06:28:01 +03:00
static BOOL test_TransportEnum ( struct dcerpc_pipe * p ,
TALLOC_CTX * mem_ctx )
{
NTSTATUS status ;
2003-11-18 11:03:06 +03:00
struct wkssvc_TransportEnum r ;
2003-11-18 06:28:01 +03:00
BOOL ret = True ;
uint32 resume_handle = 0 ;
2003-11-20 02:18:35 +03:00
struct wkssvc_TransportInfoArray array ;
2003-11-18 06:28:01 +03:00
2003-11-20 02:18:35 +03:00
ZERO_STRUCT ( array ) ;
2003-11-18 06:28:01 +03:00
r . in . server_name = dcerpc_server_name ( p ) ;
2003-11-20 02:18:35 +03:00
r . in . level = 0 ;
r . in . info . array = & array ;
2003-11-18 06:28:01 +03:00
r . in . max_buffer = ( uint32 ) - 1 ;
r . in . resume_handle = & resume_handle ;
r . out . resume_handle = & resume_handle ;
printf ( " testing TransportEnum \n " ) ;
2003-11-18 11:03:06 +03:00
status = dcerpc_wkssvc_TransportEnum ( p , mem_ctx , & r ) ;
2003-11-18 06:28:01 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
printf ( " TransportEnum failed - %s \n " , nt_errstr ( status ) ) ;
ret = False ;
}
return ret ;
}
2003-11-17 15:43:18 +03:00
BOOL torture_rpc_wkssvc ( int dummy )
{
NTSTATUS status ;
struct dcerpc_pipe * p ;
TALLOC_CTX * mem_ctx ;
BOOL ret = True ;
mem_ctx = talloc_init ( " torture_rpc_wkssvc " ) ;
2003-11-18 08:01:10 +03:00
status = torture_rpc_connection ( & p ,
DCERPC_WKSSVC_NAME ,
DCERPC_WKSSVC_UUID ,
DCERPC_WKSSVC_VERSION ) ;
2003-11-17 15:43:18 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
return False ;
}
2003-11-18 04:18:24 +03:00
p - > flags | = DCERPC_DEBUG_PRINT_BOTH ;
2003-11-17 15:43:18 +03:00
if ( ! test_QueryInfo ( p , mem_ctx ) ) {
ret = False ;
}
2003-11-18 06:28:01 +03:00
if ( ! test_TransportEnum ( p , mem_ctx ) ) {
ret = False ;
}
2003-11-17 15:43:18 +03:00
torture_rpc_close ( p ) ;
return ret ;
}