[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha7-1477-g5c43bc6
Volker Lendecke
vlendec at samba.org
Thu May 7 14:38:46 GMT 2009
The branch, master has been updated
via 5c43bc616adddbcefdf5e98df21f80a841b8697f (commit)
via 1b75345a9a4575309a713507e99921fd8e3c87fb (commit)
via d52b0a25ad2ce52f01015547d1c384dab6b931ac (commit)
via b35967edba35965f4e8242759a7d9d1d9ded980f (commit)
from 599b9fe86eba932171bb4ec13347ed28ea5edebd (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 5c43bc616adddbcefdf5e98df21f80a841b8697f
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 7 16:24:54 2009 +0200
Fix a typo
commit 1b75345a9a4575309a713507e99921fd8e3c87fb
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 7 16:24:46 2009 +0200
Add simple test chaining up sesssetup and tcon
commit d52b0a25ad2ce52f01015547d1c384dab6b931ac
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 7 16:24:04 2009 +0200
Make cli_tcon_andx chainable
commit b35967edba35965f4e8242759a7d9d1d9ded980f
Author: Volker Lendecke <vl at samba.org>
Date: Thu May 7 16:23:27 2009 +0200
Make cli_session_setup_guest chainable
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 10 ++++
source3/libsmb/cliconnect.c | 97 ++++++++++++++++++++++++++++++++-----------
source3/torture/torture.c | 55 ++++++++++++++++++++++++-
3 files changed, 137 insertions(+), 25 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c8b7927..eaaca56 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2169,11 +2169,21 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
const char *pass, int passlen,
const char *ntpass, int ntpasslen,
const char *workgroup);
+struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli,
+ struct tevent_req **psmbreq);
struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct cli_state *cli);
NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
bool cli_ulogoff(struct cli_state *cli);
+struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli,
+ const char *share, const char *dev,
+ const char *pass, int passlen,
+ struct tevent_req **psmbreq);
struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct cli_state *cli,
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index ffe2960..7a8a930 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -169,13 +169,15 @@ static uint32 cli_session_setup_capabilities(struct cli_state *cli)
struct cli_session_setup_guest_state {
struct cli_state *cli;
uint16_t vwv[16];
+ struct iovec bytes;
};
static void cli_session_setup_guest_done(struct tevent_req *subreq);
-struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- struct cli_state *cli)
+struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli,
+ struct tevent_req **psmbreq)
{
struct tevent_req *req, *subreq;
struct cli_session_setup_guest_state *state;
@@ -212,16 +214,36 @@ struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Unix", 5, NULL);
bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Samba", 6, NULL);
- if (tevent_req_nomem(bytes, req)) {
- return tevent_req_post(req, ev);
+ if (bytes == NULL) {
+ TALLOC_FREE(req);
+ return NULL;
}
- subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 13, vwv,
- talloc_get_size(bytes), bytes);
- if (tevent_req_nomem(subreq, req)) {
- return tevent_req_post(req, ev);
+ state->bytes.iov_base = bytes;
+ state->bytes.iov_len = talloc_get_size(bytes);
+
+ subreq = cli_smb_req_create(state, ev, cli, SMBsesssetupX, 0, 13, vwv,
+ 1, &state->bytes);
+ if (subreq == NULL) {
+ TALLOC_FREE(req);
+ return NULL;
}
tevent_req_set_callback(subreq, cli_session_setup_guest_done, req);
+ *psmbreq = subreq;
+ return req;
+}
+
+struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli)
+{
+ struct tevent_req *req, *subreq;
+
+ req = cli_session_setup_guest_create(mem_ctx, ev, cli, &subreq);
+ if ((req == NULL) || !cli_smb_req_send(subreq)) {
+ TALLOC_FREE(req);
+ return NULL;
+ }
return req;
}
@@ -1223,15 +1245,17 @@ bool cli_ulogoff(struct cli_state *cli)
struct cli_tcon_andx_state {
struct cli_state *cli;
uint16_t vwv[4];
+ struct iovec bytes;
};
static void cli_tcon_andx_done(struct tevent_req *subreq);
-struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- struct cli_state *cli,
- const char *share, const char *dev,
- const char *pass, int passlen)
+struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli,
+ const char *share, const char *dev,
+ const char *pass, int passlen,
+ struct tevent_req **psmbreq)
{
struct tevent_req *req, *subreq;
struct cli_tcon_andx_state *state;
@@ -1319,8 +1343,9 @@ struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
*/
tmp = talloc_asprintf_strupper_m(talloc_tos(), "\\\\%s\\%s",
cli->desthost, share);
- if (tevent_req_nomem(tmp, req)) {
- return tevent_req_post(req, ev);
+ if (tmp == NULL) {
+ TALLOC_FREE(req);
+ return NULL;
}
bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), tmp, strlen(tmp)+1,
NULL);
@@ -1330,22 +1355,29 @@ struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
* Add the devicetype
*/
tmp = talloc_strdup_upper(talloc_tos(), dev);
- if (tevent_req_nomem(tmp, req)) {
- return tevent_req_post(req, ev);
+ if (tmp == NULL) {
+ TALLOC_FREE(req);
+ return NULL;
}
bytes = smb_bytes_push_str(bytes, false, tmp, strlen(tmp)+1, NULL);
TALLOC_FREE(tmp);
- if (tevent_req_nomem(bytes, req)) {
- return tevent_req_post(req, ev);
+ if (bytes == NULL) {
+ TALLOC_FREE(req);
+ return NULL;
}
- subreq = cli_smb_send(state, ev, cli, SMBtconX, 0, 4, vwv,
- talloc_get_size(bytes), bytes);
- if (tevent_req_nomem(subreq, req)) {
- return tevent_req_post(req, ev);
+ state->bytes.iov_base = bytes;
+ state->bytes.iov_len = talloc_get_size(bytes);
+
+ subreq = cli_smb_req_create(state, ev, cli, SMBtconX, 0, 4, vwv,
+ 1, &state->bytes);
+ if (subreq == NULL) {
+ TALLOC_FREE(req);
+ return NULL;
}
tevent_req_set_callback(subreq, cli_tcon_andx_done, req);
+ *psmbreq = subreq;
return req;
access_denied:
@@ -1353,6 +1385,23 @@ struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
+struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ struct cli_state *cli,
+ const char *share, const char *dev,
+ const char *pass, int passlen)
+{
+ struct tevent_req *req, *subreq;
+
+ req = cli_tcon_andx_create(mem_ctx, ev, cli, share, dev, pass, passlen,
+ &subreq);
+ if ((req == NULL) || !cli_smb_req_send(subreq)) {
+ TALLOC_FREE(req);
+ return NULL;
+ }
+ return req;
+}
+
static void cli_tcon_andx_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 9c0449a..1d46346 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4995,6 +4995,58 @@ static bool run_chain1(int dummy)
return True;
}
+static void chain2_sesssetup_completion(struct tevent_req *req)
+{
+ NTSTATUS status;
+ status = cli_session_setup_guest_recv(req);
+ d_printf("sesssetup returned %s\n", nt_errstr(status));
+}
+
+static void chain2_tcon_completion(struct tevent_req *req)
+{
+ bool *done = (bool *)tevent_req_callback_data_void(req);
+ NTSTATUS status;
+ status = cli_tcon_andx_recv(req);
+ d_printf("tcon_and_x returned %s\n", nt_errstr(status));
+ *done = true;
+}
+
+static bool run_chain2(int dummy)
+{
+ struct cli_state *cli1;
+ struct event_context *evt = event_context_init(NULL);
+ struct tevent_req *reqs[2], *smbreqs[2];
+ bool done = false;
+
+ printf("starting chain2 test\n");
+ if (!torture_open_connection(&cli1, 0)) {
+ return False;
+ }
+
+ cli_sockopt(cli1, sockops);
+
+ reqs[0] = cli_session_setup_guest_create(talloc_tos(), evt, cli1,
+ &smbreqs[0]);
+ if (reqs[0] == NULL) return false;
+ tevent_req_set_callback(reqs[0], chain2_sesssetup_completion, NULL);
+
+ reqs[1] = cli_tcon_andx_create(talloc_tos(), evt, cli1, "IPC$",
+ "?????", NULL, 0, &smbreqs[1]);
+ if (reqs[1] == NULL) return false;
+ tevent_req_set_callback(reqs[1], chain2_tcon_completion, &done);
+
+ if (!cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs))) {
+ return false;
+ }
+
+ while (!done) {
+ event_loop_once(evt);
+ }
+
+ torture_close_connection(cli1);
+ return True;
+}
+
static bool run_mangle1(int dummy)
{
struct cli_state *cli;
@@ -5006,7 +5058,7 @@ static bool run_mangle1(int dummy)
SMB_OFF_T size;
uint16_t mode;
- printf("starting chain1 test\n");
+ printf("starting mangle1 test\n");
if (!torture_open_connection(&cli, 0)) {
return False;
}
@@ -5866,6 +5918,7 @@ static struct {
{ "EATEST", run_eatest, 0},
{ "SESSSETUP_BENCH", run_sesssetup_bench, 0},
{ "CHAIN1", run_chain1, 0},
+ { "CHAIN2", run_chain2, 0},
{ "WINDOWS-WRITE", run_windows_write, 0},
{ "CLI_ECHO", run_cli_echo, 0},
{ "GETADDRINFO", run_getaddrinfo_send, 0},
--
Samba Shared Repository
More information about the samba-cvs
mailing list