diff options
author | Günther Deschner <gd@samba.org> | 2014-03-20 15:56:13 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-03-20 16:28:26 +0100 |
commit | b905523c3289ada6f03bf086f38a041c4cad265b (patch) | |
tree | db4e894f8ade32460097d555de845a346525a557 /source4 | |
parent | cf0934caf282f4ade8c8a701b0e40b68a2f17ace (diff) | |
download | samba-b905523c3289ada6f03bf086f38a041c4cad265b.tar.gz samba-b905523c3289ada6f03bf086f38a041c4cad265b.tar.xz samba-b905523c3289ada6f03bf086f38a041c4cad265b.zip |
s4-torture: add test_EnumPrinterDrivers_buffers function.
This will allow to test the enumdriver call with pre-allocated buffer.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/rpc/spoolss.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 3d99470172..44405aa325 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -513,30 +513,36 @@ static bool test_GetPrinterDriverDirectory(struct torture_context *tctx, return true; } -static bool test_EnumPrinterDrivers_args(struct torture_context *tctx, - struct dcerpc_binding_handle *b, - const char *server_name, - const char *environment, - uint32_t level, - uint32_t *count_p, - union spoolss_DriverInfo **info_p) +static bool test_EnumPrinterDrivers_buffers(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + const char *server_name, + const char *environment, + uint32_t level, + uint32_t offered, + uint32_t *count_p, + union spoolss_DriverInfo **info_p) { struct spoolss_EnumPrinterDrivers r; uint32_t needed; uint32_t count; union spoolss_DriverInfo *info; + DATA_BLOB buffer; + + if (offered > 0) { + buffer = data_blob_talloc_zero(tctx, offered); + } r.in.server = server_name; r.in.environment = environment; r.in.level = level; - r.in.buffer = NULL; - r.in.offered = 0; + r.in.buffer = offered ? &buffer : NULL; + r.in.offered = offered; r.out.needed = &needed; r.out.count = &count; r.out.info = &info; - torture_comment(tctx, "Testing EnumPrinterDrivers(%s) level %u\n", - r.in.environment, r.in.level); + torture_comment(tctx, "Testing EnumPrinterDrivers(%s) level %u, offered: %u\n", + r.in.environment, r.in.level, r.in.offered); torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_EnumPrinterDrivers_r(b, tctx, &r), @@ -567,6 +573,20 @@ static bool test_EnumPrinterDrivers_args(struct torture_context *tctx, } + +static bool test_EnumPrinterDrivers_args(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + const char *server_name, + const char *environment, + uint32_t level, + uint32_t *count_p, + union spoolss_DriverInfo **info_p) +{ + return test_EnumPrinterDrivers_buffers(tctx, b, server_name, + environment, level, 0, + count_p, info_p); +} + static bool test_EnumPrinterDrivers_findone(struct torture_context *tctx, struct dcerpc_binding_handle *b, const char *server_name, |