summaryrefslogtreecommitdiff
path: root/source4/libcli/composite
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/composite')
-rw-r--r--source4/libcli/composite/composite.h3
-rw-r--r--source4/libcli/composite/connect.c15
-rw-r--r--source4/libcli/composite/loadfile.c9
-rw-r--r--source4/libcli/composite/savefile.c10
4 files changed, 18 insertions, 19 deletions
diff --git a/source4/libcli/composite/composite.h b/source4/libcli/composite/composite.h
index fba458795c..35d6d94878 100644
--- a/source4/libcli/composite/composite.h
+++ b/source4/libcli/composite/composite.h
@@ -33,9 +33,6 @@ struct smbcli_composite {
/* the external state - will be queried by the caller */
enum smbcli_request_state state;
- /* the internal stage */
- uint16_t stage;
-
/* a private pointer for use by the composite function
implementation */
void *private;
diff --git a/source4/libcli/composite/connect.c b/source4/libcli/composite/connect.c
index 4f6df154a7..2663c789e4 100644
--- a/source4/libcli/composite/connect.c
+++ b/source4/libcli/composite/connect.c
@@ -34,6 +34,7 @@ enum connect_stage {CONNECT_RESOLVE,
CONNECT_TCON};
struct connect_state {
+ enum connect_stage stage;
struct smbcli_socket *sock;
struct smbcli_transport *transport;
struct smbcli_session *session;
@@ -61,7 +62,7 @@ static NTSTATUS connect_send_negprot(struct smbcli_composite *c,
state->req->async.fn = request_handler;
state->req->async.private = c;
- c->stage = CONNECT_NEGPROT;
+ state->stage = CONNECT_NEGPROT;
return NT_STATUS_OK;
}
@@ -141,7 +142,7 @@ static NTSTATUS connect_session_setup(struct smbcli_composite *c,
state->req->async.fn = request_handler;
state->req->async.private = c;
- c->stage = CONNECT_TCON;
+ state->stage = CONNECT_TCON;
return NT_STATUS_OK;
}
@@ -180,7 +181,7 @@ static NTSTATUS connect_negprot(struct smbcli_composite *c,
state->creq->async.fn = composite_handler;
state->creq->async.private = c;
- c->stage = CONNECT_SESSION_SETUP;
+ state->stage = CONNECT_SESSION_SETUP;
return NT_STATUS_OK;
}
@@ -240,7 +241,7 @@ static NTSTATUS connect_socket(struct smbcli_composite *c,
state->req->async.fn = request_handler;
state->req->async.private = c;
- c->stage = CONNECT_SESSION_REQUEST;
+ state->stage = CONNECT_SESSION_REQUEST;
return NT_STATUS_OK;
}
@@ -262,7 +263,7 @@ static NTSTATUS connect_resolve(struct smbcli_composite *c,
state->creq = smbcli_sock_connect_send(state->sock, address, state->io->in.port);
NT_STATUS_HAVE_NO_MEMORY(state->creq);
- c->stage = CONNECT_SOCKET;
+ state->stage = CONNECT_SOCKET;
state->creq->async.private = c;
state->creq->async.fn = composite_handler;
@@ -277,7 +278,7 @@ static void state_handler(struct smbcli_composite *c)
{
struct connect_state *state = talloc_get_type(c->private, struct connect_state);
- switch (c->stage) {
+ switch (state->stage) {
case CONNECT_RESOLVE:
c->status = connect_resolve(c, state->io);
break;
@@ -346,9 +347,9 @@ struct smbcli_composite *smb_composite_connect_send(struct smb_composite_connect
if (state->sock == NULL) goto failed;
state->io = io;
+ state->stage = CONNECT_RESOLVE;
c->state = SMBCLI_REQUEST_SEND;
- c->stage = CONNECT_RESOLVE;
c->event_ctx = state->sock->event.ctx;
c->private = state;
diff --git a/source4/libcli/composite/loadfile.c b/source4/libcli/composite/loadfile.c
index 8290876224..b95f43149e 100644
--- a/source4/libcli/composite/loadfile.c
+++ b/source4/libcli/composite/loadfile.c
@@ -33,6 +33,7 @@ enum loadfile_stage {LOADFILE_OPEN, LOADFILE_READ, LOADFILE_CLOSE};
static void loadfile_handler(struct smbcli_request *req);
struct loadfile_state {
+ enum loadfile_stage stage;
struct smb_composite_loadfile *io;
struct smbcli_request *req;
union smb_open *io_open;
@@ -62,7 +63,7 @@ static NTSTATUS setup_close(struct smbcli_composite *c,
/* call the handler again when the close is done */
state->req->async.fn = loadfile_handler;
state->req->async.private = c;
- c->stage = LOADFILE_CLOSE;
+ state->stage = LOADFILE_CLOSE;
return NT_STATUS_OK;
}
@@ -113,7 +114,7 @@ static NTSTATUS loadfile_open(struct smbcli_composite *c,
/* call the handler again when the first read is done */
state->req->async.fn = loadfile_handler;
state->req->async.private = c;
- c->stage = LOADFILE_READ;
+ state->stage = LOADFILE_READ;
talloc_free(state->io_open);
@@ -187,7 +188,7 @@ static void loadfile_handler(struct smbcli_request *req)
/* when this handler is called, the stage indicates what
call has just finished */
- switch (c->stage) {
+ switch (state->stage) {
case LOADFILE_OPEN:
c->status = loadfile_open(c, state->io);
break;
@@ -251,7 +252,7 @@ struct smbcli_composite *smb_composite_loadfile_send(struct smbcli_tree *tree,
/* setup the callback handler */
state->req->async.fn = loadfile_handler;
state->req->async.private = c;
- c->stage = LOADFILE_OPEN;
+ state->stage = LOADFILE_OPEN;
return c;
diff --git a/source4/libcli/composite/savefile.c b/source4/libcli/composite/savefile.c
index 06eb13bb01..29d26c7eba 100644
--- a/source4/libcli/composite/savefile.c
+++ b/source4/libcli/composite/savefile.c
@@ -29,10 +29,10 @@
/* the stages of this call */
enum savefile_stage {SAVEFILE_OPEN, SAVEFILE_WRITE, SAVEFILE_CLOSE};
-
static void savefile_handler(struct smbcli_request *req);
struct savefile_state {
+ enum savefile_stage stage;
off_t total_written;
struct smb_composite_savefile *io;
union smb_open *io_open;
@@ -62,7 +62,7 @@ static NTSTATUS setup_close(struct smbcli_composite *c,
NT_STATUS_HAVE_NO_MEMORY(state->req);
/* call the handler again when the close is done */
- c->stage = SAVEFILE_CLOSE;
+ state->stage = SAVEFILE_CLOSE;
state->req->async.fn = savefile_handler;
state->req->async.private = c;
@@ -106,7 +106,7 @@ static NTSTATUS savefile_open(struct smbcli_composite *c,
NT_STATUS_HAVE_NO_MEMORY(state->req);
/* call the handler again when the first write is done */
- c->stage = SAVEFILE_WRITE;
+ state->stage = SAVEFILE_WRITE;
state->req->async.fn = savefile_handler;
state->req->async.private = c;
talloc_free(state->io_open);
@@ -189,7 +189,7 @@ static void savefile_handler(struct smbcli_request *req)
/* when this handler is called, the stage indicates what
call has just finished */
- switch (c->stage) {
+ switch (state->stage) {
case SAVEFILE_OPEN:
c->status = savefile_open(c, state->io);
break;
@@ -226,12 +226,12 @@ struct smbcli_composite *smb_composite_savefile_send(struct smbcli_tree *tree,
if (c == NULL) goto failed;
c->state = SMBCLI_REQUEST_SEND;
- c->stage = SAVEFILE_OPEN;
c->event_ctx = tree->session->transport->socket->event.ctx;
state = talloc(c, struct savefile_state);
if (state == NULL) goto failed;
+ state->stage = SAVEFILE_OPEN;
state->total_written = 0;
state->io = io;