1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

r8893: fixed the valgrind error on stream termination due to prototol errors

This commit is contained in:
Andrew Tridgell 2005-08-01 19:48:16 +00:00 committed by Gerald (Jerry) Carter
parent ce9a262d37
commit cf1a7bbe96
2 changed files with 12 additions and 4 deletions

View File

@ -659,7 +659,7 @@ error:
*/
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 @@ static void smbsrv_recv(struct stream_connection *conn, uint16_t flags)
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 @@ static void smbsrv_send(struct stream_connection *conn, uint16_t flags)
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 @@ static void smbsrv_send(struct stream_connection *conn, uint16_t flags)
}
}
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) {

View File

@ -265,6 +265,9 @@ struct smbsrv_connection {
BOOL processing;
/* mark a connection for termination */
BOOL terminate;
/* configuration parameters */
struct {
enum security_types security;