[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-1621-g7101026
Volker Lendecke
vl at samba.org
Wed Jan 23 16:06:06 GMT 2008
The branch, v3-2-test has been updated
via 7101026061c470ed962267b43ac0aa67cc761a64 (commit)
from fd34ce437057bb34cdc37f4b066e424000d36789 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 7101026061c470ed962267b43ac0aa67cc761a64
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jan 23 16:42:31 2008 +0100
read_socket_with_timeout has timeout=0 handling
-----------------------------------------------------------------------
Summary of changes:
source/lib/util_sock.c | 39 +--------------------------------------
source/libsmb/clientgen.c | 8 ++------
source/smbd/process.c | 29 ++++++-----------------------
3 files changed, 9 insertions(+), 67 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
index a3975f6..fb8f415 100644
--- a/source/lib/util_sock.c
+++ b/source/lib/util_sock.c
@@ -1054,44 +1054,7 @@ ssize_t read_socket_with_timeout(int fd,
ssize_t read_data(int fd,char *buffer,size_t N, enum smb_read_errors *pre)
{
- ssize_t ret;
- size_t total=0;
- char addr[INET6_ADDRSTRLEN];
-
- set_smb_read_error(pre,SMB_READ_OK);
-
- while (total < N) {
- ret = sys_read(fd,buffer + total,N - total);
-
- if (ret == 0) {
- DEBUG(10,("read_data: read of %d returned 0. "
- "Error = %s\n",
- (int)(N - total), strerror(errno) ));
- set_smb_read_error(pre,SMB_READ_EOF);
- return 0;
- }
-
- if (ret == -1) {
- if (fd == get_client_fd()) {
- /* Try and give an error message saying
- * what client failed. */
- DEBUG(0,("read_data: read failure for %d "
- "bytes to client %s. Error = %s\n",
- (int)(N - total),
- get_peer_addr(fd,addr,sizeof(addr)),
- strerror(errno) ));
- } else {
- DEBUG(0,("read_data: read failure for %d. "
- "Error = %s\n",
- (int)(N - total),
- strerror(errno) ));
- }
- set_smb_read_error(pre,SMB_READ_ERROR);
- return -1;
- }
- total += ret;
- }
- return (ssize_t)total;
+ return read_socket_with_timeout(fd, buffer, N, N, 0, pre);
}
/****************************************************************************
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index ecef293..042b3bd 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -180,12 +180,8 @@ bool cli_receive_smb(struct cli_state *cli)
ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len)
{
- if (cli->timeout > 0) {
- return read_socket_with_timeout(cli->fd, buffer, len,
- len, cli->timeout, &cli->smb_rw_error);
- } else {
- return read_data(cli->fd, buffer, len, &cli->smb_rw_error);
- }
+ return read_socket_with_timeout(cli->fd, buffer, len, len,
+ cli->timeout, &cli->smb_rw_error);
}
/****************************************************************************
diff --git a/source/smbd/process.c b/source/smbd/process.c
index 6fd4d17..d961f98 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -155,16 +155,8 @@ static ssize_t read_packet_remainder(int fd,
return len;
}
- if (timeout > 0) {
- ret = read_socket_with_timeout(fd,
- buffer,
- len,
- len,
- timeout,
- get_srv_read_error());
- } else {
- ret = read_data(fd, buffer, len, get_srv_read_error());
- }
+ ret = read_socket_with_timeout(fd, buffer, len, len, timeout,
+ get_srv_read_error());
if (ret != len) {
cond_set_smb_read_error(get_srv_read_error(),
@@ -206,19 +198,10 @@ static ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
memcpy(writeX_header, lenbuf, sizeof(lenbuf));
- if (timeout > 0) {
- ret = read_socket_with_timeout(fd,
- writeX_header + 4,
- STANDARD_WRITE_AND_X_HEADER_SIZE,
- STANDARD_WRITE_AND_X_HEADER_SIZE,
- timeout,
- get_srv_read_error());
- } else {
- ret = read_data(fd,
- writeX_header+4,
- STANDARD_WRITE_AND_X_HEADER_SIZE,
- get_srv_read_error());
- }
+ ret = read_socket_with_timeout(fd, writeX_header + 4,
+ STANDARD_WRITE_AND_X_HEADER_SIZE,
+ STANDARD_WRITE_AND_X_HEADER_SIZE,
+ timeout, get_srv_read_error());
if (ret != STANDARD_WRITE_AND_X_HEADER_SIZE) {
cond_set_smb_read_error(get_srv_read_error(),
--
Samba Shared Repository
More information about the samba-cvs
mailing list