]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-torture: add ndr svcctl testsuite
authorGünther Deschner <gd@samba.org>
Thu, 5 Mar 2020 19:42:21 +0000 (20:42 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 9 Mar 2020 15:00:31 +0000 (15:00 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14313

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
librpc/idl/svcctl.idl
selftest/knownfail
source4/torture/ndr/ndr.c
source4/torture/ndr/svcctl.c [new file with mode: 0644]
source4/torture/wscript_build

index 671a1dc47be21d33b9ca08b2239d45898ec5fe01..e909bf2dbed6c986b8bffbaeb0ae38370a9f696f 100644 (file)
@@ -188,7 +188,7 @@ import "misc.idl", "security.idl";
                SVCCTL_DISABLED                 = 0x00000004
        } svcctl_StartType;
 
-       WERROR svcctl_ChangeServiceConfigW(
+       [public] WERROR svcctl_ChangeServiceConfigW(
                [in,ref] policy_handle *handle,
                [in] uint32 type,
                [in] svcctl_StartType start_type,
index d4381b39a84c403cef98f6ccf29abb390c5c708e..b9c4b8de5477e4dd07f774b3c65b490f03c4b58c 100644 (file)
 # not implemented
 ^samba3.rpc.svcctl.svcctl.ChangeServiceConfigW\(ad_dc\)
 ^samba3.rpc.svcctl.svcctl.ChangeServiceConfigW\(nt4_dc\)
+# broken IDL
+^samba4.local.ndr.svcctl_ChangeServiceConfigW_NDR_IN
+^samba4.local.ndr.svcctl_ChangeServiceConfigW_NDR_OUT
+^samba4.local.ndr.system.iconv.svcctl_ChangeServiceConfigW_NDR_IN
+^samba4.local.ndr.system.iconv.svcctl_ChangeServiceConfigW_NDR_OUT
 #
 # This makes less sense when not running against an AD DC
 #
index 32efe90757dd2683511cd6380820aed262ad356a..690301f31b1dcb5ab33c3680182d9c890d92098a 100644 (file)
@@ -708,6 +708,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
        torture_suite_add_suite(suite, ndr_krb5pac_suite(suite));
        torture_suite_add_suite(suite, ndr_cabinet_suite(suite));
        torture_suite_add_suite(suite, ndr_charset_suite(suite));
+       torture_suite_add_suite(suite, ndr_svcctl_suite(suite));
 
        torture_suite_add_simple_test(suite, "string terminator",
                                      test_check_string_terminator);
diff --git a/source4/torture/ndr/svcctl.c b/source4/torture/ndr/svcctl.c
new file mode 100644 (file)
index 0000000..1c94045
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+   Unix SMB/CIFS implementation.
+   test suite for svcctl ndr operations
+
+   Copyright (C) Guenther Deschner 2020
+
+   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 3 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "torture/ndr/ndr.h"
+#include "librpc/gen_ndr/ndr_svcctl.h"
+#include "torture/ndr/proto.h"
+#include "param/param.h"
+
+static const uint8_t svcctl_ChangeServiceConfigW_req_data[] = {
+       0x00, 0x00, 0x00, 0x00, 0xcd, 0x94, 0x05, 0x40, 0x30, 0x28, 0x00, 0x49,
+       0x8d, 0xe4, 0x8e, 0x85, 0xb7, 0x19, 0x5c, 0x83, 0x10, 0x01, 0x00, 0x00,
+       0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static bool svcctl_ChangeServiceConfigW_req_check(struct torture_context *tctx,
+                                                 struct svcctl_ChangeServiceConfigW *r)
+{
+       struct policy_handle handle = { 0 };
+       GUID_from_string("400594cd-2830-4900-8de4-8e85b7195c83", &handle.uuid);
+
+       torture_assert_guid_equal(tctx, r->in.handle->uuid, handle.uuid, "handle");
+       torture_assert_u32_equal(tctx, r->in.type, 0x00000110, "type");
+       torture_assert_u32_equal(tctx, r->in.start_type, SVCCTL_AUTO_START, "start_type");
+       torture_assert_u32_equal(tctx, r->in.error_control, SVCCTL_SVC_ERROR_NORMAL, "error_control");
+       torture_assert_str_equal(tctx, r->in.binary_path, NULL, "binary_path");
+       torture_assert_str_equal(tctx, r->in.load_order_group, NULL, "load_order_group");
+       torture_assert_str_equal(tctx, r->in.dependencies, NULL, "dependencies");
+       torture_assert_str_equal(tctx, r->in.service_start_name, NULL, "service_start_name");
+       torture_assert_str_equal(tctx, r->in.password, NULL, "password");
+       torture_assert_str_equal(tctx, r->in.display_name, NULL, "display_name");
+
+       return true;
+}
+
+static const uint8_t svcctl_ChangeServiceConfigW_rep_data[] = {
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static bool svcctl_ChangeServiceConfigW_rep_check(struct torture_context *tctx,
+                                                 struct svcctl_ChangeServiceConfigW *r)
+{
+       torture_assert(tctx, r->out.tag_id == NULL, "tag_id");
+       torture_assert_werr_ok(tctx, r->out.result, "result");
+
+       return true;
+}
+
+struct torture_suite *ndr_svcctl_suite(TALLOC_CTX *ctx)
+{
+       struct torture_suite *suite = torture_suite_create(ctx, "svcctl");
+
+       torture_suite_add_ndr_pull_fn_test(suite,
+                                          svcctl_ChangeServiceConfigW,
+                                          svcctl_ChangeServiceConfigW_req_data,
+                                          NDR_IN,
+                                          svcctl_ChangeServiceConfigW_req_check);
+
+       torture_suite_add_ndr_pull_fn_test(suite,
+                                          svcctl_ChangeServiceConfigW,
+                                          svcctl_ChangeServiceConfigW_rep_data,
+                                          NDR_OUT,
+                                          svcctl_ChangeServiceConfigW_rep_check);
+       return suite;
+}
index 65af160b3226852892e7100b28df1a44fe56b986..05a6fbcbf14630c8e4e1d7e30a6e99d2e3c5c97f 100644 (file)
@@ -71,6 +71,7 @@ bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
                   ndr/winspool.c
                   ndr/cabinet.c
                   ndr/charset.c
+                  ndr/svcctl.c
                  ''',
        autoproto='ndr/proto.h',
        deps='torture krb5samba',