mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3:libsmb: move cli_state->fd to cli_state->conn.fd
metze
This commit is contained in:
parent
6d1757f189
commit
13dbd5021b
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user