summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc_smb.c
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 /source4/librpc/rpc/dcerpc_smb.c
parent78db3d4307761452ef58dea4584fe29799f76522 (diff)
downloadsamba-42b133748f67392116e98202b5e7b3285c803ea3.tar.gz
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)
Diffstat (limited to 'source4/librpc/rpc/dcerpc_smb.c')
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index 5100eb60f2f..3f35eae8f1e 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);