librpc: fix IDL for svcctl_ChangeServiceConfigW
authorGünther Deschner <gd@samba.org>
Wed, 4 Mar 2020 14:23:43 +0000 (15:23 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 9 Mar 2020 15:00:31 +0000 (15:00 +0000)
Found while trying to run winexe against Windows Server 2019.

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>
examples/winexe/winexe.c
librpc/idl/svcctl.idl
selftest/knownfail
source4/torture/ndr/svcctl.c
source4/torture/rpc/svcctl.c

index 22f748b1d456934773971b0218d15e42e44d15a3..fc6b15f8e52f1f2ca095cbcebacf7de243b85c01 100644 (file)
@@ -625,8 +625,10 @@ static NTSTATUS winexe_svc_install(
                        NULL,       /* load_order_group */
                        NULL,       /* tag_id */
                        NULL,       /* dependencies */
+                       0,          /* dwDependSize */
                        NULL,       /* service_start_name */
                        NULL,       /* password */
+                       0,          /* dwPwSize */
                        NULL,       /* display_name */
                        &werr);
 
index e909bf2dbed6c986b8bffbaeb0ae38370a9f696f..a9dd3dec99031241ecc945c22b027281c3ee6960 100644 (file)
@@ -13,6 +13,17 @@ import "misc.idl", "security.idl";
   helpstring("Service Control")
 ] interface svcctl
 {
+       const int MAX_SERVICE_NAME_LENGTH = 256;
+       const short SC_MAX_DEPEND_SIZE = 4 * 1024;
+       const short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1;
+       const short SC_MAX_PATH_LENGTH = 32 * 1024;
+       const short SC_MAX_PWD_SIZE = 514;
+       const short SC_MAX_COMPUTER_NAME_LENGTH = 1024;
+       const short SC_MAX_ACCOUNT_NAME_LENGTH = 2 * 1024;
+       const short SC_MAX_COMMENT_LENGTH = 128;
+       const short SC_MAX_ARGUMENT_LENGTH = 1024;
+       const short SC_MAX_ARGUMENTS = 1024;
+
        typedef struct {
                uint32 is_locked;
                [string,charset(UTF16)] uint16 *lock_owner;
@@ -195,11 +206,13 @@ import "misc.idl", "security.idl";
                [in] svcctl_ErrorControl error_control,
                [in,unique] [string,charset(UTF16)] uint16 *binary_path,
                [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
-               [out,ref] uint32 *tag_id,
-               [in,unique] [string,charset(UTF16)] uint16 *dependencies,
-               [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
-               [in,unique] [string,charset(UTF16)] uint16 *password,
-               [in,unique] [string,charset(UTF16)] uint16 *display_name
+               [in,out,unique] uint32 *tag_id,
+               [in,unique,size_is(dwDependSize)] [string,charset(UTF16)] uint16 *dependencies,
+               [in,range(0, SC_MAX_DEPEND_SIZE)] uint32 dwDependSize,
+               [in,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] [string,charset(UTF16)] uint16 *service_start_name,
+               [in,unique,size_is(dwPwSize)] [string,charset(UTF16)] uint16 *password,
+               [in,range(0, SC_MAX_PWD_SIZE)] uint32 dwPwSize,
+               [in,unique,range(0, SC_MAX_NAME_LENGTH)] [string,charset(UTF16)] uint16 *display_name
        );
 
        /*****************/
index b9c4b8de5477e4dd07f774b3c65b490f03c4b58c..d4381b39a84c403cef98f6ccf29abb390c5c708e 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 1c9404597cddb1ee1bff387dd5510ae48fa9abe6..6592beda02e16d9a925bf951a2b4444a4c80977e 100644 (file)
@@ -45,9 +45,12 @@ static bool svcctl_ChangeServiceConfigW_req_check(struct torture_context *tctx,
        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(tctx, r->in.tag_id == NULL, "tag_id");
        torture_assert_str_equal(tctx, r->in.dependencies, NULL, "dependencies");
+       torture_assert_u32_equal(tctx, r->in.dwDependSize, 0, "dwDependSize");
        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_u32_equal(tctx, r->in.dwPwSize, 0, "dwPwSize");
        torture_assert_str_equal(tctx, r->in.display_name, NULL, "display_name");
 
        return true;
index bd16ed4627d356b642ea58ce5cf4b3fb6ccf96ae..746b399360e013ff5fc876b35c66f73aed8bf527 100644 (file)
@@ -675,9 +675,12 @@ static bool test_ChangeServiceConfigW(struct torture_context *tctx,
        r.in.binary_path        = NULL;
        r.in.load_order_group   = NULL;
        r.in.dependencies       = NULL;
+       r.in.dwDependSize       = 0;
        r.in.service_start_name = NULL;
        r.in.password           = NULL;
+       r.in.dwPwSize           = 0;
        r.in.display_name       = NULL;
+       r.in.tag_id             = NULL;
        r.out.tag_id            = NULL;
 
        status = dcerpc_svcctl_ChangeServiceConfigW_r(b, tctx, &r);