s4-smbtorture: add test_QueryServiceConfigW() to RPC-SVCCTL.
authorGünther Deschner <gd@samba.org>
Thu, 9 Apr 2009 08:07:07 +0000 (10:07 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 9 Apr 2009 12:33:37 +0000 (14:33 +0200)
Guenther

source4/torture/rpc/svcctl.c

index b57ba1a8ba0f73bb9467305410d2547f7cdbce89..9c682683d3b4b3c03d17e4c9da091563c52d6fe3 100644 (file)
@@ -151,6 +151,48 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
        return true;
 }
 
+static bool test_QueryServiceConfigW(struct torture_context *tctx,
+                                    struct dcerpc_pipe *p)
+{
+       struct svcctl_QueryServiceConfigW r;
+       struct QUERY_SERVICE_CONFIG query;
+       struct policy_handle h, s;
+       NTSTATUS status;
+
+       uint32_t offered = 0;
+       uint32_t needed = 0;
+
+       if (!test_OpenSCManager(p, tctx, &h))
+               return false;
+
+       if (!test_OpenService(p, tctx, &h, "Netlogon", &s))
+               return false;
+
+       r.in.handle = &s;
+       r.in.offered = offered;
+       r.out.query = &query;
+       r.out.needed = &needed;
+
+       status = dcerpc_svcctl_QueryServiceConfigW(p, tctx, &r);
+       torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfigW failed!");
+
+       if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+               r.in.offered = needed;
+               status = dcerpc_svcctl_QueryServiceConfigW(p, tctx, &r);
+               torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfigW failed!");
+       }
+
+       torture_assert_werr_ok(tctx, r.out.result, "QueryServiceConfigW failed!");
+
+       if (!test_CloseServiceHandle(p, tctx, &s))
+               return false;
+
+       if (!test_CloseServiceHandle(p, tctx, &h))
+               return false;
+
+       return true;
+}
+
 static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerpc_pipe *p)
 {
        struct svcctl_QueryServiceConfig2W r;
@@ -319,6 +361,8 @@ struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx)
                                   test_QueryServiceStatus);
        torture_rpc_tcase_add_test(tcase, "QueryServiceStatusEx",
                                   test_QueryServiceStatusEx);
+       torture_rpc_tcase_add_test(tcase, "QueryServiceConfigW",
+                                  test_QueryServiceConfigW);
        torture_rpc_tcase_add_test(tcase, "QueryServiceConfig2W",
                                   test_QueryServiceConfig2W);