summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-08-15 15:45:21 +0200
committerVolker Lendecke <vl@samba.org>2010-08-17 22:44:04 +0200
commit840b0f523b978aa6cb9acbac26023a756afcea81 (patch)
tree7443faa5912357ed24d9e0f9f4a39f54ec45611b /source3
parente65197e56f86fd523516fc3ef577e72877cfab22 (diff)
downloadsamba-840b0f523b978aa6cb9acbac26023a756afcea81.tar.gz
samba-840b0f523b978aa6cb9acbac26023a756afcea81.tar.bz2
samba-840b0f523b978aa6cb9acbac26023a756afcea81.zip
s3: Move read_smb_length() to smbd/reply.c
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/util_sock.c42
-rw-r--r--source3/smbd/reply.c42
3 files changed, 42 insertions, 44 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ebb3432163..8e4c3111b5 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1448,8 +1448,6 @@ bool send_keepalive(int client);
NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
unsigned int timeout,
size_t *len);
-NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
- size_t *len);
NTSTATUS receive_smb_raw(int fd,
char *buffer,
size_t buflen,
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 756ce96abc..3bc60db61e 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -668,48 +668,6 @@ NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
}
/****************************************************************************
- Read 4 bytes of a smb packet and return the smb length of the packet.
- Store the result in the buffer. This version of the function will
- never return a session keepalive (length of zero).
- Timeout is in milliseconds.
-****************************************************************************/
-
-NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
- size_t *len)
-{
- uint8_t msgtype = SMBkeepalive;
-
- while (msgtype == SMBkeepalive) {
- NTSTATUS status;
-
- 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;
- }
-
- msgtype = CVAL(inbuf, 0);
- }
-
- DEBUG(10,("read_smb_length: got smb length of %lu\n",
- (unsigned long)len));
-
- return NT_STATUS_OK;
-}
-
-/****************************************************************************
Read an smb from a fd.
The timeout is in milliseconds.
This function will return on receipt of a session keepalive packet.
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 18d198fe0f..437d4d86dc 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3797,6 +3797,48 @@ void error_to_writebrawerr(struct smb_request *req)
}
/****************************************************************************
+ Read 4 bytes of a smb packet and return the smb length of the packet.
+ Store the result in the buffer. This version of the function will
+ never return a session keepalive (length of zero).
+ Timeout is in milliseconds.
+****************************************************************************/
+
+static NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
+ size_t *len)
+{
+ uint8_t msgtype = SMBkeepalive;
+
+ while (msgtype == SMBkeepalive) {
+ NTSTATUS status;
+
+ 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;
+ }
+
+ msgtype = CVAL(inbuf, 0);
+ }
+
+ DEBUG(10,("read_smb_length: got smb length of %lu\n",
+ (unsigned long)len));
+
+ return NT_STATUS_OK;
+}
+
+/****************************************************************************
Reply to a writebraw (core+ or LANMAN1.0 protocol).
****************************************************************************/