diff options
author | Günther Deschner <gd@samba.org> | 2016-11-11 19:17:55 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-11-11 22:57:22 +0100 |
commit | 574dd65a8185c90828e49b295d89153bae1563bf (patch) | |
tree | 25bd0045a68978c56126ad5cb658545984995802 /source4/torture/ndr | |
parent | 73f664710a8c9b312a54d0cf41d2f4440c8b42eb (diff) | |
download | samba-574dd65a8185c90828e49b295d89153bae1563bf.tar.gz |
s4-torture: add spoolss_SetPrinter ndr test to validate secdesc_ptr
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11197
Guenther
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/torture/ndr')
-rw-r--r-- | source4/torture/ndr/spoolss.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/source4/torture/ndr/spoolss.c b/source4/torture/ndr/spoolss.c index c8c466d2afd..72a4f5b9844 100644 --- a/source4/torture/ndr/spoolss.c +++ b/source4/torture/ndr/spoolss.c @@ -1769,6 +1769,61 @@ static bool setjobnamedproperty_req_check(struct torture_context *tctx, return true; } +static const uint8_t setprinter_level_3_xpsp3_req_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2b, 0x55, 0x94, 0xbe, 0x50, 0x28, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0xd1, 0xe9, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x02, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, + 0x00, 0x09, 0x18, 0x00, 0x30, 0x00, 0x0f, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x00, 0x08, 0x00, 0x02, 0x00, 0x01, 0x05, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0xa4, 0xc0, 0x7d, 0x3b, + 0xcc, 0xce, 0x29, 0xa7, 0xd1, 0xc7, 0xe9, 0xd4, 0x50, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x26, 0x02, 0x00, 0x00, + 0x00, 0x09, 0x18, 0x00, 0x30, 0x00, 0x0f, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x26, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x08, 0x00, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static bool setprinter_level_3_xpsp3_req_check(struct torture_context *tctx, + struct spoolss_SetPrinter *r) +{ + struct GUID guid; + + torture_assert_ntstatus_ok(tctx, + GUID_from_string("0000053c-0000-0000-2b55-94be50280000", &guid), + "failed to parse GUID"); + torture_assert_int_equal(tctx, r->in.handle->handle_type, 0, "handle_type"); + torture_assert_guid_equal(tctx, r->in.handle->uuid, guid, "handle.uuid"); + + torture_assert(tctx, r->in.info_ctr, "info_ctr"); + torture_assert_int_equal(tctx, r->in.info_ctr->level, 3, "level"); + torture_assert_int_equal(tctx, r->in.info_ctr->info.info3->sec_desc_ptr, 0x06e9d108, "sec_desc_ptr"); + + torture_assert(tctx, r->in.devmode_ctr, "devmode_ctr"); + torture_assert_int_equal(tctx, r->in.devmode_ctr->_ndr_size, 0, "_ndr_size"); + torture_assert(tctx, r->in.devmode_ctr->devmode == NULL, "devmode"); + + torture_assert(tctx, r->in.secdesc_ctr, "secdesc_ctr"); + torture_assert_int_equal(tctx, r->in.secdesc_ctr->sd_size, 0x000000b4, "sd_size"); + torture_assert_int_equal(tctx, r->in.secdesc_ctr->sd->revision, SECURITY_DESCRIPTOR_REVISION_1, "revision"); + torture_assert_int_equal(tctx, r->in.secdesc_ctr->sd->type, 0x8004, "type"); + torture_assert(tctx, r->in.secdesc_ctr->sd, "sd"); + torture_assert(tctx, r->in.secdesc_ctr->sd->owner_sid == NULL, "owner_sid"); + torture_assert(tctx, r->in.secdesc_ctr->sd->group_sid == NULL, "group_sid"); + torture_assert(tctx, r->in.secdesc_ctr->sd->sacl == NULL, "sacl"); + torture_assert(tctx, r->in.secdesc_ctr->sd->dacl, "dacl"); + + return true; +} + struct torture_suite *ndr_spoolss_suite(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create(ctx, "spoolss"); @@ -1859,5 +1914,8 @@ struct torture_suite *ndr_spoolss_suite(TALLOC_CTX *ctx) torture_suite_add_ndr_pull_fn_test(suite, spoolss_SetJobNamedProperty, setjobnamedproperty_req_data, NDR_IN, setjobnamedproperty_req_check); torture_suite_add_ndr_pull_fn_test(suite, winspool_AsyncSetJobNamedProperty, setjobnamedproperty_req_data, NDR_IN, NULL); + torture_suite_add_ndr_pull_fn_test(suite, spoolss_SetPrinter, setprinter_level_3_xpsp3_req_data, NDR_IN, setprinter_level_3_xpsp3_req_check); + torture_suite_add_ndr_pull_fn_test(suite, winspool_AsyncSetPrinter, setprinter_level_3_xpsp3_req_data, NDR_IN, NULL); + return suite; } |