From 46046aa69be01d4868395b9b52b8bcd22c3859e5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Nov 2003 09:10:31 +0000 Subject: yipee! we can now do lsaOpenPolicy() via the new interfaces, without using any of the old lsa code (This used to be commit f5bd301ff7befa223a1d761a37ae8f7ce7f1fcd1) --- source4/torture/rpc/echo.c | 8 ++++--- source4/torture/rpc/lsa.c | 52 +++++++++++++++++++++------------------------- 2 files changed, 29 insertions(+), 31 deletions(-) (limited to 'source4/torture/rpc') diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index 1d034c48df..8780b39f87 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -53,7 +53,7 @@ static BOOL test_echodata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) int i; NTSTATUS status; char *data_in, *data_out; - int len = 17; + int len = 1 + (random() % 5000); int len_out; printf("\nTesting EchoData\n"); @@ -92,7 +92,7 @@ static BOOL test_sourcedata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) int i; NTSTATUS status; char *data_out; - int len = 200000; + int len = 200000 + (random() % 5000); int len_out; printf("\nTesting SourceData\n"); @@ -126,7 +126,7 @@ static BOOL test_sinkdata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) int i; NTSTATUS status; char *data_in; - int len = 200000; + int len = 200000 + (random() % 5000); printf("\nTesting SinkData\n"); @@ -143,6 +143,8 @@ static BOOL test_sinkdata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return False; } + printf("sunk %d bytes\n", len); + return True; } diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index cac7f80d5a..95a07ef0c6 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. test suite for lsa rpc operations - Copyright (C) Tim Potter 2003 + Copyright (C) Andrew Tridgell 2003 This program is free software; you can redistribute it and/or modify @@ -21,38 +21,40 @@ #include "includes.h" -/* form a lsa open request */ -static DATA_BLOB blob_lsa_open_policy_req(TALLOC_CTX *mem_ctx, BOOL sec_qos, uint32 des_access) +static BOOL test_OpenPolicy(struct dcerpc_pipe *p) { - prs_struct qbuf; - LSA_Q_OPEN_POL q; - LSA_SEC_QOS qos; + struct lsa_ObjectAttribute attr; + struct policy_handle handle; + struct lsa_QosInfo qos; + NTSTATUS status; - ZERO_STRUCT(q); + qos.impersonation_level = 2; + qos.context_mode = 1; + qos.effective_only = 0; - /* Initialise parse structures */ - prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL); + attr.root_dir = NULL; + attr.object_name = NULL; + attr.attributes = 0; + attr.sec_desc = NULL; + attr.sec_qos = &qos; - /* Initialise input parameters */ - if (sec_qos) { - init_lsa_sec_qos(&qos, 2, 1, 0); - init_q_open_pol(&q, '\\', 0, des_access, &qos); - } else { - init_q_open_pol(&q, '\\', 0, des_access, NULL); + status = dcerpc_lsa_OpenPolicy(p, + "\\", + &attr, + SEC_RIGHTS_MAXIMUM_ALLOWED, + &handle); + if (!NT_STATUS_IS_OK(status)) { + printf("OpenPolicy failed - %s\n", nt_errstr(status)); + return False; } - if (lsa_io_q_open_pol("", &q, &qbuf, 0)) - return data_blob_talloc( - mem_ctx, prs_data_p(&qbuf), prs_offset(&qbuf)); - - return data_blob(NULL, 0); + return True; } BOOL torture_rpc_lsa(int dummy) { NTSTATUS status; struct dcerpc_pipe *p; - DATA_BLOB request, response; TALLOC_CTX *mem_ctx; mem_ctx = talloc_init("torture_rpc_lsa"); @@ -62,13 +64,7 @@ BOOL torture_rpc_lsa(int dummy) return False; } - request = blob_lsa_open_policy_req(mem_ctx, True, - SEC_RIGHTS_MAXIMUM_ALLOWED); - - status = cli_dcerpc_request(p, LSA_OPENPOLICY, mem_ctx, &request, &response); - if (!NT_STATUS_IS_OK(status)) { - d_printf("Failed to LSA_OPENPOLICY - %s\n", nt_errstr(status)); - } + test_OpenPolicy(p); torture_rpc_close(p); -- cgit