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

Stefan (metze) Metzmacher metze at samba.org
Mon Nov 17 12:23:29 MST 2014


Am 14.11.2014 um 23:27 schrieb Jeremy Allison:
> 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:-).

Thanks!

The remaining patches rebased on master.

metze
-------------- next part --------------
From edccbcb2917500feeeeb943632980e5b4eaba8b0 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 01/48] 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 c33bffa8ef6348f401bf5a7057daa7632a21212e 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 02/48] 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 a47c51ebeed7d0b31b4ab31bae5e24918efae7b6 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 03/48] 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 b33ea81517a36bc864376a5fb488f55bb9132242 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 04/48] 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 fc907343063b4aa276ce46a06bc7bf8f1d36a6ce 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 05/48] 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 | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index b46f510..fdb2baf 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,14 @@ 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,
-					 num_ous)) {
+		if (!add_string_to_array(mem_ctx, dn, &p, &num_ous)) {
 			TALLOC_FREE(dn);
 			ads_msgfree(ads, res);
 			return ADS_ERROR(LDAP_NO_MEMORY);
 		}
 
 		TALLOC_FREE(dn);
+		*ous = discard_const_p(char *, p);
 	}
 
 	ads_msgfree(ads, res);
-- 
1.9.1


From d5a5cc96313f8bf3d152d32297374852df5889bd 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 06/48] 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 240c474353143f356ec9a278d6c754ca20e6379e 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 07/48] 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 0289aab4ddfea4279fe31c9ea4c3e3571ee871c8 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 08/48] 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 e635bc19a991ce5ee07ce0b4a2fc9e29ce4d96a5 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 09/48] 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 76a27cb91554b7207ba37870be9febdeda7a403f 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 10/48] 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 f69dce3ca1bf19f63d1f0d52f2aac014275a48e3 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 11/48] 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 c968ac7738aa75107cebf49653420d066b69d586 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 12/48] 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 2279cfd50df34bc2617a97123c24a0d1860e0fec 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 13/48] 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 f269c27786d652dff9940a95c9ddf2cf5a39ee3b 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 14/48] 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 109a342df1d98ebddb423488acd620399539d7be 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 15/48] 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 fccf283627e3bb01b7078a83b75b100f99d30232 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 16/48] 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 e31f77bd9acc9a7f92032ad11f6881c509c5353c 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 17/48] 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 bad45c630095daced392c86e8044776364419384 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/48] 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 972c1c95cccbbcab3cfd2e07af5a312b448dc43b 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/48] 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 708c042850a067eff809a6d9fe7270f49d7b5a0c 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 20/48] 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 c161f21a967f2c35ef23181eb793584748f2ab2d 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/48] 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 77da683fa423d18bbc2a10c90bfe852a53e95238 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 22/48] 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 9d556884c68eb2be27c2c91f0982cbc21ae4486e 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 23/48] 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 744794579f41c4a6dab2cf046cfc95af6c9a2d8c 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/48] 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 a32d50691d6b61fdd69ae5e9116beed8e70baa17 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 25/48] 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 be987d955fe85d477573a745548b86a79bcf62d9 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 26/48] 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 54ce2ae43918760b85dedfdf9eda8eaadc4f7f30 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 27/48] 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 6db6d8e42e98d950f09f73d2f36834c5ab95037a 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 28/48] 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 a3c3501b5c9841bb16f5490a3cf992395ee86e58 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 29/48] 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 d6ae6bb7fc4617404c89d109f8ad8efc5c34fbf9 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 30/48] 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 afd1f648005a3d3878e946cbd7cadbfb4e1a4e2e 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 31/48] 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 284a2134d45819f3b0657bb2043c702dcff4b176 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 32/48] 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 44187c7e68f27315952860c8fb970b80d8e1a728 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 33/48] 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 618845b2215625d26a89ab6a95ecc21953c96334 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 34/48] 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 3bd322d0f4a90453dbe03f0e80a9569da7705abd 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 35/48] 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 1c1b5992a759568447a7191df0519d6160b9a252 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 36/48] 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 c245386f496ceaedfba3a32280b8f2866cce2804 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 37/48] 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 c01d1796f51e5ac311117483345965b220c11b8e 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 38/48] 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 497fa359c25bdaec527b8e24d29354d62b202628 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 39/48] 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 35645b19ed2a711779c5cc5ca750cd0da7a3bbcd 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 40/48] 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 f3e31f8da4f10fd9c53a37a36706b423b7afec7a 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 41/48] 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 c565bd34b628eb4208a30735dba2f06054af1cfa 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 42/48] 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 c4de7a280cc052fee63ae6cede2ae8cba3dbfe28 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 43/48] 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 955950d52d09acea35110d8c3e28cf5c996ca7c8 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 44/48] 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 c5934a2fa00714ccd4dcdef832deefc87d1f3ce8 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 45/48] 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 7e58ca176397bcaf9dd8d777340243303a33685d 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 46/48] 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 0734e612f2f179f39c0e338b5a34bd07f91a74fd 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 47/48] 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 7570dba4aa2e7c2a8ab59338de17f6eff7e81c3b 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 48/48] 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141117/df5632bd/attachment.pgp>


More information about the samba-technical mailing list