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"
2003-12-21 10:53:57 +03:00
static BOOL test_NetWkstaGetInfo ( struct dcerpc_pipe * p ,
2003-11-17 15:43:18 +03:00
TALLOC_CTX * mem_ctx )
{
NTSTATUS status ;
2003-12-21 10:53:57 +03:00
struct wkssvc_NetWkstaGetInfo 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 ] ;
2003-12-21 10:53:57 +03:00
printf ( " testing NetWkstaGetInfo level %u \n " , r . in . level ) ;
status = dcerpc_wkssvc_NetWkstaGetInfo ( p , mem_ctx , & r ) ;
2003-11-18 04:18:24 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
2003-12-21 10:53:57 +03:00
printf ( " NetWkstaGetInfo 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-12-21 10:53:57 +03:00
if ( ! W_ERROR_IS_OK ( r . out . result ) ) {
printf ( " NetWkstaGetInfo level %u failed - %s \n " , r . in . level , win_errstr ( r . out . result ) ) ;
}
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
2003-12-21 10:53:57 +03:00
static BOOL test_NetWkstaTransportEnum ( struct dcerpc_pipe * p ,
2003-11-18 06:28:01 +03:00
TALLOC_CTX * mem_ctx )
{
NTSTATUS status ;
2003-12-21 10:53:57 +03:00
struct wkssvc_NetWkstaTransportEnum r ;
2003-11-18 06:28:01 +03:00
BOOL ret = True ;
2004-05-25 20:24:13 +04:00
uint32_t resume_handle = 0 ;
2003-12-21 10:53:57 +03:00
struct wkssvc_NetWkstaTransportCtr0 ctr0 ;
2003-11-18 06:28:01 +03:00
2003-12-21 10:53:57 +03:00
ZERO_STRUCT ( ctr0 ) ;
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 ;
2003-12-21 10:53:57 +03:00
r . in . ctr . ctr0 = & ctr0 ;
2004-05-25 20:24:13 +04:00
r . in . max_buffer = ( uint32_t ) - 1 ;
2003-11-18 06:28:01 +03:00
r . in . resume_handle = & resume_handle ;
r . out . resume_handle = & resume_handle ;
2003-12-21 10:53:57 +03:00
printf ( " testing NetWkstaTransportEnum \n " ) ;
status = dcerpc_wkssvc_NetWkstaTransportEnum ( p , mem_ctx , & r ) ;
2003-11-18 06:28:01 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
2003-12-21 10:53:57 +03:00
printf ( " NetWkstaTransportEnum failed - %s \n " , nt_errstr ( status ) ) ;
2003-11-18 06:28:01 +03:00
ret = False ;
}
2003-12-21 10:53:57 +03:00
if ( ! W_ERROR_IS_OK ( r . out . result ) ) {
printf ( " NetWkstaTransportEnum level %u failed - %s \n " , r . in . level , win_errstr ( r . out . result ) ) ;
}
2003-11-18 06:28:01 +03:00
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
2003-12-21 10:53:57 +03:00
if ( ! test_NetWkstaGetInfo ( p , mem_ctx ) ) {
2003-11-17 15:43:18 +03:00
ret = False ;
}
2003-12-21 10:53:57 +03:00
if ( ! test_NetWkstaTransportEnum ( p , mem_ctx ) ) {
2003-11-18 06:28:01 +03:00
ret = False ;
}
2003-11-22 11:11:32 +03:00
talloc_destroy ( mem_ctx ) ;
2003-11-17 15:43:18 +03:00
torture_rpc_close ( p ) ;
return ret ;
}