summaryrefslogtreecommitdiff
path: root/source4/torture/rap
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-07-12 16:35:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:33 -0500
commit3a6f761eb061d93837038f0aa75c2ffcb0ba3639 (patch)
treecf2e16b6d1f58f06666a8fe269ad66492934ad36 /source4/torture/rap
parentbff4e6963c0b7b58a0886a207f4da0398377157f (diff)
downloadsamba-3a6f761eb061d93837038f0aa75c2ffcb0ba3639.tar.gz
samba-3a6f761eb061d93837038f0aa75c2ffcb0ba3639.tar.bz2
samba-3a6f761eb061d93837038f0aa75c2ffcb0ba3639.zip
r1470: Get the smb_trans2 structure out of the rap_cli_call struct.
Initial attempt at RAP server infrastructure. Look at rap_server.c for the dummy functions that are supposed to implement the core functionality. ipc_rap.c contains all the data shuffling. _rap_shareenum and _rap_serverenum2 in ipc_rap.c are (I think) regular enough to be auto-generated. I did not test all the corner cases yet, but nevertheless I would like some comments on the general style. Volker P.S: samba-3 smbclient now doesn't freak out anymore, although the results are not entirely correct :-) (This used to be commit 08140cc1a838b4eaa23c897b280a46c95b7ef3e0)
Diffstat (limited to 'source4/torture/rap')
-rw-r--r--source4/torture/rap/rap.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index 65519bcce0..2ed069fd61 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -26,10 +26,10 @@ struct rap_call {
char *paramdesc;
const char *datadesc;
- struct smb_trans2 trans;
-
uint16 status;
uint16 convert;
+
+ uint16 rcv_paramlen, rcv_datalen;
struct ndr_push *ndr_push_param;
struct ndr_push *ndr_push_data;
@@ -55,7 +55,7 @@ static struct rap_call *new_rap_cli_call(uint16 callno)
ZERO_STRUCTP(call);
call->callno = callno;
- call->trans.in.max_param = 4; /* uint16 error, uint16 "convert" */
+ call->rcv_paramlen = 4;
call->mem_ctx = mem_ctx;
call->ndr_push_param = ndr_push_init_ctx(mem_ctx);
@@ -102,14 +102,14 @@ static void rap_cli_push_rcvbuf(struct rap_call *call, int len)
rap_cli_push_paramdesc(call, 'r');
rap_cli_push_paramdesc(call, 'L');
ndr_push_uint16(call->ndr_push_param, len);
- call->trans.in.max_data = len;
+ call->rcv_datalen = len;
}
static void rap_cli_expect_multiple_entries(struct rap_call *call)
{
rap_cli_push_paramdesc(call, 'e');
rap_cli_push_paramdesc(call, 'h');
- call->trans.in.max_param += 4; /* uint16 entry count, uint16 total */
+ call->rcv_paramlen += 4; /* uint16 entry count, uint16 total */
}
static void rap_cli_push_string(struct rap_call *call, const char *str)
@@ -161,6 +161,7 @@ static NTSTATUS rap_cli_do_call(struct cli_state *cli, TALLOC_CTX *mem_ctx,
NTSTATUS result;
DATA_BLOB param_blob;
struct ndr_push *params;
+ struct smb_trans2 trans;
params = ndr_push_init_ctx(mem_ctx);
@@ -169,12 +170,14 @@ static NTSTATUS rap_cli_do_call(struct cli_state *cli, TALLOC_CTX *mem_ctx,
params->flags = RAPNDR_FLAGS;
- call->trans.in.max_setup = 0;
- call->trans.in.flags = 0;
- call->trans.in.timeout = 0;
- call->trans.in.setup_count = 0;
- call->trans.in.setup = NULL;
- call->trans.in.trans_name = "\\PIPE\\LANMAN";
+ trans.in.max_param = call->rcv_paramlen;
+ trans.in.max_data = call->rcv_datalen;
+ trans.in.max_setup = 0;
+ trans.in.flags = 0;
+ trans.in.timeout = 0;
+ trans.in.setup_count = 0;
+ trans.in.setup = NULL;
+ trans.in.trans_name = "\\PIPE\\LANMAN";
NDR_CHECK(ndr_push_uint16(params, call->callno));
NDR_CHECK(ndr_push_string(params, NDR_SCALARS, call->paramdesc));
@@ -184,19 +187,19 @@ static NTSTATUS rap_cli_do_call(struct cli_state *cli, TALLOC_CTX *mem_ctx,
NDR_CHECK(ndr_push_bytes(params, param_blob.data,
param_blob.length));
- call->trans.in.params = ndr_push_blob(params);
- call->trans.in.data = data_blob(NULL, 0);
+ trans.in.params = ndr_push_blob(params);
+ trans.in.data = data_blob(NULL, 0);
- result = smb_raw_trans(cli->tree, call->mem_ctx, &call->trans);
+ result = smb_raw_trans(cli->tree, call->mem_ctx, &trans);
if (!NT_STATUS_IS_OK(result))
return result;
- call->ndr_pull_param = ndr_pull_init_blob(&call->trans.out.params,
+ call->ndr_pull_param = ndr_pull_init_blob(&trans.out.params,
call->mem_ctx);
call->ndr_pull_param->flags = RAPNDR_FLAGS;
- call->ndr_pull_data = ndr_pull_init_blob(&call->trans.out.data,
+ call->ndr_pull_data = ndr_pull_init_blob(&trans.out.data,
call->mem_ctx);
call->ndr_pull_data->flags = RAPNDR_FLAGS;