diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-09-08 13:27:14 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:05:41 -0500 |
commit | dccf3f99e45137b6cd18c1de1c79808ad67130d1 (patch) | |
tree | 7c0f8e64f4ded3701818b8968171597eccd62267 /source4 | |
parent | ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 (diff) | |
download | samba-dccf3f99e45137b6cd18c1de1c79808ad67130d1.tar.gz samba-dccf3f99e45137b6cd18c1de1c79808ad67130d1.tar.bz2 samba-dccf3f99e45137b6cd18c1de1c79808ad67130d1.zip |
r25027: Fix more warnings.
(This used to be commit 5085c53fcfade614e83d21fc2c1a5bc43bb2a729)
Diffstat (limited to 'source4')
43 files changed, 122 insertions, 103 deletions
diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index 81b4181ce7..973de0c10b 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -328,7 +328,7 @@ static NTSTATUS gensec_fake_gssapi_krb5_client_start(struct gensec_security *gen if (NT_STATUS_IS_OK(nt_status)) { struct gensec_krb5_state *gensec_krb5_state; - gensec_krb5_state = gensec_security->private_data; + gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; gensec_krb5_state->gssapi = True; } return nt_status; @@ -369,7 +369,7 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB in, DATA_BLOB *out) { - struct gensec_krb5_state *gensec_krb5_state = gensec_security->private_data; + struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; krb5_error_code ret = 0; NTSTATUS nt_status; @@ -417,7 +417,7 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security, if (ret) { DEBUG(1,("krb5_rd_rep (mutual authentication) failed (%s)\n", smb_get_krb5_error_message(gensec_krb5_state->smb_krb5_context->krb5_context, ret, out_mem_ctx))); - dump_data_pw("Mutual authentication message:\n", inbuf.data, inbuf.length); + dump_data_pw("Mutual authentication message:\n", (uint8_t *)inbuf.data, inbuf.length); nt_status = NT_STATUS_ACCESS_DENIED; } else { *out = data_blob(NULL, 0); @@ -478,7 +478,7 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security, if (ret) { return NT_STATUS_LOGON_FAILURE; } - unwrapped_out.data = outbuf.data; + unwrapped_out.data = (uint8_t *)outbuf.data; unwrapped_out.length = outbuf.length; gensec_krb5_state->state_position = GENSEC_KRB5_DONE; /* wrap that up in a nice GSS-API wrapping */ diff --git a/source4/client/client.c b/source4/client/client.c index eaa8fe48a0..6a4a9c1040 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -72,7 +72,7 @@ static double dir_total; /******************************************************************* Reduce a file name, removing .. elements. ********************************************************************/ -void dos_clean_name(char *s) +static void dos_clean_name(char *s) { char *p=NULL,*r; @@ -98,7 +98,7 @@ number taken from the buffer. This may not equal the number written. ****************************************************************************/ static int writefile(int f, const void *_b, int n, BOOL translation) { - const uint8_t *b = _b; + const uint8_t *b = (const uint8_t *)_b; int i; if (!translation) { @@ -126,7 +126,7 @@ static int writefile(int f, const void *_b, int n, BOOL translation) ****************************************************************************/ static int readfile(void *_b, int n, XFILE *f, BOOL translation) { - uint8_t *b = _b; + uint8_t *b = (uint8_t *)_b; int i; int c; @@ -281,11 +281,11 @@ static int cmd_cd(struct smbclient_context *ctx, const char **args) } -BOOL mask_match(struct smbcli_state *c, const char *string, const char *pattern, - BOOL is_case_sensitive) +static bool mask_match(struct smbcli_state *c, const char *string, + const char *pattern, bool is_case_sensitive) { char *p2, *s2; - BOOL ret; + bool ret; if (ISDOTDOT(string)) string = "."; @@ -397,7 +397,7 @@ static void init_do_list_queue(void) { reset_do_list_queue(); do_list_queue_size = 1024; - do_list_queue = malloc(do_list_queue_size); + do_list_queue = malloc_array_p(char, do_list_queue_size); if (do_list_queue == 0) { d_printf("malloc fail for size %d\n", (int)do_list_queue_size); @@ -491,7 +491,7 @@ a helper for do_list ****************************************************************************/ static void do_list_helper(struct clilist_file_info *f, const char *mask, void *state) { - struct smbclient_context *ctx = state; + struct smbclient_context *ctx = (struct smbclient_context *)state; if (f->attrib & FILE_ATTRIBUTE_DIRECTORY) { if (do_list_dirs && do_this_one(ctx, f)) { @@ -2831,7 +2831,7 @@ static char **remote_completion(const char *text, int len) if (info.count == 2) info.matches[0] = strdup(info.matches[1]); else { - info.matches[0] = malloc(info.samelen+1); + info.matches[0] = malloc_array_p(char, info.samelen+1); if (!info.matches[0]) goto cleanup; strncpy(info.matches[0], info.matches[1], info.samelen); @@ -2913,7 +2913,7 @@ static char **completion_fn(const char *text, int start, int end) matches[0] = strdup(matches[1]); break; default: - matches[0] = malloc(samelen+1); + matches[0] = malloc_array_p(char, samelen+1); if (!matches[0]) goto cleanup; strncpy(matches[0], matches[1], samelen); diff --git a/source4/cluster/ctdb/client/ctdb_client.c b/source4/cluster/ctdb/client/ctdb_client.c index 626ecf01c7..7525b296d6 100644 --- a/source4/cluster/ctdb/client/ctdb_client.c +++ b/source4/cluster/ctdb/client/ctdb_client.c @@ -79,7 +79,7 @@ int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call, c->key = call->key; c->call_data = &call->call_data; - c->record_data.dptr = talloc_memdup(c, data->dptr, data->dsize); + c->record_data.dptr = (unsigned char *)talloc_memdup(c, data->dptr, data->dsize); c->record_data.dsize = data->dsize; CTDB_NO_MEMORY(ctdb, c->record_data.dptr); c->new_data = NULL; @@ -311,9 +311,10 @@ int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call) } if (state->call.reply_data.dsize) { - call->reply_data.dptr = talloc_memdup(state->ctdb_db, - state->call.reply_data.dptr, - state->call.reply_data.dsize); + call->reply_data.dptr = (unsigned char *)talloc_memdup( + state->ctdb_db, + state->call.reply_data.dptr, + state->call.reply_data.dsize); call->reply_data.dsize = state->call.reply_data.dsize; } else { call->reply_data.dptr = NULL; @@ -484,7 +485,7 @@ int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid, /* tell the daemon we no longer want a srvid */ -int ctdb_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid, void *private_data) +static int ctdb_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid, void *private_data) { int res; int32_t status; @@ -580,7 +581,7 @@ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALL h->ctdb_db = ctdb_db; h->key = key; - h->key.dptr = talloc_memdup(h, key.dptr, key.dsize); + h->key.dptr = (unsigned char *)talloc_memdup(h, key.dptr, key.dsize); if (h->key.dptr == NULL) { talloc_free(h); return NULL; @@ -812,7 +813,7 @@ int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid, if (outdata) { *outdata = state->outdata; - outdata->dptr = talloc_memdup(mem_ctx, outdata->dptr, outdata->dsize); + outdata->dptr = (unsigned char *)talloc_memdup(mem_ctx, outdata->dptr, outdata->dsize); } *status = state->status; @@ -1156,10 +1157,10 @@ int ctdb_ctrl_pulldb(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid rec = (struct ctdb_rec_data *)&reply->data[0]; for (i=0;i<reply->count;i++) { - keys->keys[i].dptr = talloc_memdup(mem_ctx, &rec->data[0], rec->keylen); + keys->keys[i].dptr = (unsigned char *)talloc_memdup(mem_ctx, &rec->data[0], rec->keylen); keys->keys[i].dsize = rec->keylen; - keys->data[i].dptr = talloc_memdup(mem_ctx, &rec->data[keys->keys[i].dsize], rec->datalen); + keys->data[i].dptr = (unsigned char *)talloc_memdup(mem_ctx, &rec->data[keys->keys[i].dsize], rec->datalen); keys->data[i].dsize = rec->datalen; if (keys->data[i].dsize < sizeof(struct ctdb_ltdb_header)) { @@ -1333,7 +1334,7 @@ int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32 int32_t res; TDB_DATA data; - data.dptr = discard_const(name); + data.dptr = (unsigned char *)discard_const(name); data.dsize = strlen(name)+1; ret = ctdb_control(ctdb, destnode, 0, @@ -1468,7 +1469,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name) ctdb_db->db_name = talloc_strdup(ctdb_db, name); CTDB_NO_MEMORY_NULL(ctdb, ctdb_db->db_name); - data.dptr = discard_const(name); + data.dptr = (unsigned char *)discard_const(name); data.dsize = strlen(name)+1; /* tell ctdb daemon to attach */ @@ -1929,7 +1930,7 @@ int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb, int ret; data.dsize = offsetof(struct ctdb_control_get_tunable, name) + strlen(name) + 1; - data.dptr = talloc_size(ctdb, data.dsize); + data.dptr = (unsigned char *)talloc_size(ctdb, data.dsize); CTDB_NO_MEMORY(ctdb, data.dptr); t = (struct ctdb_control_get_tunable *)data.dptr; diff --git a/source4/cluster/ctdb/common/ctdb_io.c b/source4/cluster/ctdb/common/ctdb_io.c index 5c418e4956..ca9c635878 100644 --- a/source4/cluster/ctdb/common/ctdb_io.c +++ b/source4/cluster/ctdb/common/ctdb_io.c @@ -115,7 +115,7 @@ static void queue_io_read(struct ctdb_queue *queue) DEBUG(0,("Invalid packet of length 0\n")); goto failed; } - d2 = talloc_memdup(queue, data, len); + d2 = (uint8_t *)talloc_memdup(queue, data, len); if (d2 == NULL) { DEBUG(0,("read error memdup failed for %u\n", len)); /* sigh */ @@ -132,7 +132,7 @@ static void queue_io_read(struct ctdb_queue *queue) queue->partial.data = data; queue->partial.length = nread; } else { - queue->partial.data = talloc_memdup(queue, data, nread); + queue->partial.data = (uint8_t *)talloc_memdup(queue, data, nread); if (queue->partial.data == NULL) { DEBUG(0,("read error memdup partial failed for %u\n", (unsigned)nread)); @@ -266,7 +266,7 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length) pkt = talloc(queue, struct ctdb_queue_pkt); CTDB_NO_MEMORY(queue->ctdb, pkt); - pkt->data = talloc_memdup(pkt, data, length2); + pkt->data = (uint8_t *)talloc_memdup(pkt, data, length2); CTDB_NO_MEMORY(queue->ctdb, pkt->data); pkt->length = length2; diff --git a/source4/cluster/ctdb/common/ctdb_ltdb.c b/source4/cluster/ctdb/common/ctdb_ltdb.c index 7db1523ca1..8d8b4fd24a 100644 --- a/source4/cluster/ctdb/common/ctdb_ltdb.c +++ b/source4/cluster/ctdb/common/ctdb_ltdb.c @@ -106,7 +106,7 @@ int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db, if (data) { data->dsize = rec.dsize - sizeof(struct ctdb_ltdb_header); - data->dptr = talloc_memdup(mem_ctx, + data->dptr = (unsigned char *)talloc_memdup(mem_ctx, sizeof(struct ctdb_ltdb_header)+rec.dptr, data->dsize); } @@ -144,7 +144,7 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key, } rec.dsize = sizeof(*header) + data.dsize; - rec.dptr = talloc_size(ctdb, rec.dsize); + rec.dptr = (unsigned char *)talloc_size(ctdb, rec.dsize); CTDB_NO_MEMORY(ctdb, rec.dptr); memcpy(rec.dptr, header, sizeof(*header)); diff --git a/source4/lib/charset/charcnv.c b/source4/lib/charset/charcnv.c index dda9f754b1..ca96277679 100644 --- a/source4/lib/charset/charcnv.c +++ b/source4/lib/charset/charcnv.c @@ -152,7 +152,7 @@ _PUBLIC_ ssize_t convert_string(charset_t from, charset_t to, smb_iconv_t descriptor; if (srclen == (size_t)-1) - srclen = strlen(src)+1; + srclen = strlen(inbuf)+1; descriptor = get_conv_handle(from, to); @@ -351,9 +351,9 @@ static ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t s if (flags & (STR_TERMINATE | STR_TERMINATE_ASCII)) { if (src_len == (size_t)-1) { - src_len = strlen(src) + 1; + src_len = strlen((const char *)src) + 1; } else { - size_t len = strnlen(src, src_len); + size_t len = strnlen((const char *)src, src_len); if (len < src_len) len++; src_len = len; diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c index 6c86b0b899..e9cca090cc 100644 --- a/source4/lib/charset/util_unistr.c +++ b/source4/lib/charset/util_unistr.c @@ -393,7 +393,7 @@ _PUBLIC_ char *strchr_m(const char *s, char c) size_t size; codepoint_t c2 = next_codepoint(s, &size); if (c2 == c) { - return discard_const(s); + return discard_const_p(char, s); } s += size; } @@ -418,7 +418,7 @@ _PUBLIC_ char *strrchr_m(const char *s, char c) size_t size; codepoint_t c2 = next_codepoint(s, &size); if (c2 == c) { - ret = discard_const(s); + ret = discard_const_p(char, s); } s += size; } @@ -482,7 +482,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) /* this takes advantage of the fact that upper/lower can't change the length of a character by more than 1 byte */ - dest = talloc_size(ctx, 2*(strlen(src))+1); + dest = talloc_array(ctx, char, 2*(strlen(src))+1); if (dest == NULL) { return NULL; } @@ -505,7 +505,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) dest[size] = 0; /* trim it so talloc_append_string() works */ - dest = talloc_realloc_size(ctx, dest, size+1); + dest = talloc_realloc(ctx, dest, char, size+1); talloc_set_name_const(dest, dest); @@ -526,7 +526,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) /* this takes advantage of the fact that upper/lower can't change the length of a character by more than 1 byte */ - dest = talloc_size(ctx, 2*(strlen(src))+1); + dest = talloc_array(ctx, char, 2*(strlen(src))+1); if (dest == NULL) { return NULL; } @@ -549,7 +549,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) dest[size] = 0; /* trim it so talloc_append_string() works */ - dest = talloc_realloc_size(ctx, dest, size+1); + dest = talloc_realloc(ctx, dest, char, size+1); talloc_set_name_const(dest, dest); diff --git a/source4/lib/events/events_epoll.c b/source4/lib/events/events_epoll.c index acd204c898..e2212e5333 100644 --- a/source4/lib/events/events_epoll.c +++ b/source4/lib/events/events_epoll.c @@ -56,7 +56,7 @@ struct epoll_event_context { called when a epoll call fails, and we should fallback to using select */ -static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason) +_NORETURN_ static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason) { DEBUG(0,("%s (%s) - calling abort()\n", reason, strerror(errno))); abort(); diff --git a/source4/lib/smbreadline/smbreadline.c b/source4/lib/smbreadline/smbreadline.c index ae9fc4a3b7..2a72750efb 100644 --- a/source4/lib/smbreadline/smbreadline.c +++ b/source4/lib/smbreadline/smbreadline.c @@ -23,6 +23,7 @@ #include "system/filesys.h" #include "system/select.h" #include "system/readline.h" +#include "lib/smbreadline/smbreadline.h" /******************************************************************* Similar to sys_select() but catch EINTR and continue. diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c index 640d195d27..184c89f3ed 100644 --- a/source4/lib/socket/socket.c +++ b/source4/lib/socket/socket.c @@ -408,7 +408,7 @@ _PUBLIC_ struct socket_address *socket_address_from_sockaddr(TALLOC_CTX *mem_ctx addr->family = NULL; addr->addr = NULL; addr->port = 0; - addr->sockaddr = talloc_memdup(addr, sockaddr, sockaddrlen); + addr->sockaddr = (struct sockaddr *)talloc_memdup(addr, sockaddr, sockaddrlen); if (!addr->sockaddr) { talloc_free(addr); return NULL; diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c index ec074ecaeb..8458c61592 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.c +++ b/source4/lib/socket_wrapper/socket_wrapper.c @@ -232,7 +232,7 @@ const char *socket_wrapper_dir(void) return s; } -unsigned int socket_wrapper_default_iface(void) +static unsigned int socket_wrapper_default_iface(void) { const char *s = getenv("SOCKET_WRAPPER_DEFAULT_IFACE"); if (s) { @@ -1288,7 +1288,7 @@ _PUBLIC_ int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen) return -1; } - my_addr = malloc(my_addrlen); + my_addr = (struct sockaddr *)malloc(my_addrlen); if (my_addr == NULL) { return -1; } diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c index bfe144a011..3f148ff7bf 100644 --- a/source4/lib/tls/tls.c +++ b/source4/lib/tls/tls.c @@ -24,6 +24,7 @@ #include "includes.h" #include "lib/events/events.h" #include "lib/socket/socket.h" +#include "lib/tls/tls.h" #if ENABLE_GNUTLS #include "gnutls/gnutls.h" diff --git a/source4/lib/util/data_blob.c b/source4/lib/util/data_blob.c index 117043f95c..b258e47bba 100644 --- a/source4/lib/util/data_blob.c +++ b/source4/lib/util/data_blob.c @@ -39,9 +39,9 @@ _PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *nam } if (p) { - ret.data = talloc_memdup(NULL, p, length); + ret.data = (uint8_t *)talloc_memdup(NULL, p, length); } else { - ret.data = talloc_size(NULL, length); + ret.data = talloc_array(NULL, uint8_t, length); } if (ret.data == NULL) { ret.length = 0; @@ -175,7 +175,7 @@ _PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob) _PUBLIC_ DATA_BLOB data_blob_string_const(const char *str) { DATA_BLOB blob; - blob.data = discard_const(str); + blob.data = discard_const_p(uint8_t, str); blob.length = strlen(str); return blob; } @@ -187,7 +187,7 @@ _PUBLIC_ DATA_BLOB data_blob_string_const(const char *str) _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length) { DATA_BLOB blob; - blob.data = discard_const(p); + blob.data = discard_const_p(uint8_t, p); blob.length = length; return blob; } @@ -198,7 +198,7 @@ _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length) **/ _PUBLIC_ bool data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length) { - blob->data = talloc_realloc_size(mem_ctx, blob->data, length); + blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, length); if (blob->data == NULL) return false; blob->length = length; diff --git a/source4/lib/util/dprintf.c b/source4/lib/util/dprintf.c index a7770f364d..91665e7bdd 100644 --- a/source4/lib/util/dprintf.c +++ b/source4/lib/util/dprintf.c @@ -48,7 +48,7 @@ _PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBU charset, but beware of it growing */ maxlen = ret*2; again: - p2 = malloc(maxlen); + p2 = (char *)malloc(maxlen); if (!p2) { SAFE_FREE(p); return -1; diff --git a/source4/lib/util/util_tdb.c b/source4/lib/util/util_tdb.c index 1112f1587c..d7bddbde01 100644 --- a/source4/lib/util/util_tdb.c +++ b/source4/lib/util/util_tdb.c @@ -22,6 +22,7 @@ #include "includes.h" #include "lib/tdb/include/tdb.h" #include "pstring.h" +#include "lib/util/util_tdb.h" /* these are little tdb utility functions that are meant to make dealing with a tdb database a little less cumbersome in Samba */ @@ -127,7 +128,7 @@ int tdb_store_int32_byblob(struct tdb_context *tdb, const char *keystr, size_t l int32_t v_store; SIVAL(&v_store,0,v); - data.dptr = (void *)&v_store; + data.dptr = (unsigned char *)&v_store; data.dsize = sizeof(int32_t); return tdb_store(tdb, key, data, TDB_REPLACE); @@ -187,7 +188,7 @@ bool tdb_store_uint32_byblob(struct tdb_context *tdb, const char *keystr, size_t bool ret = true; SIVAL(&v_store, 0, value); - data.dptr = (void *)&v_store; + data.dptr = (unsigned char *)&v_store; data.dsize = sizeof(uint32_t); if (tdb_store(tdb, key, data, TDB_REPLACE) == -1) diff --git a/source4/lib/util/xfile.c b/source4/lib/util/xfile.c index 8b90e30868..a016031a77 100644 --- a/source4/lib/util/xfile.c +++ b/source4/lib/util/xfile.c @@ -85,7 +85,7 @@ static int x_allocate_buffer(XFILE *f) { if (f->buf) return 1; if (f->bufsize == 0) return 0; - f->buf = malloc(f->bufsize); + f->buf = (char *)malloc(f->bufsize); if (!f->buf) return 0; f->next = f->buf; return 1; diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index ba85ec397a..14fd3ee4f7 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -118,7 +118,8 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.dirlist_len = 0; state.total_received = 0; - state.dirlist = talloc_new(state.mem_ctx); + state.dirlist = talloc_array(state.mem_ctx, + struct clilist_file_info, 0); mask = talloc_strdup(state.mem_ctx, Mask); if (level == RAW_SEARCH_DATA_GENERIC) { @@ -275,7 +276,8 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu state.total_received = 0; state.data_level = RAW_SEARCH_DATA_SEARCH; - state.dirlist = talloc_new(state.mem_ctx); + state.dirlist = talloc_array(state.mem_ctx, struct clilist_file_info, + 0); mask = talloc_strdup(state.mem_ctx, Mask); while (1) { diff --git a/source4/libcli/climessage.c b/source4/libcli/climessage.c index 3d4d9da96c..35607ba45b 100644 --- a/source4/libcli/climessage.c +++ b/source4/libcli/climessage.c @@ -20,6 +20,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" +#include "libcli/libcli.h" /**************************************************************************** diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c index e6e66ef36e..89ae157042 100644 --- a/source4/libcli/clireadwrite.c +++ b/source4/libcli/clireadwrite.c @@ -20,6 +20,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" +#include "libcli/libcli.h" /**************************************************************************** Read size bytes at offset offset using SMBreadX. diff --git a/source4/libcli/clitrans2.c b/source4/libcli/clitrans2.c index 03deea2e82..5c5ba6585f 100644 --- a/source4/libcli/clitrans2.c +++ b/source4/libcli/clitrans2.c @@ -19,6 +19,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" +#include "libcli/libcli.h" /**************************************************************************** send a qpathinfo call diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c index 46cca36009..edd9a92693 100644 --- a/source4/libcli/finddcs.c +++ b/source4/libcli/finddcs.c @@ -27,6 +27,7 @@ #include "libcli/composite/composite.h" #include "libcli/libcli.h" #include "libcli/resolve/resolve.h" +#include "libcli/finddcs.h" #include "param/param.h" struct finddcs_state { diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c index 8d6bb79714..1ba3edd9bf 100644 --- a/source4/libcli/security/dom_sid.c +++ b/source4/libcli/security/dom_sid.c @@ -22,6 +22,7 @@ #include "includes.h" #include "librpc/gen_ndr/security.h" +#include "libcli/security/security.h" /***************************************************************** Compare the auth portion of two sids. @@ -78,7 +79,7 @@ static int dom_sid_compare(const struct dom_sid *sid1, const struct dom_sid *sid Compare two sids. *****************************************************************/ -BOOL dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2) +bool dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2) { return dom_sid_compare(sid1, sid2) == 0; } diff --git a/source4/libcli/security/privilege.c b/source4/libcli/security/privilege.c index 635f470bf6..103e2e3c14 100644 --- a/source4/libcli/security/privilege.c +++ b/source4/libcli/security/privilege.c @@ -21,6 +21,7 @@ #include "includes.h" #include "librpc/gen_ndr/security.h" +#include "libcli/security/security.h" static const struct { diff --git a/source4/libcli/security/security_descriptor.c b/source4/libcli/security/security_descriptor.c index 06c3c2eca7..1e33e1950b 100644 --- a/source4/libcli/security/security_descriptor.c +++ b/source4/libcli/security/security_descriptor.c @@ -60,7 +60,7 @@ static struct security_acl *security_acl_dup(TALLOC_CTX *mem_ctx, return NULL; } - nacl->aces = talloc_memdup (nacl, oacl->aces, sizeof(struct security_ace) * oacl->num_aces); + nacl->aces = (struct security_ace *)talloc_memdup (nacl, oacl->aces, sizeof(struct security_ace) * oacl->num_aces); if ((nacl->aces == NULL) && (oacl->num_aces > 0)) { goto failed; } @@ -69,7 +69,7 @@ static struct security_acl *security_acl_dup(TALLOC_CTX *mem_ctx, for (i = 0; i < oacl->num_aces; i++) { nacl->aces[i].trustee.sub_auths = - talloc_memdup(nacl->aces, nacl->aces[i].trustee.sub_auths, + (uint32_t *)talloc_memdup(nacl->aces, nacl->aces[i].trustee.sub_auths, sizeof(uint32_t) * nacl->aces[i].trustee.num_auths); if ((nacl->aces[i].trustee.sub_auths == NULL) && (nacl->aces[i].trustee.num_auths > 0)) { @@ -163,7 +163,7 @@ NTSTATUS security_descriptor_dacl_add(struct security_descriptor *sd, sd->dacl->aces[sd->dacl->num_aces] = *ace; sd->dacl->aces[sd->dacl->num_aces].trustee.sub_auths = - talloc_memdup(sd->dacl->aces, + (uint32_t *)talloc_memdup(sd->dacl->aces, sd->dacl->aces[sd->dacl->num_aces].trustee.sub_auths, sizeof(uint32_t) * sd->dacl->aces[sd->dacl->num_aces].trustee.num_auths); diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 545f3c8353..cca4f861de 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -25,6 +25,7 @@ #include "libcli/smb2/smb2.h" #include "lib/util/dlinklist.h" #include "lib/events/events.h" +#include "libcli/smb2/smb2_calls.h" /* initialise a smb2 request diff --git a/source4/libcli/util/clilsa.c b/source4/libcli/util/clilsa.c index 6fd84bbe74..0fdf8a8e3a 100644 --- a/source4/libcli/util/clilsa.c +++ b/source4/libcli/util/clilsa.c @@ -31,6 +31,7 @@ #include "libcli/security/security.h" #include "librpc/gen_ndr/ndr_lsa.h" #include "librpc/gen_ndr/ndr_lsa_c.h" +#include "libcli/util/clilsa.h" struct smblsa_state { struct dcerpc_pipe *pipe; diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 522031b8e4..1cad68bf15 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -328,5 +328,7 @@ NTSTATUS ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct do NTSTATUS ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid); void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags); +void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip); +void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid); #endif /* __LIBNDR_H__ */ diff --git a/source4/librpc/ndr/uuid.c b/source4/librpc/ndr/uuid.c index 8cf6ab5446..dad65ee676 100644 --- a/source4/librpc/ndr/uuid.c +++ b/source4/librpc/ndr/uuid.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "librpc/ndr/libndr.h" /** build a GUID from a string diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 56e603645c..89eab1f244 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -959,7 +959,7 @@ static struct rpc_request *dcerpc_request_send(struct dcerpc_pipe *p, req->recv_handler = NULL; if (object != NULL) { - req->object = (struct GUID *)talloc_memdup(req, (void *)object, sizeof(*object)); + req->object = (struct GUID *)talloc_memdup(req, (const void *)object, sizeof(*object)); if (req->object == NULL) { talloc_free(req); return NULL; diff --git a/source4/nsswitch/nsstest.c b/source4/nsswitch/nsstest.c index 6c21576c2d..df7f33f8e0 100644 --- a/source4/nsswitch/nsstest.c +++ b/source4/nsswitch/nsstest.c @@ -145,13 +145,13 @@ static struct group *nss_getgrent(void) static int buflen = 1024; NSS_STATUS status; - if (!buf) buf = malloc(buflen); + if (!buf) buf = malloc_array_p(char, buflen); again: status = _nss_getgrent_r(&grp, buf, buflen, &nss_errno); if (status == NSS_STATUS_TRYAGAIN) { buflen *= 2; - buf = realloc(buf, buflen); + buf = realloc_p(buf, char, buflen); goto again; } if (status == NSS_STATUS_NOTFOUND) { @@ -173,12 +173,12 @@ static struct group *nss_getgrnam(const char *name) static int buflen = 1000; NSS_STATUS status; - if (!buf) buf = malloc(buflen); + if (!buf) buf = malloc_array_p(char, buflen); again: status = _nss_getgrnam_r(name, &grp, buf, buflen, &nss_errno); if (status == NSS_STATUS_TRYAGAIN) { buflen *= 2; - buf = realloc(buf, buflen); + buf = realloc_p(buf, char, buflen); goto again; } if (status == NSS_STATUS_NOTFOUND) { @@ -200,12 +200,12 @@ static struct group *nss_getgrgid(gid_t gid) static int buflen = 1000; NSS_STATUS status; - if (!buf) buf = malloc(buflen); + if (!buf) buf = malloc_array_p(char, buflen); again: status = _nss_getgrgid_r(gid, &grp, buf, buflen, &nss_errno); if (status == NSS_STATUS_TRYAGAIN) { buflen *= 2; - buf = realloc(buf, buflen); + buf = realloc_p(buf, char, buflen); goto again; } if (status == NSS_STATUS_NOTFOUND) { diff --git a/source4/param/generic.c b/source4/param/generic.c index ca52934950..cc269af1ec 100644 --- a/source4/param/generic.c +++ b/source4/param/generic.c @@ -177,15 +177,15 @@ void param_set_ulong(struct param_context *ctx, const char *section, const char p->value = talloc_asprintf(p, "%lu", value); } -static BOOL param_sfunc (const char *name, void *_ctx) +static bool param_sfunc (const char *name, void *_ctx) { - struct param_context *ctx = _ctx; + struct param_context *ctx = (struct param_context *)_ctx; struct param_section *section = param_get_section(ctx, name); if (section == NULL) { section = talloc_zero(ctx, struct param_section); if (section == NULL) - return False; + return false; section->name = talloc_strdup(section, name); @@ -195,12 +195,12 @@ static BOOL param_sfunc (const char *name, void *_ctx) /* Make sure this section is on top of the list for param_pfunc */ DLIST_PROMOTE(ctx->sections, section); - return True; + return true; } -static BOOL param_pfunc (const char *name, const char *value, void *_ctx) +static bool param_pfunc (const char *name, const char *value, void *_ctx) { - struct param_context *ctx = _ctx; + struct param_context *ctx = (struct param_context *)_ctx; struct param *p = param_section_get(ctx->sections, name); if (!p) { diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 83c852ace7..a38e9d9e9e 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -595,7 +595,7 @@ static void init_globals(void) parm_table[i].ptr && !(parm_table[i].flags & FLAG_CMDLINE)) { string_set(talloc_autofree_context(), - parm_table[i].ptr, ""); + (char **)parm_table[i].ptr, ""); } } @@ -1473,12 +1473,14 @@ static void copy_service(struct service *pserviceDest, break; case P_STRING: - string_set(pserviceDest, dest_ptr, + string_set(pserviceDest, + (char **)dest_ptr, *(char **)src_ptr); break; case P_USTRING: - string_set(pserviceDest, dest_ptr, + string_set(pserviceDest, + (char **)dest_ptr, *(char **)src_ptr); strupper(*(char **)dest_ptr); break; @@ -1904,11 +1906,11 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue break; case P_STRING: - string_set(mem_ctx, parm_ptr, pszParmValue); + string_set(mem_ctx, (char **)parm_ptr, pszParmValue); break; case P_USTRING: - string_set(mem_ctx, parm_ptr, pszParmValue); + string_set(mem_ctx, (char **)parm_ptr, pszParmValue); strupper(*(char **)parm_ptr); break; diff --git a/source4/scripting/ejs/ejsnet/net_ctx.c b/source4/scripting/ejs/ejsnet/net_ctx.c index 411c98cc72..a2a3821082 100644 --- a/source4/scripting/ejs/ejsnet/net_ctx.c +++ b/source4/scripting/ejs/ejsnet/net_ctx.c @@ -78,7 +78,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv) get credential values from credentials object */ mprCreds = *(argv[0]); - creds = mprGetPtr(&mprCreds, "creds"); + creds = (struct cli_credentials *)mprGetPtr(&mprCreds, "creds"); if (creds == NULL) { ejsSetErrorMsg(eid, "invalid credentials parameter"); talloc_free(ctx); @@ -122,7 +122,7 @@ static int ejs_net_join_domain(MprVarHandle eid, int argc, struct MprVar **argv) struct libnet_context *ctx; struct libnet_Join *join; NTSTATUS status; - ctx = mprGetThisPtr(eid, "ctx"); + ctx = (struct libnet_context *)mprGetThisPtr(eid, "ctx"); mem_ctx = talloc_new(mprMemCtx()); join = talloc(mem_ctx, struct libnet_Join); @@ -181,7 +181,7 @@ static int ejs_net_samsync_ldb(MprVarHandle eid, int argc, struct MprVar **argv) struct libnet_context *ctx; struct libnet_samsync_ldb *samsync; NTSTATUS status; - ctx = mprGetThisPtr(eid, "ctx"); + ctx = (struct libnet_context *)mprGetThisPtr(eid, "ctx"); mem_ctx = talloc_new(mprMemCtx()); samsync = talloc(mem_ctx, struct libnet_samsync_ldb); diff --git a/source4/scripting/ejs/ejsnet/net_user.c b/source4/scripting/ejs/ejsnet/net_user.c index 8c9ab9f0eb..34524cc0fa 100644 --- a/source4/scripting/ejs/ejsnet/net_user.c +++ b/source4/scripting/ejs/ejsnet/net_user.c @@ -45,7 +45,7 @@ int ejs_net_userman(MprVarHandle eid, int argc, struct MprVar **argv) struct MprVar obj; /* libnet context */ - ctx = mprGetThisPtr(eid, "ctx"); + ctx = (struct libnet_context *)mprGetThisPtr(eid, "ctx"); if (ctx == NULL) { ejsSetErrorMsg(eid, "ctx property returns null pointer"); return 0; @@ -128,14 +128,14 @@ static int ejs_net_createuser(MprVarHandle eid, int argc, char **argv) } /* libnet context */ - ctx = mprGetThisPtr(eid, "ctx"); + ctx = (struct libnet_context *)mprGetThisPtr(eid, "ctx"); if (ctx == NULL) { ejsSetErrorMsg(eid, "ctx property returns null pointer"); goto done; } /* domain where the account is to be created */ - userman_domain = mprGetThisPtr(eid, "domain"); + userman_domain = (const char *)mprGetThisPtr(eid, "domain"); if (userman_domain == NULL) { ejsSetErrorMsg(eid, "domain property returns null pointer"); goto done; @@ -197,7 +197,7 @@ static int ejs_net_deleteuser(MprVarHandle eid, int argc, char **argv) } /* domain where the account is to be deleted */ - userman_domain = mprGetThisPtr(eid, "domain"); + userman_domain = (struct libnet_context *)mprGetThisPtr(eid, "domain"); if (!userman_domain) { ejsSetErrorMsg(eid, "domain property returns null pointer"); goto done; @@ -253,14 +253,14 @@ static int ejs_net_userinfo(MprVarHandle eid, int argc, char **argv) } /* libnet context */ - ctx = mprGetThisPtr(eid, "ctx"); + ctx = (struct libnet_context *)mprGetThisPtr(eid, "ctx"); if (ctx == NULL) { ejsSetErrorMsg(eid, "ctx property returns null pointer"); goto done; } /* domain where the user account is to be queried */ - userman_domain = mprGetThisPtr(eid, "domain"); + userman_domain = (struct libnet_context *)mprGetThisPtr(eid, "domain"); if (userman_domain == NULL) { ejsSetErrorMsg(eid, "domain property returns null pointer"); return -1; @@ -331,7 +331,7 @@ static int ejs_net_userlist(MprVarHandle eid, int argc, struct MprVar **argv) } /* libnet context */ - ctx = mprGetThisPtr(eid, "ctx"); + ctx = (struct libnet_context *)mprGetThisPtr(eid, "ctx"); if (ctx == NULL) { ejsSetErrorMsg(eid, "ctx property returns null pointer"); goto done; diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c index 2624084f02..dcb0f73909 100644 --- a/source4/scripting/ejs/smbcalls_auth.c +++ b/source4/scripting/ejs/smbcalls_auth.c @@ -181,7 +181,7 @@ static int ejs_userAuth(MprVarHandle eid, int argc, struct MprVar **argv) return -1; } - remote_host = mprGetPtr(argv[1], "socket_address"); + remote_host = (struct socket_address *)mprGetPtr(argv[1], "socket_address"); if (remote_host == NULL) { ejsSetErrorMsg(eid, "userAuth requires a socket address second parameter"); return -1; diff --git a/source4/scripting/ejs/smbcalls_creds.c b/source4/scripting/ejs/smbcalls_creds.c index 0feead201e..b469f2c9fe 100644 --- a/source4/scripting/ejs/smbcalls_creds.c +++ b/source4/scripting/ejs/smbcalls_creds.c @@ -30,7 +30,7 @@ */ static struct cli_credentials *ejs_creds_get_credentials(int eid) { - struct cli_credentials *creds = mprGetThisPtr(eid, "creds"); + struct cli_credentials *creds = (struct cli_credentials *)mprGetThisPtr(eid, "creds"); if (creds == NULL) { ejsSetErrorMsg(eid, "NULL ejs credentials"); } diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c index 7b143ae4d9..1e55d1c563 100644 --- a/source4/scripting/ejs/smbcalls_ldb.c +++ b/source4/scripting/ejs/smbcalls_ldb.c @@ -34,7 +34,7 @@ */ static struct ldb_context *ejs_get_ldb_context(int eid) { - struct ldb_context *ldb = mprGetThisPtr(eid, "db"); + struct ldb_context *ldb = (struct ldb_context *)mprGetThisPtr(eid, "db"); if (ldb == NULL) { ejsSetErrorMsg(eid, "invalid ldb connection"); } diff --git a/source4/scripting/ejs/smbcalls_param.c b/source4/scripting/ejs/smbcalls_param.c index 0e7a83457a..9dfad39ee7 100644 --- a/source4/scripting/ejs/smbcalls_param.c +++ b/source4/scripting/ejs/smbcalls_param.c @@ -39,7 +39,7 @@ static int ejs_param_get(MprVarHandle eid, int argc, char **argv) return -1; } - ctx = mprGetThisPtr(eid, "param"); + ctx = (struct param_context *)mprGetThisPtr(eid, "param"); mprAssert(ctx); if (argc == 2) { @@ -72,7 +72,7 @@ static int ejs_param_get_list(MprVarHandle eid, int argc, char **argv) return -1; } - ctx = mprGetThisPtr(eid, "param"); + ctx = (struct param_context *)mprGetThisPtr(eid, "param"); mprAssert(ctx); if (argc == 2) { @@ -107,7 +107,7 @@ static int ejs_param_set(MprVarHandle eid, int argc, struct MprVar **argv) return -1; } - ctx = mprGetThisPtr(eid, "param"); + ctx = (struct param_context *)mprGetThisPtr(eid, "param"); mprAssert(ctx); @@ -148,7 +148,7 @@ static int ejs_param_data(MprVarHandle eid, int argc, char **argv) return -1; } - ctx = mprGetThisPtr(eid, "param"); + ctx = (struct param_context *)mprGetThisPtr(eid, "param"); mprAssert(ctx); ret = mprObject("array"); @@ -184,7 +184,7 @@ static int ejs_param_load(MprVarHandle eid, int argc, char **argv) return -1; } - ctx = mprGetThisPtr(eid, "param"); + ctx = (struct param_context *)mprGetThisPtr(eid, "param"); mprAssert(ctx); ret = param_read(ctx, argv[0]); @@ -209,7 +209,7 @@ static int ejs_param_save(MprVarHandle eid, int argc, char **argv) return -1; } - ctx = mprGetThisPtr(eid, "param"); + ctx = (struct param_context *)mprGetThisPtr(eid, "param"); mprAssert(ctx); ret = param_write(ctx, argv[0]); diff --git a/source4/scripting/ejs/smbcalls_reg.c b/source4/scripting/ejs/smbcalls_reg.c index 4d84587fa4..d4b13cc2ca 100644 --- a/source4/scripting/ejs/smbcalls_reg.c +++ b/source4/scripting/ejs/smbcalls_reg.c @@ -32,7 +32,7 @@ */ static struct registry_context *ejs_get_reg_context(int eid) { - struct registry_context *rctx = mprGetThisPtr(eid, "registry"); + struct registry_context *rctx = (struct registry_context *)mprGetThisPtr(eid, "registry"); if (rctx == NULL) { ejsSetErrorMsg(eid, "unable to find registry"); } diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c index 3c550e57cd..7c9ef50cf5 100644 --- a/source4/scripting/ejs/smbcalls_samba3.c +++ b/source4/scripting/ejs/smbcalls_samba3.c @@ -433,7 +433,7 @@ static int ejs_find_domainsecrets(MprVarHandle eid, int argc, struct MprVar **ar return -1; } - samba3 = mprGetThisPtr(eid, "samba3"); + samba3 = (struct samba3 *)mprGetThisPtr(eid, "samba3"); mprAssert(samba3); sec = samba3_find_domainsecrets(samba3, mprToString(argv[0])); diff --git a/source4/scripting/ejs/smbcalls_string.c b/source4/scripting/ejs/smbcalls_string.c index b83178dbba..215ce77b77 100644 --- a/source4/scripting/ejs/smbcalls_string.c +++ b/source4/scripting/ejs/smbcalls_string.c @@ -437,7 +437,7 @@ static int ejs_encodeURIComponent(MprVarHandle eid, int argc, char **argv) if (!isalnum(s[i])) count++; } - ret = talloc_size(mprMemCtx(), i + count*2 + 1); + ret = talloc_array(mprMemCtx(), char, i + count*2 + 1); if (ret == NULL) { return -1; } @@ -470,7 +470,7 @@ static int ejs_decodeURIComponent(MprVarHandle eid, int argc, char **argv) s = argv[0]; - ret = talloc_size(mprMemCtx(), strlen(s) + 1); + ret = talloc_array(mprMemCtx(), char, strlen(s) + 1); if (ret == NULL) { return -1; } diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 6a1c077fd5..23c52bb446 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -1353,7 +1353,7 @@ static BOOL handler_readx(int instance) parm[0].readx.in.maxcnt = gen_io_count(); parm[0].readx.in.remaining = gen_io_count(); parm[0].readx.in.read_for_execute = gen_bool(); - parm[0].readx.out.data = talloc_size(current_op.mem_ctx, + parm[0].readx.out.data = talloc_array(current_op.mem_ctx, uint8_t, MAX(parm[0].readx.in.mincnt, parm[0].readx.in.maxcnt)); GEN_COPY_PARM; @@ -1381,7 +1381,7 @@ static BOOL handler_writex(int instance) parm[0].writex.in.wmode = gen_bits_mask(0xFFFF); parm[0].writex.in.remaining = gen_io_count(); parm[0].writex.in.count = gen_io_count(); - parm[0].writex.in.data = talloc_zero_size(current_op.mem_ctx, parm[0].writex.in.count); + parm[0].writex.in.data = talloc_zero_array(current_op.mem_ctx, uint8_t, parm[0].writex.in.count); GEN_COPY_PARM; GEN_SET_FNUM(writex.in.file.fnum); diff --git a/source4/utils/getntacl.c b/source4/utils/getntacl.c index ae5c130638..c3f9332537 100644 --- a/source4/utils/getntacl.c +++ b/source4/utils/getntacl.c @@ -62,7 +62,7 @@ static NTSTATUS get_ntacl(char *filename, struct xattr_NTACL **ntacl, return NT_STATUS_INTERNAL_ERROR; } - blob.data = talloc_size(*ntacl, size); + blob.data = talloc_array(*ntacl, uint8_t, size); size = wrap_getxattr(filename, XATTR_NTACL_NAME, blob.data, size); if (size < 0) { fprintf(stderr, "get_ntacl: %s\n", strerror(errno)); |