summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/spoolss.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-07-03 22:01:01 +0200
committerGünther Deschner <gd@samba.org>2009-07-16 03:05:44 +0200
commitc3f461c35f9ca1b6a0e01efe53fbf439faaddad9 (patch)
treecffcf0fe0b889f110aefba47c48aa11be5c48669 /source4/torture/rpc/spoolss.c
parente16a2a1fa941511a8eeefd05b397dd934a77c9f6 (diff)
downloadsamba-c3f461c35f9ca1b6a0e01efe53fbf439faaddad9.tar.gz
samba-c3f461c35f9ca1b6a0e01efe53fbf439faaddad9.tar.bz2
samba-c3f461c35f9ca1b6a0e01efe53fbf439faaddad9.zip
s4-smbtorture: some work on getprinterdriver and getprinterdriver2 tests.
Guenther
Diffstat (limited to 'source4/torture/rpc/spoolss.c')
-rw-r--r--source4/torture/rpc/spoolss.c69
1 files changed, 46 insertions, 23 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index a515ef6baa..ddc14f33a2 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -2537,12 +2537,45 @@ static bool test_EnumPrinters_old(struct torture_context *tctx, struct dcerpc_pi
return ret;
}
-#if 0
-static bool test_GetPrinterDriver2(struct dcerpc_pipe *p,
+static bool test_GetPrinterDriver(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *handle,
+ const char *driver_name)
+{
+ struct spoolss_GetPrinterDriver r;
+ uint32_t needed;
+
+ r.in.handle = handle;
+ r.in.architecture = "W32X86";
+ r.in.level = 1;
+ r.in.buffer = NULL;
+ r.in.offered = 0;
+ r.out.needed = &needed;
+
+ torture_comment(tctx, "Testing GetPrinterDriver level %d\n", r.in.level);
+
+ torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_GetPrinterDriver(p, tctx, &r),
+ "failed to call GetPrinterDriver");
+ if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+ DATA_BLOB blob = data_blob_talloc(tctx, NULL, needed);
+ data_blob_clear(&blob);
+ r.in.buffer = &blob;
+ r.in.offered = needed;
+ torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_GetPrinterDriver(p, tctx, &r),
+ "failed to call GetPrinterDriver");
+ }
+
+ torture_assert_werr_ok(tctx, r.out.result,
+ "failed to call GetPrinterDriver");
+
+ return true;
+}
+
+static bool test_GetPrinterDriver2(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
struct policy_handle *handle,
const char *driver_name)
{
- NTSTATUS status;
struct spoolss_GetPrinterDriver2 r;
uint32_t needed;
uint32_t server_major_version;
@@ -2559,34 +2592,24 @@ static bool test_GetPrinterDriver2(struct dcerpc_pipe *p,
r.out.server_major_version = &server_major_version;
r.out.server_minor_version = &server_minor_version;
- printf("Testing GetPrinterDriver2\n");
-
- status = dcerpc_spoolss_GetPrinterDriver2(p, tctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("GetPrinterDriver2 failed - %s\n", nt_errstr(status));
- return false;
- }
+ torture_comment(tctx, "Testing GetPrinterDriver2 level %d\n", r.in.level);
+ torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_GetPrinterDriver2(p, tctx, &r),
+ "failed to call GetPrinterDriver2");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+ DATA_BLOB blob = data_blob_talloc(tctx, NULL, needed);
+ data_blob_clear(&blob);
+ r.in.buffer = &blob;
r.in.offered = needed;
- status = dcerpc_spoolss_GetPrinterDriver2(p, tctx, &r);
- }
-
- if (!NT_STATUS_IS_OK(status)) {
- printf("GetPrinterDriver2 failed - %s\n",
- nt_errstr(status));
- return false;
+ torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_GetPrinterDriver2(p, tctx, &r),
+ "failed to call GetPrinterDriver2");
}
- if (!W_ERROR_IS_OK(r.out.result)) {
- printf("GetPrinterDriver2 failed - %s\n",
- win_errstr(r.out.result));
- return false;
- }
+ torture_assert_werr_ok(tctx, r.out.result,
+ "failed to call GetPrinterDriver2");
return true;
}
-#endif
static bool test_EnumPrinterDrivers_old(struct torture_context *tctx,
struct dcerpc_pipe *p)