1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r25027: Fix more warnings.

This commit is contained in:
Jelmer Vernooij 2007-09-08 13:27:14 +00:00 committed by Gerald (Jerry) Carter
parent abe8349f9b
commit 5085c53fcf
43 changed files with 122 additions and 103 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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.

View File

@ -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;

View File

@ -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;
}

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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) {

View File

@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/libcli.h"
/****************************************************************************

View File

@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/libcli.h"
/****************************************************************************
Read size bytes at offset offset using SMBreadX.

View File

@ -19,6 +19,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/libcli.h"
/****************************************************************************
send a qpathinfo call

View File

@ -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 {

View File

@ -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;
}

View File

@ -21,6 +21,7 @@
#include "includes.h"
#include "librpc/gen_ndr/security.h"
#include "libcli/security/security.h"
static const struct {

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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__ */

View File

@ -22,6 +22,7 @@
*/
#include "includes.h"
#include "librpc/ndr/libndr.h"
/**
build a GUID from a string

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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]);

View File

@ -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");
}

View File

@ -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]));

View File

@ -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;
}

View File

@ -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);

View File

@ -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));