r7527: - added a ldb_search_bytree() interface, which takes a ldb_parse_tree
[sfrench/samba-autobuild/.git] / source / libcli / clireadwrite.c
index dd9f8d44cc3e4287f3e5e832365d6d6251613170..4248ac42860cc8ed11653dacb5ce0ef67c25b468 100644 (file)
 */
 
 #include "includes.h"
+#include "libcli/raw/libcliraw.h"
 
 /****************************************************************************
   Read size bytes at offset offset using SMBreadX.
 ****************************************************************************/
-ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, char *buf, off_t offset, 
+ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, void *_buf, off_t offset, 
                 size_t size)
 {
+       uint8_t *buf = _buf;
        union smb_read parms;
        int readsize;
        ssize_t total = 0;
@@ -42,8 +44,7 @@ ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, char *buf, off_t offset,
         * Set readsize to the maximum size we can handle in one readX,
         * rounded down to a multiple of 1024.
         */
-       readsize = (tree->session->transport->negotiate.max_xmit - 
-                   (MIN_SMB_SIZE+32)) & ~1023;
+       readsize = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32));
        if (readsize > 0xFFFF) readsize = 0xFFFF;
 
        while (total < size) {
@@ -83,11 +84,12 @@ ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, char *buf, off_t offset,
               0x0008 start of message mode named pipe protocol
 ****************************************************************************/
 ssize_t smbcli_write(struct smbcli_tree *tree,
-                 int fnum, uint16_t write_mode,
-                 const char *buf, off_t offset, size_t size)
+                    int fnum, uint16_t write_mode,
+                    const void *_buf, off_t offset, size_t size)
 {
+       const uint8_t *buf = _buf;
        union smb_write parms;
-       int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023;
+       int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32));
        ssize_t total = 0;
 
        if (size == 0) {
@@ -129,8 +131,9 @@ ssize_t smbcli_write(struct smbcli_tree *tree,
   write to a file using a SMBwrite and not bypassing 0 byte writes
 ****************************************************************************/
 ssize_t smbcli_smbwrite(struct smbcli_tree *tree,
-                    int fnum, char *buf, off_t offset, size_t size1)
+                    int fnum, const void *_buf, off_t offset, size_t size1)
 {
+       const uint8_t *buf = _buf;
        union smb_write parms;
        ssize_t total = 0;