1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

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 738b2c7411)
This commit is contained in:
Stefan Metzmacher 2007-04-27 05:45:53 +00:00 committed by Gerald (Jerry) Carter
parent 78db3d4307
commit 42b133748f
2 changed files with 41 additions and 0 deletions

View File

@ -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);

View File

@ -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;