[SCM] Samba Shared Repository - branch v3-5-test updated
Karolin Seeger
kseeger at samba.org
Tue Mar 30 02:26:52 MDT 2010
The branch, v3-5-test has been updated
via 482518f... s3:winbindd: correctly retry if the netlogon pipe gets disconnected during a logon call
via 877c6d0... s3:rpc_client: remove more unused code
via 86cbe6f... s3:rpc_client: remove unused code, we handle transport failures in the transport layer now
via 169628f... s3:winbindd_reconnect: don't only reconnect on NT_STATUS_UNSUCCESSFUL
via c046ae8... s3:winbindd_cm: invalidate connection if cm_connect_netlogon() fails
via c462e54... s3:winbindd: consistently use TALLOC_FREE(conn->foo_pipe) is we create a new connection
via aa7d54e... s3:winbindd_cm: use rpccli_is_connected() helper function
via 00a9319... s3:winbindd_cm: use cli_state_is_connected() helper function
via 60861fb... s3:rpc_client: return at least 10 sec as old timeout in rpccli_set_timeout() instead of 0
via 89164eb... s3:rpc_client: add set_timeout hook to rpc_cli_transport
via 958b493... s3:rpc_client: add rpccli_is_connected()
via 1e2e47d... s3:rpc_client: don't mix layers and keep a reference to cli_state in the caller
via 8d57666... s3:rpc_transport_np: add comment about bad usage in a destructor
via 8c2f442... s3:rpc_transport_np: use cli_state_is_connected() helper
via 956514c... s3:libsmb: add cli_state_is_connected() function
via 85aae5e... s3:libsmb: don't let cli_shutdown() segfault with a NULL cli_state
via e2739a2... s3:rpc_transport_np: handle trans rdata like the output of a normal read
from f4201fb... s3: Fix bug 7212, "getent group does not return group members"
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test
- Log -----------------------------------------------------------------
commit 482518fcafb18bda1f084ebf1906a2ad02436b80
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 29 22:03:55 2010 +0200
s3:winbindd: correctly retry if the netlogon pipe gets disconnected during a logon call
This fixes hopefully the last part of bug #7295.
metze
(cherry picked from commit 4c6cde99c0751a073120d8bc36d40922d8027344)
commit 877c6d0cf99dfe642f2c8dc733e075768aab2d95
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:54:29 2010 +0100
s3:rpc_client: remove more unused code
metze
(cherry picked from commit cac9981b1a88a37c703a76a951b0691fa4ba7b4b)
commit 86cbe6f85a732601b18f97b143976cbf92f56467
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:29:05 2010 +0100
s3:rpc_client: remove unused code, we handle transport failures in the transport layer now
metze
(cherry picked from commit 13cf592bb8478453dccd4d78bdb4dabec7aeddc2)
commit 169628fcb656ba5987a99bd50c7f588b731eae51
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 29 16:31:13 2010 +0200
s3:winbindd_reconnect: don't only reconnect on NT_STATUS_UNSUCCESSFUL
metze
(cherry picked from commit 6bd5a2a3739938f95fce23ab2da652c9b5a48111)
commit c046ae8428fb62ff2749689e7c738f1a2e8f8251
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:25:47 2010 +0100
s3:winbindd_cm: invalidate connection if cm_connect_netlogon() fails
metze
(cherry picked from commit 94a4bcd2f0c0464e192556679c6636639cb307ea)
commit c462e54142c00fdd81c2847d16a75119b1cc89fc
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:17:07 2010 +0100
s3:winbindd: consistently use TALLOC_FREE(conn->foo_pipe) is we create a new connection
metze
(cherry picked from commit 4f391fedac7111683d13f2d79fee7c0dbc27f86e)
commit aa7d54ed04585a183a88363406ed7f3244b24d85
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:15:57 2010 +0100
s3:winbindd_cm: use rpccli_is_connected() helper function
metze
(cherry picked from commit d980c06a994d032a833adc8d56d2f2c037f8fdaf)
commit 00a93190d2cae31cd2213b810ea348c055670399
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:14:02 2010 +0100
s3:winbindd_cm: use cli_state_is_connected() helper function
metze
(cherry picked from commit 408a3eb35a0e61b5d66a3b48ebbd1a6796672d0f)
commit 60861fba533027b6c9a0ff704b95dcf631ea3ca3
Author: Stefan Metzmacher <metze at samba.org>
Date: Sun Mar 28 19:34:34 2010 +0200
s3:rpc_client: return at least 10 sec as old timeout in rpccli_set_timeout() instead of 0
metze
(cherry picked from commit 3e70da3f470eeb122f95477fb48d89939f501b3e)
commit 89164eb8363ffc0b951256578be48d37ddba46b1
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:51:51 2010 +0100
s3:rpc_client: add set_timeout hook to rpc_cli_transport
metze
(cherry picked from commit 99664ad15460530b6fb44957b6c57823f09884bf)
commit 958b49323968740e2cbf69dc2a0a5dd57d5bcf87
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 15:00:38 2010 +0100
s3:rpc_client: add rpccli_is_connected()
metze
(cherry picked from commit 4f41b53487ac9bc96c7960e8edab464558656373)
commit 1e2e47da82aeb249dce431541738a62cb139aebb
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 29 14:58:19 2010 +0200
s3:rpc_client: don't mix layers and keep a reference to cli_state in the caller
We should not rely on the backend to have a reference to the cli_state.
This will make it possible for the backend to set its cli_state reference
to NULL, when the transport is dead.
metze
(cherry picked from commit dc09b12681ea0e6d4c2b0f1c99dfeb1f23019c65)
commit 8d576661d15f1c032a4fe17ed03bfeb376039bdb
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 14:10:25 2010 +0100
s3:rpc_transport_np: add comment about bad usage in a destructor
metze
(cherry picked from commit 5f8fc63515a02aaf55719cb8d3be8ce695178fe9)
commit 8c2f4426ce178ac33748cfba01532ec2fd205710
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 14:08:42 2010 +0100
s3:rpc_transport_np: use cli_state_is_connected() helper
metze
(cherry picked from commit b862351da8624df893ec77e020a456c1d23c58ed)
commit 956514c98975d152c6ab50e0ee2d88971aa06f55
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Mar 25 13:20:56 2010 +0100
s3:libsmb: add cli_state_is_connected() function
metze
(cherry picked from commit d7bf30ef92031ffddcde3680b38e602510bcae24)
commit 85aae5e96363d0b5b03d31fb36465121d3381cb2
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 29 18:23:40 2010 +0200
s3:libsmb: don't let cli_shutdown() segfault with a NULL cli_state
metze
(similar to commit 47e10ab9a85960c78af807b66b99bcd139713644)
commit e2739a2bf37e654c37cbea6e510f63a7ce4adfea
Author: Stefan Metzmacher <metze at samba.org>
Date: Sat Feb 20 09:08:16 2010 +0100
s3:rpc_transport_np: handle trans rdata like the output of a normal read
Inspired by bug #7159.
metze
(cherry picked from commit 911287285cc4c8485b75edfad3c1ece901a69b0b)
-----------------------------------------------------------------------
Summary of changes:
source3/include/client.h | 4 +
source3/include/proto.h | 6 +-
source3/libsmb/clientgen.c | 4 +
source3/libsmb/clierror.c | 18 +++++
source3/rpc_client/cli_pipe.c | 66 +++++++++++-------
source3/rpc_client/ndr.c | 14 ----
source3/rpc_client/rpc_transport_np.c | 117 +++++++++++++++++++++++++++----
source3/rpc_client/rpc_transport_smbd.c | 105 +++++++++++++++++++++++----
source3/rpc_client/rpc_transport_sock.c | 91 +++++++++++-------------
source3/winbindd/winbindd_cm.c | 35 ++++-----
source3/winbindd/winbindd_pam.c | 4 +-
source3/winbindd/winbindd_reconnect.c | 73 ++++++++++++++++----
12 files changed, 380 insertions(+), 157 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/client.h b/source3/include/client.h
index cc32cd1..39480d3 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -110,6 +110,10 @@ struct rpc_cli_transport {
*/
NTSTATUS (*trans_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx,
uint8_t **prdata, uint32_t *prdata_len);
+
+ bool (*is_connected)(void *priv);
+ unsigned int (*set_timeout)(void *priv, unsigned int timeout);
+
void *priv;
};
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 65fd9a8..28b7f7c 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2334,6 +2334,7 @@ bool cli_is_dos_error(struct cli_state *cli);
NTSTATUS cli_get_nt_error(struct cli_state *cli);
void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
void cli_reset_error(struct cli_state *cli);
+bool cli_state_is_connected(struct cli_state *cli);
/* The following definitions come from libsmb/clifile.c */
@@ -5291,6 +5292,7 @@ NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
struct cli_pipe_auth_data *auth);
unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
unsigned int timeout);
+bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli);
bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
struct cli_pipe_auth_data **presult);
@@ -5384,7 +5386,6 @@ NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
const struct ndr_syntax_id *abstract_syntax,
struct rpc_cli_transport **presult);
struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
-void rpccli_close_np_fd(struct rpc_pipe_client *p);
/* The following definitions come from rpc_client/rpc_transport_smbd.c */
@@ -5421,9 +5422,6 @@ struct cli_state *rpc_pipe_smbd_smb_conn(struct rpc_pipe_client *p);
NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
struct rpc_cli_transport **presult);
-int rpccli_set_sock_timeout(struct rpc_pipe_client *rpccli, int timeout);
-void rpccli_close_sock_fd(struct rpc_pipe_client *rpccli);
-bool rpc_pipe_tcp_connection_ok(struct rpc_pipe_client *rpccli);
/* The following definitions come from rpc_client/cli_samr.c */
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 1ea8033..b9f0024 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -695,6 +695,10 @@ void cli_nt_pipes_close(struct cli_state *cli)
void cli_shutdown(struct cli_state *cli)
{
+ if (cli == NULL) {
+ return;
+ }
+
if (cli->prev == NULL) {
/*
* Possible head of a DFS list,
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 54f8a7a..015afb1 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -359,3 +359,21 @@ void cli_reset_error(struct cli_state *cli)
SSVAL(cli->inbuf,smb_err,0);
}
}
+
+bool cli_state_is_connected(struct cli_state *cli)
+{
+ if (cli == NULL) {
+ return false;
+ }
+
+ if (!cli->initialised) {
+ return false;
+ }
+
+ if (cli->fd == -1) {
+ return false;
+ }
+
+ return true;
+}
+
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 2f84828..ee60c1d 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -3031,33 +3031,40 @@ NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
return status;
}
+#define RPCCLI_DEFAULT_TIMEOUT 10000 /* 10 seconds. */
+
unsigned int rpccli_set_timeout(struct rpc_pipe_client *rpc_cli,
unsigned int timeout)
{
- struct cli_state *cli;
+ unsigned int old;
- if (rpc_cli->transport->transport == NCACN_NP) {
- cli = rpc_pipe_np_smb_conn(rpc_cli);
- if (cli == NULL) {
- return 0;
- }
- return cli_set_timeout(cli, timeout);
+ if (rpc_cli->transport == NULL) {
+ return RPCCLI_DEFAULT_TIMEOUT;
}
- if (rpc_cli->transport->transport == NCACN_IP_TCP ||
- rpc_cli->transport->transport == NCALRPC) {
- return rpccli_set_sock_timeout(rpc_cli, timeout);
+ if (rpc_cli->transport->set_timeout == NULL) {
+ return RPCCLI_DEFAULT_TIMEOUT;
}
- if (rpc_cli->transport->transport == NCACN_INTERNAL) {
- cli = rpc_pipe_smbd_smb_conn(rpc_cli);
- if (!cli) {
- return 0;
- }
- return cli_set_timeout(cli, timeout);
+ old = rpc_cli->transport->set_timeout(rpc_cli->transport->priv, timeout);
+ if (old == 0) {
+ return RPCCLI_DEFAULT_TIMEOUT;
}
- return 0;
+ return old;
+}
+
+bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli)
+{
+ if (rpc_cli == NULL) {
+ return false;
+ }
+
+ if (rpc_cli->transport == NULL) {
+ return false;
+ }
+
+ return rpc_cli->transport->is_connected(rpc_cli->transport->priv);
}
bool rpccli_get_pwd_hash(struct rpc_pipe_client *rpc_cli, uint8_t nt_hash[16])
@@ -3562,14 +3569,14 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
return status;
}
-static int rpc_pipe_client_np_destructor(struct rpc_pipe_client *p)
-{
+struct rpc_pipe_client_np_ref {
struct cli_state *cli;
+ struct rpc_pipe_client *pipe;
+};
- cli = rpc_pipe_np_smb_conn(p);
- if (cli != NULL) {
- DLIST_REMOVE(cli->pipe_list, p);
- }
+static int rpc_pipe_client_np_ref_destructor(struct rpc_pipe_client_np_ref *np_ref)
+{
+ DLIST_REMOVE(np_ref->cli->pipe_list, np_ref->pipe);
return 0;
}
@@ -3592,6 +3599,7 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
{
struct rpc_pipe_client *result;
NTSTATUS status;
+ struct rpc_pipe_client_np_ref *np_ref;
/* sanity check to protect against crashes */
@@ -3630,8 +3638,16 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
result->transport->transport = NCACN_NP;
- DLIST_ADD(cli->pipe_list, result);
- talloc_set_destructor(result, rpc_pipe_client_np_destructor);
+ np_ref = talloc(result->transport, struct rpc_pipe_client_np_ref);
+ if (np_ref == NULL) {
+ TALLOC_FREE(result);
+ return NT_STATUS_NO_MEMORY;
+ }
+ np_ref->cli = cli;
+ np_ref->pipe = result;
+
+ DLIST_ADD(np_ref->cli->pipe_list, np_ref->pipe);
+ talloc_set_destructor(np_ref, rpc_pipe_client_np_ref_destructor);
*presult = result;
return NT_STATUS_OK;
diff --git a/source3/rpc_client/ndr.c b/source3/rpc_client/ndr.c
index 4e8634d..5675878 100644
--- a/source3/rpc_client/ndr.c
+++ b/source3/rpc_client/ndr.c
@@ -183,20 +183,6 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
status = cli_do_rpc_ndr_recv(req, mem_ctx);
- /*
- * NT_STATUS_IO_TIMEOUT indicates network problem,
- * tear the connection apart.
- */
- if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
- if (cli->transport->transport == NCACN_IP_TCP ||
- cli->transport->transport == NCALRPC) {
- rpccli_close_sock_fd(cli);
- }
-
- if (cli->transport->transport == NCACN_NP) {
- rpccli_close_np_fd(cli);
- }
- }
fail:
TALLOC_FREE(frame);
return status;
diff --git a/source3/rpc_client/rpc_transport_np.c b/source3/rpc_client/rpc_transport_np.c
index 1b9c7fc..9d73581 100644
--- a/source3/rpc_client/rpc_transport_np.c
+++ b/source3/rpc_client/rpc_transport_np.c
@@ -28,13 +28,51 @@ struct rpc_transport_np_state {
uint16_t fnum;
};
+static bool rpc_np_is_connected(void *priv)
+{
+ struct rpc_transport_np_state *np_transport = talloc_get_type_abort(
+ priv, struct rpc_transport_np_state);
+ bool ok;
+
+ if (np_transport->cli == NULL) {
+ return false;
+ }
+
+ ok = cli_state_is_connected(np_transport->cli);
+ if (!ok) {
+ np_transport->cli = NULL;
+ return false;
+ }
+
+ return true;
+}
+
+static unsigned int rpc_np_set_timeout(void *priv, unsigned int timeout)
+{
+ struct rpc_transport_np_state *np_transport = talloc_get_type_abort(
+ priv, struct rpc_transport_np_state);
+ bool ok;
+
+ if (np_transport->cli == NULL) {
+ return false;
+ }
+
+ ok = rpc_np_is_connected(np_transport);
+ if (!ok) {
+ return 0;
+ }
+
+ return cli_set_timeout(np_transport->cli, timeout);
+}
+
static int rpc_transport_np_state_destructor(struct rpc_transport_np_state *s)
{
- if (s->cli->fd == -1) {
+ if (!rpc_np_is_connected(s)) {
DEBUG(10, ("socket was closed, no need to send close request.\n"));
return 0;
}
-
+
+ /* TODO: do not use a sync call with a destructor!!! */
if (!NT_STATUS_IS_OK(cli_close(s->cli, s->fnum))) {
DEBUG(1, ("rpc_transport_np_state_destructor: cli_close "
"failed on pipe %s. Error was %s\n", s->pipe_name,
@@ -48,6 +86,7 @@ static int rpc_transport_np_state_destructor(struct rpc_transport_np_state *s)
}
struct rpc_np_write_state {
+ struct rpc_transport_np_state *np_transport;
size_t size;
size_t written;
};
@@ -63,13 +102,23 @@ static struct tevent_req *rpc_np_write_send(TALLOC_CTX *mem_ctx,
priv, struct rpc_transport_np_state);
struct tevent_req *req, *subreq;
struct rpc_np_write_state *state;
+ bool ok;
req = tevent_req_create(mem_ctx, &state, struct rpc_np_write_state);
if (req == NULL) {
return NULL;
}
+
+ ok = rpc_np_is_connected(np_transport);
+ if (!ok) {
+ tevent_req_nterror(req, NT_STATUS_CONNECTION_INVALID);
+ return tevent_req_post(req, ev);
+ }
+
+ state->np_transport = np_transport;
state->size = size;
+
subreq = cli_write_andx_send(mem_ctx, ev, np_transport->cli,
np_transport->fnum,
8, /* 8 means message mode. */
@@ -92,6 +141,7 @@ static void rpc_np_write_done(struct tevent_req *subreq)
status = cli_write_andx_recv(subreq, &state->written);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
+ state->np_transport->cli = NULL;
tevent_req_nterror(req, status);
return;
}
@@ -112,6 +162,7 @@ static NTSTATUS rpc_np_write_recv(struct tevent_req *req, ssize_t *pwritten)
}
struct rpc_np_read_state {
+ struct rpc_transport_np_state *np_transport;
uint8_t *data;
size_t size;
ssize_t received;
@@ -128,11 +179,20 @@ static struct tevent_req *rpc_np_read_send(TALLOC_CTX *mem_ctx,
priv, struct rpc_transport_np_state);
struct tevent_req *req, *subreq;
struct rpc_np_read_state *state;
+ bool ok;
req = tevent_req_create(mem_ctx, &state, struct rpc_np_read_state);
if (req == NULL) {
return NULL;
}
+
+ ok = rpc_np_is_connected(np_transport);
+ if (!ok) {
+ tevent_req_nterror(req, NT_STATUS_CONNECTION_INVALID);
+ return tevent_req_post(req, ev);
+ }
+
+ state->np_transport = np_transport;
state->data = data;
state->size = size;
@@ -170,18 +230,21 @@ static void rpc_np_read_done(struct tevent_req *subreq)
}
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
+ state->np_transport->cli = NULL;
tevent_req_nterror(req, status);
return;
}
if (state->received > state->size) {
TALLOC_FREE(subreq);
+ state->np_transport->cli = NULL;
tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
return;
}
if (state->received == 0) {
TALLOC_FREE(subreq);
+ state->np_transport->cli = NULL;
tevent_req_nterror(req, NT_STATUS_PIPE_BROKEN);
return;
}
@@ -205,7 +268,9 @@ static NTSTATUS rpc_np_read_recv(struct tevent_req *req, ssize_t *preceived)
}
struct rpc_np_trans_state {
+ struct rpc_transport_np_state *np_transport;
uint16_t setup[2];
+ uint32_t max_rdata_len;
uint8_t *rdata;
uint32_t rdata_len;
};
@@ -222,12 +287,22 @@ static struct tevent_req *rpc_np_trans_send(TALLOC_CTX *mem_ctx,
priv, struct rpc_transport_np_state);
struct tevent_req *req, *subreq;
struct rpc_np_trans_state *state;
+ bool ok;
req = tevent_req_create(mem_ctx, &state, struct rpc_np_trans_state);
if (req == NULL) {
return NULL;
}
+ ok = rpc_np_is_connected(np_transport);
+ if (!ok) {
+ tevent_req_nterror(req, NT_STATUS_CONNECTION_INVALID);
+ return tevent_req_post(req, ev);
+ }
+
+ state->np_transport = np_transport;
+ state->max_rdata_len = max_rdata_len;
+
SSVAL(state->setup+0, 0, TRANSACT_DCERPCCMD);
SSVAL(state->setup+1, 0, np_transport->fnum);
@@ -257,10 +332,27 @@ static void rpc_np_trans_done(struct tevent_req *subreq)
status = cli_trans_recv(subreq, state, NULL, NULL, NULL, NULL,
&state->rdata, &state->rdata_len);
TALLOC_FREE(subreq);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_BUFFER_TOO_SMALL)) {
+ status = NT_STATUS_OK;
+ }
if (!NT_STATUS_IS_OK(status)) {
+ state->np_transport->cli = NULL;
tevent_req_nterror(req, status);
return;
}
+
+ if (state->rdata_len > state->max_rdata_len) {
+ state->np_transport->cli = NULL;
+ tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
+ return;
+ }
+
+ if (state->rdata_len == 0) {
+ state->np_transport->cli = NULL;
+ tevent_req_nterror(req, NT_STATUS_PIPE_BROKEN);
+ return;
+ }
+
tevent_req_done(req);
}
@@ -293,6 +385,7 @@ struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
{
struct tevent_req *req, *subreq;
struct rpc_transport_np_init_state *state;
+ bool ok;
req = tevent_req_create(mem_ctx, &state,
struct rpc_transport_np_init_state);
@@ -300,6 +393,12 @@ struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
return NULL;
}
+ ok = cli_state_is_connected(cli);
+ if (!ok) {
+ tevent_req_nterror(req, NT_STATUS_CONNECTION_INVALID);
+ return tevent_req_post(req, ev);
+ }
+
state->transport = talloc(state, struct rpc_cli_transport);
if (tevent_req_nomem(state->transport, req)) {
return tevent_req_post(req, ev);
@@ -365,6 +464,8 @@ NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
state->transport->read_recv = rpc_np_read_recv;
state->transport->trans_send = rpc_np_trans_send;
state->transport->trans_recv = rpc_np_trans_recv;
+ state->transport->is_connected = rpc_np_is_connected;
+ state->transport->set_timeout = rpc_np_set_timeout;
*presult = talloc_move(mem_ctx, &state->transport);
return NT_STATUS_OK;
@@ -412,15 +513,3 @@ struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p)
}
return state->cli;
}
-
-void rpccli_close_np_fd(struct rpc_pipe_client *p)
-{
- struct cli_state *cli = rpc_pipe_np_smb_conn(p);
- if (cli) {
- if (cli->fd != -1) {
- close(cli->fd);
- cli->fd = -1;
- }
- }
- return;
-}
diff --git a/source3/rpc_client/rpc_transport_smbd.c b/source3/rpc_client/rpc_transport_smbd.c
index 929e553..57fac68 100644
--- a/source3/rpc_client/rpc_transport_smbd.c
+++ b/source3/rpc_client/rpc_transport_smbd.c
@@ -419,8 +419,71 @@ NTSTATUS rpc_cli_smbd_conn_init(TALLOC_CTX *mem_ctx,
return status;
}
+static void rpc_smbd_disconnect(struct rpc_transport_smbd_state *transp)
+{
+ if (transp == NULL) {
+ return;
+ }
+
+ if (transp->conn == NULL) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list