diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/ldap/schema.c | 2 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_BecomeDC.c | 2 | ||||
-rw-r--r-- | source4/torture/raw/lock.c | 4 | ||||
-rw-r--r-- | source4/torture/raw/lockbench.c | 20 | ||||
-rw-r--r-- | source4/torture/rpc/eventlog.c | 5 | ||||
-rw-r--r-- | source4/torture/rpc/ntsvcs.c | 56 | ||||
-rw-r--r-- | source4/torture/rpc/spoolss_win.c | 18 | ||||
-rw-r--r-- | source4/torture/rpc/svcctl.c | 242 | ||||
-rw-r--r-- | source4/torture/smb2/lock.c | 10 |
9 files changed, 303 insertions, 56 deletions
diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c index 6184ad266d..7ea7b39d5c 100644 --- a/source4/torture/ldap/schema.c +++ b/source4/torture/ldap/schema.c @@ -223,7 +223,7 @@ static int test_add_attribute(void *ptr, struct ldb_context *ldb, struct ldb_mes goto failed; } - status = dsdb_attribute_from_ldb(schema, msg, attr, attr); + status = dsdb_attribute_from_ldb(ldb, schema, msg, attr, attr); if (!W_ERROR_IS_OK(status)) { goto failed; } diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 2b1bff40ee..7d1c025f18 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -231,7 +231,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s, sa = talloc_zero(s->self_made_schema, struct dsdb_attribute); NT_STATUS_HAVE_NO_MEMORY(sa); - status = dsdb_attribute_from_drsuapi(s->self_made_schema, &cur->object, s, sa); + status = dsdb_attribute_from_drsuapi(s->ldb, s->self_made_schema, &cur->object, s, sa); if (!W_ERROR_IS_OK(status)) { return werror_to_ntstatus(status); } diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index 72a03e1623..7e3ac29809 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -364,7 +364,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli) lock[0].count = 2; status = smb_raw_lock(cli->tree, &io); if (TARGET_IS_WIN7(tctx)) - CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE); + CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE); else CHECK_STATUS(status, NT_STATUS_OK); lock[0].pid--; @@ -376,7 +376,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli) /* XXX This is very strange - Win7 gives us an invalid range when we * unlock the range even though the range is locked! Win7 bug? */ if (TARGET_IS_WIN7(tctx)) - CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE); + CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE); else { CHECK_STATUS(status, NT_STATUS_OK); status = smb_raw_lock(cli->tree, &io); diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d20175a018..c7f99aeb3c 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -317,13 +317,15 @@ bool torture_bench_lock(struct torture_context *torture) { bool ret = true; TALLOC_CTX *mem_ctx = talloc_new(torture); - int i; + int i, j; int timelimit = torture_setting_int(torture, "timelimit", 10); struct timeval tv; struct benchlock_state *state; int total = 0, minops=0; struct smbcli_state *cli; bool progress; + off_t offset; + int initial_locks = torture_setting_int(torture, "initial_locks", 0); progress = torture_setting_bool(torture, "progress", true); @@ -371,6 +373,21 @@ bool torture_bench_lock(struct torture_context *torture) goto failed; } + /* Optionally, lock initial_locks for each proc beforehand. */ + if (i == 0 && initial_locks > 0) { + printf("Initializing %d locks on each proc.\n", + initial_locks); + } + + for (j = 0; j < initial_locks; j++) { + offset = (0xFFFFFED8LLU * (i+2)) + j; + if (!NT_STATUS_IS_OK(smbcli_lock64(state[i].tree, + state[i].fnum, offset, 1, 0, WRITE_LOCK))) { + printf("Failed initializing, lock=%d\n", j); + goto failed; + } + } + state[i].stage = LOCK_INITIAL; lock_send(&state[i]); } @@ -413,6 +430,7 @@ bool torture_bench_lock(struct torture_context *torture) return ret; failed: + smbcli_deltree(state[0].tree, BASEDIR); talloc_free(mem_ctx); return false; } diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 10c4886259..865b4e2217 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -203,7 +203,6 @@ static bool test_ReadEventLog(struct torture_context *tctx, static bool test_ReportEventLog(struct torture_context *tctx, struct dcerpc_pipe *p) { - NTSTATUS status; struct eventlog_ReportEventW r; struct eventlog_CloseEventLog cr; struct policy_handle handle; @@ -237,7 +236,9 @@ static bool test_ReportEventLog(struct torture_context *tctx, r.out.record_number = &record_number; r.out.time_written = &time_written; - status = dcerpc_eventlog_ReportEventW(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, + dcerpc_eventlog_ReportEventW(p, tctx, &r), + "ReportEventW failed"); torture_assert_ntstatus_ok(tctx, r.out.result, "ReportEventW failed"); diff --git a/source4/torture/rpc/ntsvcs.c b/source4/torture/rpc/ntsvcs.c index 5453102039..04494b3223 100644 --- a/source4/torture/rpc/ntsvcs.c +++ b/source4/torture/rpc/ntsvcs.c @@ -47,18 +47,26 @@ static bool test_PNP_GetVersion(struct torture_context *tctx, static bool test_PNP_GetDeviceListSize(struct torture_context *tctx, struct dcerpc_pipe *p) { - NTSTATUS status; struct PNP_GetDeviceListSize r; uint32_t size = 0; r.in.devicename = NULL; - r.in.flags = 0; + r.in.flags = CM_GETIDLIST_FILTER_SERVICE; r.out.size = &size; - status = dcerpc_PNP_GetDeviceListSize(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, + dcerpc_PNP_GetDeviceListSize(p, tctx, &r), + "PNP_GetDeviceListSize"); + torture_assert_werr_equal(tctx, r.out.result, WERR_CM_INVALID_POINTER, + "PNP_GetDeviceListSize"); + + r.in.devicename = "Spooler"; - torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceListSize"); - torture_assert_werr_ok(tctx, r.out.result, "PNP_GetDeviceListSize"); + torture_assert_ntstatus_ok(tctx, + dcerpc_PNP_GetDeviceListSize(p, tctx, &r), + "PNP_GetDeviceListSize"); + torture_assert_werr_ok(tctx, r.out.result, + "PNP_GetDeviceListSize"); return true; } @@ -66,7 +74,6 @@ static bool test_PNP_GetDeviceListSize(struct torture_context *tctx, static bool test_PNP_GetDeviceList(struct torture_context *tctx, struct dcerpc_pipe *p) { - NTSTATUS status; struct PNP_GetDeviceList r; uint16_t *buffer = NULL; uint32_t length = 0; @@ -74,25 +81,35 @@ static bool test_PNP_GetDeviceList(struct torture_context *tctx, buffer = talloc_array(tctx, uint16_t, 0); r.in.filter = NULL; - r.in.flags = 0; + r.in.flags = CM_GETIDLIST_FILTER_SERVICE; r.in.length = &length; r.out.length = &length; r.out.buffer = buffer; - status = dcerpc_PNP_GetDeviceList(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceList"); + torture_assert_ntstatus_ok(tctx, + dcerpc_PNP_GetDeviceList(p, tctx, &r), + "PNP_GetDeviceList failed"); + torture_assert_werr_equal(tctx, r.out.result, WERR_CM_INVALID_POINTER, + "PNP_GetDeviceList failed"); + + r.in.filter = "Spooler"; + + torture_assert_ntstatus_ok(tctx, + dcerpc_PNP_GetDeviceList(p, tctx, &r), + "PNP_GetDeviceList failed"); if (W_ERROR_EQUAL(r.out.result, WERR_CM_BUFFER_SMALL)) { struct PNP_GetDeviceListSize s; - s.in.devicename = NULL; - s.in.flags = 0; + s.in.devicename = "Spooler"; + s.in.flags = CM_GETIDLIST_FILTER_SERVICE; s.out.size = &length; - status = dcerpc_PNP_GetDeviceListSize(p, tctx, &s); - - torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceListSize"); - torture_assert_werr_ok(tctx, s.out.result, "PNP_GetDeviceListSize"); + torture_assert_ntstatus_ok(tctx, + dcerpc_PNP_GetDeviceListSize(p, tctx, &s), + "PNP_GetDeviceListSize failed"); + torture_assert_werr_ok(tctx, s.out.result, + "PNP_GetDeviceListSize failed"); } buffer = talloc_array(tctx, uint16_t, length); @@ -101,9 +118,12 @@ static bool test_PNP_GetDeviceList(struct torture_context *tctx, r.out.length = &length; r.out.buffer = buffer; - status = dcerpc_PNP_GetDeviceList(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceList"); - torture_assert_werr_ok(tctx, r.out.result, "PNP_GetDeviceList"); + torture_assert_ntstatus_ok(tctx, + dcerpc_PNP_GetDeviceList(p, tctx, &r), + "PNP_GetDeviceList failed"); + + torture_assert_werr_ok(tctx, r.out.result, + "PNP_GetDeviceList failed"); return true; } diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c index c50cbfbaee..42b6929557 100644 --- a/source4/torture/rpc/spoolss_win.c +++ b/source4/torture/rpc/spoolss_win.c @@ -34,6 +34,8 @@ struct test_spoolss_win_context { /* EnumPrinterKeys */ const char **printer_keys; + + bool printer_has_driver; }; /* This is a convenience function for all OpenPrinterEx calls */ @@ -256,6 +258,12 @@ static bool test_GetPrinter(struct torture_context *tctx, torture_assert_werr_ok(tctx, gp.out.result, "GetPrinter failed"); ctx->current_info = gp.out.info; + + if (level == 2 && gp.out.info) { + ctx->printer_has_driver = gp.out.info->info2.drivername && + strlen(gp.out.info->info2.drivername); + } + return true; } @@ -289,6 +297,7 @@ static bool test_EnumJobs(struct torture_context *tctx, static bool test_GetPrinterDriver2(struct torture_context *tctx, struct dcerpc_pipe *p, + struct test_spoolss_win_context *ctx, struct policy_handle *handle) { NTSTATUS status; @@ -313,8 +322,11 @@ static bool test_GetPrinterDriver2(struct torture_context *tctx, status = dcerpc_spoolss_GetPrinterDriver2(p, tctx, &gpd2); torture_assert_ntstatus_ok(tctx, status, "GetPrinterDriver2 failed"); - torture_assert_werr_ok(tctx, gpd2.out.result, - "GetPrinterDriver2 failed."); + + if (ctx->printer_has_driver) { + torture_assert_werr_ok(tctx, gpd2.out.result, + "GetPrinterDriver2 failed."); + } return true; } @@ -527,7 +539,7 @@ static bool test_WinXP(struct torture_context *tctx, struct dcerpc_pipe *p) ret &= test_ClosePrinter(tctx, p, &handle04); ret &= test_EnumPrinters(tctx, p, ctx, 1556); - ret &= test_GetPrinterDriver2(tctx, p, &handle03); + ret &= test_GetPrinterDriver2(tctx, p, ctx, &handle03); ret &= test_EnumForms(tctx, p, &handle03, 0); ret &= test_EnumPrinterKey(tctx, p, &handle03, "", ctx); diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c index a4b9e6bed1..e38e8daba1 100644 --- a/source4/torture/rpc/svcctl.c +++ b/source4/torture/rpc/svcctl.c @@ -3,7 +3,7 @@ test suite for srvsvc rpc operations Copyright (C) Jelmer Vernooij 2004 - Copyright (C) Guenther Deschner 2008 + Copyright (C) Guenther Deschner 2008,2009 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 @@ -74,6 +74,36 @@ static bool test_OpenService(struct dcerpc_pipe *p, struct torture_context *tctx } +static bool test_QueryServiceStatus(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + struct svcctl_QueryServiceStatus r; + struct policy_handle h, s; + struct SERVICE_STATUS service_status; + NTSTATUS status; + + if (!test_OpenSCManager(p, tctx, &h)) + return false; + + if (!test_OpenService(p, tctx, &h, "Netlogon", &s)) + return false; + + r.in.handle = &s; + r.out.service_status = &service_status; + + status = dcerpc_svcctl_QueryServiceStatus(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "QueryServiceStatus failed!"); + torture_assert_werr_ok(tctx, r.out.result, "QueryServiceStatus failed!"); + + if (!test_CloseServiceHandle(p, tctx, &s)) + return false; + + if (!test_CloseServiceHandle(p, tctx, &h)) + return false; + + return true; +} + static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerpc_pipe *p) { struct svcctl_QueryServiceStatusEx r; @@ -82,8 +112,8 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp uint32_t info_level = SVC_STATUS_PROCESS_INFO; uint8_t *buffer; - uint32_t buf_size = 0; - uint32_t bytes_needed = 0; + uint32_t offered = 0; + uint32_t needed = 0; if (!test_OpenSCManager(p, tctx, &h)) return false; @@ -95,16 +125,16 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp r.in.handle = &s; r.in.info_level = info_level; - r.in.buf_size = buf_size; + r.in.offered = offered; r.out.buffer = buffer; - r.out.bytes_needed = &bytes_needed; + r.out.needed = &needed; status = dcerpc_svcctl_QueryServiceStatusEx(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "QueryServiceStatusEx failed!"); if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { - r.in.buf_size = bytes_needed; - buffer = talloc_array(tctx, uint8_t, bytes_needed); + r.in.offered = needed; + buffer = talloc_array(tctx, uint8_t, needed); r.out.buffer = buffer; status = dcerpc_svcctl_QueryServiceStatusEx(p, tctx, &r); @@ -121,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; @@ -129,8 +201,8 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp uint32_t info_level = SERVICE_CONFIG_DESCRIPTION; uint8_t *buffer; - uint32_t buf_size = 0; - uint32_t bytes_needed = 0; + uint32_t offered = 0; + uint32_t needed = 0; if (!test_OpenSCManager(p, tctx, &h)) return false; @@ -142,16 +214,16 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp r.in.handle = &s; r.in.info_level = info_level; - r.in.buf_size = buf_size; + r.in.offered = offered; r.out.buffer = buffer; - r.out.bytes_needed = &bytes_needed; + r.out.needed = &needed; status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!"); if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { - r.in.buf_size = bytes_needed; - buffer = talloc_array(tctx, uint8_t, bytes_needed); + r.in.offered = needed; + buffer = talloc_array(tctx, uint8_t, needed); r.out.buffer = buffer; status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r); @@ -160,16 +232,16 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp } r.in.info_level = SERVICE_CONFIG_FAILURE_ACTIONS; - r.in.buf_size = buf_size; + r.in.offered = offered; r.out.buffer = buffer; - r.out.bytes_needed = &bytes_needed; + r.out.needed = &needed; status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!"); if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { - r.in.buf_size = bytes_needed; - buffer = talloc_array(tctx, uint8_t, bytes_needed); + r.in.offered = needed; + buffer = talloc_array(tctx, uint8_t, needed); r.out.buffer = buffer; status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r); @@ -186,6 +258,59 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp return true; } +static bool test_QueryServiceObjectSecurity(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + struct svcctl_QueryServiceObjectSecurity r; + struct policy_handle h, s; + + uint8_t *buffer; + uint32_t needed; + + if (!test_OpenSCManager(p, tctx, &h)) + return false; + + if (!test_OpenService(p, tctx, &h, "Netlogon", &s)) + return false; + + r.in.handle = &s; + r.in.security_flags = 0; + r.in.offered = 0; + r.out.buffer = NULL; + r.out.needed = &needed; + + torture_assert_ntstatus_ok(tctx, + dcerpc_svcctl_QueryServiceObjectSecurity(p, tctx, &r), + "QueryServiceObjectSecurity failed!"); + torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM, + "QueryServiceObjectSecurity failed!"); + + r.in.security_flags = SECINFO_DACL; + + torture_assert_ntstatus_ok(tctx, + dcerpc_svcctl_QueryServiceObjectSecurity(p, tctx, &r), + "QueryServiceObjectSecurity failed!"); + + if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { + r.in.offered = needed; + buffer = talloc_array(tctx, uint8_t, needed); + r.out.buffer = buffer; + torture_assert_ntstatus_ok(tctx, + dcerpc_svcctl_QueryServiceObjectSecurity(p, tctx, &r), + "QueryServiceObjectSecurity failed!"); + } + + torture_assert_werr_ok(tctx, r.out.result, "QueryServiceObjectSecurity failed!"); + + if (!test_CloseServiceHandle(p, tctx, &s)) + return false; + + if (!test_CloseServiceHandle(p, tctx, &h)) + return false; + + return true; +} + static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_pipe *p) { struct svcctl_EnumServicesStatusW r; @@ -194,7 +319,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_ NTSTATUS status; uint32_t resume_handle = 0; struct ENUM_SERVICE_STATUSW *service = NULL; - uint32_t bytes_needed = 0; + uint32_t needed = 0; uint32_t services_returned = 0; if (!test_OpenSCManager(p, tctx, &h)) @@ -203,20 +328,20 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_ r.in.handle = &h; r.in.type = SERVICE_TYPE_WIN32; r.in.state = SERVICE_STATE_ALL; - r.in.buf_size = 0; + r.in.offered = 0; r.in.resume_handle = &resume_handle; r.out.service = NULL; r.out.resume_handle = &resume_handle; r.out.services_returned = &services_returned; - r.out.bytes_needed = &bytes_needed; + r.out.needed = &needed; status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!"); if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { - r.in.buf_size = bytes_needed; - r.out.service = talloc_array(tctx, uint8_t, bytes_needed); + r.in.offered = needed; + r.out.service = talloc_array(tctx, uint8_t, needed); status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r); @@ -230,7 +355,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_ DATA_BLOB blob; struct ndr_pull *ndr; - blob.length = r.in.buf_size; + blob.length = r.in.offered; blob.data = talloc_steal(tctx, r.out.service); ndr = ndr_pull_init_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx)); @@ -260,6 +385,69 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_ return true; } +static bool test_EnumDependentServicesW(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + struct svcctl_EnumDependentServicesW r; + struct policy_handle h, s; + uint32_t needed; + uint32_t services_returned; + uint32_t i; + uint32_t states[] = { SERVICE_STATE_ACTIVE, + SERVICE_STATE_INACTIVE, + SERVICE_STATE_ALL }; + + if (!test_OpenSCManager(p, tctx, &h)) + return false; + + if (!test_OpenService(p, tctx, &h, "Netlogon", &s)) + return false; + + r.in.service = &s; + r.in.offered = 0; + r.in.state = 0; + r.out.service_status = NULL; + r.out.services_returned = &services_returned; + r.out.needed = &needed; + + torture_assert_ntstatus_ok(tctx, + dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r), + "EnumDependentServicesW failed!"); + + torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM, + "EnumDependentServicesW failed!"); + + for (i=0; i<ARRAY_SIZE(states); i++) { + + r.in.state = states[i]; + + torture_assert_ntstatus_ok(tctx, + dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r), + "EnumDependentServicesW failed!"); + + if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { + r.in.offered = needed; + r.out.service_status = talloc_array(tctx, uint8_t, needed); + + torture_assert_ntstatus_ok(tctx, + dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r), + "EnumDependentServicesW failed!"); + + } + + torture_assert_werr_ok(tctx, r.out.result, + "EnumDependentServicesW failed"); + } + + if (!test_CloseServiceHandle(p, tctx, &s)) + return false; + + if (!test_CloseServiceHandle(p, tctx, &h)) + return false; + + return true; +} + static bool test_SCManager(struct torture_context *tctx, struct dcerpc_pipe *p) { @@ -285,10 +473,18 @@ struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx) test_SCManager); torture_rpc_tcase_add_test(tcase, "EnumServicesStatus", test_EnumServicesStatus); + torture_rpc_tcase_add_test(tcase, "EnumDependentServicesW", + test_EnumDependentServicesW); + torture_rpc_tcase_add_test(tcase, "QueryServiceStatus", + 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); + torture_rpc_tcase_add_test(tcase, "QueryServiceObjectSecurity", + test_QueryServiceObjectSecurity); return suite; } diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c index 5f0293c681..844309efd4 100644 --- a/source4/torture/smb2/lock.c +++ b/source4/torture/smb2/lock.c @@ -101,7 +101,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE|SMB2_LOCK_FLAG_FAIL_IMMEDIATELY; status = smb2_lock(tree, &lck); if (TARGET_IS_WIN7(torture)) { - CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE); + CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE); } else { CHECK_STATUS(status, NT_STATUS_OK); } @@ -110,7 +110,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree lck.in.reserved = 0x123ab2; status = smb2_lock(tree, &lck); if (TARGET_IS_WIN7(torture)) { - CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE); + CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE); } else { CHECK_STATUS(status, NT_STATUS_OK); } @@ -118,7 +118,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree lck.in.reserved = 0x123ab3; status = smb2_lock(tree, &lck); if (TARGET_IS_WIN7(torture)) { - CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE); + CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE); } else if (TARGET_IS_WINDOWS(torture)) { CHECK_STATUS(status, NT_STATUS_OK); } else { @@ -129,7 +129,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree lck.in.reserved = 0x123ab4; status = smb2_lock(tree, &lck); if (TARGET_IS_WIN7(torture)) { - CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE); + CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE); } else { CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED); } @@ -137,7 +137,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree lck.in.reserved = 0x123ab5; status = smb2_lock(tree, &lck); if (TARGET_IS_WIN7(torture)) { - CHECK_STATUS(status, NT_STATUS_WIN7_INVALID_RANGE); + CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE); } else if (TARGET_IS_WINDOWS(torture)) { CHECK_STATUS(status, NT_STATUS_OK); } else { |