summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-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;