LCOV - code coverage report
Current view: top level - source4/torture/ndr - svcctl.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 24 26 92.3 %
Date: 2024-04-21 15:09:00 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    test suite for svcctl ndr operations
       4             : 
       5             :    Copyright (C) Guenther Deschner 2020
       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 "torture/ndr/ndr.h"
      23             : #include "librpc/gen_ndr/ndr_svcctl.h"
      24             : #include "torture/ndr/proto.h"
      25             : #include "param/param.h"
      26             : 
      27             : static const uint8_t svcctl_ChangeServiceConfigW_req_data[] = {
      28             :         0x00, 0x00, 0x00, 0x00, 0xcd, 0x94, 0x05, 0x40, 0x30, 0x28, 0x00, 0x49,
      29             :         0x8d, 0xe4, 0x8e, 0x85, 0xb7, 0x19, 0x5c, 0x83, 0x10, 0x01, 0x00, 0x00,
      30             :         0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      31             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      32             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      33             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
      34             : };
      35             : 
      36           2 : static bool svcctl_ChangeServiceConfigW_req_check(struct torture_context *tctx,
      37             :                                                   struct svcctl_ChangeServiceConfigW *r)
      38             : {
      39           2 :         struct policy_handle handle = { 0 };
      40           2 :         GUID_from_string("400594cd-2830-4900-8de4-8e85b7195c83", &handle.uuid);
      41             : 
      42           2 :         torture_assert_guid_equal(tctx, r->in.handle->uuid, handle.uuid, "handle");
      43           2 :         torture_assert_u32_equal(tctx, r->in.type, 0x00000110, "type");
      44           2 :         torture_assert_u32_equal(tctx, r->in.start_type, SVCCTL_AUTO_START, "start_type");
      45           2 :         torture_assert_u32_equal(tctx, r->in.error_control, SVCCTL_SVC_ERROR_NORMAL, "error_control");
      46           2 :         torture_assert_str_equal(tctx, r->in.binary_path, NULL, "binary_path");
      47           2 :         torture_assert_str_equal(tctx, r->in.load_order_group, NULL, "load_order_group");
      48           2 :         torture_assert(tctx, r->in.tag_id == NULL, "tag_id");
      49           2 :         torture_assert_str_equal(tctx, r->in.dependencies, NULL, "dependencies");
      50           2 :         torture_assert_u32_equal(tctx, r->in.dwDependSize, 0, "dwDependSize");
      51           2 :         torture_assert_str_equal(tctx, r->in.service_start_name, NULL, "service_start_name");
      52           2 :         torture_assert_str_equal(tctx, r->in.password, NULL, "password");
      53           2 :         torture_assert_u32_equal(tctx, r->in.dwPwSize, 0, "dwPwSize");
      54           2 :         torture_assert_str_equal(tctx, r->in.display_name, NULL, "display_name");
      55             : 
      56           0 :         return true;
      57             : }
      58             : 
      59             : static const uint8_t svcctl_ChangeServiceConfigW_rep_data[] = {
      60             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
      61             : };
      62             : 
      63           2 : static bool svcctl_ChangeServiceConfigW_rep_check(struct torture_context *tctx,
      64             :                                                   struct svcctl_ChangeServiceConfigW *r)
      65             : {
      66           2 :         torture_assert(tctx, r->out.tag_id == NULL, "tag_id");
      67           2 :         torture_assert_werr_ok(tctx, r->out.result, "result");
      68             : 
      69           0 :         return true;
      70             : }
      71             : 
      72        2354 : struct torture_suite *ndr_svcctl_suite(TALLOC_CTX *ctx)
      73             : {
      74        2354 :         struct torture_suite *suite = torture_suite_create(ctx, "svcctl");
      75             : 
      76        2354 :         torture_suite_add_ndr_pull_fn_test(suite,
      77             :                                            svcctl_ChangeServiceConfigW,
      78             :                                            svcctl_ChangeServiceConfigW_req_data,
      79             :                                            NDR_IN,
      80             :                                            svcctl_ChangeServiceConfigW_req_check);
      81             : 
      82        2354 :         torture_suite_add_ndr_pull_fn_test(suite,
      83             :                                            svcctl_ChangeServiceConfigW,
      84             :                                            svcctl_ChangeServiceConfigW_rep_data,
      85             :                                            NDR_OUT,
      86             :                                            svcctl_ChangeServiceConfigW_rep_check);
      87        2354 :         return suite;
      88             : }

Generated by: LCOV version 1.14