2004-10-31 18:40:08 +00:00
/*
Unix SMB / CIFS implementation .
test suite for remoteactivation operations
Copyright ( C ) Jelmer Vernooij 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
2007-07-10 02:07:03 +00:00
the Free Software Foundation ; either version 3 of the License , or
2004-10-31 18:40:08 +00: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 02:07:03 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2004-10-31 18:40:08 +00:00
*/
# include "includes.h"
2006-01-03 13:41:17 +00:00
# include "torture/torture.h"
2006-03-14 23:35:30 +00:00
# include "librpc/gen_ndr/ndr_remact_c.h"
# include "librpc/gen_ndr/ndr_epmapper_c.h"
2006-03-14 15:02:05 +00:00
# include "torture/rpc/rpc.h"
2004-10-31 18:40:08 +00:00
2005-07-18 23:58:59 +00:00
# define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9"
2007-02-18 18:44:56 +00:00
# define DCERPC_IUNKNOWN_UUID "00000000-0000-0000-c000-000000000046"
# define DCERPC_ICLASSFACTORY_UUID "00000001-0000-0000-c000-000000000046"
2005-07-18 23:58:59 +00:00
2007-08-28 16:24:18 +00:00
static bool test_RemoteActivation ( struct torture_context * tctx ,
struct dcerpc_pipe * p )
2004-10-31 18:40:08 +00:00
{
struct RemoteActivation r ;
NTSTATUS status ;
2005-07-18 23:58:59 +00:00
struct GUID iids [ 1 ] ;
2005-02-10 05:09:35 +00:00
uint16_t protseq [ 3 ] = { EPM_PROTOCOL_TCP , EPM_PROTOCOL_NCALRPC , EPM_PROTOCOL_UUID } ;
2004-10-31 18:40:08 +00:00
ZERO_STRUCT ( r . in ) ;
r . in . this . version . MajorVersion = 5 ;
r . in . this . version . MinorVersion = 1 ;
2004-11-25 20:03:46 +00:00
r . in . this . cid = GUID_random ( ) ;
2005-07-18 23:58:59 +00:00
GUID_from_string ( CLSID_IMAGEDOC , & r . in . Clsid ) ;
2004-10-31 18:40:08 +00:00
r . in . ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
2004-11-02 15:32:58 +00:00
r . in . num_protseqs = 3 ;
2004-10-31 18:40:08 +00:00
r . in . protseq = protseq ;
2005-07-18 23:58:59 +00:00
r . in . Interfaces = 1 ;
2004-10-31 18:40:08 +00:00
GUID_from_string ( DCERPC_IUNKNOWN_UUID , & iids [ 0 ] ) ;
r . in . pIIDs = iids ;
2007-08-28 16:24:18 +00:00
status = dcerpc_RemoteActivation ( p , tctx , & r ) ;
torture_assert_ntstatus_ok ( tctx , status , " RemoteActivation " ) ;
2004-10-31 18:40:08 +00:00
2007-08-28 16:24:18 +00:00
torture_assert_werr_ok ( tctx , r . out . result , " RemoteActivation " ) ;
2004-10-31 18:40:08 +00:00
2007-08-28 16:24:18 +00:00
torture_assert_werr_ok ( tctx , * r . out . hr , " RemoteActivation " ) ;
2004-10-31 18:40:08 +00:00
2007-08-28 16:24:18 +00:00
torture_assert_werr_ok ( tctx , r . out . results [ 0 ] , " RemoteActivation " ) ;
2004-11-02 17:38:11 +00:00
2004-11-03 20:32:28 +00:00
GUID_from_string ( DCERPC_ICLASSFACTORY_UUID , & iids [ 0 ] ) ;
2004-11-07 16:47:46 +00:00
r . in . Interfaces = 1 ;
2004-11-02 17:38:11 +00:00
r . in . Mode = MODE_GET_CLASS_OBJECT ;
2007-08-28 16:24:18 +00:00
status = dcerpc_RemoteActivation ( p , tctx , & r ) ;
torture_assert_ntstatus_ok ( tctx , status ,
" RemoteActivation(GetClassObject) " ) ;
2004-11-02 17:38:11 +00:00
2007-08-28 16:24:18 +00:00
torture_assert_werr_ok ( tctx , r . out . result ,
" RemoteActivation(GetClassObject) " ) ;
2004-11-02 17:38:11 +00:00
2007-08-28 16:24:18 +00:00
torture_assert_werr_ok ( tctx , * r . out . hr , " RemoteActivation(GetClassObject) " ) ;
2004-11-02 17:38:11 +00:00
2007-08-28 16:24:18 +00:00
torture_assert_werr_ok ( tctx , r . out . results [ 0 ] ,
" RemoteActivation(GetClassObject) " ) ;
2004-11-02 17:38:11 +00:00
2007-08-28 16:24:18 +00:00
return true ;
2004-10-31 18:40:08 +00:00
}
2007-08-28 16:24:18 +00:00
struct torture_suite * torture_rpc_remact ( TALLOC_CTX * mem_ctx )
2004-10-31 18:40:08 +00:00
{
2007-08-28 16:24:18 +00:00
struct torture_suite * suite = torture_suite_create ( mem_ctx , " REMACT " ) ;
struct torture_rpc_tcase * tcase ;
2004-10-31 18:40:08 +00:00
2007-08-28 16:24:18 +00:00
tcase = torture_suite_add_rpc_iface_tcase ( suite , " remact " , & ndr_table_IRemoteActivation ) ;
2004-10-31 18:40:08 +00:00
2007-08-28 16:24:18 +00:00
torture_rpc_tcase_add_test ( tcase , " RemoteActivation " , test_RemoteActivation ) ;
2004-10-31 18:40:08 +00:00
2007-08-28 16:24:18 +00:00
return suite ;
2004-10-31 18:40:08 +00:00
}