mirror of
https://github.com/samba-team/samba.git
synced 2025-02-09 09:57:48 +03:00
s4-smbtorture: fix test_GetPrinter.
Guenther
This commit is contained in:
parent
8153916f4a
commit
b970eb791c
@ -2668,6 +2668,7 @@ static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe,
|
||||
struct spoolss_GetPrinter r;
|
||||
DATA_BLOB blob;
|
||||
NTSTATUS status;
|
||||
uint32_t needed;
|
||||
|
||||
mem_ctx = talloc_new(ctx);
|
||||
if (mem_ctx == NULL) {
|
||||
@ -2678,6 +2679,7 @@ static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe,
|
||||
r.in.level = level;
|
||||
r.in.buffer = NULL;
|
||||
r.in.offered = 0;
|
||||
r.out.needed = &needed;
|
||||
|
||||
status = dcerpc_spoolss_GetPrinter(pipe, mem_ctx, &r);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
@ -2697,14 +2699,14 @@ static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe,
|
||||
|
||||
r.in.handle = handle;
|
||||
r.in.level = level;
|
||||
blob = data_blob_talloc(mem_ctx, NULL, r.out.needed);
|
||||
blob = data_blob_talloc(mem_ctx, NULL, needed);
|
||||
if (blob.data == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
memset(blob.data, 0, blob.length);
|
||||
r.in.buffer = &blob;
|
||||
r.in.offered = r.out.needed;
|
||||
r.in.offered = needed;
|
||||
|
||||
status = dcerpc_spoolss_GetPrinter(pipe, mem_ctx, &r);
|
||||
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
|
||||
|
@ -220,6 +220,7 @@ static bool test_GetPrinter(struct torture_context *tctx,
|
||||
NTSTATUS status;
|
||||
struct spoolss_GetPrinter gp;
|
||||
DATA_BLOB blob = data_blob_talloc_zero(ctx, initial_blob_size);
|
||||
uint32_t needed;
|
||||
|
||||
torture_comment(tctx, "Test GetPrinter level %d\n", level);
|
||||
|
||||
@ -227,14 +228,15 @@ static bool test_GetPrinter(struct torture_context *tctx,
|
||||
gp.in.level = level;
|
||||
gp.in.buffer = (initial_blob_size == 0)?NULL:&blob;
|
||||
gp.in.offered = initial_blob_size;
|
||||
gp.out.needed = &needed;
|
||||
|
||||
status = dcerpc_spoolss_GetPrinter(p, tctx, &gp);
|
||||
torture_assert_ntstatus_ok(tctx, status, "GetPrinter failed");
|
||||
|
||||
if (W_ERROR_EQUAL(gp.out.result, WERR_INSUFFICIENT_BUFFER)) {
|
||||
blob = data_blob_talloc_zero(ctx, gp.out.needed);
|
||||
blob = data_blob_talloc_zero(ctx, needed);
|
||||
gp.in.buffer = &blob;
|
||||
gp.in.offered = gp.out.needed;
|
||||
gp.in.offered = needed;
|
||||
status = dcerpc_spoolss_GetPrinter(p, tctx, &gp);
|
||||
torture_assert_ntstatus_ok(tctx, status, "GetPrinter failed");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user