change --picky-developer into --non-picky-developer

Jeremy Allison jra at samba.org
Fri Nov 14 15:27:05 MST 2014


On Fri, Nov 14, 2014 at 01:44:31AM +0100, Stefan (metze) Metzmacher wrote:
> Hi Jeremy,
> 
> here's a patchset that passed a private autobuild.

Pushed the first chunk of these. Still reviewing (slowly:-).

Cheers,

	Jeremy.

> From e3656120573c8a1fa03eddf03960838e07b17339 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Fri, 7 Nov 2014 09:36:16 +0100
> Subject: [PATCH 01/67] wafsamba: add -Werror=return-type for developer builds
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> This avoids errors like this:
> 
>  ../source3/utils/status.c: In function ‘print_share_mode’:
>  ../source3/utils/status.c:126:3: error: ‘return’ with no value, in function
>  returning non-void [-Werror=return-type]
>    return;
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/samba_autoconf.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
> index f60ce9d..c193873 100644
> --- a/buildtools/wafsamba/samba_autoconf.py
> +++ b/buildtools/wafsamba/samba_autoconf.py
> @@ -671,6 +671,8 @@ def SAMBA_CONFIG_H(conf, path=None):
>                          testflags=True)
>          conf.ADD_CFLAGS('-Werror=declaration-after-statement -Wdeclaration-after-statement',
>                          testflags=True)
> +        conf.ADD_CFLAGS('-Werror=return-type -Wreturn-type',
> +                        testflags=True)
>  
>          conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True)
>          # This check is because for ldb_search(), a NULL format string
> -- 
> 1.9.1
> 
> 
> From f95d1289ad9dd67d7658f7ba9be27279fd158c91 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:48:59 +0100
> Subject: [PATCH 02/67] lib/texpect: make the code more portable by using
>  "replace.h" and "system/wait.h"
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/texpect/texpect.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
> index ac88979..2ce33a2 100644
> --- a/lib/texpect/texpect.c
> +++ b/lib/texpect/texpect.c
> @@ -31,20 +31,10 @@
>   * SUCH DAMAGE.
>   */
>  
> -#include "config.h"
> +#include "replace.h"
> +#include "system/filesys.h"
> +#include "system/wait.h"
>  
> -#ifndef HAVE_SYS_TYPES_H
> -#include <sys/types.h>
> -#endif
> -#ifdef HAVE_SYS_WAIT_H
> -#include <sys/wait.h>
> -#endif
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#ifdef HAVE_UNISTD_H
> -#include <unistd.h>
> -#endif
>  #ifdef HAVE_PTY_H
>  #include <pty.h>
>  #endif
> @@ -60,9 +50,7 @@
>  #endif /* STREAMPTY */
>  
>  #include <popt.h>
> -#include <errno.h>
>  #include <err.h>
> -#include <signal.h>
>  
>  struct command {
>  	enum { CMD_EXPECT = 0, CMD_SEND, CMD_PASSWORD } type;
> -- 
> 1.9.1
> 
> 
> From a8fa83c5cd12e06cc712461e3892354666932c3b Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Fri, 26 Sep 2014 09:06:59 +0200
> Subject: [PATCH 03/67] lib/texpect: fix compiler warnings
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Günther Deschner <gd at samba.org>
> ---
>  lib/texpect/texpect.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
> index 2ce33a2..d788081 100644
> --- a/lib/texpect/texpect.c
> +++ b/lib/texpect/texpect.c
> @@ -358,8 +358,9 @@ int main(int argc, const char **argv)
>  	pid_t pid;
>  	poptContext pc;
>  	const char *instruction_file;
> +	const char **args;
>  	const char *program;
> -	char* const *program_args;
> +	char * const *program_args;
>  
>  	pc = poptGetContext("texpect",
>  			    argc,
> @@ -377,7 +378,8 @@ int main(int argc, const char **argv)
>  	}
>  
>  	instruction_file = poptGetArg(pc);
> -	program_args = poptGetArgs(pc);
> +	args = poptGetArgs(pc);
> +	program_args = (char * const *)discard_const_p(char *, args);
>  	program = program_args[0];
>  
>  	if (opt_verbose) {
> -- 
> 1.9.1
> 
> 
> From c8a2c906a4b6f6b1a8e31909f3f038b0cc8b1dbe Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:52:37 +0100
> Subject: [PATCH 04/67] lib/ldb: fix compiler warnings in
>  ldb_modules_list_from_string()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/ldb/common/ldb_modules.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c
> index 05a8d8a..91412a6 100644
> --- a/lib/ldb/common/ldb_modules.c
> +++ b/lib/ldb/common/ldb_modules.c
> @@ -87,7 +87,7 @@ const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *m
>  
>  	if (modstr[0] == '\0') {
>  		modules[0] = NULL;
> -		m = (const char **)modules;
> +		m = discard_const_p(const char *, modules);
>  		return m;
>  	}
>  
> @@ -110,7 +110,7 @@ const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *m
>  
>  	modules[i + 1] = NULL;
>  
> -	m = (const char **)modules;
> +	m = discard_const_p(const char *, modules);
>  
>  	return m;
>  }
> -- 
> 1.9.1
> 
> 
> From b71627656ee2013a274d633a7e47e601818bbc56 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:53:06 +0100
> Subject: [PATCH 05/67] lib/ldb: fix compiler warnings in ldb_tdb.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/ldb/ldb_tdb/ldb_tdb.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
> index d3c83f5..bcb8f0f 100644
> --- a/lib/ldb/ldb_tdb/ldb_tdb.c
> +++ b/lib/ldb/ldb_tdb/ldb_tdb.c
> @@ -264,6 +264,7 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg
>  	void *data = ldb_module_get_private(module);
>  	struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
>  	TDB_DATA tdb_key, tdb_data;
> +	struct ldb_val ldb_data;
>  	int ret = LDB_SUCCESS;
>  
>  	tdb_key = ltdb_key(module, msg->dn);
> @@ -272,12 +273,15 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg
>  	}
>  
>  	ret = ldb_pack_data(ldb_module_get_ctx(module),
> -			    msg, (struct ldb_val *)&tdb_data);
> +			    msg, &ldb_data);
>  	if (ret == -1) {
>  		talloc_free(tdb_key.dptr);
>  		return LDB_ERR_OTHER;
>  	}
>  
> +	tdb_data.dptr = ldb_data.data;
> +	tdb_data.dsize = ldb_data.length;
> +
>  	ret = tdb_store(ltdb->tdb, tdb_key, tdb_data, flgs);
>  	if (ret != 0) {
>  		ret = ltdb_err_map(tdb_error(ltdb->tdb));
> @@ -286,7 +290,7 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg
>  
>  done:
>  	talloc_free(tdb_key.dptr);
> -	talloc_free(tdb_data.dptr);
> +	talloc_free(ldb_data.data);
>  
>  	return ret;
>  }
> @@ -673,6 +677,7 @@ int ltdb_modify_internal(struct ldb_module *module,
>  	void *data = ldb_module_get_private(module);
>  	struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
>  	TDB_DATA tdb_key, tdb_data;
> +	struct ldb_val ldb_data;
>  	struct ldb_message *msg2;
>  	unsigned int i, j, k;
>  	int ret = LDB_SUCCESS, idx;
> @@ -701,7 +706,10 @@ int ltdb_modify_internal(struct ldb_module *module,
>  		goto done;
>  	}
>  
> -	ret = ldb_unpack_data(ldb_module_get_ctx(module), (struct ldb_val *)&tdb_data, msg2);
> +	ldb_data.data = tdb_data.dptr;
> +	ldb_data.length = tdb_data.dsize;
> +
> +	ret = ldb_unpack_data(ldb_module_get_ctx(module), &ldb_data, msg2);
>  	free(tdb_data.dptr);
>  	if (ret == -1) {
>  		ret = LDB_ERR_OTHER;
> -- 
> 1.9.1
> 
> 
> From a93ef1c182109c8e5ed6ee53b205079cd9b304cd Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:56:25 +0100
> Subject: [PATCH 06/67] lib/ldb: remove unused 'allow_warnings=True'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/ldb/wscript | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/lib/ldb/wscript b/lib/ldb/wscript
> index 027c8cb..cb6b5c8 100755
> --- a/lib/ldb/wscript
> +++ b/lib/ldb/wscript
> @@ -153,7 +153,6 @@ def build(bld):
>                            pc_files='ldb.pc',
>                            vnum=VERSION,
>                            private_library=private_library,
> -                          allow_warnings=True,
>                            manpages='man/ldb.3',
>                            abi_directory='ABI',
>                            abi_match = abi_match)
> @@ -255,7 +254,6 @@ def build(bld):
>                              'common/ldb.c',
>                              deps='tevent tdb',
>                              includes='include',
> -                            allow_warnings=True,
>                              cflags=['-DLDB_MODULESDIR=\"%s\"' % modules_dir])
>  
>          LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
> -- 
> 1.9.1
> 
> 
> From 2ccb584b04de37888a20d9efc9829e33ccf1d2c7 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 10:59:49 +0100
> Subject: [PATCH 07/67] lib/util: add str_list_make_v3_const()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/util/samba_util.h   | 4 ++++
>  lib/util/util_strlist.c | 7 +++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
> index 41b3fc8..2f762ac 100644
> --- a/lib/util/samba_util.h
> +++ b/lib/util/samba_util.h
> @@ -476,6 +476,10 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string,
>  	const char *sep);
>  
>  
> +const char **str_list_make_v3_const(TALLOC_CTX *mem_ctx,
> +				    const char *string,
> +				    const char *sep);
> +
>  /* The following definitions come from lib/util/util_file.c  */
>  
>  
> diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c
> index d0be917..9dd4ab3 100644
> --- a/lib/util/util_strlist.c
> +++ b/lib/util/util_strlist.c
> @@ -588,3 +588,10 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string,
>  	TALLOC_FREE(s);
>  	return list;
>  }
> +
> +const char **str_list_make_v3_const(TALLOC_CTX *mem_ctx,
> +				    const char *string,
> +				    const char *sep)
> +{
> +	return const_str_list(str_list_make_v3(mem_ctx, string, sep));
> +}
> -- 
> 1.9.1
> 
> 
> From 4115b90244b5eb0b1b7152d8008c222af1f078a1 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:35:15 +0100
> Subject: [PATCH 08/67] lib/util/tests: avoid some compiler warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/util/charset/tests/iconv.c | 19 ++++++++-------
>  lib/util/tests/asn1_tests.c    | 22 +++++++++---------
>  lib/util/tests/strlist.c       | 53 +++++++++++++++++++++++++++++++-----------
>  3 files changed, 61 insertions(+), 33 deletions(-)
> 
> diff --git a/lib/util/charset/tests/iconv.c b/lib/util/charset/tests/iconv.c
> index 06ace9b..30161d3 100644
> --- a/lib/util/charset/tests/iconv.c
> +++ b/lib/util/charset/tests/iconv.c
> @@ -102,8 +102,10 @@ static unsigned int get_codepoint(char *buf, size_t size, const char *charset)
>  	memset(out, 0, sizeof(out));
>  
>  	ret = iconv(cd, &buf, &size_in, &ptr_out, &size_out);
> -
>  	iconv_close(cd);
> +	if (ret == (size_t) -1) {
> +		return (unsigned int)-1;
> +	}
>  
>  	return out[0] | (out[1]<<8) | (out[2]<<16) | (out[3]<<24);
>  }
> @@ -132,7 +134,8 @@ static bool test_buffer(struct torture_context *test,
>  {
>  	uint8_t buf1[1000], buf2[1000], buf3[1000];
>  	size_t outsize1, outsize2, outsize3;
> -	char *ptr_in;
> +	const char *ptr_in1;
> +	char *ptr_in2;
>  	char *ptr_out;
>  	size_t size_in1, size_in2, size_in3;
>  	size_t ret1, ret2, ret3, len1, len2;
> @@ -174,25 +177,25 @@ static bool test_buffer(struct torture_context *test,
>  	}
>  
>  	/* internal convert to charset - placing result in buf1 */
> -	ptr_in = (char *)inbuf;
> +	ptr_in1 = (const char *)inbuf;
>  	ptr_out = (char *)buf1;
>  	size_in1 = size;
>  	outsize1 = sizeof(buf1);
>  
>  	memset(ptr_out, 0, outsize1);
>  	errno = 0;
> -	ret1 = smb_iconv(cd2, (const char **) &ptr_in, &size_in1, &ptr_out, &outsize1);
> +	ret1 = smb_iconv(cd2, &ptr_in1, &size_in1, &ptr_out, &outsize1);
>  	errno1 = errno;
>  
>  	/* system convert to charset - placing result in buf2 */
> -	ptr_in = (char *)inbuf;
> +	ptr_in2 = (char *)inbuf;
>  	ptr_out = (char *)buf2;
>  	size_in2 = size;
>  	outsize2 = sizeof(buf2);
>  	
>  	memset(ptr_out, 0, outsize2);
>  	errno = 0;
> -	ret2 = iconv(cd, &ptr_in, &size_in2, &ptr_out, &outsize2);
> +	ret2 = iconv(cd, &ptr_in2, &size_in2, &ptr_out, &outsize2);
>  	errno2 = errno;
>  
>  	len1 = sizeof(buf1) - outsize1;
> @@ -247,13 +250,13 @@ static bool test_buffer(struct torture_context *test,
>  
>  	/* convert back to UTF-16, putting result in buf3 */
>  	size = size - size_in1;
> -	ptr_in = (char *)buf1;
> +	ptr_in1 = (const char *)buf1;
>  	ptr_out = (char *)buf3;
>  	size_in3 = len1;
>  	outsize3 = sizeof(buf3);
>  
>  	memset(ptr_out, 0, outsize3);
> -	ret3 = smb_iconv(cd3, (const char **) &ptr_in, &size_in3, &ptr_out, &outsize3);
> +	ret3 = smb_iconv(cd3, &ptr_in1, &size_in3, &ptr_out, &outsize3);
>  
>  	/* we only internally support the first 1M codepoints */
>  	if (outsize3 != sizeof(buf3) - size &&
> diff --git a/lib/util/tests/asn1_tests.c b/lib/util/tests/asn1_tests.c
> index 2c68cb4..6dd7c64 100644
> --- a/lib/util/tests/asn1_tests.c
> +++ b/lib/util/tests/asn1_tests.c
> @@ -111,47 +111,47 @@ static const struct {
>  	int value;
>  } integer_tests[] = {
>          {
> -		.blob = {"\x02\x01\x00", 3},
> +		.blob = { discard_const_p(uint8_t, "\x02\x01\x00"), 3},
>  		.value = 0
>  	},
>  	{
> -		.blob = {"\x02\x01\x7f", 3},
> +		.blob = { discard_const_p(uint8_t, "\x02\x01\x7f"), 3},
>  		.value = 127
>  	},
>  	{
> -		.blob = {"\x02\x02\x00\x80", 4},
> +		.blob = { discard_const_p(uint8_t, "\x02\x02\x00\x80"), 4},
>  		.value = 128
>  	},
>  	{
> -		.blob = {"\x02\x02\x01\x00", 4},
> +		.blob = { discard_const_p(uint8_t, "\x02\x02\x01\x00"), 4},
>  		.value = 256
>  	},
>  	{
> -		.blob = {"\x02\x01\x80", 3},
> +		.blob = { discard_const_p(uint8_t, "\x02\x01\x80"), 3},
>  		.value = -128
>  	},
>  	{
> -		.blob = {"\x02\x02\xff\x7f", 4},
> +		.blob = { discard_const_p(uint8_t, "\x02\x02\xff\x7f"), 4},
>  		.value = -129
>  	},
>  	{
> -		.blob = {"\x02\x01\xff", 3},
> +		.blob = { discard_const_p(uint8_t, "\x02\x01\xff"), 3},
>  		.value = -1
>  	},
>  	{
> -		.blob = {"\x02\x02\xff\x01", 4},
> +		.blob = { discard_const_p(uint8_t, "\x02\x02\xff\x01"), 4},
>  		.value = -255
>  	},
>  	{
> -		.blob = {"\x02\x02\x00\xff", 4},
> +		.blob = { discard_const_p(uint8_t, "\x02\x02\x00\xff"), 4},
>  		.value = 255
>  	},
>  	{
> -		.blob = {"\x02\x04\x80\x00\x00\x00", 6},
> +		.blob = { discard_const_p(uint8_t, "\x02\x04\x80\x00\x00\x00"), 6},
>  		.value = 0x80000000
>  	},
>  	{
> -		.blob = {"\x02\x04\x7f\xff\xff\xff", 6},
> +		.blob = { discard_const_p(uint8_t, "\x02\x04\x7f\xff\xff\xff"), 6},
>  		.value = 0x7fffffff
>  	}
>  };
> diff --git a/lib/util/tests/strlist.c b/lib/util/tests/strlist.c
> index 7df01d3..1718499 100644
> --- a/lib/util/tests/strlist.c
> +++ b/lib/util/tests/strlist.c
> @@ -111,7 +111,8 @@ static bool test_lists_shell(struct torture_context *tctx, const void *data)
>  	ret1 = str_list_make_shell(mem_ctx, element->list_as_string, element->separators);
>  	
>  	torture_assert(tctx, ret1, "str_list_make_shell() must not return NULL");
> -	tmp = str_list_join_shell(mem_ctx, (const char **) ret1, element->separators ? *element->separators : ' ');
> +	tmp = str_list_join_shell(mem_ctx, discard_const_p(const char *, ret1),
> +				  element->separators ? *element->separators : ' ');
>  	ret2 = str_list_make_shell(mem_ctx, tmp, element->separators);
>  
>  	if ((ret1 == NULL || ret2 == NULL) && ret2 != ret1) {
> @@ -161,18 +162,22 @@ static bool test_list_copy(struct torture_context *tctx)
>  	const char *list[] = { "foo", "bar", NULL };
>  	const char *empty_list[] = { NULL };
>  	const char **null_list = NULL;
> +	char **l;
>  
> -	result = (const char **)str_list_copy(tctx, list);
> +	l = str_list_copy(tctx, list);
> +	result = discard_const_p(const char *, l);
>  	torture_assert_int_equal(tctx, str_list_length(result), 2, "list length");
>  	torture_assert_str_equal(tctx, result[0], "foo", "element 0");
>  	torture_assert_str_equal(tctx, result[1], "bar", "element 1");
>  	torture_assert_str_equal(tctx, result[2], NULL, "element 2");
>  
> -	result = (const char **)str_list_copy(tctx, empty_list);
> +	l = str_list_copy(tctx, empty_list);
> +	result = discard_const_p(const char *, l);
>  	torture_assert_int_equal(tctx, str_list_length(result), 0, "list length");
>  	torture_assert_str_equal(tctx, result[0], NULL, "element 0");
>  
> -	result = (const char **)str_list_copy(tctx, null_list);
> +	l = str_list_copy(tctx, null_list);
> +	result = discard_const_p(const char *, l);
>  	torture_assert(tctx, result == NULL, "result NULL");
>  	
>  	return true;
> @@ -262,9 +267,12 @@ static bool test_list_add(struct torture_context *tctx)
>  		"element_3",
>  		NULL
>  	};
> -	result = (const char **) str_list_make(tctx, "element_0, element_1, element_2", NULL);
> +	char **l;
> +
> +	l = str_list_make(tctx, "element_0, element_1, element_2", NULL);
> +	result = discard_const_p(const char *, l);
>  	torture_assert(tctx, result, "str_list_make() must not return NULL");
> -	result2 = str_list_add((const char **) result, "element_3");
> +	result2 = str_list_add(result, "element_3");
>  	torture_assert(tctx, result2, "str_list_add() must not return NULL");
>  	torture_assert(tctx, str_list_equal(result2, list), 
>  		       "str_list_add() failed");
> @@ -282,7 +290,10 @@ static bool test_list_add_const(struct torture_context *tctx)
>  		"element_3",
>  		NULL
>  	};
> -	result = (const char **) str_list_make(tctx, "element_0, element_1, element_2", NULL);
> +	char **l;
> +
> +	l = str_list_make(tctx, "element_0, element_1, element_2", NULL);
> +	result = discard_const_p(const char *, l);
>  	torture_assert(tctx, result, "str_list_make() must not return NULL");
>  	result2 = str_list_add_const(result, "element_3");
>  	torture_assert(tctx, result2, "str_list_add_const() must not return NULL");
> @@ -301,7 +312,10 @@ static bool test_list_remove(struct torture_context *tctx)
>  		"element_3",
>  		NULL
>  	};
> -	result = (const char **) str_list_make(tctx, "element_0, element_1, element_2, element_3", NULL);
> +	char **l;
> +
> +	l = str_list_make(tctx, "element_0, element_1, element_2, element_3", NULL);
> +	result = discard_const_p(const char *, l);
>  	torture_assert(tctx, result, "str_list_make() must not return NULL");
>  	str_list_remove(result, "element_2");
>  	torture_assert(tctx, str_list_equal(result, list), 
> @@ -358,7 +372,10 @@ static bool test_list_unique(struct torture_context *tctx)
>  		"element_2",
>  		NULL
>  	};
> -	result = (const char **) str_list_copy(tctx, list_dup);
> +	char **l;
> +
> +	l = str_list_copy(tctx, list_dup);
> +	result = discard_const_p(const char *, l);
>  	/* We must copy the list, as str_list_unique does a talloc_realloc() on it's parameter */
>  	result = str_list_unique(result);
>  	torture_assert(tctx, result, "str_list_unique() must not return NULL");
> @@ -374,8 +391,11 @@ static bool test_list_unique_2(struct torture_context *tctx)
>  	int i;
>  	int count, num_dups;
>  	const char **result;
> -	const char **list = (const char **)str_list_make_empty(tctx);
> -	const char **list_dup = (const char **)str_list_make_empty(tctx);
> +	char **l1 = str_list_make_empty(tctx);
> +	char **l2 = str_list_make_empty(tctx);
> +	const char **list = discard_const_p(const char *, l1);
> +	const char **list_dup = discard_const_p(const char *, l2);
> +	char **l;
>  
>  	count = lpcfg_parm_int(tctx->lp_ctx, NULL, "list_unique", "count", 9);
>  	num_dups = lpcfg_parm_int(tctx->lp_ctx, NULL, "list_unique", "dups", 7);
> @@ -389,7 +409,8 @@ static bool test_list_unique_2(struct torture_context *tctx)
>  		list_dup = str_list_append(list_dup, list);
>  	}
>  
> -	result = (const char **)str_list_copy(tctx, list_dup);
> +	l = str_list_copy(tctx, list_dup);
> +	result = discard_const_p(const char *, l);
>  	/* We must copy the list, as str_list_unique does a talloc_realloc() on it's parameter */
>  	result = str_list_unique(result);
>  	torture_assert(tctx, result, "str_list_unique() must not return NULL");
> @@ -424,7 +445,9 @@ static bool test_list_append(struct torture_context *tctx)
>  		"element_5",
>  		NULL
>  	};
> -	result = (const char **) str_list_copy(tctx, list);
> +	char **l;
> +	l = str_list_copy(tctx, list);
> +	result = discard_const_p(const char *, l);
>  	torture_assert(tctx, result, "str_list_copy() must not return NULL");
>  	result = str_list_append(result, list2);
>  	torture_assert(tctx, result, "str_list_append() must not return NULL");
> @@ -458,7 +481,9 @@ static bool test_list_append_const(struct torture_context *tctx)
>  		"element_5",
>  		NULL
>  	};
> -	result = (const char **) str_list_copy(tctx, list);
> +	char **l;
> +	l = str_list_copy(tctx, list);
> +	result = discard_const_p(const char *, l);
>  	torture_assert(tctx, result, "str_list_copy() must not return NULL");
>  	result = str_list_append_const(result, list2);
>  	torture_assert(tctx, result, "str_list_append_const() must not return NULL");
> -- 
> 1.9.1
> 
> 
> From 655539c5ed071b584dc27116c5fa3e9e78f56061 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 08:07:47 +0100
> Subject: [PATCH 09/67] lib/param: fix const warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/param/loadparm.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
> index d1e36df..b9a3e20 100644
> --- a/lib/param/loadparm.c
> +++ b/lib/param/loadparm.c
> @@ -414,8 +414,10 @@ const char **lpcfg_parm_string_list(TALLOC_CTX *mem_ctx,
>  {
>  	const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
>  
> -	if (value != NULL)
> -		return (const char **)str_list_make(mem_ctx, value, separator);
> +	if (value != NULL) {
> +		char **l = str_list_make(mem_ctx, value, separator);
> +		return discard_const_p(const char *, l);
> +	}
>  
>  	return NULL;
>  }
> @@ -905,8 +907,8 @@ void copy_service(struct loadparm_service *pserviceDest,
>  				case P_CMDLIST:
>  				case P_LIST:
>  					TALLOC_FREE(*((char ***)dest_ptr));
> -					*(const char * const **)dest_ptr = (const char * const *)str_list_copy(pserviceDest,
> -										  *(const char * * const *)src_ptr);
> +					*(char ***)dest_ptr = str_list_copy(pserviceDest,
> +									    *discard_const_p(const char **, src_ptr));
>  					break;
>  				default:
>  					break;
> @@ -1287,8 +1289,8 @@ bool handle_netbios_aliases(struct loadparm_context *lp_ctx, struct loadparm_ser
>  			    const char *pszParmValue, char **ptr)
>  {
>  	TALLOC_FREE(lp_ctx->globals->netbios_aliases);
> -	lp_ctx->globals->netbios_aliases = (const char **)str_list_make_v3(lp_ctx->globals->ctx,
> -									   pszParmValue, NULL);
> +	lp_ctx->globals->netbios_aliases = str_list_make_v3_const(lp_ctx->globals->ctx,
> +								  pszParmValue, NULL);
>  
>  	if (lp_ctx->s3_fns) {
>  		return lp_ctx->s3_fns->set_netbios_aliases(lp_ctx->globals->netbios_aliases);
> @@ -1502,9 +1504,8 @@ static bool set_variable_helper(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr
>  
>  		case P_CMDLIST:
>  			TALLOC_FREE(*(char ***)parm_ptr);
> -			*(const char * const **)parm_ptr
> -				= (const char * const *)str_list_make_v3(mem_ctx,
> -									 pszParmValue, NULL);
> +			*(char ***)parm_ptr = str_list_make_v3(mem_ctx,
> +							pszParmValue, NULL);
>  			break;
>  
>  		case P_LIST:
> @@ -1537,7 +1538,7 @@ static bool set_variable_helper(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr
>  							  pszParmName, pszParmValue));
>  						return false;
>  					}
> -					*(const char * const **)parm_ptr = (const char * const *) new_list;
> +					*(char ***)parm_ptr = new_list;
>  					break;
>  				}
>  			}
> @@ -2001,7 +2002,7 @@ static bool is_default(void *base_structure, int i)
>  		case P_CMDLIST:
>  		case P_LIST:
>  			return str_list_equal((const char * const *)parm_table[i].def.lvalue,
> -					      *(const char ***)def_ptr);
> +					      *(const char * const **)def_ptr);
>  		case P_STRING:
>  		case P_USTRING:
>  			return strequal(parm_table[i].def.svalue,
> -- 
> 1.9.1
> 
> 
> From 73d3fd486673fe58047509f5bd386cc4e8a71dd4 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:31:42 +0100
> Subject: [PATCH 10/67] lib/smbconf: remove const warning
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  lib/smbconf/smbconf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/smbconf/smbconf.c b/lib/smbconf/smbconf.c
> index 27d36ca..4129ea5 100644
> --- a/lib/smbconf/smbconf.c
> +++ b/lib/smbconf/smbconf.c
> @@ -286,7 +286,7 @@ sbcErr smbconf_create_set_share(struct smbconf_ctx *ctx,
>  	}
>  
>  	err = smbconf_set_includes(ctx, service->name, num_includes,
> -				   (const char **)includes);
> +				   discard_const_p(const char *, includes));
>  	if (!SBC_ERROR_IS_OK(err)) {
>  		goto cancel;
>  	}
> -- 
> 1.9.1
> 
> 
> From 45998ae9fcf3bc004a3ceecbe22c3f384f9f8bcf Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:57:10 +0100
> Subject: [PATCH 11/67] librpc/ndr: add NDR_SCALAR_PTR_PROTO() helper macro
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  librpc/ndr/libndr.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
> index 76b58bb..ee3fac6 100644
> --- a/librpc/ndr/libndr.h
> +++ b/librpc/ndr/libndr.h
> @@ -556,6 +556,11 @@ enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, type v)
>  enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type *v); \
>  void ndr_print_ ## name(struct ndr_print *ndr, const char *var_name, type v); 
>  
> +#define NDR_SCALAR_PTR_PROTO(name, type) \
> +enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, const type *v); \
> +enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type **v); \
> +void ndr_print_ ## name(struct ndr_print *ndr, const char *var_name, const type *v);
> +
>  #define NDR_BUFFER_PROTO(name, type) \
>  enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, const type *v); \
>  enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type *v); \
> -- 
> 1.9.1
> 
> 
> From 54dfb03011e170252c6f0af8e26176322a595c83 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:57:41 +0100
> Subject: [PATCH 12/67] libcli/nbt: use NDR_SCALAR_PTR_PROTO() and fix the
>  prototype of ndr_pull_wrepl_nbt_name()
> 
> This avoids compiler warnings in pidl generated code.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  libcli/nbt/libnbt.h  | 2 +-
>  libcli/nbt/nbtname.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libcli/nbt/libnbt.h b/libcli/nbt/libnbt.h
> index 5a29a02..e6d7a98 100644
> --- a/libcli/nbt/libnbt.h
> +++ b/libcli/nbt/libnbt.h
> @@ -333,7 +333,7 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
>  			     struct nbt_name_packet *request);
>  
>  
> -NDR_SCALAR_PROTO(wrepl_nbt_name, const struct nbt_name *)
> +NDR_SCALAR_PTR_PROTO(wrepl_nbt_name, struct nbt_name)
>  NDR_BUFFER_PROTO(nbt_name, struct nbt_name)
>  NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode);
>  
> diff --git a/libcli/nbt/nbtname.c b/libcli/nbt/nbtname.c
> index 5be7830..d73dde1 100644
> --- a/libcli/nbt/nbtname.c
> +++ b/libcli/nbt/nbtname.c
> @@ -324,7 +324,7 @@ _PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name)
>  /**
>    pull a nbt name, WINS Replication uses another on wire format for nbt name
>  */
> -_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, const struct nbt_name **_r)
> +_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name **_r)
>  {
>  	struct nbt_name *r;
>  	uint8_t *namebuf;
> -- 
> 1.9.1
> 
> 
> From ee462a5f6f37dd8e2acdfc9c6e04774a6c946e9a Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:00:12 +0100
> Subject: [PATCH 13/67] s4:librpc: remove unused allow_warnings=True from
>  NDR_WINSREPL and NDR_WINSIF
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/librpc/wscript_build | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build
> index 8aaa0c9..15ba914 100755
> --- a/source4/librpc/wscript_build
> +++ b/source4/librpc/wscript_build
> @@ -27,7 +27,6 @@ bld.SAMBA_SUBSYSTEM('NDR_SASL_HELPERS',
>  
>  bld.SAMBA_SUBSYSTEM('NDR_WINSIF',
>  	source='gen_ndr/ndr_winsif.c',
> -	allow_warnings=True,
>  	public_deps='ndr'
>  	)
>  
> @@ -46,7 +45,6 @@ bld.SAMBA_SUBSYSTEM('NDR_NTP_SIGND',
>  
>  bld.SAMBA_SUBSYSTEM('NDR_WINSREPL',
>  	source='gen_ndr/ndr_winsrepl.c',
> -	allow_warnings=True,
>  	public_deps='ndr ndr_nbt'
>  	)
>  
> -- 
> 1.9.1
> 
> 
> From d0e367b2f16449003ed47ebd30a2cea586d7057d Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:03:15 +0100
> Subject: [PATCH 14/67] s4:librpc/idl: add a uuid to sasl_helpers.idl
> 
> This makes it possible to use decode_saslauthd in ndrdump.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/librpc/idl/sasl_helpers.idl | 2 ++
>  source4/librpc/wscript_build        | 1 -
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/source4/librpc/idl/sasl_helpers.idl b/source4/librpc/idl/sasl_helpers.idl
> index 8fa4b57..344d491 100644
> --- a/source4/librpc/idl/sasl_helpers.idl
> +++ b/source4/librpc/idl/sasl_helpers.idl
> @@ -1,6 +1,8 @@
>  #include "idl_types.h"
>  
>  [
> +  uuid("7512b2f4-5f4f-11e4-bbe6-3c970e8d8226"),
> +  version(1.0),
>    pointer_default(unique),
>    helpstring("SASL helpers")
>  ]
> diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build
> index 15ba914..ea81d2c 100755
> --- a/source4/librpc/wscript_build
> +++ b/source4/librpc/wscript_build
> @@ -19,7 +19,6 @@ bld.SAMBA_SUBSYSTEM('NDR_IRPC',
>  
>  bld.SAMBA_SUBSYSTEM('NDR_SASL_HELPERS',
>  	source='gen_ndr/ndr_sasl_helpers.c',
> -	allow_warnings=True,
>  	public_deps='ndr'
>  	)
>  
> -- 
> 1.9.1
> 
> 
> From 57747273b36abd55429b1457a59ab9d65c790239 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 22 May 2014 10:36:41 +0200
> Subject: [PATCH 15/67] auth: add missing includes to auth/wbc_auth_util.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  auth/wbc_auth_util.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/auth/wbc_auth_util.c b/auth/wbc_auth_util.c
> index ebd24a9..1c50b18 100644
> --- a/auth/wbc_auth_util.c
> +++ b/auth/wbc_auth_util.c
> @@ -21,6 +21,8 @@
>  #include "libcli/security/security.h"
>  #include "librpc/gen_ndr/netlogon.h"
>  #include "nsswitch/libwbclient/wbclient.h"
> +#include "librpc/gen_ndr/auth.h"
> +#include "auth/auth_sam_reply.h"
>  
>  #undef DBGC_CLASS
>  #define DBGC_CLASS DBGC_AUTH
> -- 
> 1.9.1
> 
> 
> From a1cadf544963abf6b523d49fd65338a6a0f74cf0 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:38:39 +0100
> Subject: [PATCH 16/67] nsswitch: avoid some compiler warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  nsswitch/pam_winbind.c       | 4 ++--
>  nsswitch/wbinfo.c            | 7 ++++---
>  nsswitch/winbind_nss_linux.c | 2 +-
>  3 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
> index 564f773..f06f2b5 100644
> --- a/nsswitch/pam_winbind.c
> +++ b/nsswitch/pam_winbind.c
> @@ -663,7 +663,7 @@ static int converse(const pam_handle_t *pamh,
>  	retval = pam_get_item(pamh, PAM_CONV, (const void **) &conv);
>  	if (retval == PAM_SUCCESS) {
>  		retval = conv->conv(nargs,
> -				    (const struct pam_message **)message,
> +				    discard_const_p(const struct pam_message *, message),
>  				    response, conv->appdata_ptr);
>  	}
>  
> @@ -1998,7 +1998,7 @@ static int winbind_chauthtok_request(struct pwb_context *ctx,
>  		}
>  
>  		/* FIXME: avoid to send multiple PAM messages after another */
> -		switch (reject_reason) {
> +		switch ((int)reject_reason) {
>  			case -1:
>  				break;
>  			case WBC_PWD_CHANGE_NO_ERROR:
> diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
> index a31fbdf..9e06fb2 100644
> --- a/nsswitch/wbinfo.c
> +++ b/nsswitch/wbinfo.c
> @@ -1329,13 +1329,14 @@ static bool wbinfo_lookuprids(const char *domain, const char *arg)
>  	}
>  
>  	wbc_status = wbcLookupRids(&dinfo->sid, num_rids, rids,
> -				   (const char **)&domain_name, &names, &types);
> +				   &p, &names, &types);
>  	if (!WBC_ERROR_IS_OK(wbc_status)) {
>  		d_printf("winbind_lookup_rids failed: %s\n",
>  			 wbcErrorString(wbc_status));
>  		goto done;
>  	}
>  
> +	domain_name = discard_const_p(char, p);
>  	d_printf("Domain: %s\n", domain_name);
>  
>  	for (i=0; i<num_rids; i++) {
> @@ -2104,7 +2105,7 @@ enum {
>  	OPT_KRB5CCNAME
>  };
>  
> -int main(int argc, char **argv, char **envp)
> +int main(int argc, const char **argv, char **envp)
>  {
>  	int opt;
>  	TALLOC_CTX *frame = talloc_stackframe();
> @@ -2219,7 +2220,7 @@ int main(int argc, char **argv, char **envp)
>  
>  	/* Parse options */
>  
> -	pc = poptGetContext("wbinfo", argc, (const char **)argv,
> +	pc = poptGetContext("wbinfo", argc, argv,
>  			    long_options, 0);
>  
>  	/* Parse command line options */
> diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
> index 70ede3e..9afa9d4 100644
> --- a/nsswitch/winbind_nss_linux.c
> +++ b/nsswitch/winbind_nss_linux.c
> @@ -287,7 +287,7 @@ static NSS_STATUS fill_pwent(struct passwd *result,
>     Return NSS_STATUS_TRYAGAIN if we run out of memory. */
>  
>  static NSS_STATUS fill_grent(struct group *result, struct winbindd_gr *gr,
> -		      char *gr_mem, char **buffer, size_t *buflen)
> +		      const char *gr_mem, char **buffer, size_t *buflen)
>  {
>  	char *name;
>  	int i;
> -- 
> 1.9.1
> 
> 
> From adabebd5c8b31ceb7ca620b07ca5bff26d48f4a7 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 17/67] s3:auth: add missing auth_samba4_init() prototype
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/auth/proto.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/source3/auth/proto.h b/source3/auth/proto.h
> index 1da0c44..9f4e47a 100644
> --- a/source3/auth/proto.h
> +++ b/source3/auth/proto.h
> @@ -380,5 +380,8 @@ NTSTATUS make_session_info_krb5(TALLOC_CTX *mem_ctx,
>  				DATA_BLOB *session_key,
>  				struct auth_session_info **session_info);
>  
> +/* The following definitions come from auth/auth_samba4.c  */
> +
> +NTSTATUS auth_samba4_init(void);
>  
>  #endif /* _AUTH_PROTO_H_ */
> -- 
> 1.9.1
> 
> 
> From 24c5eb2497c007cd81bef25967185d86ffc85b23 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 18/67] s3:auth: add some const to user_in_list()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/auth/proto.h     | 2 +-
>  source3/auth/user_util.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/source3/auth/proto.h b/source3/auth/proto.h
> index 9f4e47a..da3c099 100644
> --- a/source3/auth/proto.h
> +++ b/source3/auth/proto.h
> @@ -356,7 +356,7 @@ void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
>  
>  bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out);
>  bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname);
> -bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list);
> +bool user_in_list(TALLOC_CTX *ctx, const char *user, const char * const *list);
>  
>  /* The following definitions come from auth/user_krb5.c  */
>  struct PAC_LOGON_INFO;
> diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
> index 70ab5ad..ded2184 100644
> --- a/source3/auth/user_util.c
> +++ b/source3/auth/user_util.c
> @@ -188,7 +188,7 @@ bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname)
>   and netgroup lists.
>  ****************************************************************************/
>  
> -bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list)
> +bool user_in_list(TALLOC_CTX *ctx, const char *user, const char * const *list)
>  {
>  	if (!list || !*list)
>  		return False;
> @@ -399,7 +399,7 @@ bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
>  		}
>  
>  		if (strchr_m(dosname,'*') ||
> -		    user_in_list(ctx, user_in, (const char **)dosuserlist)) {
> +		    user_in_list(ctx, user_in, (const char * const *)dosuserlist)) {
>  			DEBUG(3,("Mapped user %s to %s\n",user_in,unixname));
>  			mapped_user = True;
>  
> -- 
> 1.9.1
> 
> 
> From 110bffe6c494d5d40dfef96cd38614efbc171fe0 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 19/67] s3:lib: fix const warnings in popt_common.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/lib/popt_common.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
> index df0465d..6f27bac 100644
> --- a/source3/lib/popt_common.c
> +++ b/source3/lib/popt_common.c
> @@ -353,8 +353,11 @@ static void popt_common_credentials_callback(poptContext con,
>  					const struct poptOption *opt,
>  					const char *arg, const void *data)
>  {
> -	struct user_auth_info *auth_info = talloc_get_type_abort(
> -		*((const char **)data), struct user_auth_info);
> +	const void **pp = discard_const(data);
> +	void *p = discard_const(*pp);
> +	struct user_auth_info *auth_info =
> +		talloc_get_type_abort(p,
> +		struct user_auth_info);
>  
>  	if (reason == POPT_CALLBACK_REASON_PRE) {
>  		set_cmdline_auth_info_username(auth_info, "GUEST");
> @@ -501,7 +504,7 @@ void popt_burn_cmdline_password(int argc, char *argv[])
>  struct poptOption popt_common_credentials[] = {
>  	{ NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE,
>  	  (void *)popt_common_credentials_callback, 0,
> -	  (const char *)&global_auth_info },
> +	  (const void *)&global_auth_info },
>  	{ "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "USERNAME" },
>  	{ "no-pass", 'N', POPT_ARG_NONE, NULL, 'N', "Don't ask for a password" },
>  	{ "kerberos", 'k', POPT_ARG_NONE, NULL, 'k', "Use kerberos (active directory) authentication" },
> -- 
> 1.9.1
> 
> 
> From 6763c2610e500f9eda07a6001ce9f6b990941bab Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 13 Nov 2014 08:50:35 +0100
> Subject: [PATCH 20/67] s3:lib: fix/simplify srprs_hex()
> 
> There're a few problems with this function.
> 
> - it pretends to support values up to UINT64_MAX
>   in it only returns 'unsigned' which support only
>   values up to UINT32_MAX. Currently we only have
>   callers with len=2 and len=8, so it's not a triggered
>   bug.
> 
>   We just allow (len >= 1 && len <= 8) now.
> 
> - The compiler is not able to inspect the format string
>   to sscanf().
> 
>   We copy up to 8 bytes into a stack buffer
>   and always pass "%8x" to sscanf.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/lib/srprs.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/source3/lib/srprs.c b/source3/lib/srprs.c
> index 35920f1..a3fd0c3 100644
> --- a/source3/lib/srprs.c
> +++ b/source3/lib/srprs.c
> @@ -125,26 +125,22 @@ fail:
>  
>  bool srprs_hex(const char** ptr, size_t len, unsigned* u)
>  {
> -	static const char* FMT[] = {
> -		"%1x","%2x","%3x","%4x","%5x","%6x","%7x","%8x",
> -		"%9x","%10x","%11x","%12x","%13x","%14x","%15x","%16x"
> -	};
> -
> -	const char* pos = *ptr;
> +	const char *str = *ptr;
> +	const char *pos = *ptr;
>  	int ret;
>  	int i;
> +	char buf[8+1] = {};
>  
> -	assert((len > 0)
> -	       && (len <= 2*sizeof(unsigned))
> -	       && (len <= sizeof(FMT)/sizeof(const char*)));
> +	assert((len >= 1) && (len <= 8));
>  
>  	for (i=0; i<len; i++) {
>  		if (!srprs_charset(&pos, "0123456789abcdefABCDEF", NULL)) {
>  			break;
>  		}
> +		buf[i] = str[i];
>  	}
>  
> -	ret = sscanf(*ptr, FMT[len-1], u);
> +	ret = sscanf(buf, "%8x", u);
>  
>  	if ( ret != 1 ) {
>  		return false;
> -- 
> 1.9.1
> 
> 
> From a98b71d3778da0a71cde8932346fa6883b282819 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 21/67] s3:lib/netapi/tests: fix invalid switch enum level
>  warning
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/lib/netapi/tests/netgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/lib/netapi/tests/netgroup.c b/source3/lib/netapi/tests/netgroup.c
> index c872087..dba4fe7 100644
> --- a/source3/lib/netapi/tests/netgroup.c
> +++ b/source3/lib/netapi/tests/netgroup.c
> @@ -348,7 +348,7 @@ NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
>  	printf("testing NetGroupSetInfo level 0\n");
>  
>  	status = NetGroupSetInfo(hostname, groupname, 0, (uint8_t *)&g0, &parm_err);
> -	switch (status) {
> +	switch ((int)status) {
>  		case 0:
>  			break;
>  		case 50: /* not supported */
> -- 
> 1.9.1
> 
> 
> From 5c0d078abe7e3af684840a67e664b5e8eeb9e70f Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 22/67] s3:lib/netapi/examples: fix pointer from integer error
>  in nltest.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/lib/netapi/examples/netlogon/nltest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/lib/netapi/examples/netlogon/nltest.c b/source3/lib/netapi/examples/netlogon/nltest.c
> index f75a995..9f96bda 100644
> --- a/source3/lib/netapi/examples/netlogon/nltest.c
> +++ b/source3/lib/netapi/examples/netlogon/nltest.c
> @@ -289,7 +289,7 @@ int main(int argc, const char **argv)
>  			status = I_NetLogonControl2(opt_server,
>  						    NETLOGON_CONTROL_SET_DBFLAG,
>  						    query_level,
> -						    (uint8_t *)opt_dbflag,
> +						    (uint8_t *)&opt_dbflag,
>  						    &buffer);
>  			if (status != 0) {
>  				fprintf(stderr, "I_NetlogonControl failed: Status = %d 0x%x %s\n",
> -- 
> 1.9.1
> 
> 
> From 5a40b6ea6d54c80372c2f58fdd6d1ffe067d1113 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 23 Oct 2014 10:17:40 +0200
> Subject: [PATCH 23/67] s3:libsmb: remove unused variables in cliconnect.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/libsmb/cliconnect.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
> index 789a85d..2b1e2ec 100644
> --- a/source3/libsmb/cliconnect.c
> +++ b/source3/libsmb/cliconnect.c
> @@ -1732,7 +1732,6 @@ static struct tevent_req *cli_session_setup_spnego_send(
>  	char *OIDs[ASN1_MAX_OIDS];
>  	int i;
>  	const DATA_BLOB *server_blob;
> -	NTSTATUS status;
>  
>  	req = tevent_req_create(mem_ctx, &state,
>  				struct cli_session_setup_spnego_state);
> @@ -3371,8 +3370,6 @@ static void cli_full_connection_done(struct tevent_req *subreq)
>  {
>  	struct tevent_req *req = tevent_req_callback_data(
>  		subreq, struct tevent_req);
> -	struct cli_full_connection_state *state = tevent_req_data(
> -		req, struct cli_full_connection_state);
>  	NTSTATUS status;
>  
>  	status = cli_tree_connect_recv(subreq);
> -- 
> 1.9.1
> 
> 
> From 1c7d19cc6b6e076de1fe04c5c351fcd854574b12 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 24/67] s3:libads: avoid some compiler warnings in ldap.c
> 
> We use helper variables and explicit casts using
> discard_const_p() to avoid bogus const warnings.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/libads/ldap.c | 36 +++++++++++++++++++++---------------
>  1 file changed, 21 insertions(+), 15 deletions(-)
> 
> diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
> index 06b4895..193d49f 100644
> --- a/source3/libads/ldap.c
> +++ b/source3/libads/ldap.c
> @@ -1436,21 +1436,23 @@ static ADS_STATUS ads_modlist_add(TALLOC_CTX *ctx, ADS_MODLIST *mods,
>  				  int mod_op, const char *name, 
>  				  const void *_invals)
>  {
> -	const void **invals = (const void **)_invals;
>  	int curmod;
>  	LDAPMod **modlist = (LDAPMod **) *mods;
>  	struct berval **ber_values = NULL;
>  	char **char_values = NULL;
>  
> -	if (!invals) {
> +	if (!_invals) {
>  		mod_op = LDAP_MOD_DELETE;
>  	} else {
> -		if (mod_op & LDAP_MOD_BVALUES)
> -			ber_values = ads_dup_values(ctx, 
> -						(const struct berval **)invals);
> -		else
> -			char_values = ads_push_strvals(ctx, 
> -						  (const char **) invals);
> +		if (mod_op & LDAP_MOD_BVALUES) {
> +			const struct berval **b;
> +			b = discard_const_p(const struct berval *, _invals);
> +			ber_values = ads_dup_values(ctx, b);
> +		} else {
> +			const char **c;
> +			c = discard_const_p(const char *, _invals);
> +			char_values = ads_push_strvals(ctx, c);
> +		}
>  	}
>  
>  	/* find the first empty slot */
> @@ -2418,7 +2420,8 @@ static bool ads_dump_field(ADS_STRUCT *ads, char *field, void **values, void *da
>  		     utf8_field=ldap_next_attribute(ads->ldap.ld,
>  						    (LDAPMessage *)msg,b)) {
>  			struct berval **ber_vals;
> -			char **str_vals, **utf8_vals;
> +			char **str_vals;
> +			char **utf8_vals;
>  			char *field;
>  			bool string; 
>  
> @@ -2433,10 +2436,12 @@ static bool ads_dump_field(ADS_STRUCT *ads, char *field, void **values, void *da
>  			string = fn(ads, field, NULL, data_area);
>  
>  			if (string) {
> +				const char **p;
> +
>  				utf8_vals = ldap_get_values(ads->ldap.ld,
>  					       	 (LDAPMessage *)msg, field);
> -				str_vals = ads_pull_strvals(ctx, 
> -						  (const char **) utf8_vals);
> +				p = discard_const_p(const char *, utf8_vals);
> +				str_vals = ads_pull_strvals(ctx, p);
>  				fn(ads, field, (void **) str_vals, data_area);
>  				ldap_value_free(utf8_vals);
>  			} else {
> @@ -3277,7 +3282,8 @@ ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
>  
>  	for (msg = ads_first_entry(ads, res); msg;
>  	     msg = ads_next_entry(ads, msg)) {
> -
> +		const char **p = discard_const_p(const char *, *ous);
> +		int i = *num_ous;
>  		char *dn = NULL;
>  
>  		dn = ads_get_dn(ads, talloc_tos(), msg);
> @@ -3286,15 +3292,15 @@ ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
>  			return ADS_ERROR(LDAP_NO_MEMORY);
>  		}
>  
> -		if (!add_string_to_array(mem_ctx, dn,
> -					 (const char ***)ous,
> -					 (int *)num_ous)) {
> +		if (!add_string_to_array(mem_ctx, dn, &p, &i)) {
>  			TALLOC_FREE(dn);
>  			ads_msgfree(ads, res);
>  			return ADS_ERROR(LDAP_NO_MEMORY);
>  		}
>  
>  		TALLOC_FREE(dn);
> +		*ous = discard_const_p(char *, p);
> +		*num_ous = i;
>  	}
>  
>  	ads_msgfree(ads, res);
> -- 
> 1.9.1
> 
> 
> From 25c8eeef72d1ace6e1eaaa978d9e3f28500607d5 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:21:07 +0100
> Subject: [PATCH 25/67] s3:wscript_build: remove unused allow_warnings=True for
>  'ads'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source3/wscript_build b/source3/wscript_build
> index 54ba3a7..0c5b02b 100755
> --- a/source3/wscript_build
> +++ b/source3/wscript_build
> @@ -454,7 +454,6 @@ bld.SAMBA3_LIBRARY('ads',
>                     libads/ldap_schema.c
>                     libads/util.c
>                     libads/ndr.c''',
> -                   allow_warnings=True,
>                     deps='cli-ldap-common krb5samba ldap lber KRBCLIENT param LIBNMB libsmb DCUTIL smbldap',
>                     private_library=True)
>  
> -- 
> 1.9.1
> 
> 
> From ff7c5b72d02a0e8f71a5b4b549ae6fdfbf3d0b1b Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:04:36 +0100
> Subject: [PATCH 26/67] s3:librpc/idl: mark struct smbXsrv_client as [public]
> 
> This avoids compiler warnings about unused code.
> 
> We don't use the NDR code for this yet, will be done
> when we get multi-channel support.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/librpc/idl/smbXsrv.idl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/librpc/idl/smbXsrv.idl b/source3/librpc/idl/smbXsrv.idl
> index 0035442..ec6d0ea 100644
> --- a/source3/librpc/idl/smbXsrv.idl
> +++ b/source3/librpc/idl/smbXsrv.idl
> @@ -79,7 +79,7 @@ interface smbXsrv
>  
>  	/* client */
>  
> -	typedef struct {
> +	typedef [public] struct {
>  		[ignore] struct tevent_context		*ev_ctx;
>  		[ignore] struct messaging_context	*msg_ctx;
>  
> -- 
> 1.9.1
> 
> 
> From 73aec10c3022771482f0d37310e1a2a20c67fafa Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 13 Nov 2014 09:12:56 +0100
> Subject: [PATCH 27/67] s3:modules: rename variables in vfs_fruit.c to fix
>  shadow warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/modules/vfs_fruit.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
> index c1555f0..da1ec7f 100644
> --- a/source3/modules/vfs_fruit.c
> +++ b/source3/modules/vfs_fruit.c
> @@ -1263,13 +1263,13 @@ static int init_fruit_config(vfs_handle_struct *handle)
>  static int adouble_path(TALLOC_CTX *ctx, const char *path_in, char **path_out)
>  {
>  	char *parent;
> -	const char *basename;
> +	const char *base;
>  
> -	if (!parent_dirname(ctx, path_in, &parent, &basename)) {
> +	if (!parent_dirname(ctx, path_in, &parent, &base)) {
>  		return -1;
>  	}
>  
> -	*path_out = talloc_asprintf(ctx, "%s/._%s", parent, basename);
> +	*path_out = talloc_asprintf(ctx, "%s/._%s", parent, base);
>  	if (*path_out == NULL) {
>  		return -1;
>  	}
> @@ -1451,7 +1451,7 @@ static void update_btime(vfs_handle_struct *handle,
>  /**
>   * Map an access mask to a Netatalk single byte byte range lock
>   **/
> -static off_t access_to_netatalk_brl(enum apple_fork fork,
> +static off_t access_to_netatalk_brl(enum apple_fork fork_type,
>  				    uint32_t access_mask)
>  {
>  	off_t offset;
> @@ -1471,7 +1471,7 @@ static off_t access_to_netatalk_brl(enum apple_fork fork,
>  		break;
>  	}
>  
> -	if (fork == APPLE_FORK_RSRC) {
> +	if (fork_type == APPLE_FORK_RSRC) {
>  		if (offset == AD_FILELOCK_OPEN_NONE) {
>  			offset = AD_FILELOCK_RSRC_OPEN_NONE;
>  		} else {
> @@ -1485,7 +1485,7 @@ static off_t access_to_netatalk_brl(enum apple_fork fork,
>  /**
>   * Map a deny mode to a Netatalk brl
>   **/
> -static off_t denymode_to_netatalk_brl(enum apple_fork fork,
> +static off_t denymode_to_netatalk_brl(enum apple_fork fork_type,
>  				      uint32_t deny_mode)
>  {
>  	off_t offset;
> @@ -1503,7 +1503,7 @@ static off_t denymode_to_netatalk_brl(enum apple_fork fork,
>  		smb_panic("denymode_to_netatalk_brl: bad deny mode\n");
>  	}
>  
> -	if (fork == APPLE_FORK_RSRC) {
> +	if (fork_type == APPLE_FORK_RSRC) {
>  		offset += 2;
>  	}
>  
> @@ -1548,7 +1548,7 @@ static NTSTATUS fruit_check_access(vfs_handle_struct *handle,
>  	off_t off;
>  
>  	/* FIXME: hardcoded data fork, add resource fork */
> -	enum apple_fork fork = APPLE_FORK_DATA;
> +	enum apple_fork fork_type = APPLE_FORK_DATA;
>  
>  	DEBUG(10, ("fruit_check_access: %s, am: %s/%s, dm: %s/%s\n",
>  		  fsp_str_dbg(fsp),
> @@ -1563,10 +1563,10 @@ static NTSTATUS fruit_check_access(vfs_handle_struct *handle,
>  	if ((access_mask & FILE_READ_DATA) || (deny_mode & DENY_READ)) {
>  		/* Check access */
>  		open_for_reading = test_netatalk_lock(
> -			fsp, access_to_netatalk_brl(fork, FILE_READ_DATA));
> +			fsp, access_to_netatalk_brl(fork_type, FILE_READ_DATA));
>  
>  		deny_read = test_netatalk_lock(
> -			fsp, denymode_to_netatalk_brl(fork, DENY_READ));
> +			fsp, denymode_to_netatalk_brl(fork_type, DENY_READ));
>  
>  		DEBUG(10, ("read: %s, deny_write: %s\n",
>  			  open_for_reading == true ? "yes" : "no",
> @@ -1579,7 +1579,7 @@ static NTSTATUS fruit_check_access(vfs_handle_struct *handle,
>  
>  		/* Set locks */
>  		if (access_mask & FILE_READ_DATA) {
> -			off = access_to_netatalk_brl(fork, FILE_READ_DATA);
> +			off = access_to_netatalk_brl(fork_type, FILE_READ_DATA);
>  			br_lck = do_lock(
>  				handle->conn->sconn->msg_ctx, fsp,
>  				fsp->op->global->open_persistent_id, 1, off,
> @@ -1593,7 +1593,7 @@ static NTSTATUS fruit_check_access(vfs_handle_struct *handle,
>  		}
>  
>  		if (deny_mode & DENY_READ) {
> -			off = denymode_to_netatalk_brl(fork, DENY_READ);
> +			off = denymode_to_netatalk_brl(fork_type, DENY_READ);
>  			br_lck = do_lock(
>  				handle->conn->sconn->msg_ctx, fsp,
>  				fsp->op->global->open_persistent_id, 1, off,
> @@ -1613,10 +1613,10 @@ static NTSTATUS fruit_check_access(vfs_handle_struct *handle,
>  	if ((access_mask & FILE_WRITE_DATA) || (deny_mode & DENY_WRITE)) {
>  		/* Check access */
>  		open_for_writing = test_netatalk_lock(
> -			fsp, access_to_netatalk_brl(fork, FILE_WRITE_DATA));
> +			fsp, access_to_netatalk_brl(fork_type, FILE_WRITE_DATA));
>  
>  		deny_write = test_netatalk_lock(
> -			fsp, denymode_to_netatalk_brl(fork, DENY_WRITE));
> +			fsp, denymode_to_netatalk_brl(fork_type, DENY_WRITE));
>  
>  		DEBUG(10, ("write: %s, deny_write: %s\n",
>  			  open_for_writing == true ? "yes" : "no",
> @@ -1629,7 +1629,7 @@ static NTSTATUS fruit_check_access(vfs_handle_struct *handle,
>  
>  		/* Set locks */
>  		if (access_mask & FILE_WRITE_DATA) {
> -			off = access_to_netatalk_brl(fork, FILE_WRITE_DATA);
> +			off = access_to_netatalk_brl(fork_type, FILE_WRITE_DATA);
>  			br_lck = do_lock(
>  				handle->conn->sconn->msg_ctx, fsp,
>  				fsp->op->global->open_persistent_id, 1, off,
> @@ -1643,7 +1643,7 @@ static NTSTATUS fruit_check_access(vfs_handle_struct *handle,
>  
>  		}
>  		if (deny_mode & DENY_WRITE) {
> -			off = denymode_to_netatalk_brl(fork, DENY_WRITE);
> +			off = denymode_to_netatalk_brl(fork_type, DENY_WRITE);
>  			br_lck = do_lock(
>  				handle->conn->sconn->msg_ctx, fsp,
>  				fsp->op->global->open_persistent_id, 1, off,
> -- 
> 1.9.1
> 
> 
> From 06c196b6b2cf1ddf68fe687a7dc40ea182ac6c83 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:11:33 +0100
> Subject: [PATCH 28/67] s3:modules: remove unused allow_warnings=True for
>  non_posix_acls, and vfs_media_harmony
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/modules/wscript_build | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
> index e5d04f7..de4947b 100644
> --- a/source3/modules/wscript_build
> +++ b/source3/modules/wscript_build
> @@ -7,7 +7,6 @@ bld.SAMBA3_SUBSYSTEM('NFS4_ACLS',
>  bld.SAMBA3_LIBRARY('non_posix_acls',
>                     source='non_posix_acls.c',
>                     deps='samba-util vfs',
> -                   allow_warnings=True,
>                     private_library=True)
>  
>  bld.SAMBA3_SUBSYSTEM('VFS_AIXACL_UTIL',
> @@ -439,7 +438,6 @@ bld.SAMBA3_MODULE('vfs_time_audit',
>  bld.SAMBA3_MODULE('vfs_media_harmony',
>                   subsystem='vfs',
>                   source='vfs_media_harmony.c',
> -                 allow_warnings=True,
>                   deps='samba-util',
>                   init_function='',
>                   internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_media_harmony'),
> -- 
> 1.9.1
> 
> 
> From bed5f05bbc032cf9e12602697c6a8a0b2d42e475 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:12:48 +0100
> Subject: [PATCH 29/67] s3:param: fix compiler warnings
> 
> ---
>  source3/param/loadparm.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
> index d6ba8fb..1a9ccf6 100644
> --- a/source3/param/loadparm.c
> +++ b/source3/param/loadparm.c
> @@ -559,7 +559,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
>  
>  	init_printer_values(lp_ctx, Globals.ctx, &sDefault);
>  
> -	sDefault.ntvfs_handler = (const char **)str_list_make_v3(NULL, "unixuid default", NULL);
> +	sDefault.ntvfs_handler = str_list_make_v3_const(NULL, "unixuid default", NULL);
>  
>  	DEBUG(3, ("Initialising global parameters\n"));
>  
> @@ -617,7 +617,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
>  	string_set(Globals.ctx, &Globals.logon_home, "\\\\%N\\%U");
>  	string_set(Globals.ctx, &Globals.logon_path, "\\\\%N\\%U\\profile");
>  
> -	Globals.name_resolve_order = (const char **)str_list_make_v3(NULL, "lmhosts wins host bcast", NULL);
> +	Globals.name_resolve_order = str_list_make_v3_const(NULL, "lmhosts wins host bcast", NULL);
>  	string_set(Globals.ctx, &Globals.password_server, "*");
>  
>  	Globals.algorithmic_rid_base = BASE_RID;
> @@ -802,7 +802,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
>  	Globals.winbind_trusted_domains_only = false;
>  	Globals.winbind_nested_groups = true;
>  	Globals.winbind_expand_groups = 0;
> -	Globals.winbind_nss_info = (const char **)str_list_make_v3(NULL, "template", NULL);
> +	Globals.winbind_nss_info = str_list_make_v3_const(NULL, "template", NULL);
>  	Globals.winbind_refresh_tickets = false;
>  	Globals.winbind_offline_logon = false;
>  
> @@ -820,7 +820,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
>  	Globals.server_signing = SMB_SIGNING_DEFAULT;
>  
>  	Globals.defer_sharing_violations = true;
> -	Globals.smb_ports = (const char **)str_list_make_v3(NULL, SMB_PORTS, NULL);
> +	Globals.smb_ports = str_list_make_v3_const(NULL, SMB_PORTS, NULL);
>  
>  	Globals.enable_privileges = true;
>  	Globals.host_msdfs        = true;
> @@ -857,9 +857,9 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
>  
>  	string_set(Globals.ctx, &Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
>  
> -	Globals.server_services = (const char **)str_list_make_v3(NULL, "s3fs rpc nbt wrepl ldap cldap kdc drepl winbindd ntp_signd kcc dnsupdate dns", NULL);
> +	Globals.server_services = str_list_make_v3_const(NULL, "s3fs rpc nbt wrepl ldap cldap kdc drepl winbindd ntp_signd kcc dnsupdate dns", NULL);
>  
> -	Globals.dcerpc_endpoint_servers = (const char **)str_list_make_v3(NULL, "epmapper wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi dssetup unixinfo browser eventlog6 backupkey dnsserver", NULL);
> +	Globals.dcerpc_endpoint_servers = str_list_make_v3_const(NULL, "epmapper wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi dssetup unixinfo browser eventlog6 backupkey dnsserver", NULL);
>  
>  	Globals.tls_enabled = true;
>  
> @@ -881,26 +881,26 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
>  	if (s == NULL) {
>  		smb_panic("init_globals: ENOMEM");
>  	}
> -	Globals.samba_kcc_command = (const char **)str_list_make_v3(NULL, s, NULL);
> +	Globals.samba_kcc_command = str_list_make_v3_const(NULL, s, NULL);
>  	TALLOC_FREE(s);
>  
>  	s = talloc_asprintf(talloc_tos(), "%s/samba_dnsupdate", get_dyn_SCRIPTSBINDIR());
>  	if (s == NULL) {
>  		smb_panic("init_globals: ENOMEM");
>  	}
> -	Globals.dns_update_command = (const char **)str_list_make_v3(NULL, s, NULL);
> +	Globals.dns_update_command = str_list_make_v3_const(NULL, s, NULL);
>  	TALLOC_FREE(s);
>  
>  	s = talloc_asprintf(talloc_tos(), "%s/samba_spnupdate", get_dyn_SCRIPTSBINDIR());
>  	if (s == NULL) {
>  		smb_panic("init_globals: ENOMEM");
>  	}
> -	Globals.spn_update_command = (const char **)str_list_make_v3(NULL, s, NULL);
> +	Globals.spn_update_command = str_list_make_v3_const(NULL, s, NULL);
>  	TALLOC_FREE(s);
>  
> -	Globals.nsupdate_command = (const char **)str_list_make_v3(NULL, "/usr/bin/nsupdate -g", NULL);
> +	Globals.nsupdate_command = str_list_make_v3_const(NULL, "/usr/bin/nsupdate -g", NULL);
>  
> -	Globals.rndc_command = (const char **)str_list_make_v3(NULL, "/usr/sbin/rndc", NULL);
> +	Globals.rndc_command = str_list_make_v3_const(NULL, "/usr/sbin/rndc", NULL);
>  
>  	Globals.cldap_port = 389;
>  
> @@ -1163,7 +1163,7 @@ const char **lp_parm_string_list(int snum, const char *type, const char *option,
>  		data->list = str_list_make_v3(NULL, data->value, NULL);
>  	}
>  
> -	return (const char **)data->list;
> +	return discard_const_p(const char *, data->list);
>  }
>  
>  /* Return parametric option from a given service. Type is a part of option before ':' */
> -- 
> 1.9.1
> 
> 
> From c2acc99d86fa2ac2af753a6a2faf7a531eed5661 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:13:23 +0100
> Subject: [PATCH 30/67] s3:wscript_build: remove unused allow_warnings=True for
>  'param'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source3/wscript_build b/source3/wscript_build
> index 0c5b02b..6373913 100755
> --- a/source3/wscript_build
> +++ b/source3/wscript_build
> @@ -190,7 +190,6 @@ bld.SAMBA3_SUBSYSTEM('param',
>                     lib/sharesec.c
>                     lib/ldap_debug_handler.c
>                     lib/util_names.c''',
> -                   allow_warnings=True,
>                     deps='samba-util PARAM_UTIL ldap lber LOADPARM_CTX samba3core smbconf param_local.h param_global.h cups''')
>  
>  # this includes only the low level parse code, not stuff
> -- 
> 1.9.1
> 
> 
> From 8d9cd846b749ecc9f48ce2f1b972ae9bd7286fd9 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 31/67] s3:passdb: always copy the history in
>  pdb_set_plaintext_passwd()
> 
> We should not write to memory marked as const
> (returned from pdb_get_pw_history())!
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/passdb/pdb_get_set.c | 33 ++++++++++++++-------------------
>  1 file changed, 14 insertions(+), 19 deletions(-)
> 
> diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
> index 0d7f4cb..1b716f4 100644
> --- a/source3/passdb/pdb_get_set.c
> +++ b/source3/passdb/pdb_get_set.c
> @@ -1001,6 +1001,7 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext)
>  	uchar *pwhistory;
>  	uint32_t pwHistLen;
>  	uint32_t current_history_len;
> +	const uint8_t *current_history;
>  
>  	if (!plaintext)
>  		return False;
> @@ -1051,33 +1052,27 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext)
>  	 * the pw_history was first loaded into the struct samu struct
>  	 * and now.... JRA.
>  	 */
> -	pwhistory = (uchar *)pdb_get_pw_history(sampass, &current_history_len);
> -
> -	if ((current_history_len != 0) && (pwhistory == NULL)) {
> +	current_history = pdb_get_pw_history(sampass, &current_history_len);
> +	if ((current_history_len != 0) && (current_history == NULL)) {
>  		DEBUG(1, ("pdb_set_plaintext_passwd: pwhistory == NULL!\n"));
>  		return false;
>  	}
>  
> -	if (current_history_len < pwHistLen) {
> -		/*
> -		 * Ensure we have space for the needed history. This
> -		 * also takes care of an account which did not have
> -		 * any history at all so far, i.e. pwhistory==NULL
> -		 */
> -		uchar *new_history = talloc_zero_array(
> +	/*
> +	 * Ensure we have space for the needed history. This
> +	 * also takes care of an account which did not have
> +	 * any history at all so far, i.e. pwhistory==NULL
> +	 */
> +	pwhistory = talloc_zero_array(
>  			sampass, uchar,
>  			pwHistLen*PW_HISTORY_ENTRY_LEN);
> -
> -		if (!new_history) {
> -			return False;
> -		}
> -
> -		memcpy(new_history, pwhistory,
> -		       current_history_len*PW_HISTORY_ENTRY_LEN);
> -
> -		pwhistory = new_history;
> +	if (!pwhistory) {
> +		return false;
>  	}
>  
> +	memcpy(pwhistory, current_history,
> +	       current_history_len*PW_HISTORY_ENTRY_LEN);
> +
>  	/*
>  	 * Make room for the new password in the history list.
>  	 */
> -- 
> 1.9.1
> 
> 
> From ef64f55a36e92912d34b9f36fe8d22d186e91590 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 32/67] s3:passdb: avoid invalid pointer type warnings in
>  pdb_wbc_sam.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/passdb/pdb_wbc_sam.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/source3/passdb/pdb_wbc_sam.c b/source3/passdb/pdb_wbc_sam.c
> index 655890f..2343649 100644
> --- a/source3/passdb/pdb_wbc_sam.c
> +++ b/source3/passdb/pdb_wbc_sam.c
> @@ -135,18 +135,21 @@ static NTSTATUS pdb_wbc_sam_lookup_rids(struct pdb_methods *methods,
>  					enum lsa_SidType *attrs)
>  {
>  	NTSTATUS result = NT_STATUS_OK;
> +	const char *p = NULL;
> +	const char **pp = NULL;
>  	char *domain = NULL;
>  	char **account_names = NULL;
>  	enum lsa_SidType *attr_list = NULL;
>  	int i;
>  
>  	if (!winbind_lookup_rids(talloc_tos(), domain_sid, num_rids, rids,
> -				 (const char **)&domain,
> -				 (const char ***)&account_names, &attr_list))
> +				 &p, &pp, &attr_list))
>  	{
>  		result = NT_STATUS_NONE_MAPPED;
>  		goto done;
>  	}
> +	domain = discard_const_p(char, p);
> +	account_names = discard_const_p(char *, pp);
>  
>  	memcpy(attrs, attr_list, num_rids * sizeof(enum lsa_SidType));
>  
> @@ -243,16 +246,18 @@ static NTSTATUS pdb_wbc_sam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map
>  				 struct dom_sid sid)
>  {
>  	NTSTATUS result = NT_STATUS_OK;
> +	const char *p1 = NULL, *p2 = NULL;
>  	char *name = NULL;
>  	char *domain = NULL;
>  	enum lsa_SidType name_type;
>  	gid_t gid;
>  
> -	if (!winbind_lookup_sid(talloc_tos(), &sid, (const char **)&domain,
> -				(const char **) &name, &name_type)) {
> +	if (!winbind_lookup_sid(talloc_tos(), &sid, &p1, &p2, &name_type)) {
>  		result = NT_STATUS_NO_SUCH_GROUP;
>  		goto done;
>  	}
> +	domain = discard_const_p(char, p1);
> +	name = discard_const_p(char, p2);
>  
>  	if ((name_type != SID_NAME_DOM_GRP) &&
>  	    (name_type != SID_NAME_DOMAIN) &&
> @@ -282,6 +287,7 @@ static NTSTATUS pdb_wbc_sam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map
>  				 gid_t gid)
>  {
>  	NTSTATUS result = NT_STATUS_OK;
> +	const char *p1 = NULL, *p2 = NULL;
>  	char *name = NULL;
>  	char *domain = NULL;
>  	struct dom_sid sid;
> @@ -292,11 +298,12 @@ static NTSTATUS pdb_wbc_sam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map
>  		goto done;
>  	}
>  
> -	if (!winbind_lookup_sid(talloc_tos(), &sid, (const char **)&domain,
> -				(const char **)&name, &name_type)) {
> +	if (!winbind_lookup_sid(talloc_tos(), &sid, &p1, &p2, &name_type)) {
>  		result = NT_STATUS_NO_SUCH_GROUP;
>  		goto done;
>  	}
> +	domain = discard_const_p(char, p1);
> +	name = discard_const_p(char, p2);
>  
>  	if ((name_type != SID_NAME_DOM_GRP) &&
>  	    (name_type != SID_NAME_DOMAIN) &&
> -- 
> 1.9.1
> 
> 
> From 928a7dfe847db1200598c24a9a926df4092fc16a Mon Sep 17 00:00:00 2001
> From: Kai Blin <kai at samba.org>
> Date: Fri, 14 Mar 2014 09:07:16 +0100
> Subject: [PATCH 33/67] s3:printing: Avoid compiler warning about unused label
> 
> Signed-off-by: Kai Blin <kai at samba.org>
> Reviewed-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/printing/pcap.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c
> index c5524ad..7261118 100644
> --- a/source3/printing/pcap.c
> +++ b/source3/printing/pcap.c
> @@ -181,7 +181,11 @@ void pcap_cache_reload(struct tevent_context *ev,
>  
>  	pcap_reloaded = std_pcap_cache_reload(pcap_name, &pcache);
>  
> +/* Fix silly compiler warning about done not being used if none of the above
> + * ifdefs are used */
> +#if defined(HAVE_CUPS) || defined(HAVE_IPRINT) || defined(SYSV) || defined(HPUX) || defined(AIX)
>  done:
> +#endif
>  	DEBUG(3, ("reload status: %s\n", (pcap_reloaded) ? "ok" : "error"));
>  
>  	if ((pcap_reloaded) && (post_cache_fill_fn_handled == false)) {
> -- 
> 1.9.1
> 
> 
> From aa566f5c5456ad58b57d3bf93b42823a32a8d52b Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 3 Jul 2014 13:14:20 +0200
> Subject: [PATCH 34/67] s3:printing: fix some const warnings in print_iprint.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/printing/print_iprint.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c
> index eeb193c..1c9e5a2 100644
> --- a/source3/printing/print_iprint.c
> +++ b/source3/printing/print_iprint.c
> @@ -206,19 +206,19 @@ static int iprint_get_server_version(http_t *http, char* serviceUri)
>  
>  static int iprint_cache_add_printer(http_t *http,
>  				   int reqId,
> -				   char *url,
> +				   const char *url,
>  				   struct pcap_cache **pcache)
>  {
>  	ipp_t		*request = NULL,	/* IPP Request */
>  			*response = NULL;	/* IPP Response */
>  	ipp_attribute_t	*attr;			/* Current attribute */
>  	cups_lang_t	*language = NULL;	/* Default language */
> -	char		*name,			/* printer-name attribute */
> -			*info,			/* printer-info attribute */
> -			smb_enabled,		/* smb-enabled attribute */
> +	const char	*name,			/* printer-name attribute */
> +			*info;			/* printer-info attribute */
> +	char		smb_enabled,		/* smb-enabled attribute */
>  			secure;			/* security-enabled attrib. */
>  
> -	char		*httpPath;	/* path portion of the printer-uri */
> +	const char	*httpPath;	/* path portion of the printer-uri */
>  
>  	static const char *pattrs[] =	/* Requested printer attributes */
>  			{
> @@ -440,7 +440,7 @@ bool iprint_cache_reload(struct pcap_cache **_pcache)
>  			{
>  				for (i = 0; i<ippGetCount(attr); i++)
>  				{
> -					char *url = ippGetString(attr, i, NULL);
> +					const char *url = ippGetString(attr, i, NULL);
>  					if (!url || !strlen(url))
>  						continue;
>  					iprint_cache_add_printer(http, i+2, url,
> -- 
> 1.9.1
> 
> 
> From 22c863d488999de989eb7b4254bc087ab1b6a47b Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 35/67] s3:registry: use discard_const_p() to avoid const
>  warning in smb_iconv() define
> 
> I'm wondering why we have this in reg_parse_internal.h at all!
> 
> But for now just fix warnings...
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/registry/reg_parse_internal.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/registry/reg_parse_internal.h b/source3/registry/reg_parse_internal.h
> index bd364a5..1440d55 100644
> --- a/source3/registry/reg_parse_internal.h
> +++ b/source3/registry/reg_parse_internal.h
> @@ -38,7 +38,7 @@ struct cbuf;
>  #if defined USE_NATIVE_ICONV && defined HAVE_NATIVE_ICONV
>  #  define smb_iconv_t     iconv_t
>  #  define smb_iconv(CD, IPTR, ILEN, OPTR, OLEN) \
> -	iconv(CD, (char**)(IPTR), ILEN, OPTR, OLEN)
> +	iconv(CD, discard_const_p(char*, (IPTR)), ILEN, OPTR, OLEN)
>  #  define smb_iconv_open  iconv_open
>  #  define smb_iconv_close iconv_close
>  #endif
> -- 
> 1.9.1
> 
> 
> From 31ba493b1e8f03f3194ed77b0d8dfccf76b5ab5f Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:18:14 +0100
> Subject: [PATCH 36/67] s3:wscript_build: remove unused allow_warnings=True for
>  'smbregistry'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source3/wscript_build b/source3/wscript_build
> index 6373913..d6edc68 100755
> --- a/source3/wscript_build
> +++ b/source3/wscript_build
> @@ -221,7 +221,6 @@ bld.SAMBA3_LIBRARY('smbregistry',
>                     replace util_reg samba-util samba-security
>                     errors3 dbwrap samba3-util''',
>                     allow_undefined_symbols=True,
> -                   allow_warnings=True,
>                     private_library=True)
>  
>  bld.SAMBA3_SUBSYSTEM('REG_SMBCONF',
> -- 
> 1.9.1
> 
> 
> From 47bbdf92a2ce7caa2890889800e4a0b526df6e7b Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 37/67] s3:smbd: do casting of dm_sessid_t in steps
> 
> This makes it more explicit and avoids compiler warnings.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/smbd/dmapi.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/source3/smbd/dmapi.c b/source3/smbd/dmapi.c
> index 8c93873..90c24bd 100644
> --- a/source3/smbd/dmapi.c
> +++ b/source3/smbd/dmapi.c
> @@ -266,18 +266,20 @@ uint32 dmapi_file_flags(const char * const path)
>  	uint		nevents;
>  
>  	dm_sessid_t     dmapi_session;
> -	const void      *dmapi_session_ptr;
> +	dm_sessid_t     *dmapi_session_ptr;
> +	const void      *_dmapi_session_ptr;
>  	void	        *dm_handle = NULL;
>  	size_t	        dm_handle_len = 0;
>  
>  	uint32	        flags = 0;
>  
> -	dmapi_session_ptr = dmapi_get_current_session();
> -	if (dmapi_session_ptr == NULL) {
> +	_dmapi_session_ptr = dmapi_get_current_session();
> +	if (_dmapi_session_ptr == NULL) {
>  		return 0;
>  	}
>  
> -	dmapi_session = *(const dm_sessid_t *)dmapi_session_ptr;
> +	dmapi_session_ptr = discard_const_p(dm_sessid_t, _dmapi_session_ptr);
> +	dmapi_session = *dmapi_session_ptr;
>  	if (dmapi_session == DM_NO_SESSION) {
>  		return 0;
>  	}
> -- 
> 1.9.1
> 
> 
> From 9cab7c140bf5c13d8b06afcb3b14f6d8ef800df0 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 38/67] s3:smbd: avoid a compiler warning in
>  open_sockets_smbd()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/smbd/server.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/source3/smbd/server.c b/source3/smbd/server.c
> index 0d649e1..fc1622a 100644
> --- a/source3/smbd/server.c
> +++ b/source3/smbd/server.c
> @@ -755,7 +755,9 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
>  
>  	/* use a reasonable default set of ports - listing on 445 and 139 */
>  	if (smb_ports) {
> -		ports = (const char **)str_list_make_v3(talloc_tos(), smb_ports, NULL);
> +		char **l;
> +		l = str_list_make_v3(talloc_tos(), smb_ports, NULL);
> +		ports = discard_const_p(const char *, l);
>  	}
>  
>  	for (j = 0; ports && ports[j]; j++) {
> -- 
> 1.9.1
> 
> 
> From 9c747df2f91f3c287cd5d6ef26e1743c2d7982ff Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 23 Oct 2014 10:18:21 +0200
> Subject: [PATCH 39/67] s3:torture: avoid nesting of macros and function calls
>  in torture_cli_session_setup2()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/torture/torture.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/source3/torture/torture.c b/source3/torture/torture.c
> index 2cd63e1..f90f882 100644
> --- a/source3/torture/torture.c
> +++ b/source3/torture/torture.c
> @@ -416,10 +416,11 @@ bool torture_cli_session_setup2(struct cli_state *cli, uint16 *new_vuid)
>  	bool ret;
>  
>  	cli_state_set_uid(cli, 0);
> -	ret = NT_STATUS_IS_OK(cli_session_setup(cli, username,
> -						password, passlen,
> -						password, passlen,
> -						workgroup));
> +	status = cli_session_setup(cli, username,
> +				   password, passlen,
> +				   password, passlen,
> +				   workgroup);
> +	ret = NT_STATUS_IS_OK(status);
>  	*new_vuid = cli_state_get_uid(cli);
>  	cli_state_set_uid(cli, old_vuid);
>  	return ret;
> -- 
> 1.9.1
> 
> 
> From c88a61f22f970d741f6b2416377df58fdb881304 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 40/67] s3:utils: add debug functions instead of magic format
>  strings in net_idmap_check.c
> 
> This way the compiler can check the format string and doesn't generate warnings.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/utils/net_idmap_check.c | 47 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 39 insertions(+), 8 deletions(-)
> 
> diff --git a/source3/utils/net_idmap_check.c b/source3/utils/net_idmap_check.c
> index 4b82871..51f4a40 100644
> --- a/source3/utils/net_idmap_check.c
> +++ b/source3/utils/net_idmap_check.c
> @@ -73,7 +73,9 @@ static bool is_map(const struct record* r) {
>  /* action *********************************************************************/
>  
>  typedef struct check_action {
> -	const char* fmt;
> +	void (*fmt)(struct check_action *a,
> +		    struct record *r,
> +		    TDB_DATA *v);
>  	const char* name;
>  	const char* prompt;
>  	const char* answers;
> @@ -97,6 +99,38 @@ struct check_actions {
>  	check_action invalid_diff;
>  };
>  
> +static void invalid_mapping_fmt(struct check_action *a,
> +				struct record *r,
> +				TDB_DATA *v)
> +{
> +	d_printf("%1$s: %2$s -> %3$s\n(%4$s <- %3$s)\n",
> +		 a->name,
> +		 print_data(r, r->key),
> +		 print_data(r, r->val),
> +		 (v ? print_data(r, *v) : ""));
> +}
> +
> +static void record_exists_fmt(struct check_action *a,
> +			      struct record *r,
> +			      TDB_DATA *v)
> +{
> +	d_printf("%1$s: %2$s\n-%4$s\n+%3$s\n",
> +		 a->name,
> +		 print_data(r, r->key),
> +		 print_data(r, r->val),
> +		 (v ? print_data(r, *v) : ""));
> +}
> +
> +static void valid_mapping_fmt(struct check_action *a,
> +			      struct record *r,
> +			      TDB_DATA *v)
> +{
> +	d_printf("%1$s: %2$s <-> %3$s\n",
> +		 a->name,
> +		 print_data(r, r->key),
> +		 print_data(r, r->val));
> +}
> +
>  static struct check_actions
>  check_actions_init(const struct check_options* opts) {
>  	struct check_actions ret = {
> @@ -117,7 +151,7 @@ check_actions_init(const struct check_options* opts) {
>  			.verbose = true,
>  		},
>  		.invalid_mapping = (check_action) {
> -			.fmt = "%1$s: %2$s -> %3$s\n(%4$s <- %3$s)\n",
> +			.fmt = invalid_mapping_fmt,
>  			.name = "Invalid mapping",
>  			.prompt = "[e]dit/[d]elete/[D]elete all"
>  			"/[s]kip/[S]kip all",
> @@ -134,7 +168,7 @@ check_actions_init(const struct check_options* opts) {
>  			.verbose = true,
>  		},
>  		.record_exists = (check_action) {
> -			.fmt = "%1$s: %2$s\n-%4$s\n+%3$s\n",
> +			.fmt = record_exists_fmt,
>  			.name = "Record exists",
>  			.prompt = "[o]verwrite/[O]verwrite all/[e]dit"
>  			"/[d]elete/[D]elete all/[s]kip/[S]kip all",
> @@ -164,7 +198,7 @@ check_actions_init(const struct check_options* opts) {
>  			.verbose = true,
>  		},
>  		.valid_mapping = (check_action) {
> -			.fmt = "%1$s: %2$s <-> %3$s\n",
> +			.fmt = valid_mapping_fmt,
>  			.name = "Mapping",
>  			.auto_action = 's',
>  			.verbose = opts->verbose,
> @@ -230,10 +264,7 @@ static char get_action(struct check_action* a, struct record* r, TDB_DATA* v) {
>  				d_printf("\n");
>  			}
>  		} else {
> -			d_printf(a->fmt, a->name,
> -				 print_data(r, r->key),
> -				 print_data(r, r->val),
> -				 (v ? print_data(r, *v) : ""));
> +			a->fmt(a, r, v);
>  		}
>  	}
>  
> -- 
> 1.9.1
> 
> 
> From 72bed26ddfb6b0a84ebdc988b4cf834c5a7fee28 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:39:01 +0100
> Subject: [PATCH 41/67] s3:utils: fix compiler warnings in status_profile*.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/utils/status_profile.c       | 2 +-
>  source3/utils/status_profile_dummy.c | 3 +++
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
> index 282dea3..f98feac 100644
> --- a/source3/utils/status_profile.c
> +++ b/source3/utils/status_profile.c
> @@ -42,7 +42,7 @@ static void profile_separator(const char * title)
>  /*******************************************************************
>   dump the elements of the profile structure
>    ******************************************************************/
> -bool status_profile_dump(bool verbose)
> +bool status_profile_dump(bool be_verbose)
>  {
>  	if (!profile_setup(NULL, True)) {
>  		fprintf(stderr,"Failed to initialise profile memory\n");
> diff --git a/source3/utils/status_profile_dummy.c b/source3/utils/status_profile_dummy.c
> index c58f696..36a1770 100644
> --- a/source3/utils/status_profile_dummy.c
> +++ b/source3/utils/status_profile_dummy.c
> @@ -20,6 +20,9 @@
>  #include "includes.h"
>  #include "smbprofile.h"
>  
> +bool status_profile_dump(bool be_verbose);
> +bool status_profile_rates(bool be_verbose);
> +
>  bool status_profile_dump(bool be_verbose)
>  {
>  	fprintf(stderr, "Profile data unavailable\n");
> -- 
> 1.9.1
> 
> 
> From aa386a7bce19352f6e3117cc5c1aece3015c0004 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 13 Nov 2014 09:12:56 +0100
> Subject: [PATCH 42/67] s3:utils: rename variables in regedit_*.c to fix shadow
>  warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/utils/regedit_dialog.c    | 14 +++++++-------
>  source3/utils/regedit_hexedit.c   |  6 +++---
>  source3/utils/regedit_treeview.c  | 14 +++++++-------
>  source3/utils/regedit_valuelist.c |  4 ++--
>  4 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/source3/utils/regedit_dialog.c b/source3/utils/regedit_dialog.c
> index d0b486f..07fb190 100644
> --- a/source3/utils/regedit_dialog.c
> +++ b/source3/utils/regedit_dialog.c
> @@ -969,7 +969,7 @@ WERROR dialog_section_text_field_set_lines(TALLOC_CTX *ctx,
>  					   const char **array)
>  {
>  	int rows, cols, max;
> -	size_t padding, length, index;
> +	size_t padding, length, idx;
>  	const char **arrayp;
>  	char *buf = NULL;
>  	struct dialog_section_text_field *text_field =
> @@ -979,7 +979,7 @@ WERROR dialog_section_text_field_set_lines(TALLOC_CTX *ctx,
>  	/* try to fit each string on it's own line. each line
>  	   needs to be padded with whitespace manually, since
>  	   ncurses fields do not have newlines. */
> -	for (index = 0, arrayp = array; *arrayp != NULL; ++arrayp) {
> +	for (idx = 0, arrayp = array; *arrayp != NULL; ++arrayp) {
>  		length = MIN(strlen(*arrayp), cols);
>  		padding = cols - length;
>  		buf = talloc_realloc(ctx, buf, char,
> @@ -988,11 +988,11 @@ WERROR dialog_section_text_field_set_lines(TALLOC_CTX *ctx,
>  		if (buf == NULL) {
>  			return WERR_NOMEM;
>  		}
> -		memcpy(&buf[index], *arrayp, length);
> -		index += length;
> -		memset(&buf[index], ' ', padding);
> -		index += padding;
> -		buf[index] = '\0';
> +		memcpy(&buf[idx], *arrayp, length);
> +		idx += length;
> +		memset(&buf[idx], ' ', padding);
> +		idx += padding;
> +		buf[idx] = '\0';
>  	}
>  
>  	set_field_buffer(text_field->field[0], 0, buf);
> diff --git a/source3/utils/regedit_hexedit.c b/source3/utils/regedit_hexedit.c
> index 377eef9..d70c521 100644
> --- a/source3/utils/regedit_hexedit.c
> +++ b/source3/utils/regedit_hexedit.c
> @@ -459,7 +459,7 @@ static void erase_at(struct hexedit *buf, size_t pos)
>  static void do_backspace(struct hexedit *buf)
>  {
>  	size_t off;
> -	bool erase = true;
> +	bool do_erase = true;
>  
>  	if (buf->cursor_offset == 0) {
>  		return;
> @@ -479,11 +479,11 @@ static void do_backspace(struct hexedit *buf)
>  		calc_cursor_offset(buf);
>  	} else {
>  		if (buf->cursor_x < ASCII_COL && buf->nibble) {
> -			erase = false;
> +			do_erase = false;
>  		}
>  		cursor_left(buf);
>  	}
> -	if (erase) {
> +	if (do_erase) {
>  		erase_at(buf, off - 1);
>  	}
>  }
> diff --git a/source3/utils/regedit_treeview.c b/source3/utils/regedit_treeview.c
> index 4c68fea..ece15e5 100644
> --- a/source3/utils/regedit_treeview.c
> +++ b/source3/utils/regedit_treeview.c
> @@ -481,11 +481,11 @@ void tree_view_driver(struct tree_view *view, int c)
>  	multilist_driver(view->list, c);
>  }
>  
> -void tree_view_set_selected(struct tree_view *view, bool select)
> +void tree_view_set_selected(struct tree_view *view, bool reverse)
>  {
>  	attr_t attr = A_NORMAL;
>  
> -	if (select) {
> +	if (reverse) {
>  		attr = A_REVERSE;
>  	}
>  	mvwchgat(view->window, 0, HEADING_X, 3, attr, 0, NULL);
> @@ -649,7 +649,7 @@ void tree_view_resize(struct tree_view *view, int nlines, int ncols,
>  const char **tree_node_get_path(TALLOC_CTX *ctx, struct tree_node *node)
>  {
>  	const char **array;
> -	size_t nitems, index;
> +	size_t nitems, idx;
>  	struct tree_node *p;
>  
>  	for (nitems = 0, p = node; !tree_node_is_root(p); p = p->parent) {
> @@ -661,11 +661,11 @@ const char **tree_node_get_path(TALLOC_CTX *ctx, struct tree_node *node)
>  		return NULL;
>  	}
>  
> -	for (index = nitems - 1, p = node;
> +	for (idx = nitems - 1, p = node;
>  	     !tree_node_is_root(p);
> -	     p = p->parent, --index) {
> -		array[index] = talloc_strdup(array, p->name);
> -		if (array[index] == NULL) {
> +	     p = p->parent, --idx) {
> +		array[idx] = talloc_strdup(array, p->name);
> +		if (array[idx] == NULL) {
>  			talloc_free(discard_const(array));
>  			return NULL;
>  		}
> diff --git a/source3/utils/regedit_valuelist.c b/source3/utils/regedit_valuelist.c
> index f12a81e..76417ce 100644
> --- a/source3/utils/regedit_valuelist.c
> +++ b/source3/utils/regedit_valuelist.c
> @@ -169,11 +169,11 @@ fail:
>  	return NULL;
>  }
>  
> -void value_list_set_selected(struct value_list *vl, bool select)
> +void value_list_set_selected(struct value_list *vl, bool reverse)
>  {
>  	attr_t attr = A_NORMAL;
>  
> -	if (select) {
> +	if (reverse) {
>  		attr = A_REVERSE;
>  	}
>  	mvwchgat(vl->window, 0, HEADING_X, 5, attr, 0, NULL);
> -- 
> 1.9.1
> 
> 
> From cfb3625c840b5efe5b1149d1229da0e6265afc09 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 43/67] s3:winbindd: avoid invalid pointer type warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/winbindd/idmap_nss.c      | 4 +++-
>  source3/winbindd/winbindd_msrpc.c | 5 ++++-
>  source3/winbindd/winbindd_rpc.c   | 5 ++++-
>  3 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/source3/winbindd/idmap_nss.c b/source3/winbindd/idmap_nss.c
> index 5cd2bc2..e65a499 100644
> --- a/source3/winbindd/idmap_nss.c
> +++ b/source3/winbindd/idmap_nss.c
> @@ -135,6 +135,7 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma
>  	for (i = 0; ids[i]; i++) {
>  		struct group *gr;
>  		enum lsa_SidType type;
> +		const char *p = NULL;
>  		char *name = NULL;
>  		bool ret;
>  
> @@ -142,8 +143,9 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma
>  		   the following call will not recurse so this is safe */
>  		(void)winbind_on();
>  		ret = winbind_lookup_sid(talloc_tos(), ids[i]->sid, NULL,
> -					 (const char **)&name, &type);
> +					 &p, &type);
>  		(void)winbind_off();
> +		name = discard_const_p(char, p);
>  
>  		if (!ret) {
>  			/* TODO: how do we know if the name is really not mapped,
> diff --git a/source3/winbindd/winbindd_msrpc.c b/source3/winbindd/winbindd_msrpc.c
> index 8454f93..77e5ffc 100644
> --- a/source3/winbindd/winbindd_msrpc.c
> +++ b/source3/winbindd/winbindd_msrpc.c
> @@ -234,6 +234,7 @@ static NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
>  	struct dom_sid *sids = NULL;
>  	enum lsa_SidType *types = NULL;
>  	char *full_name = NULL;
> +	const char *names[1];
>  	NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
>  	char *mapped_name = NULL;
>  
> @@ -265,8 +266,10 @@ static NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
>  	DEBUG(3,("name_to_sid [rpc] %s for domain %s\n",
>  		 full_name?full_name:"", domain_name ));
>  
> +	names[0] = full_name;
> +
>  	result = winbindd_lookup_names(mem_ctx, domain, 1,
> -				       (const char **)&full_name, NULL,
> +				       names, NULL,
>  				       &sids, &types);
>  	if (!NT_STATUS_IS_OK(result))
>  		return result;
> diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
> index 7a80237..03bc9b5 100644
> --- a/source3/winbindd/winbindd_rpc.c
> +++ b/source3/winbindd/winbindd_rpc.c
> @@ -277,6 +277,7 @@ NTSTATUS rpc_name_to_sid(TALLOC_CTX *mem_ctx,
>  	enum lsa_SidType *types = NULL;
>  	struct dom_sid *sids = NULL;
>  	char *full_name = NULL;
> +	const char *names[1];
>  	char *mapped_name = NULL;
>  	NTSTATUS status;
>  
> @@ -302,6 +303,8 @@ NTSTATUS rpc_name_to_sid(TALLOC_CTX *mem_ctx,
>  	DEBUG(3,("name_to_sid: %s for domain %s\n",
>  		 full_name ? full_name : "", domain_name ));
>  
> +	names[0] = full_name;
> +
>  	/*
>  	 * We don't run into deadlocks here, cause winbind_off() is
>  	 * called in the main function.
> @@ -310,7 +313,7 @@ NTSTATUS rpc_name_to_sid(TALLOC_CTX *mem_ctx,
>  					 mem_ctx,
>  					 lsa_policy,
>  					 1, /* num_names */
> -					 (const char **) &full_name,
> +					 names,
>  					 NULL, /* domains */
>  					 1, /* level */
>  					 &sids,
> -- 
> 1.9.1
> 
> 
> From 4263264616d6b94a0db5e8445af8eac0490a92de Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 20:16:26 +0100
> Subject: [PATCH 44/67] s3:winbindd: make use of talloc_string_sub2() in
>  generate_krb5_ccache()
> 
> This way we don't pass a given format string to talloc_asprintf().
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/winbindd/winbindd_pam.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
> index 5351937..d56d2fa 100644
> --- a/source3/winbindd/winbindd_pam.c
> +++ b/source3/winbindd/winbindd_pam.c
> @@ -512,7 +512,20 @@ static const char *generate_krb5_ccache(TALLOC_CTX *mem_ctx,
>  				p++;
>  
>  				if (p != NULL && *p == 'u' && strchr(p, '%') == NULL) {
> -					gen_cc = talloc_asprintf(mem_ctx, type, uid);
> +					char uid_str[sizeof("18446744073709551615")];
> +
> +					snprintf(uid_str, sizeof(uid_str), "%u", uid);
> +
> +					gen_cc = talloc_string_sub2(mem_ctx,
> +							type,
> +							"%u",
> +							uid_str,
> +							/* remove_unsafe_characters */
> +							false,
> +							/* replace_once */
> +							true,
> +							/* allow_trailing_dollar */
> +							false);
>  				}
>  			}
>  		}
> -- 
> 1.9.1
> 
> 
> From a8fd1defe750612050f9cfddad7774022412be24 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:21:07 +0100
> Subject: [PATCH 45/67] s3:wscript_build: remove unused allow_warnings=True for
>  'KRBCLIENT'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source3/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source3/wscript_build b/source3/wscript_build
> index d6edc68..d5d1247 100755
> --- a/source3/wscript_build
> +++ b/source3/wscript_build
> @@ -255,7 +255,6 @@ bld.SAMBA3_LIBRARY('util_cmdline',
>  
>  bld.SAMBA3_SUBSYSTEM('KRBCLIENT',
>                       source='libads/kerberos.c libads/ads_status.c',
> -                     allow_warnings=True,
>                       public_deps='krb5samba k5crypto gssapi LIBTSOCKET CLDAP LIBNMB')
>  
>  bld.SAMBA3_SUBSYSTEM('samba3util',
> -- 
> 1.9.1
> 
> 
> From b0795cc99513f4f2816ecbc344a44a0089428f2d Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:49:47 +0100
> Subject: [PATCH 46/67] s4:lib/registry: avoid some const warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/lib/registry/tools/regpatch.c |  4 ++--
>  source4/lib/registry/tools/regshell.c | 42 +++++++++++++++++------------------
>  source4/lib/registry/tools/regtree.c  |  4 ++--
>  3 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
> index a8c1843..34cbd1c 100644
> --- a/source4/lib/registry/tools/regpatch.c
> +++ b/source4/lib/registry/tools/regpatch.c
> @@ -26,7 +26,7 @@
>  #include "param/param.h"
>  #include "events/events.h"
>  
> -int main(int argc, char **argv)
> +int main(int argc, const char **argv)
>  {
>    	int opt;
>  	poptContext pc;
> @@ -44,7 +44,7 @@ int main(int argc, char **argv)
>  		{ NULL }
>  	};
>  
> -	pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0);
> +	pc = poptGetContext(argv[0], argc, argv, long_options,0);
>  
>  	while((opt = poptGetNextOpt(pc)) != -1) {
>  	}
> diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
> index dd154f7..448f957 100644
> --- a/source4/lib/registry/tools/regshell.c
> +++ b/source4/lib/registry/tools/regshell.c
> @@ -37,9 +37,9 @@ struct regshell_context {
>  	struct registry_key *root;
>  };
>  
> -static WERROR get_full_path(struct regshell_context *ctx, char *path, char **ret_path) 
> +static WERROR get_full_path(struct regshell_context *ctx, const char *path, char **ret_path)
>  {
> -	char *dir;
> +	const char *dir;
>  	char *tmp;
>  	char *new_path;
>  
> @@ -49,7 +49,7 @@ static WERROR get_full_path(struct regshell_context *ctx, char *path, char **ret
>   		new_path = talloc_strdup(ctx, ctx->path);
>  	}		
>  
> -	dir = strtok(path, "\\");
> +	dir = strtok(discard_const_p(char, path), "\\");
>  	if (dir == NULL) {
>  		*ret_path = new_path;
>  		return WERR_OK;
> @@ -98,7 +98,7 @@ static WERROR get_full_path(struct regshell_context *ctx, char *path, char **ret
>   * exit
>   */
>  
> -static WERROR cmd_info(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_info(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	struct security_descriptor *sec_desc = NULL;
>  	time_t last_mod;
> @@ -150,7 +150,7 @@ static WERROR cmd_info(struct regshell_context *ctx, int argc, char **argv)
>  	return WERR_OK;
>  }
>  
> -static WERROR cmd_predef(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_predef(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	struct registry_key *ret = NULL;
>  	if (argc < 2) {
> @@ -176,7 +176,7 @@ static WERROR cmd_predef(struct regshell_context *ctx, int argc, char **argv)
>  }
>  
>  static WERROR cmd_pwd(struct regshell_context *ctx,
> -		      int argc, char **argv)
> +		      int argc, const char **argv)
>  {
>  	if (ctx->predef) {
>  		printf("%s\\", ctx->predef);
> @@ -185,7 +185,7 @@ static WERROR cmd_pwd(struct regshell_context *ctx,
>  	return WERR_OK;
>  }
>  
> -static WERROR cmd_set(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_set(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	struct registry_value val;
>  	WERROR error;
> @@ -209,7 +209,7 @@ static WERROR cmd_set(struct regshell_context *ctx, int argc, char **argv)
>  	return WERR_OK;
>  }
>  
> -static WERROR cmd_ck(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_ck(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	struct registry_key *nkey = NULL;
>  	char *full_path;
> @@ -238,7 +238,7 @@ static WERROR cmd_ck(struct regshell_context *ctx, int argc, char **argv)
>  	return WERR_OK;
>  }
>  
> -static WERROR cmd_print(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_print(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	uint32_t value_type;
>  	DATA_BLOB value_data;
> @@ -262,7 +262,7 @@ static WERROR cmd_print(struct regshell_context *ctx, int argc, char **argv)
>  	return WERR_OK;
>  }
>  
> -static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_ls(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	unsigned int i;
>  	WERROR error;
> @@ -292,7 +292,7 @@ static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
>  
>  	return WERR_OK;
>  }
> -static WERROR cmd_mkkey(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_mkkey(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	struct registry_key *tmp;
>  	WERROR error;
> @@ -314,7 +314,7 @@ static WERROR cmd_mkkey(struct regshell_context *ctx, int argc, char **argv)
>  }
>  
>  static WERROR cmd_rmkey(struct regshell_context *ctx,
> -			int argc, char **argv)
> +			int argc, const char **argv)
>  {
>  	WERROR error;
>  
> @@ -334,7 +334,7 @@ static WERROR cmd_rmkey(struct regshell_context *ctx,
>  	return WERR_OK;
>  }
>  
> -static WERROR cmd_rmval(struct regshell_context *ctx, int argc, char **argv)
> +static WERROR cmd_rmval(struct regshell_context *ctx, int argc, const char **argv)
>  {
>  	WERROR error;
>  
> @@ -355,18 +355,18 @@ static WERROR cmd_rmval(struct regshell_context *ctx, int argc, char **argv)
>  }
>  
>  _NORETURN_ static WERROR cmd_exit(struct regshell_context *ctx,
> -				  int argc, char **argv)
> +				  int argc, const char **argv)
>  {
>  	exit(0);
>  }
>  
> -static WERROR cmd_help(struct regshell_context *ctx, int, char **);
> +static WERROR cmd_help(struct regshell_context *ctx, int, const char **);
>  
>  static struct {
>  	const char *name;
>  	const char *alias;
>  	const char *help;
> -	WERROR (*handle)(struct regshell_context *ctx, int argc, char **argv);
> +	WERROR (*handle)(struct regshell_context *ctx, int argc, const char **argv);
>  } regshell_cmds[] = {
>  	{"ck", "cd", "Change current key", cmd_ck },
>  	{"info", "i", "Show detailed information of a key", cmd_info },
> @@ -384,7 +384,7 @@ static struct {
>  };
>  
>  static WERROR cmd_help(struct regshell_context *ctx,
> -		       int argc, char **argv)
> +		       int argc, const char **argv)
>  {
>  	unsigned int i;
>  	printf("Available commands:\n");
> @@ -399,10 +399,10 @@ static WERROR process_cmd(struct regshell_context *ctx,
>  			  char *line)
>  {
>  	int argc;
> -	char **argv = NULL;
> +	const char **argv = NULL;
>  	int ret, i;
>  
> -	if ((ret = poptParseArgvString(line, &argc, (const char ***) &argv)) != 0) {
> +	if ((ret = poptParseArgvString(line, &argc, &argv)) != 0) {
>  		fprintf(stderr, "regshell: %s\n", poptStrerror(ret));
>  		return WERR_INVALID_PARAM;
>  	}
> @@ -551,7 +551,7 @@ static char **reg_completion(const char *text, int start, int end)
>  	}
>  }
>  
> -int main(int argc, char **argv)
> +int main(int argc, const char **argv)
>  {
>  	int opt;
>  	const char *file = NULL;
> @@ -570,7 +570,7 @@ int main(int argc, char **argv)
>  		{ NULL }
>  	};
>  
> -	pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0);
> +	pc = poptGetContext(argv[0], argc, argv, long_options,0);
>  
>  	while((opt = poptGetNextOpt(pc)) != -1) {
>  	}
> diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
> index 40570dd..6df8e50 100644
> --- a/source4/lib/registry/tools/regtree.c
> +++ b/source4/lib/registry/tools/regtree.c
> @@ -98,7 +98,7 @@ static void print_tree(unsigned int level, struct registry_key *p,
>  	talloc_free(mem_ctx);
>  }
>  
> -int main(int argc, char **argv)
> +int main(int argc, const char **argv)
>  {
>  	int opt;
>  	unsigned int i;
> @@ -122,7 +122,7 @@ int main(int argc, char **argv)
>  		{ NULL }
>  	};
>  
> -	pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0);
> +	pc = poptGetContext(argv[0], argc, argv, long_options,0);
>  
>  	while((opt = poptGetNextOpt(pc)) != -1) {
>  	}
> -- 
> 1.9.1
> 
> 
> From cbe62f317c5221fa322bce7191fe4585a3cecbb1 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:24:44 +0100
> Subject: [PATCH 47/67] s4:lib/registry: fix compiler warnings
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/lib/registry/regf.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
> index 544dbb0..8495e53 100644
> --- a/source4/lib/registry/regf.c
> +++ b/source4/lib/registry/regf.c
> @@ -1720,18 +1720,21 @@ static WERROR regf_del_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
>  	}
>  
>  	if (key->nk->subkeys_offset != -1) {
> -		char *sk_name;
>  		struct hive_key *sk = (struct hive_key *)key;
>  		unsigned int i = key->nk->num_subkeys;
>  		while (i--) {
> +			char *sk_name;
> +			const char *p = NULL;
> +
>  			/* Get subkey information. */
>  			error = regf_get_subkey_by_index(parent_nk, sk, 0,
> -							 (const char **)&sk_name,
> +							 &p,
>  							 NULL, NULL);
>  			if (!W_ERROR_IS_OK(error)) {
>  				DEBUG(0, ("Can't retrieve subkey by index.\n"));
>  				return error;
>  			}
> +			sk_name = discard_const_p(char, p);
>  
>  			/* Delete subkey. */
>  			error = regf_del_key(NULL, sk, sk_name);
> @@ -1745,19 +1748,22 @@ static WERROR regf_del_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
>  	}
>  
>  	if (key->nk->values_offset != -1) {
> -		char *val_name;
>  		struct hive_key *sk = (struct hive_key *)key;
>  		DATA_BLOB data;
>  		unsigned int i = key->nk->num_values;
>  		while (i--) {
> +			char *val_name;
> +			const char *p = NULL;
> +
>  			/* Get value information. */
>  			error = regf_get_value(parent_nk, sk, 0,
> -					       (const char **)&val_name,
> +					       &p,
>  					       NULL, &data);
>  			if (!W_ERROR_IS_OK(error)) {
>  				DEBUG(0, ("Can't retrieve value by index.\n"));
>  				return error;
>  			}
> +			val_name = discard_const_p(char, p);
>  
>  			/* Delete value. */
>  			error = regf_del_value(NULL, sk, val_name);
> -- 
> 1.9.1
> 
> 
> From 4d44217d8fdffd6f4987da277435ecd1cc4ad900 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:25:24 +0100
> Subject: [PATCH 48/67] s4:lib/registry: remove unused allow_warnings=True
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/lib/registry/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source4/lib/registry/wscript_build b/source4/lib/registry/wscript_build
> index 0055e2e..495969a 100644
> --- a/source4/lib/registry/wscript_build
> +++ b/source4/lib/registry/wscript_build
> @@ -12,7 +12,6 @@ bld.SAMBA_SUBSYSTEM('TDR_REGF',
>  
>  bld.SAMBA_LIBRARY('registry',
>  	source='interface.c util.c samba.c patchfile_dotreg.c patchfile_preg.c patchfile.c regf.c hive.c local.c ldb.c rpc.c',
> -	allow_warnings=True,
>  	pc_files='registry.pc',
>  	public_deps='dcerpc samba-util TDR_REGF ldb RPC_NDR_WINREG ldbsamba util_reg',
>  	public_headers='registry.h',
> -- 
> 1.9.1
> 
> 
> From f98d4fa069a48ce4dba12bb91a4a74b30b57076a Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:50:57 +0100
> Subject: [PATCH 49/67] s4:libcli/raw: use smb_setfsinfo_level in smb_setfsinfo
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/libcli/raw/interfaces.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
> index 9003c12..03e9bbb 100644
> --- a/source4/libcli/raw/interfaces.h
> +++ b/source4/libcli/raw/interfaces.h
> @@ -1339,12 +1339,12 @@ enum smb_setfsinfo_level {
>  union smb_setfsinfo {
>  	/* generic interface */
>  	struct {
> -		enum smb_fsinfo_level level;
> +		enum smb_setfsinfo_level level;
>  	} generic;
>  
>  	/* TRANS2 RAW_QFS_UNIX_INFO interface */
>  	struct {
> -		enum smb_fsinfo_level level;
> +		enum smb_setfsinfo_level level;
>  
>  		struct {
>  			uint16_t major_version;
> -- 
> 1.9.1
> 
> 
> From a81bec1633592a0ada57dfa7dccdb6723d405e87 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:29:36 +0100
> Subject: [PATCH 50/67] s4:kdc: comment out unused code in db-glue.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/kdc/db-glue.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/source4/kdc/db-glue.c b/source4/kdc/db-glue.c
> index b0c3e7a..00b58fd 100644
> --- a/source4/kdc/db-glue.c
> +++ b/source4/kdc/db-glue.c
> @@ -1362,10 +1362,10 @@ static krb5_error_code samba_kdc_lookup_server(krb5_context context,
>  	} else {
>  		int lret;
>  		char *short_princ;
> -		const char *realm;
> +		/* const char *realm; */
>  		/* server as client principal case, but we must not lookup userPrincipalNames */
>  		*realm_dn = ldb_get_default_basedn(kdc_db_ctx->samdb);
> -		realm = krb5_principal_get_realm(context, principal);
> +		/* realm = krb5_principal_get_realm(context, principal); */
>  
>  		/* TODO: Check if it is our realm, otherwise give referral */
>  
> -- 
> 1.9.1
> 
> 
> From d77cb3e7700c2c7b604ed3f09ff20c4e80c9d9f4 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:21:07 +0100
> Subject: [PATCH 51/67] s4:kdc: remove unused allow_warnings=True for
>  'MIT_SAMBA'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/kdc/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source4/kdc/wscript_build b/source4/kdc/wscript_build
> index c77f2a2..78a79b7 100755
> --- a/source4/kdc/wscript_build
> +++ b/source4/kdc/wscript_build
> @@ -62,7 +62,6 @@ bld.SAMBA_LIBRARY('db-glue',
>  
>  bld.SAMBA_SUBSYSTEM('MIT_SAMBA',
>  	source='mit_samba.c',
> -	allow_warnings=True,
>  	deps='ldb auth4_sam auth_sam_reply samba-credentials hdb db-glue PAC_GLUE samba-hostconfig com_err'
>  	)
>  
> -- 
> 1.9.1
> 
> 
> From e23847d8d4887ab3cc43281b248c55371b12642d Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:29:36 +0100
> Subject: [PATCH 52/67] s4:nbt_server: avoid str_list related const warning
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/nbt_server/wins/winsclient.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c
> index b047b2b..0636594 100644
> --- a/source4/nbt_server/wins/winsclient.c
> +++ b/source4/nbt_server/wins/winsclient.c
> @@ -142,6 +142,7 @@ static void nbtd_wins_refresh(struct tevent_context *ev, struct tevent_timer *te
>  	struct nbt_name_socket *nbtsock = wins_socket(iface);
>  	struct tevent_req *subreq;
>  	struct nbtd_wins_refresh_state *state;
> +	char **l;
>  
>  	state = talloc_zero(iname, struct nbtd_wins_refresh_state);
>  	if (state == NULL) {
> @@ -152,7 +153,8 @@ static void nbtd_wins_refresh(struct tevent_context *ev, struct tevent_timer *te
>  
>  	/* setup a wins name refresh request */
>  	state->io.in.name            = iname->name;
> -	state->io.in.wins_servers    = (const char **)str_list_make_single(state, iname->wins_server);
> +	l = str_list_make_single(state, iname->wins_server);
> +	state->io.in.wins_servers    = discard_const_p(const char *, l);
>  	state->io.in.wins_port       = lpcfg_nbt_port(iface->nbtsrv->task->lp_ctx);
>  	state->io.in.addresses       = nbtd_address_list(iface, state);
>  	state->io.in.nb_flags        = iname->nb_flags;
> -- 
> 1.9.1
> 
> 
> From 84c526a55073a341c35067ac3245a87d4b84d18d Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:29:36 +0100
> Subject: [PATCH 53/67] s4:ntvfs: explicitly handle
>  RAW_FILEINFO_UNIX_{BASIC,LINK} in ntvfs_map_fileinfo()
> 
> This avoids compiler warnings.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/ntvfs/ntvfs_generic.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c
> index 0854aa3..d3f7919 100644
> --- a/source4/ntvfs/ntvfs_generic.c
> +++ b/source4/ntvfs/ntvfs_generic.c
> @@ -908,8 +908,10 @@ NTSTATUS ntvfs_map_fileinfo(TALLOC_CTX *mem_ctx,
>  		info->alignment_information.out.alignment_requirement =
>  			info2->generic.out.alignment_requirement;
>  		return NT_STATUS_OK;
> -#if 0	
>  	case RAW_FILEINFO_UNIX_BASIC:
> +#if 1
> +		return NT_STATUS_INVALID_LEVEL;
> +#else
>  		info->unix_basic_info.out.end_of_file = info2->generic.out.end_of_file;
>  		info->unix_basic_info.out.num_bytes = info2->generic.out.size;
>  		info->unix_basic_info.out.status_change_time = info2->generic.out.change_time;
> @@ -924,8 +926,11 @@ NTSTATUS ntvfs_map_fileinfo(TALLOC_CTX *mem_ctx,
>  		info->unix_basic_info.out.permissions = info2->generic.out.permissions;
>  		info->unix_basic_info.out.nlink = info2->generic.out.nlink;
>  		return NT_STATUS_OK;
> -		
> +#endif
>  	case RAW_FILEINFO_UNIX_LINK:
> +#if 1
> +		return NT_STATUS_INVALID_LEVEL;
> +#else
>  		info->unix_link_info.out.link_dest = info2->generic.out.link_dest;
>  		return NT_STATUS_OK;
>  #endif
> -- 
> 1.9.1
> 
> 
> From f1e49d6e2bc465df92d7f80425770c59456a9635 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:29:36 +0100
> Subject: [PATCH 54/67] s4:ntvfs/smb2: ifdef out unused code
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/ntvfs/smb2/vfs_smb2.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/source4/ntvfs/smb2/vfs_smb2.c b/source4/ntvfs/smb2/vfs_smb2.c
> index a3a670a..dbb76b3 100644
> --- a/source4/ntvfs/smb2/vfs_smb2.c
> +++ b/source4/ntvfs/smb2/vfs_smb2.c
> @@ -100,6 +100,7 @@ struct async_info {
>    a handler for oplock break events from the server - these need to be passed
>    along to the client
>   */
> +#if 0
>  static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
>  {
>  	struct cvfs_private *p = p_private;
> @@ -123,6 +124,7 @@ static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uin
>  	if (!NT_STATUS_IS_OK(status)) return false;
>  	return true;
>  }
> +#endif
>  
>  /*
>    return a handle to the root of the share
> -- 
> 1.9.1
> 
> 
> From ba3b3487efd0f43751f56e23a18f35504f35120c Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:08:17 +0100
> Subject: [PATCH 55/67] s4:smb_server/smb2: avoid unused warnings in
>  smb2srv_setinfo_send()
> 
> op->req and req have the same value.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/smb_server/smb2/fileinfo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source4/smb_server/smb2/fileinfo.c b/source4/smb_server/smb2/fileinfo.c
> index 5e4f35e..8c49336 100644
> --- a/source4/smb_server/smb2/fileinfo.c
> +++ b/source4/smb_server/smb2/fileinfo.c
> @@ -250,7 +250,7 @@ static void smb2srv_setinfo_send(struct ntvfs_request *ntvfs)
>  
>  	SMB2SRV_CHECK_ASYNC_STATUS(op, struct smb2srv_setinfo_op);
>  
> -	SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x02, false, 0));
> +	SMB2SRV_CHECK(smb2srv_setup_reply(op->req, 0x02, false, 0));
>  
>  	smb2srv_send_reply(req);
>  }
> -- 
> 1.9.1
> 
> 
> From 84c5e02aa4dc3a6d42a636f67f8fb9120f6d7754 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:08:17 +0100
> Subject: [PATCH 56/67] s4:smb_server/smb2: remove unused _pad variables
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/smb_server/smb2/keepalive.c | 4 ----
>  source4/smb_server/smb2/sesssetup.c | 4 ----
>  source4/smb_server/smb2/tcon.c      | 4 ----
>  3 files changed, 12 deletions(-)
> 
> diff --git a/source4/smb_server/smb2/keepalive.c b/source4/smb_server/smb2/keepalive.c
> index c362acb..cd53778 100644
> --- a/source4/smb_server/smb2/keepalive.c
> +++ b/source4/smb_server/smb2/keepalive.c
> @@ -51,8 +51,6 @@ static void smb2srv_keepalive_send(struct smb2srv_request *req)
>  
>  void smb2srv_keepalive_recv(struct smb2srv_request *req)
>  {
> -	uint16_t _pad;
> -
>  	if (req->in.body_size != 0x04) {
>  		smb2srv_send_error(req,  NT_STATUS_INVALID_PARAMETER);
>  		return;
> @@ -63,8 +61,6 @@ void smb2srv_keepalive_recv(struct smb2srv_request *req)
>  		return;
>  	}
>  
> -	_pad	= SVAL(req->in.body, 0x02);
> -
>  	req->status = smb2srv_keepalive_backend(req);
>  
>  	if (req->control_flags & SMB2SRV_REQ_CTRL_FLAG_NOT_REPLY) {
> diff --git a/source4/smb_server/smb2/sesssetup.c b/source4/smb_server/smb2/sesssetup.c
> index 35a1484..d4b8de6 100644
> --- a/source4/smb_server/smb2/sesssetup.c
> +++ b/source4/smb_server/smb2/sesssetup.c
> @@ -282,12 +282,8 @@ static void smb2srv_logoff_send(struct smb2srv_request *req)
>  
>  void smb2srv_logoff_recv(struct smb2srv_request *req)
>  {
> -	uint16_t _pad;
> -
>  	SMB2SRV_CHECK_BODY_SIZE(req, 0x04, false);
>  
> -	_pad	= SVAL(req->in.body, 0x02);
> -
>  	req->status = smb2srv_logoff_backend(req);
>  
>  	if (req->control_flags & SMB2SRV_REQ_CTRL_FLAG_NOT_REPLY) {
> diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c
> index e7d2847..b2d1043 100644
> --- a/source4/smb_server/smb2/tcon.c
> +++ b/source4/smb_server/smb2/tcon.c
> @@ -434,12 +434,8 @@ static void smb2srv_tdis_send(struct smb2srv_request *req)
>  
>  void smb2srv_tdis_recv(struct smb2srv_request *req)
>  {
> -	uint16_t _pad;
> -
>  	SMB2SRV_CHECK_BODY_SIZE(req, 0x04, false);
>  
> -	_pad	= SVAL(req->in.body, 0x02);
> -
>  	req->status = smb2srv_tdis_backend(req);
>  
>  	if (req->control_flags & SMB2SRV_REQ_CTRL_FLAG_NOT_REPLY) {
> -- 
> 1.9.1
> 
> 
> From 5c038ef38aa57dafa6ed2e56a536bc04065e57ee Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 27 Feb 2014 09:08:17 +0100
> Subject: [PATCH 57/67] s4:torture/locktest: comment out unused code and avoid
>  smbcli_nt_error()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/torture/locktest.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
> index 0d2608f..ac8d854a 100644
> --- a/source4/torture/locktest.c
> +++ b/source4/torture/locktest.c
> @@ -221,7 +221,7 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
>  	uint64_t len = rec->len;
>  	enum brl_type op = rec->lock_type;
>  	int server;
> -	bool ret[NSERVERS];
> +	/* bool ret[NSERVERS]; */
>  	NTSTATUS status[NSERVERS];
>  
>  	switch (rec->lock_op) {
> @@ -256,8 +256,8 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
>  				res = smb_raw_lock(tree, &parms);
>  			}
>  
> -			ret[server] = NT_STATUS_IS_OK(res); 
> -			status[server] = smbcli_nt_error(cli[server][conn]->tree);
> +			/* ret[server] = NT_STATUS_IS_OK(res); */
> +			status[server] = res;
>  			if (!exact_error_codes && 
>  			    NT_STATUS_EQUAL(status[server], 
>  					    NT_STATUS_FILE_LOCK_CONFLICT)) {
> @@ -302,8 +302,8 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
>  				res = smb_raw_lock(tree, &parms);
>  			}
>  
> -			ret[server] = NT_STATUS_IS_OK(res);
> -			status[server] = smbcli_nt_error(cli[server][conn]->tree);
> +			/* ret[server] = NT_STATUS_IS_OK(res); */
> +			status[server] = res;
>  		}
>  		if (showall || 
>  		    (!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1]))) {
> -- 
> 1.9.1
> 
> 
> From e89571869277dfe55738e1a37d7ec0d99b5c488d Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 11:39:39 +0100
> Subject: [PATCH 58/67] s4:torture/winbind: remove unused variables in
>  struct_based.c
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/torture/winbind/struct_based.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
> index ef27b05..2bd7443 100644
> --- a/source4/torture/winbind/struct_based.c
> +++ b/source4/torture/winbind/struct_based.c
> @@ -52,9 +52,10 @@
>  	} \
>  } while(0)
>  
> +#undef _STRUCT_NOOP
> +#define _STRUCT_NOOP do {} while(0);
>  #define DO_STRUCT_REQ_REP(op,req,rep) do { \
> -	bool __noop = false; \
> -	DO_STRUCT_REQ_REP_EXT(op,req,rep,NSS_STATUS_SUCCESS,true,__noop=true,NULL); \
> +	DO_STRUCT_REQ_REP_EXT(op,req,rep,NSS_STATUS_SUCCESS,true, _STRUCT_NOOP, NULL); \
>  } while (0)
>  
>  static bool torture_winbind_struct_interface_version(struct torture_context *torture)
> @@ -853,9 +854,8 @@ static bool torture_winbind_struct_getpwent(struct torture_context *torture)
>  	ZERO_STRUCT(rep);
>  	req.data.num_entries = 1;
>  	if (torture_setting_bool(torture, "samba3", false)) {
> -		bool __noop = false;
>  		DO_STRUCT_REQ_REP_EXT(WINBINDD_GETPWENT, &req, &rep,
> -				      NSS_STATUS_SUCCESS, false, __noop=true,
> +				      NSS_STATUS_SUCCESS, false, _STRUCT_NOOP,
>  				      NULL);
>  	} else {
>  		DO_STRUCT_REQ_REP(WINBINDD_GETPWENT, &req, &rep);
> -- 
> 1.9.1
> 
> 
> From f537b65e5f121e8b286f6d1bb967c7e04a3c13d2 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:26:38 +0100
> Subject: [PATCH 59/67] s4:torture: remove unused allow_warnings=True for
>  'TORTURE_BASIC' and 'TORTURE_VFS'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/torture/wscript_build | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build
> index c13e7d4..aa5784a 100755
> --- a/source4/torture/wscript_build
> +++ b/source4/torture/wscript_build
> @@ -10,7 +10,6 @@ bld.SAMBA_SUBSYSTEM('TORTURE_UTIL',
>  
>  bld.SAMBA_MODULE('TORTURE_BASIC',
>  	source='basic/base.c basic/misc.c basic/scanner.c basic/utable.c basic/charset.c basic/mangle_test.c basic/denytest.c basic/aliases.c basic/locking.c basic/secleak.c basic/rename.c basic/dir.c basic/delete.c basic/unlink.c basic/disconnect.c basic/delaywrite.c basic/attr.c basic/properties.c',
> -	allow_warnings=True,
>  	subsystem='smbtorture',
>  	deps='LIBCLI_SMB popt POPT_CREDENTIALS TORTURE_UTIL smbclient-raw TORTURE_RAW',
>  	internal_module=True,
> @@ -152,7 +151,6 @@ bld.SAMBA_MODULE('TORTURE_NTP',
>  
>  bld.SAMBA_MODULE('TORTURE_VFS',
>  	source='vfs/vfs.c vfs/fruit.c',
> -	allow_warnings=True,
>  	subsystem='smbtorture',
>  	deps='LIBCLI_SMB POPT_CREDENTIALS TORTURE_UTIL smbclient-raw TORTURE_RAW',
>  	internal_module=True,
> -- 
> 1.9.1
> 
> 
> From 4f005537cbdfcea2accaee48b8062317c5fb270e Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Thu, 22 May 2014 10:41:33 +0200
> Subject: [PATCH 60/67] wafsamba: use -Wno-error=deprecated-declarations in
>  picky-developer mode
> 
> Currently we use too many deprecated function like
> dcerpc_binding_handle_set_sync_ev() and others, but this should not be a reason
> to require 'allow_warnings=True'.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/samba_autoconf.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
> index c193873..c818025 100644
> --- a/buildtools/wafsamba/samba_autoconf.py
> +++ b/buildtools/wafsamba/samba_autoconf.py
> @@ -691,7 +691,7 @@ int main(void) {
>              conf.env['EXTRA_CFLAGS'].extend(TO_LIST("-Werror=format"))
>  
>      if Options.options.picky_developer:
> -        conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror', testflags=True)
> +        conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror -Wno-error=deprecated-declarations', testflags=True)
>  
>      if Options.options.fatal_errors:
>          conf.ADD_CFLAGS('-Wfatal-errors', testflags=True)
> -- 
> 1.9.1
> 
> 
> From 4b77bf67f823b8b2433b384b9e3df6119912f0b2 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:27:28 +0100
> Subject: [PATCH 61/67] s4:lib/events: remove unused allow_warnings=True
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/lib/events/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source4/lib/events/wscript_build b/source4/lib/events/wscript_build
> index 355f315..d08d5dd 100644
> --- a/source4/lib/events/wscript_build
> +++ b/source4/lib/events/wscript_build
> @@ -5,6 +5,5 @@ bld.SAMBA_LIBRARY('events',
>                    source='tevent_s4.c',
>                    deps='samba-util',
>                    public_deps='tevent',
> -                  allow_warnings=True,
>                    private_library=True
>                    )
> -- 
> 1.9.1
> 
> 
> From 62e83785c3a1e039debcbbc5099f00628eb9ed6d Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:27:28 +0100
> Subject: [PATCH 62/67] s4:lib/messaging: remove unused allow_warnings=True
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/lib/messaging/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source4/lib/messaging/wscript_build b/source4/lib/messaging/wscript_build
> index c1b7e1e..31a97a2 100644
> --- a/source4/lib/messaging/wscript_build
> +++ b/source4/lib/messaging/wscript_build
> @@ -4,7 +4,6 @@
>  bld.SAMBA_LIBRARY('MESSAGING',
>  	source='messaging.c',
>  	public_deps='samba-util tdb-wrap NDR_IRPC UNIX_PRIVS util_tdb cluster ndr samba_socket dcerpc',
> -	allow_warnings=True,
>  	private_library=True
>  	)
>  
> -- 
> 1.9.1
> 
> 
> From 5100e2cdf2316ad98a3c42b5e9414df2ef70cb3a Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:27:28 +0100
> Subject: [PATCH 63/67] s4:librpc: remove unused allow_warnings=True for
>  'dcerpc'
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/librpc/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build
> index ea81d2c..9b96437 100755
> --- a/source4/librpc/wscript_build
> +++ b/source4/librpc/wscript_build
> @@ -123,7 +123,6 @@ bld.SAMBA_LIBRARY('dcerpc',
>  	rpc/dcerpc_connect.c rpc/dcerpc_secondary.c''',
>  	pc_files='dcerpc.pc',
>  	deps='samba_socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 ndr NDR_DCERPC RPC_NDR_EPMAPPER NDR_SCHANNEL RPC_NDR_NETLOGON RPC_NDR_MGMT gensec LIBCLI_AUTH smbclient-raw LP_RESOLVE tevent-util dcerpc-binding param_options http',
> -	allow_warnings=True,
>  	autoproto='rpc/dcerpc_proto.h',
>  	public_deps='samba-credentials tevent talloc',
>  	public_headers='''rpc/dcerpc.h ../../librpc/gen_ndr/mgmt.h
> -- 
> 1.9.1
> 
> 
> From aeb38ef6900a590353ca81b152e7bcfb1a8a2511 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 29 Oct 2014 12:27:28 +0100
> Subject: [PATCH 64/67] s4:ntvfs/unixuid: remove unused allow_warnings=True
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/ntvfs/unixuid/wscript_build | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source4/ntvfs/unixuid/wscript_build b/source4/ntvfs/unixuid/wscript_build
> index f014674..56fd42d 100644
> --- a/source4/ntvfs/unixuid/wscript_build
> +++ b/source4/ntvfs/unixuid/wscript_build
> @@ -2,7 +2,6 @@
>  
>  bld.SAMBA_MODULE('ntvfs_unixuid',
>  	source='vfs_unixuid.c',
> -	allow_warnings=True,
>  	subsystem='ntvfs',
>  	init_function='ntvfs_unixuid_init',
>  	deps='auth_unix_token talloc'
> -- 
> 1.9.1
> 
> 
> From cbbba419ee365b12572b293ddad6720883bfaa37 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 07:34:51 +0100
> Subject: [PATCH 65/67] wafsamba: change the default to allow_warnings=False
>  for SAMBA_{SUBSYSTEM,LIBRARY,MODULE}()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index b68b9d2..020516b 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -132,7 +132,7 @@ def SAMBA_LIBRARY(bld, libname, source,
>                    private_library=False,
>                    grouping_library=False,
>                    allow_undefined_symbols=False,
> -                  allow_warnings=True,
> +                  allow_warnings=False,
>                    enabled=True):
>      '''define a Samba library'''
>  
> @@ -420,7 +420,7 @@ def SAMBA_MODULE(bld, modname, source,
>                   pyembed=False,
>                   manpages=None,
>                   allow_undefined_symbols=False,
> -                 allow_warnings=True
> +                 allow_warnings=False
>                   ):
>      '''define a Samba module.'''
>  
> @@ -520,7 +520,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
>                      vars=None,
>                      subdir=None,
>                      hide_symbols=False,
> -                    allow_warnings=True,
> +                    allow_warnings=False,
>                      pyext=False,
>                      pyembed=False):
>      '''define a Samba subsystem'''
> -- 
> 1.9.1
> 
> 
> From b4dca2a747e45ebb53c309ac57982918d9fa5415 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 26 Feb 2014 07:34:51 +0100
> Subject: [PATCH 66/67] wafsamba: change the default to allow_warnings=False
>  for CURRENT_CFLAGS()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/samba_autoconf.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
> index c818025..9e50ee5 100644
> --- a/buildtools/wafsamba/samba_autoconf.py
> +++ b/buildtools/wafsamba/samba_autoconf.py
> @@ -765,7 +765,7 @@ def ADD_EXTRA_INCLUDES(conf, includes):
>  
>  
>  
> -def CURRENT_CFLAGS(bld, target, cflags, allow_warnings=True, hide_symbols=False):
> +def CURRENT_CFLAGS(bld, target, cflags, allow_warnings=False, hide_symbols=False):
>      '''work out the current flags. local flags are added first'''
>      ret = TO_LIST(cflags)
>      if not 'EXTRA_CFLAGS' in bld.env:
> -- 
> 1.9.1
> 
> 
> From f4c58527db95640e33ea7e8dc060c47d7e50f8c2 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 11 Nov 2014 14:54:41 +0100
> Subject: [PATCH 67/67] script/autobuild.py: build 'samba' using
>  --picky-developer
> 
> This makes sure we don't get unexpected new compiler warnings.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  script/autobuild.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/script/autobuild.py b/script/autobuild.py
> index 2b25a10..ba08e52 100755
> --- a/script/autobuild.py
> +++ b/script/autobuild.py
> @@ -44,7 +44,7 @@ tasks = {
>                 ("clean", "make clean", "text/plain") ],
>  
>      # We have 'test' before 'install' because, 'test' should work without 'install'
> -    "samba" : [ ("configure", "./configure.developer ${PREFIX} --with-selftest-prefix=./bin/ab", "text/plain"),
> +    "samba" : [ ("configure", "./configure.developer --picky-developer ${PREFIX} --with-selftest-prefix=./bin/ab", "text/plain"),
>                  ("make", "make -j", "text/plain"),
>                  ("test", "make test FAIL_IMMEDIATELY=1", "text/plain"),
>                  ("install", "make install", "text/plain"),
> -- 
> 1.9.1
> 





More information about the samba-technical mailing list