Author: tridge Date: 2005-08-01 19:48:16 +0000 (Mon, 01 Aug 2005) New Revision: 8893
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8893 Log: fixed the valgrind error on stream termination due to prototol errors Modified: branches/SAMBA_4_0/source/smb_server/smb_server.c branches/SAMBA_4_0/source/smb_server/smb_server.h Changeset: Modified: branches/SAMBA_4_0/source/smb_server/smb_server.c =================================================================== --- branches/SAMBA_4_0/source/smb_server/smb_server.c 2005-08-01 19:47:57 UTC (rev 8892) +++ branches/SAMBA_4_0/source/smb_server/smb_server.c 2005-08-01 19:48:16 UTC (rev 8893) @@ -659,7 +659,7 @@ */ void smbsrv_terminate_connection(struct smbsrv_connection *smb_conn, const char *reason) { - stream_terminate_connection(smb_conn->connection, reason); + smb_conn->terminate = True; } /* @@ -684,10 +684,10 @@ smb_conn->processing = True; status = receive_smb_request(smb_conn); smb_conn->processing = False; - if (NT_STATUS_IS_ERR(status)) { + if (NT_STATUS_IS_ERR(status) || smb_conn->terminate) { talloc_free(conn->event.fde); conn->event.fde = NULL; - smbsrv_terminate_connection(smb_conn, nt_errstr(status)); + stream_terminate_connection(smb_conn->connection, nt_errstr(status)); return; } @@ -717,7 +717,7 @@ status = socket_send(conn->socket, &blob, &sendlen, 0); if (NT_STATUS_IS_ERR(status)) { smbsrv_terminate_connection(req->smb_conn, nt_errstr(status)); - return; + break; } if (sendlen == 0) { break; @@ -733,6 +733,11 @@ } } + if (smb_conn->terminate) { + stream_terminate_connection(smb_conn->connection, "send termination"); + return; + } + /* if no more requests are pending to be sent then we should stop select for write */ if (smb_conn->pending_send == NULL) { Modified: branches/SAMBA_4_0/source/smb_server/smb_server.h =================================================================== --- branches/SAMBA_4_0/source/smb_server/smb_server.h 2005-08-01 19:47:57 UTC (rev 8892) +++ branches/SAMBA_4_0/source/smb_server/smb_server.h 2005-08-01 19:48:16 UTC (rev 8893) @@ -265,6 +265,9 @@ BOOL processing; + /* mark a connection for termination */ + BOOL terminate; + /* configuration parameters */ struct { enum security_types security;
