summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-03-01 16:39:35 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-03-01 16:39:35 +0100
commit09ac816b36e45fd537af2f7fe7c57a11f5c744f5 (patch)
tree4d5d44c27a2395a39efc62359f6e4b6976f2ba2e /source4/torture/rpc
parent235244f4cc707130dd130afce88bde49606bd501 (diff)
parent54bc27e9374742d37b1ed9012d1cfe8f5ace6d40 (diff)
downloadsamba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.tar.gz
samba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.tar.bz2
samba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.zip
Merge branch 'master' of git://git.samba.org/samba into teventfix
Conflicts: lib/tevent/pytevent.c
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/eventlog.c8
-rw-r--r--source4/torture/rpc/spoolss.c167
2 files changed, 139 insertions, 36 deletions
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index 2fd9d923f1..10c4886259 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -306,7 +306,7 @@ static bool test_GetLogInformation(struct torture_context *tctx,
struct dcerpc_pipe *p)
{
NTSTATUS status;
- struct eventlog_GetLogIntormation r;
+ struct eventlog_GetLogInformation r;
struct eventlog_CloseEventLog cr;
struct policy_handle handle;
uint32_t bytes_needed = 0;
@@ -320,14 +320,14 @@ static bool test_GetLogInformation(struct torture_context *tctx,
r.out.buffer = NULL;
r.out.bytes_needed = &bytes_needed;
- status = dcerpc_eventlog_GetLogIntormation(p, tctx, &r);
+ status = dcerpc_eventlog_GetLogInformation(p, tctx, &r);
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_INVALID_LEVEL,
"GetLogInformation failed");
r.in.level = 0;
- status = dcerpc_eventlog_GetLogIntormation(p, tctx, &r);
+ status = dcerpc_eventlog_GetLogInformation(p, tctx, &r);
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_BUFFER_TOO_SMALL,
"GetLogInformation failed");
@@ -335,7 +335,7 @@ static bool test_GetLogInformation(struct torture_context *tctx,
r.in.buf_size = bytes_needed;
r.out.buffer = talloc_array(tctx, uint8_t, bytes_needed);
- status = dcerpc_eventlog_GetLogIntormation(p, tctx, &r);
+ status = dcerpc_eventlog_GetLogInformation(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "GetLogInformation failed");
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index de600e8fb3..9d8bc4b186 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -168,6 +168,69 @@ static bool test_EnumPorts(struct torture_context *tctx,
return true;
}
+static bool test_GetPrintProcessorDirectory(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct test_spoolss_context *ctx)
+{
+ NTSTATUS status;
+ struct spoolss_GetPrintProcessorDirectory r;
+ struct {
+ uint16_t level;
+ const char *server;
+ } levels[] = {{
+ .level = 1,
+ .server = NULL
+ },{
+ .level = 1,
+ .server = ""
+ },{
+ .level = 78,
+ .server = ""
+ },{
+ .level = 1,
+ .server = talloc_asprintf(ctx, "\\\\%s", dcerpc_server_name(p))
+ },{
+ .level = 1024,
+ .server = talloc_asprintf(ctx, "\\\\%s", dcerpc_server_name(p))
+ }
+ };
+ int i;
+ uint32_t needed;
+
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ int level = levels[i].level;
+ DATA_BLOB blob;
+
+ r.in.server = levels[i].server;
+ r.in.environment = SPOOLSS_ARCHITECTURE_NT_X86;
+ r.in.level = level;
+ r.in.buffer = NULL;
+ r.in.offered = 0;
+ r.out.needed = &needed;
+
+ torture_comment(tctx, "Testing GetPrintProcessorDirectory level %u\n", r.in.level);
+
+ status = dcerpc_spoolss_GetPrintProcessorDirectory(p, ctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "dcerpc_spoolss_GetPrintProcessorDirectory failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_INSUFFICIENT_BUFFER,
+ "GetPrintProcessorDirectory unexpected return code");
+
+ blob = data_blob_talloc(ctx, NULL, needed);
+ data_blob_clear(&blob);
+ r.in.buffer = &blob;
+ r.in.offered = needed;
+
+ status = dcerpc_spoolss_GetPrintProcessorDirectory(p, ctx, &r);
+ torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_GetPrintProcessorDirectory failed");
+
+ torture_assert_werr_ok(tctx, r.out.result, "GetPrintProcessorDirectory failed");
+ }
+
+ return true;
+}
+
+
static bool test_GetPrinterDriverDirectory(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct test_spoolss_context *ctx)
@@ -679,7 +742,8 @@ static bool test_ClosePrinter(struct torture_context *tctx,
static bool test_GetForm(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *handle,
- const char *form_name)
+ const char *form_name,
+ uint32_t level)
{
NTSTATUS status;
struct spoolss_GetForm r;
@@ -687,12 +751,12 @@ static bool test_GetForm(struct torture_context *tctx,
r.in.handle = handle;
r.in.form_name = form_name;
- r.in.level = 1;
+ r.in.level = level;
r.in.buffer = NULL;
r.in.offered = 0;
r.out.needed = &needed;
- torture_comment(tctx, "Testing GetForm\n");
+ torture_comment(tctx, "Testing GetForm level %d\n", r.in.level);
status = dcerpc_spoolss_GetForm(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "GetForm failed");
@@ -724,45 +788,54 @@ static bool test_EnumForms(struct torture_context *tctx,
bool ret = true;
uint32_t needed;
uint32_t count;
+ uint32_t levels[] = { 1, 2 };
+ int i;
- r.in.handle = handle;
- r.in.level = 1;
- r.in.buffer = NULL;
- r.in.offered = 0;
- r.out.needed = &needed;
- r.out.count = &count;
+ for (i=0; i<ARRAY_SIZE(levels); i++) {
+
+ r.in.handle = handle;
+ r.in.level = levels[i];
+ r.in.buffer = NULL;
+ r.in.offered = 0;
+ r.out.needed = &needed;
+ r.out.count = &count;
- torture_comment(tctx, "Testing EnumForms\n");
+ torture_comment(tctx, "Testing EnumForms level %d\n", levels[i]);
- status = dcerpc_spoolss_EnumForms(p, tctx, &r);
- torture_assert_ntstatus_ok(tctx, status, "EnumForms failed");
+ status = dcerpc_spoolss_EnumForms(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status, "EnumForms failed");
- if (print_server && W_ERROR_EQUAL(r.out.result, WERR_BADFID))
- torture_fail(tctx, "EnumForms on the PrintServer isn't supported by test server (NT4)");
+ if ((r.in.level == 2) && (W_ERROR_EQUAL(r.out.result, WERR_UNKNOWN_LEVEL))) {
+ break;
+ }
- if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
- union spoolss_FormInfo *info;
- int j;
- DATA_BLOB blob = data_blob_talloc(tctx, NULL, needed);
- data_blob_clear(&blob);
- r.in.buffer = &blob;
- r.in.offered = needed;
+ if (print_server && W_ERROR_EQUAL(r.out.result, WERR_BADFID))
+ torture_fail(tctx, "EnumForms on the PrintServer isn't supported by test server (NT4)");
- status = dcerpc_spoolss_EnumForms(p, tctx, &r);
+ if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+ union spoolss_FormInfo *info;
+ int j;
+ DATA_BLOB blob = data_blob_talloc(tctx, NULL, needed);
+ data_blob_clear(&blob);
+ r.in.buffer = &blob;
+ r.in.offered = needed;
- torture_assert(tctx, r.out.info, "No forms returned");
+ status = dcerpc_spoolss_EnumForms(p, tctx, &r);
- info = r.out.info;
+ torture_assert(tctx, r.out.info, "No forms returned");
- for (j = 0; j < count; j++) {
- if (!print_server)
- ret &= test_GetForm(tctx, p, handle, info[j].info1.form_name);
+ info = r.out.info;
+
+ for (j = 0; j < count; j++) {
+ if (!print_server)
+ ret &= test_GetForm(tctx, p, handle, info[j].info1.form_name, levels[i]);
+ }
}
- }
- torture_assert_ntstatus_ok(tctx, status, "EnumForms failed");
+ torture_assert_ntstatus_ok(tctx, status, "EnumForms failed");
- torture_assert_werr_ok(tctx, r.out.result, "EnumForms failed");
+ torture_assert_werr_ok(tctx, r.out.result, "EnumForms failed");
+ }
return true;
}
@@ -815,7 +888,7 @@ static bool test_AddForm(struct torture_context *tctx,
torture_assert_werr_ok(tctx, r.out.result, "AddForm failed");
- if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name);
+ if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name, 1);
{
struct spoolss_SetForm sf;
@@ -839,7 +912,7 @@ static bool test_AddForm(struct torture_context *tctx,
torture_assert_werr_ok(tctx, r.out.result, "SetForm failed");
}
- if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name);
+ if (!print_server) ret &= test_GetForm(tctx, p, handle, form_name, 1);
if (!test_DeleteForm(tctx, p, handle, form_name)) {
ret = false;
@@ -972,6 +1045,33 @@ static bool test_SetJob(struct torture_context *tctx,
return true;
}
+static bool test_AddJob(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct spoolss_AddJob r;
+ uint32_t needed;
+
+ r.in.level = 0;
+ r.in.handle = handle;
+ r.in.offered = 0;
+ r.out.needed = &needed;
+
+ torture_comment(tctx, "Testing AddJob\n");
+
+ status = dcerpc_spoolss_AddJob(p, tctx, &r);
+ torture_assert_werr_equal(tctx, r.out.result, WERR_UNKNOWN_LEVEL, "AddJob failed");
+
+ r.in.level = 1;
+
+ status = dcerpc_spoolss_AddJob(p, tctx, &r);
+ torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM, "AddJob failed");
+
+ return true;
+}
+
+
static bool test_EnumJobs(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *handle)
@@ -1011,6 +1111,7 @@ static bool test_EnumJobs(struct torture_context *tctx,
info = r.out.info;
for (j = 0; j < count; j++) {
+
test_GetJob(tctx, p, handle, info[j].info1.job_id);
test_SetJob(tctx, p, handle, info[j].info1.job_id, SPOOLSS_JOB_CONTROL_PAUSE);
test_SetJob(tctx, p, handle, info[j].info1.job_id, SPOOLSS_JOB_CONTROL_RESUME);
@@ -1090,6 +1191,7 @@ static bool test_DoPrintTest(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_EndDocPrinter failed");
torture_assert_werr_ok(tctx, e.out.result, "EndDocPrinter failed");
+ ret &= test_AddJob(tctx, p, handle);
ret &= test_EnumJobs(tctx, p, handle);
ret &= test_SetJob(tctx, p, handle, job_id, SPOOLSS_JOB_CONTROL_DELETE);
@@ -1831,6 +1933,7 @@ bool torture_rpc_spoolss(struct torture_context *torture)
ret &= test_AddForm(torture, p, &ctx->server_handle, true);
ret &= test_EnumPorts(torture, p, ctx);
ret &= test_GetPrinterDriverDirectory(torture, p, ctx);
+ ret &= test_GetPrintProcessorDirectory(torture, p, ctx);
ret &= test_EnumPrinterDrivers(torture, p, ctx);
ret &= test_EnumMonitors(torture, p, ctx);
ret &= test_EnumPrintProcessors(torture, p, ctx);