summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-04-27 05:45:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:38 -0500
commit42b133748f67392116e98202b5e7b3285c803ea3 (patch)
treefb484e314a528cc43ba7869b6419f88c4f0c3c3d
parent78db3d4307761452ef58dea4584fe29799f76522 (diff)
downloadsamba-42b133748f67392116e98202b5e7b3285c803ea3.tar.gz
samba-42b133748f67392116e98202b5e7b3285c803ea3.tar.bz2
samba-42b133748f67392116e98202b5e7b3285c803ea3.zip
r22528: remember that the connection was marked dead and don't
allow sending packet over the broken connection, as we would segfault... metze (This used to be commit 738b2c74117bdbef3b314c37f01f2f73b7a80685)
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c21
-rw-r--r--source4/librpc/rpc/dcerpc_smb2.c20
2 files changed, 41 insertions, 0 deletions
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index 5100eb60f2..3f35eae8f1 100644
--- a/source4/librpc/rpc/dcerpc_smb.c
+++ b/source4/librpc/rpc/dcerpc_smb.c
@@ -31,6 +31,7 @@ struct smb_private {
uint16_t fnum;
struct smbcli_tree *tree;
const char *server_name;
+ bool dead;
};
@@ -39,6 +40,14 @@ struct smb_private {
*/
static void pipe_dead(struct dcerpc_connection *c, NTSTATUS status)
{
+ struct smb_private *smb = c->transport.private;
+
+ smb->dead = true;
+
+ if (smb->dead) {
+ return;
+ }
+
if (NT_STATUS_EQUAL(NT_STATUS_UNSUCCESSFUL, status)) {
status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
}
@@ -189,6 +198,12 @@ static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLO
*/
static NTSTATUS send_read_request(struct dcerpc_connection *c)
{
+ struct smb_private *smb = c->transport.private;
+
+ if (smb->dead) {
+ return NT_STATUS_CONNECTION_DISCONNECTED;
+ }
+
return send_read_request_continue(c, NULL);
}
@@ -302,6 +317,10 @@ static NTSTATUS smb_send_request(struct dcerpc_connection *c, DATA_BLOB *blob, B
union smb_write io;
struct smbcli_request *req;
+ if (smb->dead) {
+ return NT_STATUS_CONNECTION_DISCONNECTED;
+ }
+
if (trigger_read) {
return smb_send_trans_request(c, blob);
}
@@ -505,6 +524,8 @@ static void pipe_open_recv(struct smbcli_request *req)
smb->server_name= strupper_talloc(smb,
state->tree->session->transport->called.name);
if (composite_nomem(smb->server_name, ctx)) return;
+ smb->dead = false;
+
c->transport.private = smb;
composite_done(ctx);
diff --git a/source4/librpc/rpc/dcerpc_smb2.c b/source4/librpc/rpc/dcerpc_smb2.c
index 385cb00919..15605c21da 100644
--- a/source4/librpc/rpc/dcerpc_smb2.c
+++ b/source4/librpc/rpc/dcerpc_smb2.c
@@ -33,6 +33,7 @@ struct smb2_private {
struct smb2_handle handle;
struct smb2_tree *tree;
const char *server_name;
+ bool dead;
};
@@ -41,6 +42,14 @@ struct smb2_private {
*/
static void pipe_dead(struct dcerpc_connection *c, NTSTATUS status)
{
+ struct smb2_private *smb = c->transport.private;
+
+ smb->dead = true;
+
+ if (smb->dead) {
+ return;
+ }
+
if (NT_STATUS_EQUAL(NT_STATUS_UNSUCCESSFUL, status)) {
status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
}
@@ -183,6 +192,12 @@ static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLO
*/
static NTSTATUS send_read_request(struct dcerpc_connection *c)
{
+ struct smb2_private *smb = c->transport.private;
+
+ if (smb->dead) {
+ return NT_STATUS_CONNECTION_DISCONNECTED;
+ }
+
return send_read_request_continue(c, NULL);
}
@@ -287,6 +302,10 @@ static NTSTATUS smb2_send_request(struct dcerpc_connection *c, DATA_BLOB *blob,
struct smb2_write io;
struct smb2_request *req;
+ if (smb->dead) {
+ return NT_STATUS_CONNECTION_DISCONNECTED;
+ }
+
if (trigger_read) {
return smb2_send_trans_request(c, blob);
}
@@ -461,6 +480,7 @@ static void pipe_open_recv(struct smb2_request *req)
smb->server_name= strupper_talloc(smb,
tree->session->transport->socket->hostname);
if (composite_nomem(smb->server_name, ctx)) return;
+ smb->dead = false;
c->transport.private = smb;