summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-25 21:02:52 +0100
committerVolker Lendecke <vl@samba.org>2008-02-02 11:03:21 +0100
commit3e5b98555b832772d6fe93a57005bc39222a5189 (patch)
tree3a69a1ef7e18e41be0ff39744ef53693129b7217 /source3
parent3f970f91c2af77acd531c37ee3aa1a09ca71e7ab (diff)
downloadsamba-3e5b98555b832772d6fe93a57005bc39222a5189.tar.gz
samba-3e5b98555b832772d6fe93a57005bc39222a5189.tar.bz2
samba-3e5b98555b832772d6fe93a57005bc39222a5189.zip
Convert read_smb_length_return_keepalive to read_socket_with_timeout_ntstatus
(This used to be commit 59e8f22f36be5a70fdb101964570ce7c10e8ff65)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_sock.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index f61cdb151e..d32d67f2fc 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1146,10 +1146,27 @@ ssize_t read_smb_length_return_keepalive(int fd,
unsigned int timeout,
enum smb_read_errors *pre)
{
- ssize_t len=0;
+ size_t len=0;
int msg_type;
+ NTSTATUS status;
+
+ set_smb_read_error(pre, SMB_READ_OK);
+
+ status = read_socket_with_timeout_ntstatus(fd, inbuf, 4, 4, timeout,
+ NULL);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
+ set_smb_read_error(pre, SMB_READ_EOF);
+ return -1;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ set_smb_read_error(pre, SMB_READ_TIMEOUT);
+ return -1;
+ }
- if (read_socket_with_timeout(fd, inbuf, 4, 4, timeout, pre) != 4) {
+ set_smb_read_error(pre, SMB_READ_ERROR);
return -1;
}