summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/echo.c8
-rw-r--r--source4/torture/rpc/lsa.c52
-rw-r--r--source4/torture/torture.c52
3 files changed, 34 insertions, 78 deletions
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);
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index bb5741c54f..d88a58032f 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -135,65 +135,23 @@ BOOL torture_close_connection(struct cli_state *c)
NTSTATUS torture_rpc_connection(struct dcerpc_pipe **p, const char *pipe_name)
{
struct cli_state *cli;
- int fnum;
NTSTATUS status;
- char *name = NULL;
- union smb_open open_parms;
- TALLOC_CTX *mem_ctx;
if (!torture_open_connection(&cli)) {
return NT_STATUS_UNSUCCESSFUL;
}
- asprintf(&name, "\\%s", pipe_name);
- if (!name) {
- return NT_STATUS_NO_MEMORY;
- }
-
- open_parms.ntcreatex.level = RAW_OPEN_NTCREATEX;
- open_parms.ntcreatex.in.flags = 0;
- open_parms.ntcreatex.in.root_fid = 0;
- open_parms.ntcreatex.in.access_mask =
- STD_RIGHT_READ_CONTROL_ACCESS |
- SA_RIGHT_FILE_WRITE_ATTRIBUTES |
- SA_RIGHT_FILE_WRITE_EA |
- GENERIC_RIGHTS_FILE_READ |
- GENERIC_RIGHTS_FILE_WRITE;
- open_parms.ntcreatex.in.file_attr = 0;
- open_parms.ntcreatex.in.alloc_size = 0;
- open_parms.ntcreatex.in.share_access =
- NTCREATEX_SHARE_ACCESS_READ |
- NTCREATEX_SHARE_ACCESS_WRITE;
- open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
- open_parms.ntcreatex.in.create_options = 0;
- open_parms.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;
- open_parms.ntcreatex.in.security_flags = 0;
- open_parms.ntcreatex.in.fname = name;
-
- mem_ctx = talloc_init("torture_rpc_connection");
- status = smb_raw_open(cli->tree, mem_ctx, &open_parms);
- free(name);
- talloc_destroy(mem_ctx);
-
+ if (!(*p = dcerpc_pipe_init(cli->tree))) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = dcerpc_pipe_open_smb(*p, pipe_name);
if (!NT_STATUS_IS_OK(status)) {
printf("Open of pipe %s failed with error (%s)\n",
pipe_name, nt_errstr(status));
return status;
}
- if (!(*p = dcerpc_pipe_init(cli->tree))) {
- return NT_STATUS_NO_MEMORY;
- }
-
- (*p)->fnum = open_parms.ntcreatex.out.fnum;
-
- status = cli_dcerpc_bind_byname(*p, pipe_name);
-
- if (!NT_STATUS_IS_OK(status)) {
- cli_close(cli, fnum);
- dcerpc_pipe_close(*p);
- }
-
return status;
}