From 9112a632f6791ffc3c3c1aadd214cbaba8fe816e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 4 Dec 2004 13:56:25 +0000 Subject: 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) --- source4/libcli/climessage.c | 2 +- source4/libcli/clireadwrite.c | 9 ++++++--- source4/libcli/raw/clisession.c | 2 +- source4/libcli/raw/clisocket.c | 4 ++-- source4/libcli/raw/clitransport.c | 10 +++++----- source4/libcli/raw/clitree.c | 2 +- source4/libcli/raw/rawdate.c | 4 ++-- source4/libcli/raw/rawfile.c | 2 +- source4/libcli/raw/rawnegotiate.c | 2 +- source4/libcli/raw/rawrequest.c | 28 ++++++++++++++-------------- source4/libcli/raw/rawsearch.c | 2 +- source4/libcli/raw/rawtrans.c | 6 +++--- source4/libcli/raw/smb_signing.c | 2 +- source4/libcli/util/smbencrypt.c | 2 +- 14 files changed, 40 insertions(+), 37 deletions(-) (limited to 'source4/libcli') 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)); -- cgit