Author: metze Date: 2007-04-27 05:45:53 +0000 (Fri, 27 Apr 2007) New Revision: 22528
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22528 Log: remember that the connection was marked dead and don't allow sending packet over the broken connection, as we would segfault... metze Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c Changeset: Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c =================================================================== --- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c 2007-04-26 17:36:19 UTC (rev 22527) +++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c 2007-04-27 05:45:53 UTC (rev 22528) @@ -31,6 +31,7 @@ uint16_t fnum; struct smbcli_tree *tree; const char *server_name; + bool dead; }; @@ -39,6 +40,14 @@ */ 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(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 @@ 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 @@ 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); Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c =================================================================== --- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c 2007-04-26 17:36:19 UTC (rev 22527) +++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c 2007-04-27 05:45:53 UTC (rev 22528) @@ -33,6 +33,7 @@ struct smb2_handle handle; struct smb2_tree *tree; const char *server_name; + bool dead; }; @@ -41,6 +42,14 @@ */ 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(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 @@ 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 @@ 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;