| 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 |
static bool svcctl_ChangeServiceConfigW_req_check(struct torture_context *tctx, |
| 37 |
struct svcctl_ChangeServiceConfigW *r) |
| 38 |
{ |
| 39 |
struct policy_handle handle = { 0 }; |
| 40 |
GUID_from_string("400594cd-2830-4900-8de4-8e85b7195c83", &handle.uuid); |
| 41 |
|
| 42 |
torture_assert_guid_equal(tctx, r->in.handle->uuid, handle.uuid, "handle"); |
| 43 |
torture_assert_u32_equal(tctx, r->in.type, 0x00000110, "type"); |
| 44 |
torture_assert_u32_equal(tctx, r->in.start_type, SVCCTL_AUTO_START, "start_type"); |
| 45 |
torture_assert_u32_equal(tctx, r->in.error_control, SVCCTL_SVC_ERROR_NORMAL, "error_control"); |
| 46 |
torture_assert_str_equal(tctx, r->in.binary_path, NULL, "binary_path"); |
| 47 |
torture_assert_str_equal(tctx, r->in.load_order_group, NULL, "load_order_group"); |
| 48 |
torture_assert(tctx, r->in.tag_id == NULL, "tag_id"); |
| 49 |
torture_assert_str_equal(tctx, r->in.dependencies, NULL, "dependencies"); |
| 50 |
torture_assert_u32_equal(tctx, r->in.dwDependSize, 0, "dwDependSize"); |
| 51 |
torture_assert_str_equal(tctx, r->in.service_start_name, NULL, "service_start_name"); |
| 52 |
torture_assert_str_equal(tctx, r->in.password, NULL, "password"); |
| 53 |
torture_assert_u32_equal(tctx, r->in.dwPwSize, 0, "dwPwSize"); |
| 54 |
torture_assert_str_equal(tctx, r->in.display_name, NULL, "display_name"); |
| 55 |
|
| 56 |
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 |
static bool svcctl_ChangeServiceConfigW_rep_check(struct torture_context *tctx, |
| 64 |
struct svcctl_ChangeServiceConfigW *r) |
| 65 |
{ |
| 66 |
torture_assert(tctx, r->out.tag_id == NULL, "tag_id"); |
| 67 |
torture_assert_werr_ok(tctx, r->out.result, "result"); |
| 68 |
|
| 69 |
return true; |
| 70 |
} |
| 71 |
|
| 72 |
struct torture_suite *ndr_svcctl_suite(TALLOC_CTX *ctx) |
| 73 |
{ |
| 74 |
struct torture_suite *suite = torture_suite_create(ctx, "svcctl"); |
| 75 |
|
| 76 |
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 |
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 |
return suite; |
| 88 |
} |