[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu May 5 16:58:02 MDT 2011


The branch, master has been updated
       via  9eee6e2 More const fixes... getting near the end now.
       via  f85e095 More simple const fixups.
       via  02af307 More simple const fixes.
       via  e131c94 More const fixes for compiler warnings from the waf build.
      from  38492b1 Fixup build without --with-aio.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9eee6e2fd2fcb1dcf19541d1bdc72eb048b3ba4a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 5 14:56:30 2011 -0700

    More const fixes... getting near the end now.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Fri May  6 00:57:00 CEST 2011 on sn-devel-104

commit f85e095dd29638dcb4819f60a7239bc37e8a41ca
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 5 14:36:55 2011 -0700

    More simple const fixups.

commit 02af3075858814811bc30f03623eb6715f9b7a78
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 5 14:22:11 2011 -0700

    More simple const fixes.

commit e131c94ac1b06cc49b1c25717d3496dba8b0b3df
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 5 13:42:05 2011 -0700

    More const fixes for compiler warnings from the waf build.

-----------------------------------------------------------------------

Summary of changes:
 nsswitch/libwbclient/tests/wbclient.c   |    2 +-
 nsswitch/pam_winbind.c                  |   28 ++++----
 source3/auth/pass_check.c               |   16 ++--
 source3/client/clitar.c                 |   12 ++--
 source3/include/libsmb_internal.h       |    2 +-
 source3/include/proto.h                 |    2 +-
 source3/intl/lang_tdb.c                 |    2 +-
 source3/lib/filename_util.c             |    4 +-
 source3/lib/gencache.c                  |    2 +-
 source3/lib/interface.c                 |    2 +-
 source3/lib/interfaces.c                |    4 +-
 source3/lib/messages.c                  |    2 +-
 source3/lib/netapi/samr.c               |    2 +-
 source3/lib/netapi/user.c               |    2 +-
 source3/lib/smbldap.c                   |    2 +-
 source3/lib/tallocmsg.c                 |    2 +-
 source3/lib/util.c                      |    8 +-
 source3/lib/util_sock.c                 |    4 +-
 source3/lib/util_str.c                  |    4 +-
 source3/libads/kerberos.c               |    4 +-
 source3/libads/ldap.c                   |   12 ++--
 source3/libads/sasl.c                   |    4 +-
 source3/libgpo/gpo_filesync.c           |    4 +-
 source3/libnet/libnet_dssync_passdb.c   |    2 +-
 source3/libsmb/async_smb.c              |    2 +-
 source3/libsmb/clidgram.c               |    2 +-
 source3/libsmb/clifsinfo.c              |    2 +-
 source3/libsmb/clikrb5.c                |  126 ++++++++++++++++--------------
 source3/libsmb/clilist.c                |    2 +-
 source3/libsmb/cliquota.c               |    6 +-
 source3/libsmb/clireadwrite.c           |    4 +-
 source3/libsmb/libsmb_file.c            |    2 +-
 source3/libsmb/libsmb_stat.c            |    4 +-
 source3/libsmb/libsmb_xattr.c           |   12 ++--
 source3/libsmb/namequery.c              |   22 +++---
 source3/libsmb/nmblib.c                 |    2 +-
 source3/libsmb/nmblib.h                 |    2 +-
 source3/libsmb/trusts_util.c            |    2 +-
 source3/locking/brlock.c                |    4 +-
 source3/nmbd/nmbd.c                     |    6 +-
 source3/nmbd/nmbd_packets.c             |   10 +-
 source3/nmbd/nmbd_processlogon.c        |    6 +-
 source3/nmbd/nmbd_subnetdb.c            |    2 +-
 source3/printing/notify.c               |    2 +-
 source3/printing/nt_printing_migrate.c  |    4 +-
 source3/rpcclient/cmd_samr.c            |    2 +-
 source3/smbd/lanman.c                   |    8 +-
 source3/smbd/msdfs.c                    |    2 +-
 source3/smbd/notify_internal.c          |    2 +-
 source3/smbd/sesssetup.c                |    4 +-
 source3/smbd/smb2_server.c              |    8 +-
 source3/smbd/smb2_sesssetup.c           |    2 +-
 source3/smbd/smb2_tcon.c                |    2 +-
 source3/utils/net_ads.c                 |    8 +-
 source3/utils/net_lookup.c              |    2 +-
 source3/utils/net_rpc.c                 |   18 ++--
 source3/utils/net_rpc_join.c            |    2 +-
 source3/web/swat.c                      |    2 +-
 source3/winbindd/wb_lookupuseraliases.c |    2 +-
 source3/winbindd/winbindd_cache.c       |    4 +-
 source3/winbindd/winbindd_dual.c        |    4 +-
 source3/winbindd/winbindd_pam.c         |    6 +-
 62 files changed, 219 insertions(+), 211 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index c6ee531..12fc31e 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -395,7 +395,7 @@ static bool test_wbc_lookup_rids(struct torture_context *tctx)
 	torture_assert_str_equal(
 		tctx, names[1], "Users", "S-1-5-32-545 not mapped to 'Users'");
 
-	wbcFreeMemory((char *)domain_name);
+	wbcFreeMemory(discard_const_p(char ,domain_name));
 	wbcFreeMemory(names);
 	wbcFreeMemory(types);
 
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 7005c25..a385e74 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -412,51 +412,51 @@ static int _pam_parse(const pam_handle_t *pamh,
 		config_file = PAM_WINBIND_CONFIG_FILE;
 	}
 
-	d = iniparser_load(CONST_DISCARD(char *, config_file));
+	d = iniparser_load(discard_const_p(char, config_file));
 	if (d == NULL) {
 		goto config_from_pam;
 	}
 
-	if (iniparser_getboolean(d, CONST_DISCARD(char *, "global:debug"), false)) {
+	if (iniparser_getboolean(d, discard_const_p(char, "global:debug"), false)) {
 		ctrl |= WINBIND_DEBUG_ARG;
 	}
 
-	if (iniparser_getboolean(d, CONST_DISCARD(char *, "global:debug_state"), false)) {
+	if (iniparser_getboolean(d, discard_const_p(char, "global:debug_state"), false)) {
 		ctrl |= WINBIND_DEBUG_STATE;
 	}
 
-	if (iniparser_getboolean(d, CONST_DISCARD(char *, "global:cached_login"), false)) {
+	if (iniparser_getboolean(d, discard_const_p(char, "global:cached_login"), false)) {
 		ctrl |= WINBIND_CACHED_LOGIN;
 	}
 
-	if (iniparser_getboolean(d, CONST_DISCARD(char *, "global:krb5_auth"), false)) {
+	if (iniparser_getboolean(d, discard_const_p(char, "global:krb5_auth"), false)) {
 		ctrl |= WINBIND_KRB5_AUTH;
 	}
 
-	if (iniparser_getboolean(d, CONST_DISCARD(char *, "global:silent"), false)) {
+	if (iniparser_getboolean(d, discard_const_p(char, "global:silent"), false)) {
 		ctrl |= WINBIND_SILENT;
 	}
 
-	if (iniparser_getstr(d, CONST_DISCARD(char *, "global:krb5_ccache_type")) != NULL) {
+	if (iniparser_getstr(d, discard_const_p(char, "global:krb5_ccache_type")) != NULL) {
 		ctrl |= WINBIND_KRB5_CCACHE_TYPE;
 	}
 
-	if ((iniparser_getstr(d, CONST_DISCARD(char *, "global:require-membership-of"))
+	if ((iniparser_getstr(d, discard_const_p(char, "global:require-membership-of"))
 	     != NULL) ||
-	    (iniparser_getstr(d, CONST_DISCARD(char *, "global:require_membership_of"))
+	    (iniparser_getstr(d, discard_const_p(char, "global:require_membership_of"))
 	     != NULL)) {
 		ctrl |= WINBIND_REQUIRED_MEMBERSHIP;
 	}
 
-	if (iniparser_getboolean(d, CONST_DISCARD(char *, "global:try_first_pass"), false)) {
+	if (iniparser_getboolean(d, discard_const_p(char, "global:try_first_pass"), false)) {
 		ctrl |= WINBIND_TRY_FIRST_PASS_ARG;
 	}
 
-	if (iniparser_getint(d, CONST_DISCARD(char *, "global:warn_pwd_expire"), 0)) {
+	if (iniparser_getint(d, discard_const_p(char, "global:warn_pwd_expire"), 0)) {
 		ctrl |= WINBIND_WARN_PWD_EXPIRE;
 	}
 
-	if (iniparser_getboolean(d, CONST_DISCARD(char *, "global:mkhomedir"), false)) {
+	if (iniparser_getboolean(d, discard_const_p(char, "global:mkhomedir"), false)) {
 		ctrl |= WINBIND_MKHOMEDIR;
 	}
 
@@ -1764,7 +1764,7 @@ static int winbind_auth_request(struct pwb_context *ctx,
 					     &logon.blobs,
 					     "krb5_cc_type",
 					     0,
-					     (uint8_t *)cctype,
+					     discard_const_p(uint8_t, cctype),
 					     strlen(cctype)+1);
 		if (!WBC_ERROR_IS_OK(wbc_status)) {
 			goto done;
@@ -2514,7 +2514,7 @@ static int _pam_delete_cred(pam_handle_t *pamh, int flags,
 						     &logoff.blobs,
 						     "ccfilename",
 						     0,
-						     (uint8_t *)ccname,
+						     discard_const_p(uint8_t, ccname),
 						     strlen(ccname)+1);
 			if (!WBC_ERROR_IS_OK(wbc_status)) {
 				goto out;
diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c
index a7a1c3d..714cc96 100644
--- a/source3/auth/pass_check.c
+++ b/source3/auth/pass_check.c
@@ -502,8 +502,8 @@ it assumes the string starts lowercased
 ****************************************************************************/
 static NTSTATUS string_combinations2(char *s, int offset,
 				     NTSTATUS (*fn)(const char *s,
-						    void *private_data),
-				     int N, void *private_data)
+						    const void *private_data),
+				     int N, const void *private_data)
 {
 	int len = strlen(s);
 	int i;
@@ -540,8 +540,8 @@ it assumes the string starts lowercased
 ****************************************************************************/
 static NTSTATUS string_combinations(char *s,
 				    NTSTATUS (*fn)(const char *s,
-						   void *private_data),
-				    int N, void *private_data)
+						   const void *private_data),
+				    int N, const void *private_data)
 {
 	int n;
 	NTSTATUS nt_status;
@@ -558,7 +558,7 @@ static NTSTATUS string_combinations(char *s,
 /****************************************************************************
 core of password checking routine
 ****************************************************************************/
-static NTSTATUS password_check(const char *password, void *private_data)
+static NTSTATUS password_check(const char *password, const void *private_data)
 {
 #ifdef WITH_PAM
 	const char *rhost = (const char *)private_data;
@@ -840,7 +840,7 @@ NTSTATUS pass_check(const struct passwd *pass,
 #endif /* defined(WITH_PAM) */
 
 	/* try it as it came to us */
-	nt_status = password_check(password, (void *)rhost);
+	nt_status = password_check(password, (const void *)rhost);
         if NT_STATUS_IS_OK(nt_status) {
 		return (nt_status);
 	} else if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) {
@@ -868,7 +868,7 @@ NTSTATUS pass_check(const struct passwd *pass,
 	/* try all lowercase if it's currently all uppercase */
 	if (strhasupper(pass2)) {
 		strlower_m(pass2);
-		nt_status = password_check(pass2, (void *)rhost);
+		nt_status = password_check(pass2, (const void *)rhost);
 		if (NT_STATUS_IS_OK(nt_status)) {
 			return (nt_status);
 		}
@@ -883,7 +883,7 @@ NTSTATUS pass_check(const struct passwd *pass,
 	strlower_m(pass2);
 
 	nt_status = string_combinations(pass2, password_check, level,
-					(void *)rhost);
+					(const void *)rhost);
         if (NT_STATUS_IS_OK(nt_status)) {
 		return nt_status;
 	}
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 80968a6..f04071f 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -101,7 +101,7 @@ char tar_type='\0';
 static char **cliplist=NULL;
 static int clipn=0;
 static bool must_free_cliplist = False;
-extern const char *cmd_ptr;
+extern char *cmd_ptr;
 
 extern bool lowercase;
 extern uint16 cnum;
@@ -1291,7 +1291,7 @@ int cmd_block(void)
 	char *buf;
 	int block;
 
-	if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
+	if (!next_token_talloc(ctx, (const char **)&cmd_ptr,&buf,NULL)) {
 		DEBUG(0, ("blocksize <n>\n"));
 		return 1;
 	}
@@ -1316,7 +1316,7 @@ int cmd_tarmode(void)
 	TALLOC_CTX *ctx = talloc_tos();
 	char *buf;
 
-	while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
+	while (next_token_talloc(ctx, (const char **)&cmd_ptr,&buf,NULL)) {
 		if (strequal(buf, "full"))
 			tar_inc=False;
 		else if (strequal(buf, "inc"))
@@ -1366,7 +1366,7 @@ int cmd_setmode(void)
 
 	attra[0] = attra[1] = 0;
 
-	if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
+	if (!next_token_talloc(ctx, (const char **)&cmd_ptr,&buf,NULL)) {
 		DEBUG(0, ("setmode <filename> <[+|-]rsha>\n"));
 		return 1;
 	}
@@ -1379,7 +1379,7 @@ int cmd_setmode(void)
 		return 1;
 	}
 
-	while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
+	while (next_token_talloc(ctx, (const char **)&cmd_ptr,&buf,NULL)) {
 		q=buf;
 
 		while(*q) {
@@ -1481,7 +1481,7 @@ int cmd_tar(void)
 	int argcl = 0;
 	int ret;
 
-	if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
+	if (!next_token_talloc(ctx, (const char **)&cmd_ptr,&buf,NULL)) {
 		DEBUG(0,("tar <c|x>[IXbgan] <filename>\n"));
 		return 1;
 	}
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index 61dc95e..7f16ab6 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -366,7 +366,7 @@ SMBC_close_ctx(SMBCCTX *context,
 bool
 SMBC_getatr(SMBCCTX * context,
             SMBCSRV *srv,
-            char *path,
+            const char *path,
             uint16 *mode,
             SMB_OFF_T *size,
             struct timespec *create_time_ts,
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2305a7a..60a34d1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -649,7 +649,7 @@ void smb_panic_s3(const char *why);
 void log_stack_trace(void);
 const char *readdirname(SMB_STRUCT_DIR *p);
 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
-void set_namearray(name_compare_entry **ppname_array, const char *namelist);
+void set_namearray(name_compare_entry **ppname_array, char *namelist);
 void free_namearray(name_compare_entry *name_array);
 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c
index 8fcb9f2..15793b7 100644
--- a/source3/intl/lang_tdb.c
+++ b/source3/intl/lang_tdb.c
@@ -236,7 +236,7 @@ const char *lang_msg(const char *msgid)
 void lang_msg_free(const char *msgstr)
 {
 	if (!tdb) return;
-	free((void *)msgstr);
+	free(discard_const_p(void, msgstr));
 }
 
 /* 
diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index aad8a08..d24660c 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -60,8 +60,8 @@ NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
 	ZERO_STRUCT(smb_fname_loc);
 
 	/* Setup the base_name/stream_name. */
-	smb_fname_loc.base_name = CONST_DISCARD(char *, base_name);
-	smb_fname_loc.stream_name = CONST_DISCARD(char *, stream_name);
+	smb_fname_loc.base_name = discard_const_p(char, base_name);
+	smb_fname_loc.stream_name = discard_const_p(char, stream_name);
 
 	/* Copy the psbuf if one was given. */
 	if (psbuf)
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 67c37f3..19cc7c9 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -125,7 +125,7 @@ again:
 static TDB_DATA last_stabilize_key(void)
 {
 	TDB_DATA result;
-	result.dptr = (uint8_t *)"@LAST_STABILIZED";
+	result.dptr = discard_const_p(uint8_t, "@LAST_STABILIZED");
 	result.dsize = 17;
 	return result;
 }
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 30e9406..ac68324 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -305,7 +305,7 @@ static void add_interface(const struct iface_struct *ifs)
 	char addr[INET6_ADDRSTRLEN];
 	struct interface *iface;
 
-	if (iface_find((struct sockaddr *)&ifs->ip, False)) {
+	if (iface_find((const struct sockaddr *)&ifs->ip, False)) {
 		DEBUG(3,("add_interface: not adding duplicate interface %s\n",
 			print_sockaddr(addr, sizeof(addr), &ifs->ip) ));
 		return;
diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c
index e40eaa9..a2dce97 100644
--- a/source3/lib/interfaces.c
+++ b/source3/lib/interfaces.c
@@ -81,13 +81,13 @@ static void make_bcast_or_net(struct sockaddr_storage *pss_out,
 #if defined(HAVE_IPV6)
 	if (pss_in->ss_family == AF_INET6) {
 		p = (char *)&((struct sockaddr_in6 *)pss_out)->sin6_addr;
-		pmask = (char *)&((struct sockaddr_in6 *)nmask)->sin6_addr;
+		pmask = discard_const_p(char, &((const struct sockaddr_in6 *)nmask)->sin6_addr);
 		len = 16;
 	}
 #endif
 	if (pss_in->ss_family == AF_INET) {
 		p = (char *)&((struct sockaddr_in *)pss_out)->sin_addr;
-		pmask = (char *)&((struct sockaddr_in *)nmask)->sin_addr;
+		pmask = discard_const_p(char, &((const struct sockaddr_in *)nmask)->sin_addr);
 		len = 4;
 	}
 
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 4335554..7b2b8c1 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -112,7 +112,7 @@ static int traverse_fn(struct db_record *rec, const struct server_id *id,
 	 * the msg has already been deleted from the messages.tdb.*/
 
 	status = messaging_send_buf(msg_all->msg_ctx, *id, msg_all->msg_type,
-				    (uint8 *)msg_all->buf, msg_all->len);
+				    (const uint8 *)msg_all->buf, msg_all->len);
 
 	if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
 		
diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c
index 5446980..1c3a94e 100644
--- a/source3/lib/netapi/samr.c
+++ b/source3/lib/netapi/samr.c
@@ -240,7 +240,7 @@ WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx,
 	status = dcerpc_samr_OpenDomain(b, mem_ctx,
 					connect_handle,
 					builtin_mask,
-					CONST_DISCARD(struct dom_sid *, &global_sid_Builtin),
+					discard_const_p(struct dom_sid, &global_sid_Builtin),
 					builtin_handle,
 					&result);
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c
index 653ece1..7831e20 100644
--- a/source3/lib/netapi/user.c
+++ b/source3/lib/netapi/user.c
@@ -575,7 +575,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
 	status = dcerpc_samr_OpenDomain(b, talloc_tos(),
 					&connect_handle,
 					SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
-					CONST_DISCARD(struct dom_sid *, &global_sid_Builtin),
+					discard_const_p(struct dom_sid, &global_sid_Builtin),
 					&builtin_handle,
 					&result);
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index fe43237..002b170 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -1562,7 +1562,7 @@ int smbldap_search_paged(struct smbldap_state *ldap_state,
 	}
 	ber_flatten(cookie_be, &cookie_bv);
 
-	pr.ldctl_oid = CONST_DISCARD(char *, ADS_PAGE_CTL_OID);
+	pr.ldctl_oid = discard_const_p(char, ADS_PAGE_CTL_OID);
 	pr.ldctl_iscritical = (char) critical;
 	pr.ldctl_value.bv_len = cookie_bv->bv_len;
 	pr.ldctl_value.bv_val = cookie_bv->bv_val;
diff --git a/source3/lib/tallocmsg.c b/source3/lib/tallocmsg.c
index da380c9..9a0ce8a 100644
--- a/source3/lib/tallocmsg.c
+++ b/source3/lib/tallocmsg.c
@@ -65,7 +65,7 @@ static void msg_pool_usage_helper(const void *ptr, int depth, int max_depth, int
 			       (unsigned long)talloc_total_blocks(ptr),
 			       talloc_reference_count(ptr),
 			       MIN(50, talloc_get_size(ptr)),
-			       (char *)ptr);
+			       (const char *)ptr);
 		return;
 	}
 
diff --git a/source3/lib/util.c b/source3/lib/util.c
index cd856ee..b0b6377 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -335,7 +335,7 @@ void show_msg(const char *buf)
 	if (DEBUGLEVEL < 50)
 		bcc = MIN(bcc, 512);
 
-	dump_data(10, (const uint8 *)smb_buf(buf), bcc);
+	dump_data(10, (const uint8 *)smb_buf_const(buf), bcc);
 }
 
 /*******************************************************************
@@ -1321,10 +1321,10 @@ bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensit
  if possible.
 ********************************************************************/
 
-void set_namearray(name_compare_entry **ppname_array, const char *namelist)
+void set_namearray(name_compare_entry **ppname_array, char *namelist)
 {
 	char *name_end;
-	char *nameptr = (char *)namelist;
+	char *nameptr = namelist;
 	int num_entries = 0;
 	int i;
 
@@ -1367,7 +1367,7 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist)
 	}
 
 	/* Now copy out the names */
-	nameptr = (char *)namelist;
+	nameptr = namelist;
 	i = 0;
 	while(*nameptr) {
 		if ( *nameptr == '/' ) {
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 0e1bfc0..ca355c2 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -306,7 +306,7 @@ ssize_t write_data(int fd, const char *buffer, size_t N)
 {
 	struct iovec iov;
 
-	iov.iov_base = CONST_DISCARD(void *, buffer);
+	iov.iov_base = discard_const_p(void, buffer);
 	iov.iov_len = N;
 	return write_data_iov(fd, &iov, 1);
 }
@@ -960,7 +960,7 @@ static bool matchname(const char *remotehost,
 			continue;
 		}
 		if (sockaddr_equal((const struct sockaddr *)res->ai_addr,
-					(struct sockaddr *)pss)) {
+					(const struct sockaddr *)pss)) {
 			freeaddrinfo(ailist);
 			return true;
 		}
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 583eea4..3dc73d9 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -387,7 +387,7 @@ static bool string_init(char **dest,const char *src)
 	l = strlen(src);
 
 	if (l == 0) {
-		*dest = CONST_DISCARD(char*, null_string);
+		*dest = discard_const_p(char, null_string);
 	} else {
 		(*dest) = SMB_STRDUP(src);
 		if ((*dest) == NULL) {
@@ -684,7 +684,7 @@ char *strnrchr_m(const char *s, char c, unsigned int n)
 		/* Too hard to try and get right. */
 		return NULL;
 	}
-	ret = (char *)(s+strlen(s2));
+	ret = discard_const_p(char, (s+strlen(s2)));
 	TALLOC_FREE(ws);
 	TALLOC_FREE(s2);
 	return ret;
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index d496ade..0b62ebf 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -223,8 +223,8 @@ int kerberos_kinit_password_ext(const char *principal,
 		krb5_get_init_creds_opt_set_address_list(opt, addr->addrs);
 	}
 
-	if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, CONST_DISCARD(char *,password), 
-						 kerb_prompter, CONST_DISCARD(char *,password),
+	if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, discard_const_p(char,password), 
+						 kerb_prompter, discard_const_p(char, password),
 						 0, NULL, opt))) {
 		goto out;
 	}
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index de3ad5a..893e141 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -940,21 +940,21 @@ static ADS_STATUS ads_do_paged_search_args(ADS_STRUCT *ads,
 		ber_printf(cookie_be, "{io}", (ber_int_t) 1000, "", 0);
 	}
 	ber_flatten(cookie_be, &cookie_bv);
-	PagedResults.ldctl_oid = CONST_DISCARD(char *, ADS_PAGE_CTL_OID);
+	PagedResults.ldctl_oid = discard_const_p(char, ADS_PAGE_CTL_OID);
 	PagedResults.ldctl_iscritical = (char) 1;
 	PagedResults.ldctl_value.bv_len = cookie_bv->bv_len;
 	PagedResults.ldctl_value.bv_val = cookie_bv->bv_val;
 
-	NoReferrals.ldctl_oid = CONST_DISCARD(char *, ADS_NO_REFERRALS_OID);
+	NoReferrals.ldctl_oid = discard_const_p(char, ADS_NO_REFERRALS_OID);
 	NoReferrals.ldctl_iscritical = (char) 0;
 	NoReferrals.ldctl_value.bv_len = 0;
-	NoReferrals.ldctl_value.bv_val = CONST_DISCARD(char *, "");
+	NoReferrals.ldctl_value.bv_val = discard_const_p(char, "");
 
 	if (external_control && 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list