diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-12-04 13:56:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:06:21 -0500 |
commit | 9112a632f6791ffc3c3c1aadd214cbaba8fe816e (patch) | |
tree | 129b941d550b15e919461dedcde286f1697ba94d | |
parent | 4127edc1afd702ac3bcb77893ba864eb98729451 (diff) | |
download | samba-9112a632f6791ffc3c3c1aadd214cbaba8fe816e.tar.gz samba-9112a632f6791ffc3c3c1aadd214cbaba8fe816e.tar.bz2 samba-9112a632f6791ffc3c3c1aadd214cbaba8fe816e.zip |
r4063: - change char * -> uint8_t in struct request_buffer
- 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, 159 insertions, 154 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index dae24ce927..f17586f994 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -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; diff --git a/source4/include/request.h b/source4/include/request.h index fc5fa8442a..587adeef21 100644 --- a/source4/include/request.h +++ b/source4/include/request.h @@ -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 diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h index bc5c43f59a..4b767c8d70 100644 --- a/source4/include/smb_interfaces.h +++ b/source4/include/smb_interfaces.h @@ -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; }; diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 041554a7c0..6975f45c8e 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -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); diff --git a/source4/lib/time.c b/source4/lib/time.c index 8d477fac02..504b5d6ac3 100644 --- a/source4/lib/time.c +++ b/source4/lib/time.c @@ -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; diff --git a/source4/libcli/climessage.c b/source4/libcli/climessage.c index 7e3a50b842..113b752e8b 100644 --- a/source4/libcli/climessage.c +++ b/source4/libcli/climessage.c @@ -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) || diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c index 6b6cb2f2a2..4248ac4286 100644 --- a/source4/libcli/clireadwrite.c +++ b/source4/libcli/clireadwrite.c @@ -25,9 +25,10 @@ /**************************************************************************** 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; diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c index c92e3ecb0b..7d2b7ad9b8 100644 --- a/source4/libcli/raw/clisession.c +++ b/source4/libcli/raw/clisession.c @@ -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); diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 349b4b9a9c..fb9afeab81 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -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; diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 52cb4d8beb..0af6df33b2 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -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); diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index daa8549099..b9d0ffbc1f 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -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)) { diff --git a/source4/libcli/raw/rawdate.c b/source4/libcli/raw/rawdate.c index db18a7a194..894eb53528 100644 --- a/source4/libcli/raw/rawdate.c +++ b/source4/libcli/raw/rawdate.c @@ -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); } diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index 69b8c6a07c..028d8734e1 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -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 */ diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c index 4f7d7b4058..a8cf603d46 100644 --- a/source4/libcli/raw/rawnegotiate.c +++ b/source4/libcli/raw/rawnegotiate.c @@ -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); } diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index b56bfa9a3c..7aa07bef41 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -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 */ diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c index 4907eec70a..d55a47ca26 100644 --- a/source4/libcli/raw/rawsearch.c +++ b/source4/libcli/raw/rawsearch.c @@ -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; diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 371f50410d..fb8ab4203f 100644 --- a/source4/libcli/raw/rawtrans.c +++ b/source4/libcli/raw/rawtrans.c @@ -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; diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c index c0c1337312..4204f3b4dc 100644 --- a/source4/libcli/raw/smb_signing.c +++ b/source4/libcli/raw/smb_signing.c @@ -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. diff --git a/source4/libcli/util/smbencrypt.c b/source4/libcli/util/smbencrypt.c index 9e8a4cd02d..ee423fbbba 100644 --- a/source4/libcli/util/smbencrypt.c +++ b/source4/libcli/util/smbencrypt.c @@ -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)); diff --git a/source4/smb_server/negprot.c b/source4/smb_server/negprot.c index bd1d8249d9..2cbdb9fcca 100644 --- a/source4/smb_server/negprot.c +++ b/source4/smb_server/negprot.c @@ -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; diff --git a/source4/smb_server/nttrans.c b/source4/smb_server/nttrans.c index 31391b88c1..0ab9c9ce2e 100644 --- a/source4/smb_server/nttrans.c +++ b/source4/smb_server/nttrans.c @@ -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) { diff --git a/source4/smb_server/reply.c b/source4/smb_server/reply.c index 31616b9435..3f1ddd26c7 100644 --- a/source4/smb_server/reply.c +++ b/source4/smb_server/reply.c @@ -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); diff --git a/source4/smb_server/request.c b/source4/smb_server/request.c index 8e83ea31b3..4e63acdd92 100644 --- a/source4/smb_server/request.c +++ b/source4/smb_server/request.c @@ -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; diff --git a/source4/smb_server/search.c b/source4/smb_server/search.c index a0bc5b764b..b017c996ef 100644 --- a/source4/smb_server/search.c +++ b/source4/smb_server/search.c @@ -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); diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 24d1c7eeb6..d9fa226c8b 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -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; diff --git a/source4/smb_server/srvtime.c b/source4/smb_server/srvtime.c index 999ffc3ee1..faeda6faf6 100644 --- a/source4/smb_server/srvtime.c +++ b/source4/smb_server/srvtime.c @@ -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); } diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c index 50aabb825a..018bfd9f1a 100644 --- a/source4/torture/basic/aliases.c +++ b/source4/torture/basic/aliases.c @@ -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); diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c index 7979778c3f..0e0032058f 100644 --- a/source4/torture/basic/denytest.c +++ b/source4/torture/basic/denytest.c @@ -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; } } diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index ba7d568706..7a1a13762b 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -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)) { diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index f9233595cf..01984077a3 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -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); } diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c index 32bd108442..b83234be91 100644 --- a/source4/torture/nbench/nbio.c +++ b/source4/torture/nbench/nbio.c @@ -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); diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 7fb49c3376..d0a948c401 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -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"); diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index 547115c9f5..478c0a5a42 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -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)) { diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index fe0d4fe4fa..a1cc76ebd8 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -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; diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index ff6d2baa2b..12818f7ba6 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -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"; diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c index 10b930b18f..716a73b8f7 100644 --- a/source4/torture/raw/seek.c +++ b/source4/torture/raw/seek.c @@ -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; diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 7053f6c998..16c1bee3f1 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -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); diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c index 7def976b46..06fbe667ea 100644 --- a/source4/torture/raw/write.c +++ b/source4/torture/raw/write.c @@ -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); diff --git a/source4/torture/torture.c b/source4/torture/torture.c index af5c9a2f8e..192ec4b64b 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -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; |