r4063: - change char * -> uint8_t in struct request_buffer
authorStefan Metzmacher <metze@samba.org>
Sat, 4 Dec 2004 13:56:25 +0000 (13:56 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:06:21 +0000 (13:06 -0500)
- change smbcli_read/write to take void * for the buffers to match read(2)/write(2)

all this fixes a lot of gcc-4 warnings

metze
(This used to be commit b94f92bc6637f748d6f7049f4f9a30b0b8d18a7a)

39 files changed:
source4/client/client.c
source4/include/request.h
source4/include/smb_interfaces.h
source4/lib/messaging/messaging.c
source4/lib/time.c
source4/libcli/climessage.c
source4/libcli/clireadwrite.c
source4/libcli/raw/clisession.c
source4/libcli/raw/clisocket.c
source4/libcli/raw/clitransport.c
source4/libcli/raw/clitree.c
source4/libcli/raw/rawdate.c
source4/libcli/raw/rawfile.c
source4/libcli/raw/rawnegotiate.c
source4/libcli/raw/rawrequest.c
source4/libcli/raw/rawsearch.c
source4/libcli/raw/rawtrans.c
source4/libcli/raw/smb_signing.c
source4/libcli/util/smbencrypt.c
source4/smb_server/negprot.c
source4/smb_server/nttrans.c
source4/smb_server/reply.c
source4/smb_server/request.c
source4/smb_server/search.c
source4/smb_server/smb_server.c
source4/smb_server/srvtime.c
source4/torture/basic/aliases.c
source4/torture/basic/denytest.c
source4/torture/basic/locking.c
source4/torture/basic/utable.c
source4/torture/nbench/nbio.c
source4/torture/raw/context.c
source4/torture/raw/lock.c
source4/torture/raw/open.c
source4/torture/raw/read.c
source4/torture/raw/seek.c
source4/torture/raw/streams.c
source4/torture/raw/write.c
source4/torture/torture.c

index dae24ce9278282ec8d7432640e7ed04ba0ae1914..f17586f994a10ce5ee5724bcfb8bee9dcfab5ba6 100644 (file)
@@ -138,8 +138,9 @@ void dos_clean_name(char *s)
 write to a local file with CR/LF->LF translation if appropriate. return the 
 number taken from the buffer. This may not equal the number written.
 ****************************************************************************/
-static int writefile(int f, char *b, int n)
+static int writefile(int f, const void *_b, int n)
 {
+       const uint8_t *b = _b;
        int i;
 
        if (!translation) {
@@ -165,8 +166,9 @@ static int writefile(int f, char *b, int n)
   read from a file with LF->CR/LF translation if appropriate. return the 
   number read. read approx n bytes.
 ****************************************************************************/
-static int readfile(char *b, int n, XFILE *f)
+static int readfile(void *_b, int n, XFILE *f)
 {
+       uint8_t *b = _b;
        int i;
        int c;
 
@@ -719,7 +721,7 @@ static int do_get(char *rname, const char *lname, BOOL reget)
 {  
        int handle = 0, fnum;
        BOOL newhandle = False;
-       char *data;
+       uint8_t *data;
        struct timeval tp_start;
        int read_size = io_bufsize;
        uint16_t attr;
@@ -775,7 +777,7 @@ static int do_get(char *rname, const char *lname, BOOL reget)
        DEBUG(2,("getting file %s of size %.0f as %s ", 
                 rname, (double)size, lname));
 
-       if(!(data = (char *)malloc(read_size))) { 
+       if(!(data = (uint8_t *)malloc(read_size))) { 
                d_printf("malloc fail for size %d\n", read_size);
                smbcli_close(cli->tree, fnum);
                return 1;
@@ -1149,7 +1151,7 @@ static int do_put(char *rname, char *lname, BOOL reput)
        XFILE *f;
        size_t start = 0;
        off_t nread = 0;
-       char *buf = NULL;
+       uint8_t *buf = NULL;
        int maxwrite = io_bufsize;
        int rc = 0;
        
@@ -1202,7 +1204,7 @@ static int do_put(char *rname, char *lname, BOOL reput)
        DEBUG(1,("putting file %s as %s ",lname,
                 rname));
   
-       buf = (char *)malloc(maxwrite);
+       buf = (uint8_t *)malloc(maxwrite);
        if (!buf) {
                d_printf("ERROR: Not enough memory!\n");
                return 1;
index fc5fa8442acabc22d9527f3b646451b439ffe354..587adeef21b655be1265b999267dbf3e4c4e593b 100644 (file)
@@ -29,7 +29,7 @@
 
 struct request_buffer {
        /* the raw SMB buffer, including the 4 byte length header */
-       char *buffer;
+       uint8_t *buffer;
        
        /* the size of the raw buffer, including 4 byte header */
        uint_t size;
@@ -40,15 +40,15 @@ struct request_buffer {
        uint_t allocated;
        
        /* the start of the SMB header - this is always buffer+4 */
-       char *hdr;
+       uint8_t *hdr;
        
        /* the command words and command word count. vwv points
           into the raw buffer */
-       char *vwv;
+       uint8_t *vwv;
        uint_t wct;
        
        /* the data buffer and size. data points into the raw buffer */
-       char *data;
+       uint8_t *data;
        uint_t data_size;
        
        /* ptr is used as a moving pointer into the data area
@@ -56,7 +56,7 @@ struct request_buffer {
         * variable in each function is that when a realloc of
         * a send packet is done we need to move this
         * pointer */
-       char *ptr;
+       uint8_t *ptr;
 };
 
 #endif
index bc5c43f59a66481fc7195a35267edac67686341b..4b767c8d70be7aff74c609744dea730ffa64ca95 100644 (file)
@@ -1275,7 +1275,7 @@ union smb_read {
                        uint16_t remaining;
                } in;
                struct {
-                       char *data;
+                       uint8_t *data;
                        uint16_t remaining;
                        uint16_t compaction_mode;
                        uint16_t nread;
@@ -1294,7 +1294,7 @@ union smb_read {
                        uint32_t  timeout;
                } in;
                struct {
-                       char *data;
+                       uint8_t *data;
                        uint32_t nread;
                } out;
        } readbraw;
@@ -1311,7 +1311,7 @@ union smb_read {
                        uint16_t remaining;
                } in;
                struct {
-                       char *data;
+                       uint8_t *data;
                        uint16_t nread;
                } out;
        } lockread;
@@ -1327,7 +1327,7 @@ union smb_read {
                        uint16_t remaining;
                } in;
                struct {
-                       char *data;
+                       uint8_t *data;
                        uint16_t nread;
                } out;
        } read;
@@ -1353,7 +1353,7 @@ union smb_write {
                        uint16_t wmode;
                        uint16_t remaining;
                        uint32_t count;
-                       const char *data;
+                       const uint8_t *data;
                } in;
                struct {
                        uint32_t nwritten;
@@ -1370,7 +1370,7 @@ union smb_write {
                        uint16_t count;
                        uint32_t offset;
                        uint16_t remaining;
-                       const char *data;
+                       const uint8_t *data;
                } in;
                struct {
                        uint32_t nwritten;
@@ -1386,7 +1386,7 @@ union smb_write {
                        uint16_t count;
                        uint32_t offset;
                        uint16_t remaining;
-                       const char *data;
+                       const uint8_t *data;
                } in;
                struct {
                        uint16_t nwritten;
@@ -1402,7 +1402,7 @@ union smb_write {
                        uint16_t count;
                        uint32_t offset;
                        time_t mtime;
-                       const char *data;
+                       const uint8_t *data;
                } in;
                struct {
                        uint16_t nwritten;
@@ -1416,7 +1416,7 @@ union smb_write {
                struct {
                        uint16_t fnum;
                        uint16_t count;
-                       const char *data;
+                       const uint8_t *data;
                } in;
        } splwrite;
 };
index 041554a7c04a52a68add8745e89164242427a84a..6975f45c8e07977a7f874e72715d7dd5aa59ff70 100644 (file)
@@ -285,7 +285,7 @@ static void messaging_send_handler(struct event_context *ev, struct fd_event *fd
                size_t nsent;
                DATA_BLOB blob;
 
-               blob.data = rec->ndone + (char *)&rec->header;
+               blob.data = rec->ndone + (uint8_t *)&rec->header;
                blob.length = sizeof(rec->header) - rec->ndone;
 
                status = socket_send(rec->sock, &blob, &nsent, 0);
index 8d477fac02e221d29afb44858d9b3f1b81014b87..504b5d6ac3194c3d3be17cc71c2c0b0bf16a2015 100644 (file)
@@ -164,7 +164,7 @@ static uint32_t make_dos_date(time_t unixdate, int zone_offset)
 put a dos date into a buffer (time/date format)
 This takes GMT time and puts local time in the buffer
 ********************************************************************/
-void push_dos_date(char *buf, int offset, time_t unixdate, int zone_offset)
+void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset)
 {
        uint32_t x = make_dos_date(unixdate, zone_offset);
        SIVAL(buf,offset,x);
@@ -174,7 +174,7 @@ void push_dos_date(char *buf, int offset, time_t unixdate, int zone_offset)
 put a dos date into a buffer (date/time format)
 This takes GMT time and puts local time in the buffer
 ********************************************************************/
-void push_dos_date2(char *buf,int offset,time_t unixdate, int zone_offset)
+void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
 {
        uint32_t x;
        x = make_dos_date(unixdate, zone_offset);
@@ -187,7 +187,7 @@ put a dos 32 bit "unix like" date into a buffer. This routine takes
 GMT and converts it to LOCAL time before putting it (most SMBs assume
 localtime for this sort of date)
 ********************************************************************/
-void push_dos_date3(char *buf,int offset,time_t unixdate, int zone_offset)
+void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
 {
        if (!null_time(unixdate)) {
                unixdate -= zone_offset;
@@ -354,7 +354,7 @@ const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt)
 /*
   put a NTTIME into a packet
 */
-void push_nttime(void *base, uint16_t offset, NTTIME t)
+void push_nttime(uint8_t *base, uint16_t offset, NTTIME t)
 {
        SBVAL(base, offset,   t);
 }
@@ -362,7 +362,7 @@ void push_nttime(void *base, uint16_t offset, NTTIME t)
 /*
   pull a NTTIME from a packet
 */
-NTTIME pull_nttime(void *base, uint16_t offset)
+NTTIME pull_nttime(uint8_t *base, uint16_t offset)
 {
        NTTIME ret = BVAL(base, offset);
        return ret;
index 7e3a50b842805a99af4d77484a9258b22621aa79..113b752e8be05065d9ba2b989a89736424c29938 100644 (file)
@@ -58,7 +58,7 @@ BOOL smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
        req = smbcli_request_setup(tree, SMBsendtxt, 1, 0);
        SSVAL(req->out.vwv, VWV(0), grp);
 
-       smbcli_req_append_bytes(req, msg, len);
+       smbcli_req_append_bytes(req, (const uint8_t *)msg, len);
 
        if (!smbcli_request_send(req) || 
            !smbcli_request_receive(req) ||
index 6b6cb2f2a2daa7cfa4a9362a29c838eb3ae22da0..4248ac42860cc8ed11653dacb5ce0ef67c25b468 100644 (file)
 /****************************************************************************
   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;
@@ -84,8 +85,9 @@ ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, char *buf, off_t offset,
 ****************************************************************************/
 ssize_t smbcli_write(struct smbcli_tree *tree,
                     int fnum, uint16_t write_mode,
-                    const uint8_t *buf, off_t offset, size_t size)
+                    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));
        ssize_t total = 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;
 
index c92e3ecb0b963266d67d4095ea572b1965aca806..7d2b7ad9b8c5c9852838e3450234e24d40e98b6f 100644 (file)
@@ -156,7 +156,7 @@ NTSTATUS smb_raw_session_setup_recv(struct smbcli_request *req,
                                    union smb_sesssetup *parms) 
 {
        uint16_t len;
-       char *p;
+       uint8_t *p;
 
        if (!smbcli_request_receive(req)) {
                return smbcli_request_destroy(req);
index 349b4b9a9ccbbd3bca7b4fe6e87e5247a1318591..fb9afeab81b3016b0918ec3ae4667085b35b9e08 100644 (file)
@@ -109,7 +109,7 @@ void smbcli_sock_set_options(struct smbcli_socket *sock, const char *options)
 /****************************************************************************
  Write to socket. Return amount written.
 ****************************************************************************/
-ssize_t smbcli_sock_write(struct smbcli_socket *sock, const char *data, size_t len)
+ssize_t smbcli_sock_write(struct smbcli_socket *sock, const uint8_t *data, size_t len)
 {
        NTSTATUS status;
        DATA_BLOB blob;
@@ -135,7 +135,7 @@ ssize_t smbcli_sock_write(struct smbcli_socket *sock, const char *data, size_t l
 /****************************************************************************
  Read from socket. return amount read
 ****************************************************************************/
-ssize_t smbcli_sock_read(struct smbcli_socket *sock, char *data, size_t len)
+ssize_t smbcli_sock_read(struct smbcli_socket *sock, uint8_t *data, size_t len)
 {
        NTSTATUS status;
        size_t nread;
index 52cb4d8beb50ea26f2aeed28472db29723ea0446..0af6df33b2fb2babfd304e0f9c2f0ed9923bf2f7 100644 (file)
@@ -156,7 +156,7 @@ BOOL smbcli_transport_connect(struct smbcli_transport *transport,
                           struct nmb_name *calling, 
                           struct nmb_name *called)
 {
-       char *p;
+       uint8_t *p;
        int len = NBT_HDR_SIZE;
        struct smbcli_request *req;
 
@@ -174,13 +174,13 @@ BOOL smbcli_transport_connect(struct smbcli_transport *transport,
 
        /* put in the destination name */
        p = req->out.buffer + NBT_HDR_SIZE;
-       name_mangle(called->name, p, called->name_type);
-       len += name_len(p);
+       name_mangle(called->name, (char *)p, called->name_type);
+       len += name_len((char *)p);
 
        /* and my name */
        p = req->out.buffer+len;
-       name_mangle(calling->name, p, calling->name_type);
-       len += name_len(p);
+       name_mangle(calling->name, (char *)p, calling->name_type);
+       len += name_len((char *)p);
 
        _smb_setlen(req->out.buffer,len-4);
        SCVAL(req->out.buffer,0,0x81);
index daa85490990b008936341d4240ca08efb501eb5e..b9d0ffbc1f9bfced13c6526741f29376f65c0586 100644 (file)
@@ -85,7 +85,7 @@ struct smbcli_request *smb_tree_connect_send(struct smbcli_tree *tree, union smb
 ****************************************************************************/
 NTSTATUS smb_tree_connect_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
 {
-       char *p;
+       uint8_t *p;
 
        if (!smbcli_request_receive(req) ||
            smbcli_request_is_error(req)) {
index db18a7a194cfed9a4c8174f2369c7669696a47b6..894eb53528fe6a79cd8e0bcd64189d292ad84047 100644 (file)
@@ -38,7 +38,7 @@ put a dos date into a buffer (date/time format)
 This takes GMT time and puts local time in the buffer
 ********************************************************************/
 void raw_push_dos_date2(struct smbcli_transport *transport,
-                      char *buf, int offset, time_t unixdate)
+                      uint8_t *buf, int offset, time_t unixdate)
 {
        push_dos_date2(buf, offset, unixdate, transport->negotiate.server_zone);
 }
@@ -48,7 +48,7 @@ put a dos 32 bit "unix like" date into a buffer. This routine takes
 GMT and converts it to LOCAL time in zone_offset before putting it
 ********************************************************************/
 void raw_push_dos_date3(struct smbcli_transport *transport,
-                      char *buf, int offset, time_t unixdate)
+                      uint8_t *buf, int offset, time_t unixdate)
 {
        push_dos_date3(buf, offset, unixdate, transport->negotiate.server_zone);
 }
index 69b8c6a07c4c9c08741f0dfe25e20b3b0c5db407..028d8734e1970528a53d8f58b953b68a878079c5 100644 (file)
@@ -702,7 +702,7 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc
                /* copy in all the locks */
                lockp = &parms->lockx.in.locks[0];
                for (i = 0; i < lock_count; i++) {
-                       char *p = req->out.data + lck_size * i;
+                       uint8_t *p = req->out.data + lck_size * i;
                        SSVAL(p, 0, lockp[i].pid);
                        if (parms->lockx.in.mode & LOCKING_ANDX_LARGE_FILES) {
                                SSVAL(p,  2, 0); /* reserved */
index 4f7d7b4058d3bb9a4e123cd1625ae0c0da97d2f9..a8cf603d46f9b879121a43af633aeada2fdd2889 100644 (file)
@@ -70,7 +70,7 @@ struct smbcli_request *smb_negprot_send(struct smbcli_transport *transport, int
 
        /* setup the protocol strings */
        for (i=0; i < ARRAY_SIZE(prots) && prots[i].prot <= maxprotocol; i++) {
-               smbcli_req_append_bytes(req, "\2", 1);
+               smbcli_req_append_bytes(req, (const uint8_t *)"\2", 1);
                smbcli_req_append_string(req, prots[i].name, STR_TERMINATE | STR_ASCII);
        }
 
index b56bfa9a3c99695d3858c4b29a5e857ccd14efad..7aa07bef416340c1ad55c76b2827e724a5b35ace 100644 (file)
@@ -187,7 +187,7 @@ struct smbcli_request *smbcli_request_setup(struct smbcli_tree *tree,
 static void smbcli_req_grow_allocation(struct smbcli_request *req, uint_t new_size)
 {
        int delta;
-       char *buf2;
+       uint8_t *buf2;
 
        delta = new_size - req->out.data_size;
        if (delta + req->out.size <= req->out.allocated) {
@@ -295,7 +295,7 @@ BOOL smbcli_request_receive_more(struct smbcli_request *req)
   handle oplock break requests from the server - return True if the request was
   an oplock break
 */
-BOOL handle_oplock_break(struct smbcli_transport *transport, uint_t len, const char *hdr, const char *vwv)
+BOOL handle_oplock_break(struct smbcli_transport *transport, uint_t len, const uint8_t *hdr, const uint8_t *vwv)
 {
        /* we must be very fussy about what we consider an oplock break to avoid
           matching readbraw replies */
@@ -479,7 +479,7 @@ size_t smbcli_req_append_var_block(struct smbcli_request *req, const uint8_t *by
   of bytes consumed in the packet is returned
 */
 static size_t smbcli_req_pull_ucs2(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
-                               char **dest, const char *src, int byte_len, uint_t flags)
+                               char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2, alignment=0;
        ssize_t ret;
@@ -532,7 +532,7 @@ static size_t smbcli_req_pull_ucs2(struct smbcli_request *req, TALLOC_CTX *mem_c
   of bytes consumed in the packet is returned
 */
 size_t smbcli_req_pull_ascii(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
-                            char **dest, const char *src, int byte_len, uint_t flags)
+                            char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2;
        ssize_t ret;
@@ -545,7 +545,7 @@ size_t smbcli_req_pull_ascii(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
        if (byte_len != -1 && src_len > byte_len) {
                src_len = byte_len;
        }
-       src_len2 = strnlen(src, src_len);
+       src_len2 = strnlen((const char *)src, src_len);
        if (src_len2 < src_len - 1) {
                /* include the termination if we didn't reach the end of the packet */
                src_len2++;
@@ -575,7 +575,7 @@ size_t smbcli_req_pull_ascii(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
   of bytes consumed in the packet is returned
 */
 size_t smbcli_req_pull_string(struct smbcli_request *req, TALLOC_CTX *mem_ctx, 
-                          char **dest, const char *src, int byte_len, uint_t flags)
+                          char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        if (!(flags & STR_ASCII) && 
            (((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) {
@@ -592,7 +592,7 @@ size_t smbcli_req_pull_string(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
 
   if byte_len is -1 then limit the blob only by packet size
 */
-DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx, const char *src, int byte_len)
+DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx, const uint8_t *src, int byte_len)
 {
        int src_len;
 
@@ -611,7 +611,7 @@ DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
 
 /* check that a lump of data in a request is within the bounds of the data section of
    the packet */
-static BOOL smbcli_req_data_oob(struct smbcli_request *req, const char *ptr, uint32_t count)
+static BOOL smbcli_req_data_oob(struct smbcli_request *req, const uint8_t *ptr, uint32_t count)
 {
        /* be careful with wraparound! */
        if (ptr < req->in.data ||
@@ -628,7 +628,7 @@ static BOOL smbcli_req_data_oob(struct smbcli_request *req, const char *ptr, uin
 
   return False if any part is outside the data portion of the packet
 */
-BOOL smbcli_raw_pull_data(struct smbcli_request *req, const char *src, int len, char *dest)
+BOOL smbcli_raw_pull_data(struct smbcli_request *req, const uint8_t *src, int len, uint8_t *dest)
 {
        if (len == 0) return True;
 
@@ -673,14 +673,14 @@ NTTIME smbcli_pull_nttime(void *base, uint16_t offset)
 */
 static size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
                                 DATA_BLOB *blob, const char **dest, 
-                                const char *src, int byte_len, uint_t flags)
+                                const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2, alignment=0;
        ssize_t ret;
        char *dest2;
 
-       if (src < (const char *)blob->data ||
-           src >= (const char *)(blob->data + blob->length)) {
+       if (src < blob->data ||
+           src >= (blob->data + blob->length)) {
                *dest = NULL;
                return 0;
        }
@@ -729,7 +729,7 @@ static size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
 */
 static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
                                  DATA_BLOB *blob, const char **dest, 
-                                 const char *src, int byte_len, uint_t flags)
+                                 const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2;
        ssize_t ret;
@@ -743,7 +743,7 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
        if (byte_len != -1 && src_len > byte_len) {
                src_len = byte_len;
        }
-       src_len2 = strnlen(src, src_len);
+       src_len2 = strnlen((const char *)src, src_len);
 
        if (src_len2 < src_len - 1) {
                /* include the termination if we didn't reach the end of the packet */
index 4907eec70a8c81adc465d480dc39d400734df791..d55a47ca265e95fc0bb925a847ae17fd9d8ed40d 100644 (file)
@@ -33,7 +33,7 @@ static void smb_raw_search_backend(struct smbcli_request *req,
 {
        union smb_search_data search_data;
        int i;
-       char *p;
+       uint8_t *p;
 
        if (req->in.data_size < 3 + count*43) {
                req->status = NT_STATUS_INVALID_PARAMETER;
index 371f50410dec64b2f18adec4225e15a3a1e28adc..fb8ab4203f80d9fdc56a8955736a40ba77a0258a 100644 (file)
@@ -29,7 +29,7 @@
 static BOOL raw_trans_oob(struct smbcli_request *req,
                          uint_t offset, uint_t count)
 {
-       char *ptr;
+       uint8_t *ptr;
 
        if (count == 0) {
                return False;
@@ -208,7 +208,7 @@ struct smbcli_request *smb_raw_trans_send_backend(struct smbcli_tree *tree,
 {
        int wct = 14 + parms->in.setup_count;
        struct smbcli_request *req; 
-       char *outdata,*outparam;
+       uint8_t *outdata,*outparam;
        int i;
        int padding;
        size_t namelen = 0;
@@ -460,7 +460,7 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree,
                                         struct smb_nttrans *parms)
 {
        struct smbcli_request *req; 
-       char *outdata, *outparam;
+       uint8_t *outdata, *outparam;
        int i;
        int align = 0;
 
index c0c1337312b2f1ae5b936f57b2abed2eea859c4b..4204f3b4dc455de69fa0c200524b128db30d3e69 100644 (file)
@@ -104,7 +104,7 @@ void sign_outgoing_message(struct request_buffer *out, DATA_BLOB *mac_key, uint_
 {
        uint8_t calc_md5_mac[16];
        struct MD5Context md5_ctx;
-       unsigned char key_buf[16];
+       uint8_t key_buf[16];
 
        /*
         * Firstly put the sequence number into the first 4 bytes.
index 9e8a4cd02d44aed5755b4cde0493ee5a68eba49b..ee423fbbbae6891db9256e34937baa8258756662 100644 (file)
@@ -293,7 +293,7 @@ static DATA_BLOB NTLMv2_generate_client_data(TALLOC_CTX *mem_ctx, const DATA_BLO
 {
        uint8_t client_chal[8];
        DATA_BLOB response = data_blob(NULL, 0);
-       char long_date[8];
+       uint8_t long_date[8];
        NTTIME nttime;
 
        unix_to_nt_time(&nttime, time(NULL));
index bd1d8249d9085c017ff1fe3b665ab5e385793ba4..2cbdb9fccad9d530391210da1ca8b743be106d41 100644 (file)
@@ -25,7 +25,7 @@
 
 
 /* initialise the auth_context for this server and return the cryptkey */
-static void get_challenge(struct smbsrv_connection *smb_conn, char buff[8]) 
+static void get_challenge(struct smbsrv_connection *smb_conn, uint8_t buff[8]) 
 {
        NTSTATUS nt_status;
        const uint8_t *cryptkey;
@@ -386,7 +386,7 @@ void reply_negprot(struct smbsrv_request *req)
        int Index=0;
        int choice = -1;
        int protocol;
-       char *p;
+       uint8_t *p;
 
        if (req->smb_conn->negotiate.done_negprot) {
                smbsrv_terminate_connection(req->smb_conn, "multiple negprot's are not permitted");
@@ -398,8 +398,8 @@ void reply_negprot(struct smbsrv_request *req)
 
        while (p < req->in.data + req->in.data_size) { 
                Index++;
-               DEBUG(3,("Requested protocol [%s]\n",p));
-               p += strlen(p) + 2;
+               DEBUG(3,("Requested protocol [%s]\n",(const char *)p));
+               p += strlen((const char *)p) + 2;
        }
     
        /* Check for protocols, most desirable first */
@@ -409,10 +409,10 @@ void reply_negprot(struct smbsrv_request *req)
                if ((supported_protocols[protocol].protocol_level <= lp_maxprotocol()) &&
                                (supported_protocols[protocol].protocol_level >= lp_minprotocol()))
                        while (p < (req->in.data + req->in.data_size)) { 
-                               if (strequal(p,supported_protocols[protocol].proto_name))
+                               if (strequal((const char *)p,supported_protocols[protocol].proto_name))
                                        choice = Index;
                                Index++;
-                               p += strlen(p) + 2;
+                               p += strlen((const char *)p) + 2;
                        }
                if(choice != -1)
                        break;
index 31391b88c10bd8b67accd7f1d9fda063808fa71a..0ab9c9ce2eaa04b1ecd1ebb6d80f0d3a5cf55e77 100644 (file)
@@ -92,7 +92,7 @@ static NTSTATUS nttrans_create(struct smbsrv_request *req,
        io->ntcreatex.in.ea_list          = NULL;
 
        req_pull_string(req, &io->ntcreatex.in.fname, 
-                       (const char *)(params + 54)
+                       params + 54
                        trans->in.params.length - 54,
                        STR_NO_RANGE_CHECK | STR_TERMINATE);
        if (!io->ntcreatex.in.fname) {
index 31616b9435a53e19b0948c31ca1505b2305f6c1f..3f1ddd26c7b1cc041083e3ce05e39dace02f317e 100644 (file)
@@ -83,7 +83,7 @@ void reply_tcon(struct smbsrv_request *req)
 {
        union smb_tcon con;
        NTSTATUS status;
-       char *p;
+       uint8_t *p;
        
        /* parse request */
        REQ_CHECK_WCT(req, 0);
@@ -126,7 +126,7 @@ void reply_tcon_and_X(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_tcon con;
-       char *p;
+       uint8_t *p;
        uint16_t passlen;
 
        con.tconx.level = RAW_TCON_TCONX;
@@ -1625,7 +1625,7 @@ void reply_rmdir(struct smbsrv_request *req)
 void reply_mv(struct smbsrv_request *req)
 {
        union smb_rename *io;
-       char *p;
+       uint8_t *p;
  
        /* parse the request */
        REQ_CHECK_WCT(req, 1);
@@ -1659,7 +1659,7 @@ void reply_mv(struct smbsrv_request *req)
 void reply_ntrename(struct smbsrv_request *req)
 {
        union smb_rename *io;
-       char *p;
+       uint8_t *p;
  
        /* parse the request */
        REQ_CHECK_WCT(req, 4);
@@ -1711,7 +1711,7 @@ static void reply_copy_send(struct smbsrv_request *req)
 void reply_copy(struct smbsrv_request *req)
 {
        struct smb_copy *cp;
-       char *p;
+       uint8_t *p;
 
        /* parse request */
        REQ_CHECK_WCT(req, 3);
@@ -1774,7 +1774,7 @@ void reply_lockingX(struct smbsrv_request *req)
        union smb_lock *lck;
        uint_t total_locks, i;
        uint_t lck_size;
-       char *p;
+       uint8_t *p;
 
        /* parse request */
        REQ_CHECK_WCT(req, 8);
@@ -1953,7 +1953,7 @@ static void reply_sesssetup_old(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_sesssetup sess;
-       char *p;
+       uint8_t *p;
        uint16_t passlen;
 
        sess.old.level = RAW_SESSSETUP_OLD;
@@ -2011,7 +2011,7 @@ static void reply_sesssetup_nt1(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_sesssetup sess;
-       char *p;
+       uint8_t *p;
        uint16_t passlen1, passlen2;
 
        sess.nt1.level = RAW_SESSSETUP_NT1;
@@ -2081,7 +2081,7 @@ static void reply_sesssetup_spnego(struct smbsrv_request *req)
 {
        NTSTATUS status;
        union smb_sesssetup sess;
-       char *p;
+       uint8_t *p;
        uint16_t blob_len;
 
        sess.spnego.level = RAW_SESSSETUP_SPNEGO;
@@ -2371,7 +2371,7 @@ void reply_sendtxt(struct smbsrv_request *req)
 void reply_special(struct smbsrv_request *req)
 {
        uint8_t msg_type;
-       char *buf = talloc_zero_array_p(req, char, 4);
+       uint8_t *buf = talloc_zero_array_p(req, uint8_t, 4);
        
        msg_type = CVAL(req->in.buffer,0);
 
index 8e83ea31b32614dc4bb316420aa94088d68228db..4e63acdd924d1d2f29814d57c22be8b7287428ae 100644 (file)
@@ -218,7 +218,7 @@ int req_max_data(struct smbsrv_request *req)
 static void req_grow_allocation(struct smbsrv_request *req, uint_t new_size)
 {
        int delta;
-       char *buf2;
+       uint8_t *buf2;
 
        delta = new_size - req->out.data_size;
        if (delta + req->out.size <= req->out.allocated) {
@@ -378,11 +378,11 @@ void req_reply_error(struct smbsrv_request *req, NTSTATUS status)
 
   if dest_len is -1 then no limit applies
 */
-size_t req_push_str(struct smbsrv_request *req, char *dest, const char *str, int dest_len, uint_t flags)
+size_t req_push_str(struct smbsrv_request *req, uint8_t *dest, const char *str, int dest_len, uint_t flags)
 {
        size_t len;
        uint_t grow_size;
-       char *buf0;
+       uint8_t *buf0;
        const int max_bytes_per_char = 3;
 
        if (!(flags & (STR_ASCII|STR_UNICODE))) {
@@ -460,7 +460,7 @@ size_t req_append_var_block(struct smbsrv_request *req,
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the packet is returned
 */
-static size_t req_pull_ucs2(struct smbsrv_request *req, const char **dest, const char *src, int byte_len, uint_t flags)
+static size_t req_pull_ucs2(struct smbsrv_request *req, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2, alignment=0;
        ssize_t ret;
@@ -518,7 +518,7 @@ static size_t req_pull_ucs2(struct smbsrv_request *req, const char **dest, const
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the packet is returned
 */
-static size_t req_pull_ascii(struct smbsrv_request *req, const char **dest, const char *src, int byte_len, uint_t flags)
+static size_t req_pull_ascii(struct smbsrv_request *req, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2;
        ssize_t ret;
@@ -537,7 +537,7 @@ static size_t req_pull_ascii(struct smbsrv_request *req, const char **dest, cons
                }
        }
 
-       src_len2 = strnlen(src, src_len);
+       src_len2 = strnlen((const char *)src, src_len);
        if (src_len2 <= src_len - 1) {
                /* include the termination if we didn't reach the end of the packet */
                src_len2++;
@@ -567,7 +567,7 @@ static size_t req_pull_ascii(struct smbsrv_request *req, const char **dest, cons
   on failure zero is returned and *dest is set to NULL, otherwise the number
   of bytes consumed in the packet is returned
 */
-size_t req_pull_string(struct smbsrv_request *req, const char **dest, const char *src, int byte_len, uint_t flags)
+size_t req_pull_string(struct smbsrv_request *req, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        if (!(flags & STR_ASCII) && 
            (((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) {
@@ -587,7 +587,7 @@ size_t req_pull_string(struct smbsrv_request *req, const char **dest, const char
   on failure *dest is set to the zero length string. This seems to
   match win2000 behaviour
 */
-size_t req_pull_ascii4(struct smbsrv_request *req, const char **dest, const char *src, uint_t flags)
+size_t req_pull_ascii4(struct smbsrv_request *req, const char **dest, const uint8_t *src, uint_t flags)
 {
        ssize_t ret;
 
@@ -616,7 +616,7 @@ size_t req_pull_ascii4(struct smbsrv_request *req, const char **dest, const char
 
   return False if any part is outside the data portion of the packet
 */
-BOOL req_pull_blob(struct smbsrv_request *req, const char *src, int len, DATA_BLOB *blob)
+BOOL req_pull_blob(struct smbsrv_request *req, const uint8_t *src, int len, DATA_BLOB *blob)
 {
        if (len != 0 && req_data_oob(req, src, len)) {
                return False;
@@ -629,7 +629,7 @@ BOOL req_pull_blob(struct smbsrv_request *req, const char *src, int len, DATA_BL
 
 /* check that a lump of data in a request is within the bounds of the data section of
    the packet */
-BOOL req_data_oob(struct smbsrv_request *req, const char *ptr, uint32_t count)
+BOOL req_data_oob(struct smbsrv_request *req, const uint8_t *ptr, uint32_t count)
 {
        if (count == 0) {
                return False;
@@ -649,7 +649,7 @@ BOOL req_data_oob(struct smbsrv_request *req, const char *ptr, uint32_t count)
 /* 
    pull an open file handle from a packet, taking account of the chained_fnum
 */
-uint16_t req_fnum(struct smbsrv_request *req, const char *base, uint_t offset)
+uint16_t req_fnum(struct smbsrv_request *req, const uint8_t *base, uint_t offset)
 {
        if (req->chained_fnum != -1) {
                return req->chained_fnum;
index a0bc5b764b7c6456eb18ac71aa1bdbd52e524b69..b017c996ef2969a1b149c02b3e73568dd3748de5 100644 (file)
@@ -70,7 +70,7 @@ struct search_state {
 static BOOL find_fill_info(struct smbsrv_request *req,
                           union smb_search_data *file)
 {
-       char *p;
+       uint8_t *p;
 
        if (req->out.data_size + 43 > req_max_data(req)) {
                return False;
@@ -111,7 +111,7 @@ void reply_search(struct smbsrv_request *req)
        union smb_search_next *sn;
        uint16_t resume_key_length;
        struct search_state state;
-       char *p;
+       uint8_t *p;
        NTSTATUS status;
        enum smb_search_level level = RAW_SEARCH_SEARCH;
        uint8_t op = CVAL(req->in.hdr,HDR_COM);
@@ -225,7 +225,7 @@ void reply_fclose(struct smbsrv_request *req)
 {
        union smb_search_close *sc;
        uint16_t resume_key_length;
-       char *p;
+       uint8_t *p;
        const char *pattern;
 
        REQ_TALLOC(sc);
index 24d1c7eeb628e78e95b39cb955386cd28681f10f..d9fa226c8b1a54a01fa23af14714a339a442d0bd 100644 (file)
@@ -80,7 +80,7 @@ static NTSTATUS receive_smb_request(struct smbsrv_connection *smb_conn, struct t
                        return NT_STATUS_NO_MEMORY;
                }
 
-               req->in.buffer = talloc_array_p(req, char, NBT_HDR_SIZE);
+               req->in.buffer = talloc_array_p(req, uint8_t, NBT_HDR_SIZE);
                if (req->in.buffer == NULL) {
                        talloc_free(req);
                        return NT_STATUS_NO_MEMORY;
@@ -576,7 +576,7 @@ static void construct_reply(struct smbsrv_request *req)
 void chain_reply(struct smbsrv_request *req)
 {
        uint16_t chain_cmd, chain_offset;
-       char *vwv, *data;
+       uint8_t *vwv, *data;
        uint16_t wct;
        uint16_t data_size;
 
index 999ffc3ee121504350cdbba99cc24a5c6064a478..faeda6faf634f4aac42c2c4b462cc6ec767a6a46 100644 (file)
@@ -39,7 +39,7 @@ put a dos date into a buffer (date/time format)
 This takes GMT time and puts local time in the buffer
 ********************************************************************/
 void srv_push_dos_date2(struct smbsrv_connection *smb_server,
-                      char *buf, int offset, time_t unixdate)
+                      uint8_t *buf, int offset, time_t unixdate)
 {
        push_dos_date2(buf, offset, unixdate, smb_server->negotiate.zone_offset);
 }
@@ -49,7 +49,7 @@ put a dos 32 bit "unix like" date into a buffer. This routine takes
 GMT and converts it to LOCAL time in zone_offset before putting it
 ********************************************************************/
 void srv_push_dos_date3(struct smbsrv_connection *smb_server,
-                      char *buf, int offset, time_t unixdate)
+                      uint8_t *buf, int offset, time_t unixdate)
 {
        push_dos_date3(buf, offset, unixdate, smb_server->negotiate.zone_offset);
 }
index 50aabb825a866342946b3ef99f5fbf2e1c992d98..018bfd9f1a29cfa21447c702b546bc61ed542e51 100644 (file)
@@ -125,7 +125,7 @@ static void qfileinfo_aliases(struct smbcli_state *cli)
                printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
 
        SSVAL(t2.in.params.data, 0, fnum);
 
@@ -165,7 +165,7 @@ static void qpathinfo_aliases(struct smbcli_state *cli)
                printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
        smbcli_close(cli->tree, fnum);
 
        SIVAL(t2.in.params.data, 2, 0);
@@ -209,7 +209,7 @@ static void findfirst_aliases(struct smbcli_state *cli)
                printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
        smbcli_close(cli->tree, fnum);
 
        SSVAL(t2.in.params.data, 0, 0);
@@ -321,7 +321,7 @@ static void setfileinfo_aliases(struct smbcli_state *cli)
                printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
 
        SSVAL(t2.in.params.data, 0, fnum);
        SSVAL(t2.in.params.data, 4, 0);
@@ -362,7 +362,7 @@ static void setpathinfo_aliases(struct smbcli_state *cli)
                printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
        }
 
-       smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+       smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
        smbcli_close(cli->tree, fnum);
 
        SSVAL(t2.in.params.data, 2, 0);
index 7979778c3f2229bb637472de03f8e9b5c842502c..0e0032058f9509b09e0a28775209d506dd56a952 100644 (file)
@@ -1454,12 +1454,12 @@ BOOL torture_denytest1(void)
                } else if (fnum2 == -1) {
                        res = A_0;
                } else {
-                       char x = 1;
+                       uint8_t x = 1;
                        res = A_0;
-                       if (smbcli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_read(cli1->tree, fnum2, &x, 0, 1) == 1) {
                                res += A_R;
                        }
-                       if (smbcli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_write(cli1->tree, fnum2, 0, &x, 0, 1) == 1) {
                                res += A_W;
                        }
                }
@@ -1551,12 +1551,12 @@ BOOL torture_denytest2(void)
                } else if (fnum2 == -1) {
                        res = A_0;
                } else {
-                       char x = 1;
+                       uint8_t x = 1;
                        res = A_0;
-                       if (smbcli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_read(cli2->tree, fnum2, &x, 0, 1) == 1) {
                                res += A_R;
                        }
-                       if (smbcli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+                       if (smbcli_write(cli2->tree, fnum2, 0, &x, 0, 1) == 1) {
                                res += A_W;
                        }
                }
@@ -1782,7 +1782,7 @@ static BOOL torture_ntdenytest(struct smbcli_state *cli1, struct smbcli_state *c
        union smb_open io1, io2;
        extern int torture_numops;
        int failures = 0;
-       char buf[1];
+       uint8_t buf[1];
 
        ZERO_STRUCT(buf);
 
@@ -1843,11 +1843,11 @@ static BOOL torture_ntdenytest(struct smbcli_state *cli1, struct smbcli_state *c
                } else {
                        res = A_0;
                        if (smbcli_read(cli2->tree, 
-                                       io2.ntcreatex.out.fnum, (void *)buf, 0, sizeof(buf)) >= 1) {
+                                       io2.ntcreatex.out.fnum, buf, 0, sizeof(buf)) >= 1) {
                                res += A_R;
                        }
                        if (smbcli_write(cli2->tree, 
-                                        io2.ntcreatex.out.fnum, 0, (void *)buf, 0, sizeof(buf)) >= 1) {
+                                        io2.ntcreatex.out.fnum, 0, buf, 0, sizeof(buf)) >= 1) {
                                res += A_W;
                        }
                }
index ba7d5687060e128f6f05d7ac155c7d0705cb1e88..7a1a13762b2c77f90729bad40bc9fb300c4851db 100644 (file)
@@ -464,7 +464,7 @@ BOOL torture_locktest4(void)
        const char *fname = "\\lockt4.lck";
        int fnum1, fnum2, f;
        BOOL ret;
-       char buf[1000];
+       uint8_t buf[1000];
        BOOL correct = True;
 
        if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
@@ -632,7 +632,7 @@ BOOL torture_locktest5(void)
        const char *fname = "\\lockt5.lck";
        int fnum1, fnum2, fnum3;
        BOOL ret;
-       char buf[1000];
+       uint8_t buf[1000];
        BOOL correct = True;
 
        if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
@@ -792,7 +792,7 @@ BOOL torture_locktest7(void)
        int fnum1;
        int fnum2 = -1;
        size_t size;
-       char buf[200];
+       uint8_t buf[200];
        BOOL correct = False;
 
        if (!torture_open_connection(&cli1)) {
index f9233595cf62126340ad3a5cc947b3144ac21c34..01984077a352eee9557e59988dbad3dd935db1e8 100644 (file)
@@ -28,7 +28,7 @@ BOOL torture_utable(void)
        fstring fname;
        const char *alt_name;
        int fnum;
-       char c2[4];
+       uint8_t c2[4];
        int c, len, fd;
        int chars_allowed=0, alt_allowed=0;
        uint8_t valid[0x10000];
@@ -102,7 +102,7 @@ BOOL torture_utable(void)
 static char *form_name(int c)
 {
        static fstring fname;
-       char c2[4];
+       uint8_t c2[4];
        char *p;
        int len;
 
@@ -178,7 +178,7 @@ BOOL torture_casetable(void)
                                return False;
                        }
 
-                       smbcli_read(cli->tree, fnum, (char *)c2, 0, size);
+                       smbcli_read(cli->tree, fnum, c2, 0, size);
                        printf("%04x: ", c);
                        equiv[c][0] = c;
                        for (i=0; i<size/sizeof(int); i++) {
@@ -189,7 +189,7 @@ BOOL torture_casetable(void)
                        fflush(stdout);
                }
 
-               smbcli_write(cli->tree, fnum, 0, (char *)&c, size, sizeof(c));
+               smbcli_write(cli->tree, fnum, 0, &c, size, sizeof(c));
                smbcli_close(cli->tree, fnum);
        }
 
index 32bd108442a10bc0a61b502fcf4e8bd9410ab478..b83234be9190c9772045ffb0d2fba0ac86972e23 100644 (file)
@@ -293,7 +293,7 @@ void nb_writex(int handle, int offset, int size, int ret_size, NTSTATUS status)
        union smb_write io;
        int i;
        NTSTATUS ret;
-       char *buf;
+       uint8_t *buf;
 
        i = find_handle(handle);
 
@@ -330,7 +330,7 @@ void nb_write(int handle, int offset, int size, int ret_size, NTSTATUS status)
        union smb_write io;
        int i;
        NTSTATUS ret;
-       char *buf;
+       uint8_t *buf;
 
        i = find_handle(handle);
 
@@ -420,7 +420,7 @@ void nb_readx(int handle, int offset, int size, int ret_size, NTSTATUS status)
        union smb_read io;
        int i;
        NTSTATUS ret;
-       char *buf;
+       uint8_t *buf;
 
        i = find_handle(handle);
 
index 7fb49c33765e04c99cad73d6d74213248c4b8284..d0a948c401a4abe583cf89679344aff64902c3f7 100644 (file)
@@ -67,7 +67,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        union smb_close cl;
        int fnum;
        const char *fname = BASEDIR "\\test.txt";
-       char c = 1;
+       uint8_t c = 1;
 
        printf("TESTING SESSION HANDLING\n");
 
@@ -208,7 +208,7 @@ static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        union smb_close cl;
        int fnum;
        const char *fname = BASEDIR "\\test.txt";
-       char c = 1;
+       uint8_t c = 1;
 
        printf("TESTING TREE HANDLING\n");
 
@@ -307,7 +307,7 @@ static BOOL test_pid(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        union smb_close cl;
        int fnum;
        const char *fname = BASEDIR "\\test.txt";
-       char c = 1;
+       uint8_t c = 1;
        uint16_t pid1, pid2;
 
        printf("TESTING PID HANDLING\n");
index 547115c9f5e8b1c0a495ea330454128ee1bc6057..478c0a5a4292d4dd911747425f05681203833371 100644 (file)
@@ -366,7 +366,7 @@ static BOOL test_pidhigh(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        BOOL ret = True;
        int fnum;
        const char *fname = BASEDIR "\\test.txt";
-       char c = 1;
+       uint8_t c = 1;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return False;
@@ -598,7 +598,7 @@ static BOOL test_changetype(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char c = 0;
+       uint8_t c = 0;
        const char *fname = BASEDIR "\\test.txt";
 
        if (!torture_setup_dir(cli, BASEDIR)) {
index fe0d4fe4fa995a31ad0a301916d401e4f6b6bf61..a1cc76ebd8b4be13b033f4c09ec982169af14a2f 100644 (file)
@@ -33,7 +33,7 @@ enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
 */
 static enum rdwr_mode check_rdwr(struct smbcli_tree *tree, int fnum)
 {
-       char c = 1;
+       uint8_t c = 1;
        BOOL can_read  = (smbcli_read(tree, fnum, &c, 0, 1) == 1);
        BOOL can_write = (smbcli_write(tree, fnum, 0, &c, 0, 1) == 1);
        if ( can_read &&  can_write) return RDWR_RDWR;
index ff6d2baa2b01e8f2e70da73b396570ec6b03674a..12818f7ba66ffd71762830e2ea81088d2c3f7b8e 100644 (file)
@@ -50,7 +50,7 @@
 /*
   setup a random buffer based on a seed
 */
-static void setup_buffer(char *buf, uint_t seed, int len)
+static void setup_buffer(uint8_t *buf, uint_t seed, int len)
 {
        int i;
        srandom(seed);
@@ -60,12 +60,12 @@ static void setup_buffer(char *buf, uint_t seed, int len)
 /*
   check a random buffer based on a seed
 */
-static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
+static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, int line)
 {
        int i;
        srandom(seed);
        for (i=0;i<len;i++) {
-               char v = random();
+               uint8_t v = random();
                if (buf[i] != v) {
                        printf("Buffer incorrect at line %d! ofs=%d v1=0x%x v2=0x%x\n", 
                               line, i, buf[i], v);
@@ -84,7 +84,7 @@ static BOOL test_read(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        const char *test_data = "TEST DATA";
@@ -208,7 +208,7 @@ static BOOL test_lockread(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        const char *test_data = "TEST DATA";
@@ -351,7 +351,7 @@ static BOOL test_readx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        const char *test_data = "TEST DATA";
@@ -545,7 +545,7 @@ static BOOL test_readbraw(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        const char *test_data = "TEST DATA";
index 10b930b18f3e255679d6d492ad923663d1cc1e2f..716a73b8f777902cf719d82da0a019285803f5ba 100644 (file)
@@ -50,7 +50,7 @@ static BOOL test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        BOOL ret = True;
        int fnum, fnum2;
        const char *fname = BASEDIR "\\test.txt";
-       char c[2];
+       uint8_t c[2];
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return False;
index 7053f6c99844baf4df8c57d330af377a5ef6d483..16c1bee3f1139edb558a8d4c69c7867b75ef30d6 100644 (file)
@@ -50,7 +50,7 @@ static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
 {
        int fnum;
        const char *full_name;
-       char *buf;
+       uint8_t *buf;
        ssize_t ret;
 
        full_name = talloc_asprintf(mem_ctx, "%s:%s", fname, sname);
index 7def976b46883df982589b1da97a540217306fa6..06fbe667eab2a32cbc669a0af8ee41fb765129d8 100644 (file)
@@ -64,7 +64,7 @@
 /*
   setup a random buffer based on a seed
 */
-static void setup_buffer(char *buf, uint_t seed, int len)
+static void setup_buffer(uint8_t *buf, uint_t seed, int len)
 {
        int i;
        srandom(seed);
@@ -74,12 +74,12 @@ static void setup_buffer(char *buf, uint_t seed, int len)
 /*
   check a random buffer based on a seed
 */
-static BOOL check_buffer(char *buf, uint_t seed, int len, const char *location)
+static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, const char *location)
 {
        int i;
        srandom(seed);
        for (i=0;i<len;i++) {
-               char v = random();
+               uint8_t v = random();
                if (buf[i] != v) {
                        printf("Buffer incorrect at %s! ofs=%d buf=0x%x correct=0x%x\n", 
                               location, i, buf[i], v);
@@ -98,7 +98,7 @@ static BOOL test_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        uint_t seed = time(NULL);
@@ -215,7 +215,7 @@ static BOOL test_writex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum, i;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        uint_t seed = time(NULL);
@@ -391,7 +391,7 @@ static BOOL test_writeunlock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        uint_t seed = time(NULL);
@@ -528,7 +528,7 @@ static BOOL test_writeclose(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        NTSTATUS status;
        BOOL ret = True;
        int fnum;
-       char *buf;
+       uint8_t *buf;
        const int maxsize = 90000;
        const char *fname = BASEDIR "\\test.txt";
        uint_t seed = time(NULL);
index af5c9a2f8eee0bf6fef14b3f6db8d9fd3e075b6a..192ec4b64b10fb9b4163f177e573dc4820fe7fb1 100644 (file)
@@ -267,7 +267,7 @@ static BOOL rw_torture(struct smbcli_state *c)
        int fnum2;
        pid_t pid2, pid = getpid();
        int i, j;
-       char buf[1024];
+       uint8_t buf[1024];
        BOOL correct = True;
 
        fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, 
@@ -298,13 +298,13 @@ static BOOL rw_torture(struct smbcli_state *c)
                        break;
                }
 
-               if (smbcli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) {
+               if (smbcli_write(c->tree, fnum, 0, &pid, 0, sizeof(pid)) != sizeof(pid)) {
                        printf("write failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                }
 
                for (j=0;j<50;j++) {
-                       if (smbcli_write(c->tree, fnum, 0, (char *)buf, 
+                       if (smbcli_write(c->tree, fnum, 0, buf, 
                                      sizeof(pid)+(j*sizeof(buf)), 
                                      sizeof(buf)) != sizeof(buf)) {
                                printf("write failed (%s)\n", smbcli_errstr(c->tree));
@@ -314,7 +314,7 @@ static BOOL rw_torture(struct smbcli_state *c)
 
                pid2 = 0;
 
-               if (smbcli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) {
+               if (smbcli_read(c->tree, fnum, &pid2, 0, sizeof(pid)) != sizeof(pid)) {
                        printf("read failed (%s)\n", smbcli_errstr(c->tree));
                        correct = False;
                }
@@ -366,8 +366,8 @@ static BOOL rw_torture3(struct smbcli_state *c, const char *lockfname)
 {
        int fnum = -1;
        uint_t i = 0;
-       char buf[131072];
-       char buf_rd[131072];
+       uint8_t buf[131072];
+       uint8_t buf_rd[131072];
        uint_t count;
        uint_t countprev = 0;
        ssize_t sent = 0;
@@ -597,7 +597,7 @@ static BOOL run_tcon_test(void)
        int fnum1;
        uint16_t cnum1, cnum2, cnum3;
        uint16_t vuid1, vuid2;
-       char buf[4];
+       uint8_t buf[4];
        BOOL ret = True;
        struct smbcli_tree *tree1;
        const char *host = lp_parm_string(-1, "torture", "host");
@@ -818,7 +818,7 @@ static BOOL run_fdpasstest(void)
        struct smbcli_state *cli1, *cli2;
        const char *fname = "\\fdpass.tst";
        int fnum1, oldtid;
-       pstring buf;
+       uint8_t buf[1024];
 
        if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
                return False;
@@ -1284,7 +1284,7 @@ static BOOL run_trans2test(void)
 
        fnum = smbcli_open(cli->tree, fname2, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
-       smbcli_write(cli->tree, fnum,  0, (char *)&fnum, 0, sizeof(fnum));
+       smbcli_write(cli->tree, fnum,  0, &fnum, 0, sizeof(fnum));
        smbcli_close(cli->tree, fnum);
        if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) {
                printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
@@ -1536,7 +1536,7 @@ static BOOL run_vuidtest(void)
        static struct smbcli_state *cli2;
        const char *fname = "\\readonly.file";
        int fnum1, fnum2;
-       char buf[20];
+       uint8_t buf[20];
        size_t fsize;
        BOOL correct = True;
        char *tmp_path;