s3: Move read_smb_length() to smbd/reply.c
authorVolker Lendecke <vl@samba.org>
Sun, 15 Aug 2010 13:45:21 +0000 (15:45 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 17 Aug 2010 20:44:04 +0000 (22:44 +0200)
source3/include/proto.h
source3/lib/util_sock.c
source3/smbd/reply.c

index ebb34321639465f5b8e3895dbb3248b1d677996f..8e4c3111b5e3d17791829d69022db879f5b291c0 100644 (file)
@@ -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,
index 756ce96abc3d1fe3d42276c9b9a7eda07357252c..3bc60db61e2227769b3084453e3bb33726c16c8c 100644 (file)
@@ -667,48 +667,6 @@ NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
        return NT_STATUS_OK;
 }
 
-/****************************************************************************
- 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.
index 18d198fe0fae53a5c09c2bc4dc892f6c7768e054..437d4d86dc32880d4e85379cda3510e545ab347d 100644 (file)
@@ -3796,6 +3796,48 @@ void error_to_writebrawerr(struct smb_request *req)
        TALLOC_FREE(old_outbuf);
 }
 
+/****************************************************************************
+ 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).
 ****************************************************************************/