s4-torture: add test for svcctl_QueryServiceConfigEx
authorGünther Deschner <gd@samba.org>
Mon, 20 Apr 2020 13:09:01 +0000 (15:09 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Nov 2023 08:00:30 +0000 (08:00 +0000)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/knownfail
source4/torture/rpc/svcctl.c

index 4e34effbbd14af41a2d175d97d265b55ed152acd..e43e4deb89e7da1ea6ff72bcd039da03943ad8d0 100644 (file)
 # not implemented
 ^samba3.rpc.svcctl.svcctl.ChangeServiceConfigW\(ad_dc\)
 ^samba3.rpc.svcctl.svcctl.ChangeServiceConfigW\(nt4_dc\)
+^samba3.rpc.svcctl.svcctl.QueryServiceConfigEx\(ad_dc\)
+^samba3.rpc.svcctl.svcctl.QueryServiceConfigEx\(nt4_dc\)
 #
 # This makes less sense when not running against an AD DC
 #
index 746b399360e013ff5fc876b35c66f73aed8bf527..2dcf786514ba250e14c105e27fd28ad376115b1c 100644 (file)
@@ -271,6 +271,45 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
        return true;
 }
 
+static bool test_QueryServiceConfigEx(struct torture_context *tctx, struct dcerpc_pipe *p)
+{
+       struct svcctl_QueryServiceConfigEx r;
+       struct policy_handle h, s;
+       NTSTATUS status;
+       struct dcerpc_binding_handle *b = p->binding_handle;
+       struct SC_RPC_CONFIG_INFOW info;
+       int i;
+
+       if (!test_OpenSCManager(b, tctx, &h))
+               return false;
+
+       if (!test_OpenService(b, tctx, &h, TORTURE_DEFAULT_SERVICE, &s))
+               return false;
+
+       for (i=0; i < 16; i++) {
+
+               r.in.hService = s;
+               r.in.dwInfoLevel = i;
+               r.out.pInfo = &info;
+
+               status = dcerpc_svcctl_QueryServiceConfigEx_r(b, tctx, &r);
+               if (i == 8) {
+                       torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfigEx failed!");
+                       torture_assert_werr_ok(tctx, r.out.result, "QueryServiceConfigEx failed!");
+               } else {
+                       torture_assert_ntstatus_equal(tctx, status, NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE, "QueryServiceConfigEx failed!");
+               }
+       }
+
+       if (!test_CloseServiceHandle(b, tctx, &s))
+               return false;
+
+       if (!test_CloseServiceHandle(b, tctx, &h))
+               return false;
+
+       return true;
+}
+
 static bool test_QueryServiceObjectSecurity(struct torture_context *tctx,
                                            struct dcerpc_pipe *p)
 {
@@ -721,6 +760,8 @@ struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx)
                                   test_QueryServiceConfigW);
        torture_rpc_tcase_add_test(tcase, "QueryServiceConfig2W",
                                   test_QueryServiceConfig2W);
+       torture_rpc_tcase_add_test(tcase, "QueryServiceConfigEx",
+                                  test_QueryServiceConfigEx);
        torture_rpc_tcase_add_test(tcase, "QueryServiceObjectSecurity",
                                   test_QueryServiceObjectSecurity);
        torture_rpc_tcase_add_test(tcase, "SetServiceObjectSecurity",