summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-07 13:31:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:26 -0500
commit6cf69fee189857ae6f85cd3f81a6a58364839942 (patch)
tree06d80ff7f9c730a0ae70526f94d88acea800eccd
parentbd5a802a26f427779663a3de5f6d49f352b7c473 (diff)
downloadsamba-6cf69fee189857ae6f85cd3f81a6a58364839942.tar.gz
samba-6cf69fee189857ae6f85cd3f81a6a58364839942.tar.xz
samba-6cf69fee189857ae6f85cd3f81a6a58364839942.zip
r24994: Fix some C++ warnings.
(This used to be commit 925abf74fa1ed5ae726bae8781ec549302786b39)
-rw-r--r--source4/auth/gensec/gensec.c2
-rw-r--r--source4/auth/gensec/gensec_krb5.c6
-rw-r--r--source4/lib/registry/local.c4
-rw-r--r--source4/lib/registry/patchfile.c14
-rw-r--r--source4/lib/registry/patchfile_dotreg.c11
-rw-r--r--source4/lib/registry/patchfile_preg.c12
-rw-r--r--source4/lib/registry/samba.c2
-rw-r--r--source4/lib/registry/tools/common.c1
-rw-r--r--source4/libcli/clideltree.c2
-rw-r--r--source4/libcli/clireadwrite.c6
-rw-r--r--source4/libcli/raw/clitransport.c2
-rw-r--r--source4/libcli/raw/rawfileinfo.c2
-rw-r--r--source4/libcli/raw/rawrequest.c2
-rw-r--r--source4/libcli/raw/rawtrans.c4
-rw-r--r--source4/libcli/smb2/request.c2
-rw-r--r--source4/libcli/smb_composite/appendacl.c2
-rw-r--r--source4/libcli/smb_composite/loadfile.c2
-rw-r--r--source4/libcli/smb_composite/savefile.c2
-rw-r--r--source4/libcli/smb_composite/sesssetup.c2
-rw-r--r--source4/librpc/rpc/dcerpc.c2
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c20
-rw-r--r--source4/librpc/rpc/dcerpc_smb2.c12
-rw-r--r--source4/librpc/rpc/dcerpc_sock.c10
-rw-r--r--source4/librpc/tools/ndrdump.c4
-rw-r--r--source4/scripting/ejs/smbscript.c2
-rw-r--r--source4/smbd/process_standard.c2
-rw-r--r--source4/smbd/server.c2
-rw-r--r--source4/torture/rap/rap.c2
-rw-r--r--source4/torture/raw/qfileinfo.c1
-rw-r--r--source4/torture/raw/setfileinfo.c1
-rw-r--r--source4/torture/smbtorture.c4
-rw-r--r--source4/torture/ui.c8
32 files changed, 77 insertions, 73 deletions
diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c
index 25366dc246d..51d0056920a 100644
--- a/source4/auth/gensec/gensec.c
+++ b/source4/auth/gensec/gensec.c
@@ -1222,7 +1222,7 @@ NTSTATUS gensec_register(const struct gensec_security_ops *ops)
return NT_STATUS_NO_MEMORY;
}
- generic_security_ops[gensec_num_backends] = discard_const(ops);
+ generic_security_ops[gensec_num_backends] = discard_const_p(struct gensec_security_ops, ops);
gensec_num_backends++;
generic_security_ops[gensec_num_backends] = NULL;
diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c
index 87ce571fc02..a64da5128f2 100644
--- a/source4/auth/gensec/gensec_krb5.c
+++ b/source4/auth/gensec/gensec_krb5.c
@@ -191,7 +191,7 @@ static NTSTATUS gensec_krb5_server_start(struct gensec_security *gensec_security
return nt_status;
}
- gensec_krb5_state = gensec_security->private_data;
+ gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data;
gensec_krb5_state->state_position = GENSEC_KRB5_SERVER_START;
return NT_STATUS_OK;
@@ -203,7 +203,7 @@ static NTSTATUS gensec_fake_gssapi_krb5_server_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;
@@ -240,7 +240,7 @@ static NTSTATUS gensec_krb5_client_start(struct gensec_security *gensec_security
return nt_status;
}
- gensec_krb5_state = gensec_security->private_data;
+ gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data;
gensec_krb5_state->state_position = GENSEC_KRB5_CLIENT_START;
principal = gensec_get_target_principal(gensec_security);
diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c
index aefb11bde20..8ccb96cbdcb 100644
--- a/source4/lib/registry/local.c
+++ b/source4/lib/registry/local.c
@@ -146,7 +146,7 @@ WERROR local_get_predefined_key (const struct registry_context *ctx,
return WERR_OK;
}
-WERROR local_enum_key(TALLOC_CTX *mem_ctx,
+static WERROR local_enum_key(TALLOC_CTX *mem_ctx,
const struct registry_key *key, uint32_t idx,
const char **name,
const char **keyclass,
@@ -169,7 +169,7 @@ static WERROR local_create_key (TALLOC_CTX *mem_ctx,
struct hive_key *hivekey;
const char **elements;
int i;
- char *last_part;
+ const char *last_part;
last_part = strrchr(name, '\\');
if (last_part == NULL) {
diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c
index 8df873d56bf..99887c67bfa 100644
--- a/source4/lib/registry/patchfile.c
+++ b/source4/lib/registry/patchfile.c
@@ -253,8 +253,8 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
* Load diff file
*/
_PUBLIC_ WERROR reg_diff_load(const char *filename,
- const struct reg_diff_callbacks *callbacks,
- void *callback_data)
+ const struct reg_diff_callbacks *callbacks,
+ void *callback_data)
{
int fd;
char hdr[4];
@@ -295,7 +295,7 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename,
*/
static WERROR reg_diff_apply_add_key(void *_ctx, const char *key_name)
{
- struct registry_context *ctx = _ctx;
+ struct registry_context *ctx = (struct registry_context *)_ctx;
struct registry_key *tmp;
WERROR error;
@@ -310,7 +310,7 @@ static WERROR reg_diff_apply_add_key(void *_ctx, const char *key_name)
static WERROR reg_diff_apply_del_key(void *_ctx, const char *key_name)
{
- struct registry_context *ctx = _ctx;
+ struct registry_context *ctx = (struct registry_context *)_ctx;
WERROR error;
error = reg_key_del_abs(ctx, key_name);
@@ -325,7 +325,7 @@ static WERROR reg_diff_apply_del_key(void *_ctx, const char *key_name)
static WERROR reg_diff_apply_set_value(void *_ctx, const char *path, const char *value_name, uint32_t value_type, DATA_BLOB value)
{
- struct registry_context *ctx = _ctx;
+ struct registry_context *ctx = (struct registry_context *)_ctx;
struct registry_key *tmp;
WERROR error;
@@ -350,7 +350,7 @@ static WERROR reg_diff_apply_set_value(void *_ctx, const char *path, const char
static WERROR reg_diff_apply_del_value (void *_ctx, const char *key_name, const char *value_name)
{
- struct registry_context *ctx = _ctx;
+ struct registry_context *ctx = (struct registry_context *)_ctx;
struct registry_key *tmp;
WERROR error;
@@ -374,7 +374,7 @@ static WERROR reg_diff_apply_del_value (void *_ctx, const char *key_name, const
static WERROR reg_diff_apply_del_all_values(void *_ctx, const char *key_name)
{
- struct registry_context *ctx = _ctx;
+ struct registry_context *ctx = (struct registry_context *)_ctx;
struct registry_key *key;
WERROR error;
int i;
diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c
index 1b4bffe8197..32b70d21441 100644
--- a/source4/lib/registry/patchfile_dotreg.c
+++ b/source4/lib/registry/patchfile_dotreg.c
@@ -40,7 +40,7 @@ struct dotreg_data {
static WERROR reg_dotreg_diff_add_key(void *_data, const char *key_name)
{
- struct dotreg_data *data = _data;
+ struct dotreg_data *data = (struct dotreg_data *)_data;
fdprintf(data->fd, "\n[%s]\n", key_name);
@@ -49,7 +49,7 @@ static WERROR reg_dotreg_diff_add_key(void *_data, const char *key_name)
static WERROR reg_dotreg_diff_del_key(void *_data, const char *key_name)
{
- struct dotreg_data *data = _data;
+ struct dotreg_data *data = (struct dotreg_data *)_data;
fdprintf(data->fd, "\n[-%s]\n", key_name);
@@ -59,7 +59,7 @@ static WERROR reg_dotreg_diff_del_key(void *_data, const char *key_name)
static WERROR reg_dotreg_diff_set_value(void *_data, const char *path,
const char *value_name, uint32_t value_type, DATA_BLOB value)
{
- struct dotreg_data *data = _data;
+ struct dotreg_data *data = (struct dotreg_data *)_data;
fdprintf(data->fd, "\"%s\"=%s:%s\n",
value_name, str_regtype(value_type),
@@ -70,7 +70,7 @@ static WERROR reg_dotreg_diff_set_value(void *_data, const char *path,
static WERROR reg_dotreg_diff_del_value(void *_data, const char *path, const char *value_name)
{
- struct dotreg_data *data = _data;
+ struct dotreg_data *data = (struct dotreg_data *)_data;
fdprintf(data->fd, "\"%s\"=-\n", value_name);
@@ -130,7 +130,8 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
/**
* Load diff file
*/
-_PUBLIC_ WERROR reg_dotreg_diff_load(int fd, const struct reg_diff_callbacks *callbacks, void *callback_data)
+_PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
+ const struct reg_diff_callbacks *callbacks, void *callback_data)
{
char *line, *p, *q;
char *curkey = NULL;
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 1c8d76538a0..993de19f987 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -42,37 +42,37 @@ static WERROR preg_read_utf16(int fd, char *c)
/* FIXME These functions need to be implemented */
static WERROR reg_preg_diff_add_key(void *_data, const char *key_name)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
return WERR_OK;
}
static WERROR reg_preg_diff_del_key(void *_data, const char *key_name)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
return WERR_OK;
}
static WERROR reg_preg_diff_set_value(void *_data, const char *key_name, const char *value_name, uint32_t value_type, DATA_BLOB value_data)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
return WERR_OK;
}
static WERROR reg_preg_diff_del_value(void *_data, const char *key_name, const char *value_name)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
return WERR_OK;
}
static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
return WERR_OK;
}
static WERROR reg_preg_diff_done(void *_data)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
close(data->fd);
talloc_free(data);
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index 6aaaa118d03..a5d6f764591 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -24,7 +24,7 @@
* @brief Samba-specific registry functions
*/
-WERROR mount_samba_hive(struct registry_context *ctx,
+static WERROR mount_samba_hive(struct registry_context *ctx,
struct auth_session_info *auth_info,
struct cli_credentials *creds,
const char *name,
diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c
index c8b0945c2cb..aa11eccbee8 100644
--- a/source4/lib/registry/tools/common.c
+++ b/source4/lib/registry/tools/common.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "auth/credentials/credentials.h"
#include "lib/registry/registry.h"
+#include "lib/registry/tools/common.h"
struct registry_context *reg_common_open_remote(const char *remote, struct cli_credentials *creds)
{
diff --git a/source4/libcli/clideltree.c b/source4/libcli/clideltree.c
index 33c39ea0937..d191bd277a5 100644
--- a/source4/libcli/clideltree.c
+++ b/source4/libcli/clideltree.c
@@ -33,7 +33,7 @@ struct delete_state {
*/
static void delete_fn(struct clilist_file_info *finfo, const char *name, void *state)
{
- struct delete_state *dstate = state;
+ struct delete_state *dstate = (struct delete_state *)state;
char *s, *n;
if (ISDOT(finfo->name) || ISDOTDOT(finfo->name)) {
return;
diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c
index 10a1c753082..e6e66ef36e5 100644
--- a/source4/libcli/clireadwrite.c
+++ b/source4/libcli/clireadwrite.c
@@ -27,7 +27,7 @@
ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, void *_buf, off_t offset,
size_t size)
{
- uint8_t *buf = _buf;
+ uint8_t *buf = (uint8_t *)_buf;
union smb_read parms;
int readsize;
ssize_t total = 0;
@@ -87,7 +87,7 @@ ssize_t smbcli_write(struct smbcli_tree *tree,
int fnum, uint16_t write_mode,
const void *_buf, off_t offset, size_t size)
{
- const uint8_t *buf = _buf;
+ const uint8_t *buf = (const uint8_t *)_buf;
union smb_write parms;
int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32));
ssize_t total = 0;
@@ -133,7 +133,7 @@ ssize_t smbcli_write(struct smbcli_tree *tree,
ssize_t smbcli_smbwrite(struct smbcli_tree *tree,
int fnum, const void *_buf, off_t offset, size_t size1)
{
- const uint8_t *buf = _buf;
+ const uint8_t *buf = (const uint8_t *)_buf;
union smb_write parms;
ssize_t total = 0;
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 98f5042d999..0482b04f244 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -635,7 +635,7 @@ NTSTATUS smb_raw_echo_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
p->out.sequence_number = SVAL(req->in.vwv, VWV(0));
p->out.size = req->in.data_size;
talloc_free(p->out.data);
- p->out.data = talloc_size(mem_ctx, p->out.size);
+ p->out.data = talloc_array(mem_ctx, uint8_t, p->out.size);
NT_STATUS_HAVE_NO_MEMORY(p->out.data);
if (!smbcli_raw_pull_data(req, req->in.data, p->out.size, p->out.data)) {
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c
index faae3a52b10..8481995c1a0 100644
--- a/source4/libcli/raw/rawfileinfo.c
+++ b/source4/libcli/raw/rawfileinfo.c
@@ -66,7 +66,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx,
if (size == -1) {
return NT_STATUS_ILLEGAL_CHARACTER;
}
- io->streams[n].stream_name.s = vstr;
+ io->streams[n].stream_name.s = (const char *)vstr;
io->streams[n].stream_name.private_length = nlen;
io->num_streams++;
len = IVAL(blob.data, ofs);
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 6bf2bb58cc3..778b896abdf 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -83,7 +83,7 @@ struct smbcli_request *smbcli_request_setup_nonsmb(struct smbcli_transport *tran
/* over allocate by a small amount */
req->out.allocated = req->out.size + REQ_OVER_ALLOCATION;
- req->out.buffer = talloc_size(req, req->out.allocated);
+ req->out.buffer = talloc_array(req, uint8_t, req->out.allocated);
if (!req->out.buffer) {
return NULL;
}
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c
index fe26a713109..40a30bd0672 100644
--- a/source4/libcli/raw/rawtrans.c
+++ b/source4/libcli/raw/rawtrans.c
@@ -86,7 +86,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req,
/* allocate it */
if (total_data != 0) {
- tdata = talloc_size(mem_ctx, total_data);
+ tdata = talloc_array(mem_ctx, uint8_t, total_data);
if (!tdata) {
DEBUG(0,("smb_raw_receive_trans: failed to enlarge data buffer to %d bytes\n", total_data));
req->status = NT_STATUS_NO_MEMORY;
@@ -96,7 +96,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req,
}
if (total_param != 0) {
- tparam = talloc_size(mem_ctx, total_param);
+ tparam = talloc_array(mem_ctx, uint8_t, total_param);
if (!tparam) {
DEBUG(0,("smb_raw_receive_trans: failed to enlarge param buffer to %d bytes\n", total_param));
req->status = NT_STATUS_NO_MEMORY;
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index d857fc8c5ba..392fec1cb91 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -229,7 +229,7 @@ static NTSTATUS smb2_grow_buffer(struct smb2_request_buffer *buf, size_t increas
dynamic_ofs = buf->dynamic - buf->buffer;
- buffer_ptr = talloc_realloc_size(buf, buf->buffer, newsize);
+ buffer_ptr = talloc_realloc(buf, buf->buffer, uint8_t, newsize);
NT_STATUS_HAVE_NO_MEMORY(buffer_ptr);
buf->buffer = buffer_ptr;
diff --git a/source4/libcli/smb_composite/appendacl.c b/source4/libcli/smb_composite/appendacl.c
index f82714de5b4..0fda8c4d653 100644
--- a/source4/libcli/smb_composite/appendacl.c
+++ b/source4/libcli/smb_composite/appendacl.c
@@ -187,7 +187,7 @@ static NTSTATUS appendacl_close(struct composite_context *c,
*/
static void appendacl_handler(struct smbcli_request *req)
{
- struct composite_context *c = req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private;
struct appendacl_state *state = talloc_get_type(c->private_data, struct appendacl_state);
/* when this handler is called, the stage indicates what
diff --git a/source4/libcli/smb_composite/loadfile.c b/source4/libcli/smb_composite/loadfile.c
index 9b65d04ef38..d42d3329b68 100644
--- a/source4/libcli/smb_composite/loadfile.c
+++ b/source4/libcli/smb_composite/loadfile.c
@@ -180,7 +180,7 @@ static NTSTATUS loadfile_close(struct composite_context *c,
*/
static void loadfile_handler(struct smbcli_request *req)
{
- struct composite_context *c = req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private;
struct loadfile_state *state = talloc_get_type(c->private_data, struct loadfile_state);
/* when this handler is called, the stage indicates what
diff --git a/source4/libcli/smb_composite/savefile.c b/source4/libcli/smb_composite/savefile.c
index 32fcdbcd87b..b94be9e9b17 100644
--- a/source4/libcli/smb_composite/savefile.c
+++ b/source4/libcli/smb_composite/savefile.c
@@ -180,7 +180,7 @@ static NTSTATUS savefile_close(struct composite_context *c,
*/
static void savefile_handler(struct smbcli_request *req)
{
- struct composite_context *c = req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private;
struct savefile_state *state = talloc_get_type(c->private_data, struct savefile_state);
/* when this handler is called, the stage indicates what
diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c
index 25cf8b3f126..579706261ab 100644
--- a/source4/libcli/smb_composite/sesssetup.c
+++ b/source4/libcli/smb_composite/sesssetup.c
@@ -76,7 +76,7 @@ static void set_user_session_key(struct smbcli_session *session,
*/
static void request_handler(struct smbcli_request *req)
{
- struct composite_context *c = req->async.private;
+ struct composite_context *c = (struct composite_context *)req->async.private;
struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state);
struct smbcli_session *session = req->session;
DATA_BLOB session_key = data_blob(NULL, 0);
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 984cc20fbc7..160b9772f48 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 = talloc_memdup(req, object, sizeof(*object));
+ req->object = talloc_memdup(req, (void *)object, sizeof(*object));
if (req->object == NULL) {
talloc_free(req);
return NULL;
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index 5064e998dd0..f629410bf1c 100644
--- a/source4/librpc/rpc/dcerpc_smb.c
+++ b/source4/librpc/rpc/dcerpc_smb.c
@@ -39,7 +39,7 @@ struct smb_private {
*/
static void pipe_dead(struct dcerpc_connection *c, NTSTATUS status)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
if (smb->dead) {
return;
@@ -141,7 +141,7 @@ static void smb_read_callback(struct smbcli_request *req)
*/
static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLOB *blob)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
union smb_read *io;
struct smb_read_state *state;
struct smbcli_request *req;
@@ -197,7 +197,7 @@ static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLO
*/
static NTSTATUS send_read_request(struct dcerpc_connection *c)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
if (smb->dead) {
return NT_STATUS_CONNECTION_DISCONNECTED;
@@ -220,7 +220,7 @@ struct smb_trans_state {
*/
static void smb_trans_callback(struct smbcli_request *req)
{
- struct smb_trans_state *state = req->async.private;
+ struct smb_trans_state *state = (struct smb_trans_state *)req->async.private;
struct dcerpc_connection *c = state->c;
NTSTATUS status;
@@ -249,7 +249,7 @@ static void smb_trans_callback(struct smbcli_request *req)
*/
static NTSTATUS smb_send_trans_request(struct dcerpc_connection *c, DATA_BLOB *blob)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
struct smb_trans2 *trans;
uint16_t setup[2];
struct smb_trans_state *state;
@@ -297,7 +297,7 @@ static NTSTATUS smb_send_trans_request(struct dcerpc_connection *c, DATA_BLOB *b
*/
static void smb_write_callback(struct smbcli_request *req)
{
- struct dcerpc_connection *c = req->async.private;
+ struct dcerpc_connection *c = (struct dcerpc_connection *)req->async.private;
if (!NT_STATUS_IS_OK(req->status)) {
DEBUG(0,("dcerpc_smb: write callback error\n"));
@@ -312,7 +312,7 @@ static void smb_write_callback(struct smbcli_request *req)
*/
static NTSTATUS smb_send_request(struct dcerpc_connection *c, DATA_BLOB *blob, BOOL trigger_read)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
union smb_write io;
struct smbcli_request *req;
@@ -356,7 +356,7 @@ static NTSTATUS smb_send_request(struct dcerpc_connection *c, DATA_BLOB *blob, B
*/
static NTSTATUS smb_shutdown_pipe(struct dcerpc_connection *c, NTSTATUS status)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
union smb_close io;
struct smbcli_request *req;
@@ -382,7 +382,7 @@ static NTSTATUS smb_shutdown_pipe(struct dcerpc_connection *c, NTSTATUS status)
*/
static const char *smb_peer_name(struct dcerpc_connection *c)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
return smb->server_name;
}
@@ -400,7 +400,7 @@ static const char *smb_target_hostname(struct dcerpc_connection *c)
*/
static NTSTATUS smb_session_key(struct dcerpc_connection *c, DATA_BLOB *session_key)
{
- struct smb_private *smb = c->transport.private_data;
+ struct smb_private *smb = (struct smb_private *)c->transport.private_data;
if (smb->tree->session->user_session_key.data) {
*session_key = smb->tree->session->user_session_key;
diff --git a/source4/librpc/rpc/dcerpc_smb2.c b/source4/librpc/rpc/dcerpc_smb2.c
index dcfee1f2235..615c96c9058 100644
--- a/source4/librpc/rpc/dcerpc_smb2.c
+++ b/source4/librpc/rpc/dcerpc_smb2.c
@@ -41,7 +41,7 @@ struct smb2_private {
*/
static void pipe_dead(struct dcerpc_connection *c, NTSTATUS status)
{
- struct smb2_private *smb = c->transport.private_data;
+ struct smb2_private *smb = (struct smb2_private *)c->transport.private_data;
if (smb->dead) {
return;
@@ -145,7 +145,7 @@ static void smb2_read_callback(struct smb2_request *req)
*/
static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLOB *blob)
{
- struct smb2_private *smb = c->transport.private_data;
+ struct smb2_private *smb = (struct smb2_private *)c->transport.private_data;
struct smb2_read io;
struct smb2_read_state *state;
struct smb2_request *req;
@@ -190,7 +190,7 @@ static NTSTATUS send_read_request_continue(struct dcerpc_connection *c, DATA_BLO
*/
static NTSTATUS send_read_request(struct dcerpc_connection *c)
{
- struct smb2_private *smb = c->transport.private_data;
+ struct smb2_private *smb = (struct smb2_private *)c->transport.private_data;
if (smb->dead) {
return NT_STATUS_CONNECTION_DISCONNECTED;
@@ -280,7 +280,7 @@ static NTSTATUS smb2_send_trans_request(struct dcerpc_connection *c, DATA_BLOB *
*/
static void smb2_write_callback(struct smb2_request *req)
{
- struct dcerpc_connection *c = req->async.private;
+ struct dcerpc_connection *c = (struct dcerpc_connection *)req->async.private;
if (!NT_STATUS_IS_OK(req->status)) {
DEBUG(0,("dcerpc_smb2: write callback error\n"));
@@ -296,7 +296,7 @@ static void smb2_write_callback(struct smb2_request *req)
static NTSTATUS smb2_send_request(struct dcerpc_connection *c, DATA_BLOB *blob,
BOOL trigger_read)
{
- struct smb2_private *smb = c->transport.private_data;
+ struct smb2_private *smb = (struct smb2_private *)c->transport.private_data;
struct smb2_write io;
struct smb2_request *req;
@@ -328,7 +328,7 @@ static NTSTATUS smb2_send_request(struct dcerpc_connection *c, DATA_BLOB *blob,
*/
static NTSTATUS smb2_shutdown_pipe(struct dcerpc_connection *c, NTSTATUS status)
{
- struct smb2_private *smb = c->transport.private_data;
+ struct smb2_private *smb = (struct smb2_private *)c->transport.private_data;
struct smb2_close io;
struct smb2_request *req;
diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c
index a5abf9b4be3..974cbd26920 100644
--- a/source4/librpc/rpc/dcerpc_sock.c
+++ b/source4/librpc/rpc/dcerpc_sock.c
@@ -45,7 +45,7 @@ struct sock_private {
*/
static void sock_dead(struct dcerpc_connection *p, NTSTATUS status)
{
- struct sock_private *sock = p->transport.private_data;
+ struct sock_private *sock = (struct sock_private *)p->transport.private_data;
if (!sock) return;
@@ -111,7 +111,7 @@ static NTSTATUS sock_process_recv(void *private, DATA_BLOB blob)
{
struct dcerpc_connection *p = talloc_get_type(private,
struct dcerpc_connection);
- struct sock_private *sock = p->transport.private_data;
+ struct sock_private *sock = (struct sock_private *)p->transport.private_data;
sock->pending_reads--;
if (sock->pending_reads == 0) {
packet_recv_disable(sock->packet);
@@ -128,7 +128,7 @@ static void sock_io_handler(struct event_context *ev, struct fd_event *fde,
{
struct dcerpc_connection *p = talloc_get_type(private,
struct dcerpc_connection);
- struct sock_private *sock = p->transport.private_data;
+ struct sock_private *sock = (struct sock_private *)p->transport.private_data;
if (flags & EVENT_FD_WRITE) {
packet_queue_run(sock->packet);
@@ -149,7 +149,7 @@ static void sock_io_handler(struct event_context *ev, struct fd_event *fde,
*/
static NTSTATUS sock_send_read(struct dcerpc_connection *p)
{
- struct sock_private *sock = p->transport.private_data;
+ struct sock_private *sock = (struct sock_private *)p->transport.private_data;
sock->pending_reads++;
if (sock->pending_reads == 1) {
packet_recv_enable(sock->packet);
@@ -163,7 +163,7 @@ static NTSTATUS sock_send_read(struct dcerpc_connection *p)
static NTSTATUS sock_send_request(struct dcerpc_connection *p, DATA_BLOB *data,
BOOL trigger_read)
{
- struct sock_private *sock = p->transport.private_data;
+ struct sock_private *sock = (struct sock_private *)p->transport.private_data;
DATA_BLOB blob;
NTSTATUS status;
diff --git a/source4/librpc/tools/ndrdump.c b/source4/librpc/tools/ndrdump.c
index 8a5e55f91ee..bd9d860c84b 100644
--- a/source4/librpc/tools/ndrdump.c
+++ b/source4/librpc/tools/ndrdump.c
@@ -50,7 +50,7 @@ static const struct ndr_interface_call *find_function(
#if (_SAMBA_BUILD_ >= 4)
-static void show_pipes(void)
+_NORETURN_ static void show_pipes(void)
{
const struct ndr_interface_list *l;
printf("\nYou must specify a pipe\n");
@@ -67,7 +67,7 @@ static void show_pipes(void)
#endif
-static void show_functions(const struct ndr_interface_table *p)
+_NORETURN_ static void show_functions(const struct ndr_interface_table *p)
{
int i;
printf("\nYou must specify a function\n");
diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c
index c97bc1ff8df..a21669a07e1 100644
--- a/source4/scripting/ejs/smbscript.c
+++ b/source4/scripting/ejs/smbscript.c
@@ -29,7 +29,7 @@
static EjsId eid;
-static void smbscript_ejs_exception(const char *reason)
+_NORETURN_ static void smbscript_ejs_exception(const char *reason)
{
Ejs *ep = ejsPtr(eid);
ejsSetErrorMsg(eid, "%s", reason);
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index b9a245d140f..07fdccdb36a 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -191,7 +191,7 @@ static void standard_new_task(struct event_context *ev,
/* called when a task goes down */
-static void standard_terminate(struct event_context *ev, const char *reason)
+_NORETURN_ static void standard_terminate(struct event_context *ev, const char *reason)
{
DEBUG(2,("standard_terminate: reason[%s]\n",reason));
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 1a90592fcd5..78f39f7fa7b 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -168,7 +168,7 @@ static void server_stdin_handler(struct event_context *event_ctx, struct fd_even
/*
die if the user selected maximum runtime is exceeded
*/
-static void max_runtime_handler(struct event_context *ev, struct timed_event *te,
+_NORETURN_ static void max_runtime_handler(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private)
{
const char *binary_name = private;
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index bd05c0f38ff..f09e79919cc 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -155,7 +155,7 @@ static NTSTATUS rap_pull_string(TALLOC_CTX *mem_ctx, struct ndr_pull *ndr,
if ( string_offset + len + 1 > ndr->data_size )
return NT_STATUS_INVALID_PARAMETER;
- *dest = talloc_zero_size(mem_ctx, len+1);
+ *dest = talloc_zero_array(mem_ctx, char, len+1);
pull_string(*dest, p, len+1, len, STR_ASCII);
return NT_STATUS_OK;
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 95680392b4e..af9001c7570 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -25,6 +25,7 @@
#include "torture/util.h"
#include "librpc/rpc/dcerpc.h"
#include "torture/rpc/rpc.h"
+#include "torture/raw/proto.h"
static struct {
const char *name;
diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c
index b06a04753fc..f2d5b0c199a 100644
--- a/source4/torture/raw/setfileinfo.c
+++ b/source4/torture/raw/setfileinfo.c
@@ -23,6 +23,7 @@
#include "libcli/raw/libcliraw.h"
#include "libcli/libcli.h"
#include "torture/util.h"
+#include "torture/raw/proto.h"
#define BASEDIR "\\testsfileinfo"
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 8cd449a9b2a..babfb42fd8e 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -179,7 +179,7 @@ static void print_test_list(void)
}
}
-static void usage(poptContext pc)
+_NORETURN_ static void usage(poptContext pc)
{
struct torture_suite *o;
struct torture_suite *s;
@@ -271,7 +271,7 @@ static void usage(poptContext pc)
exit(1);
}
-static void max_runtime_handler(int sig)
+_NORETURN_ static void max_runtime_handler(int sig)
{
DEBUG(0,("maximum runtime exceeded for smbtorture - terminating\n"));
exit(1);
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index 4c22d950aee..064e3ee764f 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -87,12 +87,12 @@ void torture_tcase_set_fixture(struct torture_tcase *tcase,
}
static bool wrap_test_with_testcase(struct torture_context *torture_ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
+ struct torture_tcase *tcase,
+ struct torture_test *test)
{
bool (*fn) (struct torture_context *,
- const void *tcase_data,
- const void *test_data);
+ const void *tcase_data,
+ const void *test_data);
fn = test->fn;