From 1f0afe1aed5cc267c3c24322992bfcb7c82847b1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 15 Aug 2010 15:36:28 +0200 Subject: s3: Lift smbd_server_fd() from read_smb_length_return_keepalive --- source3/lib/util_sock.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'source3/lib/util_sock.c') diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 74a3e343ac..9950a416f5 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -652,18 +652,6 @@ NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf, status = read_fd_with_timeout(fd, inbuf, 4, 4, timeout, NULL); if (!NT_STATUS_IS_OK(status)) { - if (fd == smbd_server_fd()) { - char addr[INET6_ADDRSTRLEN]; - /* Try and give an error message - * saying what client failed. */ - DEBUG(0, ("read_fd_with_timeout failed for " - "client %s read error = %s.\n", - get_peer_addr(fd,addr,sizeof(addr)), - nt_errstr(status))); - } else { - DEBUG(0, ("read_fd_with_timeout failed, read error = " - "%s.\n", nt_errstr(status))); - } return status; } @@ -697,6 +685,18 @@ NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout, status = read_smb_length_return_keepalive(fd, inbuf, timeout, len); if (!NT_STATUS_IS_OK(status)) { + if (fd == smbd_server_fd()) { + char addr[INET6_ADDRSTRLEN]; + /* Try and give an error message + * saying what client failed. */ + DEBUG(0, ("read_fd_with_timeout failed for " + "client %s read error = %s.\n", + get_peer_addr(fd,addr,sizeof(addr)), + nt_errstr(status))); + } else { + DEBUG(0, ("read_fd_with_timeout failed, read " + "error = %s.\n", nt_errstr(status))); + } return status; } @@ -727,7 +727,18 @@ NTSTATUS receive_smb_raw(int fd, char *buffer, size_t buflen, unsigned int timeo status = read_smb_length_return_keepalive(fd,buffer,timeout,&len); if (!NT_STATUS_IS_OK(status)) { - DEBUG(10, ("receive_smb_raw: %s!\n", nt_errstr(status))); + if (fd == smbd_server_fd()) { + char addr[INET6_ADDRSTRLEN]; + /* Try and give an error message + * saying what client failed. */ + DEBUG(0, ("read_fd_with_timeout failed for " + "client %s read error = %s.\n", + get_peer_addr(fd,addr,sizeof(addr)), + nt_errstr(status))); + } else { + DEBUG(0, ("read_fd_with_timeout failed, read " + "error = %s.\n", nt_errstr(status))); + } return status; } -- cgit