diff options
-rw-r--r-- | source3/include/client.h | 2 | ||||
-rw-r--r-- | source3/libsmb/async_smb.c | 6 | ||||
-rw-r--r-- | source3/libsmb/clientgen.c | 5 | ||||
-rw-r--r-- | source3/libsmb/clierror.c | 8 | ||||
-rw-r--r-- | source3/libsmb/smb2cli_base.c | 12 |
5 files changed, 16 insertions, 17 deletions
diff --git a/source3/include/client.h b/source3/include/client.h index 26b8fcb405..4043774e22 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -51,7 +51,6 @@ struct cli_state { * A list of subsidiary connections for DFS. */ struct cli_state *prev, *next; - int fd; int protocol; int sec_mode; int rap_error; @@ -125,6 +124,7 @@ struct cli_state { char *dfs_mountpoint; struct { + int fd; struct tevent_queue *outgoing; struct tevent_req **pending; } conn; diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 724e8b7d4f..87614bd326 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -215,7 +215,7 @@ bool cli_smb_req_set_pending(struct tevent_req *req) * We're the first ones, add the read_smb request that waits for the * answer from the server */ - subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd); + subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd); if (subreq == NULL) { cli_smb_req_unset_pending(req); return false; @@ -431,7 +431,7 @@ static NTSTATUS cli_smb_req_iov_send(struct tevent_req *req, iov_count = 1; } subreq = writev_send(state, state->ev, state->cli->conn.outgoing, - state->cli->fd, false, iov, iov_count); + state->cli->conn.fd, false, iov, iov_count); if (subreq == NULL) { return NT_STATUS_NO_MEMORY; } @@ -649,7 +649,7 @@ static void cli_smb_received(struct tevent_req *subreq) */ state = tevent_req_data(cli->conn.pending[0], struct cli_smb_state); - subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd); + subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd); if (subreq == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 7a417ec6c0..ca6201e6bb 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -187,7 +187,6 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx, if (!cli->dfs_mountpoint) { goto error; } - cli->fd = -1; cli->raw_status = NT_STATUS_INTERNAL_ERROR; cli->protocol = PROTOCOL_NT1; cli->timeout = 20000; /* Timeout is in milliseconds. */ @@ -244,7 +243,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx, goto error; } - cli->fd = fd; + cli->conn.fd = fd; ss_length = sizeof(cli->src_ss); ret = getsockname(fd, @@ -364,7 +363,7 @@ void cli_shutdown(struct cli_state *cli) void cli_sockopt(struct cli_state *cli, const char *options) { - set_socket_options(cli->fd, options); + set_socket_options(cli->conn.fd, options); } uint16_t cli_state_get_vc_num(struct cli_state *cli) diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c index 92c2cc2815..4ff5d9193b 100644 --- a/source3/libsmb/clierror.c +++ b/source3/libsmb/clierror.c @@ -187,7 +187,7 @@ bool cli_state_is_connected(struct cli_state *cli) return false; } - if (cli->fd == -1) { + if (cli->conn.fd == -1) { return false; } @@ -196,8 +196,8 @@ bool cli_state_is_connected(struct cli_state *cli) void cli_state_disconnect(struct cli_state *cli) { - if (cli->fd != -1) { - close(cli->fd); + if (cli->conn.fd != -1) { + close(cli->conn.fd); } - cli->fd = -1; + cli->conn.fd = -1; } diff --git a/source3/libsmb/smb2cli_base.c b/source3/libsmb/smb2cli_base.c index a1ecfb4e38..88b890438a 100644 --- a/source3/libsmb/smb2cli_base.c +++ b/source3/libsmb/smb2cli_base.c @@ -132,7 +132,7 @@ static bool smb2cli_req_set_pending(struct tevent_req *req) * We're the first ones, add the read_smb request that waits for the * answer from the server */ - subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd); + subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd); if (subreq == NULL) { smb2cli_req_unset_pending(req); return false; @@ -143,10 +143,10 @@ static bool smb2cli_req_set_pending(struct tevent_req *req) static void smb2cli_notify_pending(struct cli_state *cli, NTSTATUS status) { - if (cli->fd != -1) { - close(cli->fd); - cli->fd = -1; + if (cli->conn.fd != -1) { + close(cli->conn.fd); } + cli->conn.fd = -1; /* * Cancel all pending requests. We don't do a for-loop walking @@ -294,7 +294,7 @@ NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs, iov[0].iov_len = sizeof(state->nbt); subreq = writev_send(state, state->ev, state->cli->conn.outgoing, - state->cli->fd, false, iov, num_iov); + state->cli->conn.fd, false, iov, num_iov); if (subreq == NULL) { return NT_STATUS_NO_MEMORY; } @@ -572,7 +572,7 @@ static void smb2cli_inbuf_received(struct tevent_req *subreq) * add the read_smb request that waits for the * next answer from the server */ - subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd); + subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd); if (subreq == NULL) { smb2cli_notify_pending(cli, NT_STATUS_NO_MEMORY); return; |