diff options
author | Günther Deschner <gd@samba.org> | 2010-11-10 10:19:01 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-11-10 15:23:21 +0100 |
commit | fa0b44ed9c31baf19c70aa47a25233c947c0ae05 (patch) | |
tree | c722582c9a42332c54a99730314d70f25c80046f /source4/torture/rpc | |
parent | fa203f4541190b01b1f82f1ff9a47c31152c2412 (diff) | |
download | samba-fa0b44ed9c31baf19c70aa47a25233c947c0ae05.tar.gz samba-fa0b44ed9c31baf19c70aa47a25233c947c0ae05.tar.bz2 samba-fa0b44ed9c31baf19c70aa47a25233c947c0ae05.zip |
s4-smbtorture: allow to test returned type after specific error code in PrinterData tests.
Guenther
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/spoolss.c | 63 |
1 files changed, 48 insertions, 15 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 8154cd2ba2..8b219777f3 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -3474,13 +3474,14 @@ static bool test_ResumePrinter(struct torture_context *tctx, return true; } -static bool test_GetPrinterData(struct torture_context *tctx, - struct dcerpc_binding_handle *b, - struct policy_handle *handle, - const char *value_name, - enum winreg_Type *type_p, - uint8_t **data_p, - uint32_t *needed_p) +static bool test_GetPrinterData_checktype(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + struct policy_handle *handle, + const char *value_name, + enum winreg_Type *expected_type, + enum winreg_Type *type_p, + uint8_t **data_p, + uint32_t *needed_p) { NTSTATUS status; struct spoolss_GetPrinterData r; @@ -3501,6 +3502,9 @@ static bool test_GetPrinterData(struct torture_context *tctx, torture_assert_ntstatus_ok(tctx, status, "GetPrinterData failed"); if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { + if (expected_type) { + torture_assert_int_equal(tctx, type, *expected_type, "unexpected type"); + } r.in.offered = needed; r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered); status = dcerpc_spoolss_GetPrinterData_r(b, tctx, &r); @@ -3527,14 +3531,27 @@ static bool test_GetPrinterData(struct torture_context *tctx, return true; } -static bool test_GetPrinterDataEx(struct torture_context *tctx, - struct dcerpc_pipe *p, - struct policy_handle *handle, - const char *key_name, - const char *value_name, - enum winreg_Type *type_p, - uint8_t **data_p, - uint32_t *needed_p) +static bool test_GetPrinterData(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + struct policy_handle *handle, + const char *value_name, + enum winreg_Type *type_p, + uint8_t **data_p, + uint32_t *needed_p) +{ + return test_GetPrinterData_checktype(tctx, b, handle, value_name, + NULL, type_p, data_p, needed_p); +} + +static bool test_GetPrinterDataEx_checktype(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct policy_handle *handle, + const char *key_name, + const char *value_name, + enum winreg_Type *expected_type, + enum winreg_Type *type_p, + uint8_t **data_p, + uint32_t *needed_p) { NTSTATUS status; struct spoolss_GetPrinterDataEx r; @@ -3563,6 +3580,9 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx, } if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) { + if (expected_type) { + torture_assert_int_equal(tctx, type, *expected_type, "unexpected type"); + } r.in.offered = needed; r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered); status = dcerpc_spoolss_GetPrinterDataEx_r(b, tctx, &r); @@ -3589,6 +3609,19 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx, return true; } +static bool test_GetPrinterDataEx(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct policy_handle *handle, + const char *key_name, + const char *value_name, + enum winreg_Type *type_p, + uint8_t **data_p, + uint32_t *needed_p) +{ + return test_GetPrinterDataEx_checktype(tctx, p, handle, key_name, value_name, + NULL, type_p, data_p, needed_p); +} + static bool test_get_environment(struct torture_context *tctx, struct dcerpc_binding_handle *b, struct policy_handle *handle, |