LCOV - code coverage report
Current view: top level - source4/torture/rpc - remact.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 5 41 12.2 %
Date: 2021-09-23 10:06:22 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    test suite for remoteactivation operations
       4             : 
       5             :    Copyright (C) Jelmer Vernooij 2004
       6             : 
       7             :    This program is free software; you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation; either version 3 of the License, or
      10             :    (at your option) any later version.
      11             : 
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             : 
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include "includes.h"
      22             : #include "librpc/gen_ndr/ndr_remact_c.h"
      23             : #include "librpc/gen_ndr/ndr_epmapper_c.h"
      24             : #include "torture/rpc/torture_rpc.h"
      25             : 
      26             : #define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9"
      27             : #define DCERPC_IUNKNOWN_UUID "00000000-0000-0000-c000-000000000046"
      28             : #define DCERPC_ICLASSFACTORY_UUID "00000001-0000-0000-c000-000000000046"
      29             : 
      30           0 : static bool test_RemoteActivation(struct torture_context *tctx,
      31             :                                   struct dcerpc_pipe *p)
      32             : {
      33             :         struct RemoteActivation r;
      34             :         NTSTATUS status;
      35             :         struct GUID iids[1];
      36           0 :         uint16_t protseq[3] = { EPM_PROTOCOL_TCP, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID };
      37           0 :         struct dcerpc_binding_handle *b = p->binding_handle;
      38             :         struct ORPCTHAT that;
      39             :         uint64_t pOxid;
      40             :         struct DUALSTRINGARRAY *pdsaOxidBindings;
      41             :         struct GUID ipidRemUnknown;
      42             :         uint32_t AuthnHint;
      43             :         struct COMVERSION ServerVersion;
      44             :         HRESULT hr;
      45             :         struct MInterfacePointer *ifaces;
      46             : 
      47           0 :         ZERO_STRUCT(r);
      48             : 
      49           0 :         r.in.this_object.version.MajorVersion = 5;
      50           0 :         r.in.this_object.version.MinorVersion = 1;
      51           0 :         r.in.this_object.cid = GUID_random();
      52           0 :         GUID_from_string(CLSID_IMAGEDOC, &r.in.Clsid);
      53           0 :         r.in.ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY;
      54           0 :         r.in.num_protseqs = 3;
      55           0 :         r.in.protseq = protseq;
      56           0 :         r.in.Interfaces = 1;
      57           0 :         GUID_from_string(DCERPC_IUNKNOWN_UUID, &iids[0]);
      58           0 :         r.in.pIIDs = iids;
      59             : 
      60           0 :         r.out.that = &that;
      61           0 :         r.out.pOxid = &pOxid;
      62           0 :         r.out.pdsaOxidBindings = &pdsaOxidBindings;
      63           0 :         r.out.ipidRemUnknown = &ipidRemUnknown;
      64           0 :         r.out.AuthnHint = &AuthnHint;
      65           0 :         r.out.ServerVersion = &ServerVersion;
      66           0 :         r.out.hr = &hr;
      67           0 :         r.out.ifaces = &ifaces;
      68             : 
      69           0 :         status = dcerpc_RemoteActivation_r(b, tctx, &r);
      70           0 :         torture_assert_ntstatus_ok(tctx, status, "RemoteActivation");
      71             : 
      72           0 :         torture_assert_werr_ok(tctx, r.out.result, "RemoteActivation");
      73             : 
      74           0 :         torture_assert_hresult_ok(tctx, *r.out.hr, "RemoteActivation");
      75             : 
      76           0 :         torture_assert_hresult_ok(tctx, r.out.results[0], "RemoteActivation");
      77             : 
      78           0 :         GUID_from_string(DCERPC_ICLASSFACTORY_UUID, &iids[0]);
      79           0 :         r.in.Interfaces = 1;
      80           0 :         r.in.Mode = MODE_GET_CLASS_OBJECT;
      81             : 
      82           0 :         status = dcerpc_RemoteActivation_r(b, tctx, &r);
      83           0 :         torture_assert_ntstatus_ok(tctx, status, "RemoteActivation(GetClassObject)");
      84             : 
      85           0 :         torture_assert_werr_ok(tctx, r.out.result, "RemoteActivation(GetClassObject)");
      86             : 
      87           0 :         torture_assert_hresult_ok(tctx, *r.out.hr, "RemoteActivation(GetClassObject)");
      88             : 
      89           0 :         torture_assert_hresult_ok(tctx, r.out.results[0], "RemoteActivation(GetClassObject)");
      90             : 
      91           0 :         return true;
      92             : }
      93             : 
      94        2355 : struct torture_suite *torture_rpc_remact(TALLOC_CTX *mem_ctx)
      95             : {
      96        2355 :         struct torture_suite *suite = torture_suite_create(mem_ctx, "remact");
      97             :         struct torture_rpc_tcase *tcase;
      98             : 
      99        2355 :         tcase = torture_suite_add_rpc_iface_tcase(suite, "remact", &ndr_table_IRemoteActivation);
     100             : 
     101        2355 :         torture_rpc_tcase_add_test(tcase, "RemoteActivation", test_RemoteActivation);
     102             : 
     103        2355 :         return suite;
     104             : }

Generated by: LCOV version 1.13