[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu May 5 18:45:01 MDT 2011
The branch, master has been updated
via 153a091 Fix const in smbtorture.
via a5a8441 Fix broken interface to set_namearray() - don't modify incoming string.
via bb00bdb Fixup use of const.
via 7d6ebe0 More const fixes. Remove CONST_DISCARD.
via 76f5a39 Change the char * pointers in the struct to const char * (which is how they're treated).
from 9eee6e2 More const fixes... getting near the end now.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 153a091d9c2593938c0686c0a2a86c91dde6f9d7
Author: Jeremy Allison <jra at samba.org>
Date: Thu May 5 16:44:27 2011 -0700
Fix const in smbtorture.
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Fri May 6 02:45:00 CEST 2011 on sn-devel-104
commit a5a84415e238a861aa9a574f0b486f4ba417aaa6
Author: Jeremy Allison <jra at samba.org>
Date: Thu May 5 16:32:01 2011 -0700
Fix broken interface to set_namearray() - don't modify incoming string.
commit bb00bdbe8ff4efde18d7d15f533b98ee78ebc328
Author: Jeremy Allison <jra at samba.org>
Date: Thu May 5 16:31:41 2011 -0700
Fixup use of const.
commit 7d6ebe0de7d99c20854cafb8af50fe8f30ed778a
Author: Jeremy Allison <jra at samba.org>
Date: Thu May 5 16:19:49 2011 -0700
More const fixes. Remove CONST_DISCARD.
commit 76f5a39c7f165c656cdc9db29bfa0df59514fceb
Author: Jeremy Allison <jra at samba.org>
Date: Thu May 5 16:19:23 2011 -0700
Change the char * pointers in the struct to const char * (which is how they're treated).
-----------------------------------------------------------------------
Summary of changes:
lib/addns/dnsgss.c | 4 +-
lib/addns/dnsrecord.c | 2 +-
libcli/auth/krb5_wrap.c | 4 +-
libgpo/gpext/gpext.c | 2 +-
nsswitch/pam_winbind.c | 2 -
source3/auth/auth_server.c | 2 +-
source3/include/includes.h | 4 --
source3/include/popt_common.h | 2 +-
source3/include/proto.h | 2 +-
source3/lib/smbldap.c | 4 +-
source3/lib/tldap_util.c | 2 +-
source3/lib/util.c | 23 ++++++++++---
source3/libsmb/clikrb5.c | 2 +-
source3/modules/vfs_acl_common.c | 10 +++---
source3/modules/vfs_fileid.c | 2 +-
source3/modules/vfs_gpfs.c | 10 +++---
source3/modules/vfs_hpuxacl.c | 8 ++--
source3/modules/vfs_preopen.c | 2 +-
source3/modules/vfs_scannedonly.c | 41 +++++++++++------------
source3/modules/vfs_shadow_copy2.c | 4 +-
source3/modules/vfs_smb_traffic_analyzer.c | 6 ++--
source3/modules/vfs_streams_xattr.c | 4 +-
source3/modules/vfs_xattr_tdb.c | 2 +-
source3/pam_smbpass/support.c | 8 ++--
source3/passdb/pdb_ldap.c | 12 +++---
source3/registry/reg_parse.c | 2 +-
source3/rpc_server/rpc_handles.c | 4 +-
source3/rpc_server/spoolss/srv_spoolss_nt.c | 4 +-
source3/rpc_server/srv_pipe_hnd.c | 10 +++---
source3/rpc_server/srv_pipe_hnd.h | 2 +-
source3/smbd/dmapi.c | 4 +-
source3/smbd/filename.c | 2 +-
source3/torture/denytest.c | 4 +-
source3/torture/mangle_test.c | 2 +-
source3/torture/torture.c | 17 +++++-----
source3/utils/eventlogadm.c | 2 +-
source3/utils/net_printing.c | 2 +-
source3/utils/ntlm_auth.c | 6 ++--
source3/utils/smbcontrol.c | 4 +-
source3/utils/smbget.c | 2 +-
source3/winbindd/idmap_adex/domain_util.c | 2 +-
source3/winbindd/idmap_adex/provider_unified.c | 2 +-
source3/winbindd/winbindd_msrpc.c | 2 +-
43 files changed, 120 insertions(+), 117 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/addns/dnsgss.c b/lib/addns/dnsgss.c
index c903741..19b734a 100644
--- a/lib/addns/dnsgss.c
+++ b/lib/addns/dnsgss.c
@@ -92,7 +92,7 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx,
DNS_ERROR err;
gss_OID_desc krb5_oid_desc =
- { 9, (char *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" };
+ { 9, (const char *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" };
*ctx = GSS_C_NO_CONTEXT;
input_ptr = NULL;
@@ -222,7 +222,7 @@ DNS_ERROR dns_negotiate_sec_ctx( const char *target_realm,
gss_name_t targ_name;
gss_OID_desc nt_host_oid_desc =
- {10, (char *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"};
+ {10, (const char *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"};
TALLOC_CTX *mem_ctx;
diff --git a/lib/addns/dnsrecord.c b/lib/addns/dnsrecord.c
index 559c264..528fdf2 100644
--- a/lib/addns/dnsrecord.c
+++ b/lib/addns/dnsrecord.c
@@ -131,7 +131,7 @@ DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
return ERROR_DNS_SUCCESS;
}
- ip = ((struct sockaddr_in *)pss)->sin_addr;
+ ip = ((const struct sockaddr_in *)pss)->sin_addr;
if (!(data = (uint8 *)TALLOC_MEMDUP(mem_ctx, (const void *)&ip.s_addr,
sizeof(ip.s_addr)))) {
return ERROR_DNS_NO_MEMORY;
diff --git a/libcli/auth/krb5_wrap.c b/libcli/auth/krb5_wrap.c
index 7725261..485a722 100644
--- a/libcli/auth/krb5_wrap.c
+++ b/libcli/auth/krb5_wrap.c
@@ -203,8 +203,8 @@ krb5_error_code smb_krb5_unparse_name(TALLOC_CTX *mem_ctx,
for (i = 0; i < len1; i++) {
- p1 = krb5_princ_component(context, CONST_DISCARD(krb5_principal, princ1), i);
- p2 = krb5_princ_component(context, CONST_DISCARD(krb5_principal, princ2), i);
+ p1 = krb5_princ_component(context, discard_const(krb5_principal, princ1), i);
+ p2 = krb5_princ_component(context, discard_const(krb5_principal, princ2), i);
if (p1->length != p2->length || memcmp(p1->data, p2->data, p1->length))
return False;
diff --git a/libgpo/gpext/gpext.c b/libgpo/gpext/gpext.c
index 080bf07..f38d873 100644
--- a/libgpo/gpext/gpext.c
+++ b/libgpo/gpext/gpext.c
@@ -442,7 +442,7 @@ static WERROR gp_extension_store_reg_entry(TALLOC_CTX *mem_ctx,
subkeyname = GUID_string2(mem_ctx, &entry->guid);
W_ERROR_HAVE_NO_MEMORY(subkeyname);
- strupper_m(CONST_DISCARD(char *,subkeyname));
+ strupper_m(discard_const_p(char, subkeyname));
werr = gp_store_reg_subkey(mem_ctx,
subkeyname,
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index a385e74..f7637e7 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -11,8 +11,6 @@
*/
#include "pam_winbind.h"
-#define CONST_DISCARD(type,ptr) ((type)(void *)ptr)
-
static int wbc_error_to_pam_error(wbcErr status)
{
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index 5dc8ea7..37705c7 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -258,7 +258,7 @@ static DATA_BLOB auth_get_challenge_server(const struct auth_context *auth_conte
/* The return must be allocated on the caller's mem_ctx, as our own will be
destoyed just after the call. */
- return data_blob_talloc((TALLOC_CTX *)auth_context, cli->secblob.data,8);
+ return data_blob_talloc(discard_const_p(TALLOC_CTX, auth_context), cli->secblob.data,8);
} else {
return data_blob_null;
}
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 0079619..59aa45a 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -652,10 +652,6 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATT
#undef HAVE_MMAP
#endif
-#ifndef CONST_DISCARD
-#define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
-#endif
-
void dump_core(void) _NORETURN_;
void exit_server(const char *const reason) _NORETURN_;
void exit_server_cleanly(const char *const reason) _NORETURN_;
diff --git a/source3/include/popt_common.h b/source3/include/popt_common.h
index 70d7278..10dd2f4 100644
--- a/source3/include/popt_common.h
+++ b/source3/include/popt_common.h
@@ -42,7 +42,7 @@ extern const struct poptOption popt_common_dynconfig[];
#define POPT_COMMON_CONFIGFILE { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile, 0, "Common samba config:", NULL },
#define POPT_COMMON_CREDENTIALS { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_credentials, 0, "Authentication options:", NULL },
#define POPT_COMMON_DYNCONFIG { NULL, 0, POPT_ARG_INCLUDE_TABLE, \
- CONST_DISCARD(poptOption *, popt_common_dynconfig), 0, \
+ discard_const_p(poptOption, popt_common_dynconfig), 0, \
"Build-time configuration overrides:", NULL },
#define POPT_COMMON_DEBUGLEVEL { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debuglevel, 0, "Common samba debugging:", NULL },
#define POPT_COMMON_OPTION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_option, 0, "Common samba commandline config:", NULL },
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 60a34d1..2305a7a 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, char *namelist);
+void set_namearray(name_compare_entry **ppname_array, const 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/lib/smbldap.c b/source3/lib/smbldap.c
index 002b170..d7d06e9 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -1480,7 +1480,7 @@ static int smbldap_search_ext(struct smbldap_state *ldap_state,
while (another_ldap_try(ldap_state, &rc, &attempts, endtime)) {
rc = ldap_search_ext_s(ldap_state->ldap_struct, base, scope,
utf8_filter,
- CONST_DISCARD(char **, attrs),
+ discard_const_p(char *, attrs),
attrsonly, sctrls, cctrls, &timeout,
sizelimit, res);
if (rc != LDAP_SUCCESS) {
@@ -1924,7 +1924,7 @@ static bool smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *val
}
rc = ldap_search_s(ld, "", LDAP_SCOPE_BASE,
- "(objectclass=*)", CONST_DISCARD(char **, attrs), 0 , &msg);
+ "(objectclass=*)", discard_const_p(char *, attrs), 0 , &msg);
if (rc != LDAP_SUCCESS) {
DEBUG(3,("smbldap_check_root_dse: Could not search rootDSE\n"));
diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
index 0c22d65..e4cb5f0 100644
--- a/source3/lib/tldap_util.c
+++ b/source3/lib/tldap_util.c
@@ -325,7 +325,7 @@ bool tldap_make_mod_fmt(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
blob.length = strlen(newval);
if (blob.length != 0) {
- blob.data = CONST_DISCARD(uint8_t *, newval);
+ blob.data = discard_const_p(uint8_t, newval);
}
ret = tldap_make_mod_blob_int(existing, mem_ctx, pmods, pnum_mods,
attrib, blob, compare_utf8_blobs);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index b0b6377..db92f3c 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1314,25 +1314,31 @@ bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensit
passing to is_in_path(). We do this for
speed so we can pre-parse all the names in the list
and don't do it for each call to is_in_path().
- namelist is modified here and is assumed to be
- a copy owned by the caller.
We also check if the entry contains a wildcard to
remove a potentially expensive call to mask_match
if possible.
********************************************************************/
-void set_namearray(name_compare_entry **ppname_array, char *namelist)
+void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
{
char *name_end;
- char *nameptr = namelist;
+ char *namelist;
+ char *nameptr;
int num_entries = 0;
int i;
(*ppname_array) = NULL;
- if((nameptr == NULL ) || ((nameptr != NULL) && (*nameptr == '\0')))
+ if((namelist_in == NULL ) || ((namelist_in != NULL) && (*namelist_in == '\0')))
return;
+ namelist = talloc_strdup(talloc_tos(), namelist_in);
+ if (namelist == NULL) {
+ DEBUG(0,("set_namearray: talloc fail\n"));
+ return;
+ }
+ nameptr = namelist;
+
/* We need to make two passes over the string. The
first to count the number of elements, the second
to split it.
@@ -1358,11 +1364,14 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
num_entries++;
}
- if(num_entries == 0)
+ if(num_entries == 0) {
+ talloc_free(namelist);
return;
+ }
if(( (*ppname_array) = SMB_MALLOC_ARRAY(name_compare_entry, num_entries + 1)) == NULL) {
DEBUG(0,("set_namearray: malloc fail\n"));
+ talloc_free(namelist);
return;
}
@@ -1389,6 +1398,7 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
(*ppname_array)[i].is_wild = ms_has_wild(nameptr);
if(((*ppname_array)[i].name = SMB_STRDUP(nameptr)) == NULL) {
DEBUG(0,("set_namearray: malloc fail (1)\n"));
+ talloc_free(namelist);
return;
}
@@ -1399,6 +1409,7 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
(*ppname_array)[i].name = NULL;
+ talloc_free(namelist);
return;
}
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index df8ba0a..73a37b3 100644
--- a/source3/libsmb/clikrb5.c
+++ b/source3/libsmb/clikrb5.c
@@ -721,7 +721,7 @@ static krb5_error_code ads_krb5_mk_req(krb5_context context,
retval = krb5_fwd_tgt_creds(context,/* Krb5 context [in] */
*auth_context, /* Authentication context [in] */
- CONST_DISCARD(char *, KRB5_TGS_NAME), /* Ticket service name ("krbtgt") [in] */
+ discard_const_p(char, KRB5_TGS_NAME), /* Ticket service name ("krbtgt") [in] */
credsp->client, /* Client principal for the tgt [in] */
credsp->server, /* Server principal for the tgt [in] */
ccache, /* Credential cache to use for storage [in] */
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index 6c57acb..a177146 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -144,7 +144,7 @@ static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
xacl.version = 3;
xacl.info.sd_hs3 = &sd_hs3;
- xacl.info.sd_hs3->sd = CONST_DISCARD(struct security_descriptor *, psd);
+ xacl.info.sd_hs3->sd = discard_const_p(struct security_descriptor, psd);
xacl.info.sd_hs3->hash_type = hash_type;
memcpy(&xacl.info.sd_hs3->hash[0], hash, XATTR_SD_HASH_SIZE);
@@ -190,7 +190,7 @@ static void add_directory_inheritable_components(vfs_handle_struct *handle,
/* Fake a quick smb_filename. */
ZERO_STRUCT(smb_fname);
smb_fname.st = *psbuf;
- smb_fname.base_name = CONST_DISCARD(char *, name);
+ smb_fname.base_name = discard_const_p(char, name);
dir_mode = unix_mode(conn,
FILE_ATTRIBUTE_DIRECTORY, &smb_fname, NULL);
@@ -729,7 +729,7 @@ static NTSTATUS fset_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp,
DEBUG(10,("fset_nt_acl_xattr: incoming sd for file %s\n",
fsp_str_dbg(fsp)));
NDR_PRINT_DEBUG(security_descriptor,
- CONST_DISCARD(struct security_descriptor *,orig_psd));
+ discard_const_p(struct security_descriptor, orig_psd));
}
status = get_nt_acl_internal(handle, fsp,
@@ -784,7 +784,7 @@ static NTSTATUS fset_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp,
DEBUG(10,("fset_nt_acl_xattr: storing xattr sd for file %s\n",
fsp_str_dbg(fsp)));
NDR_PRINT_DEBUG(security_descriptor,
- CONST_DISCARD(struct security_descriptor *,psd));
+ discard_const_p(struct security_descriptor, psd));
}
create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash);
store_acl_blob_fsp(handle, fsp, &blob);
@@ -836,7 +836,7 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
}
ZERO_STRUCT(local_fname);
- local_fname.base_name = CONST_DISCARD(char *,final_component);
+ local_fname.base_name = discard_const_p(char, final_component);
/* Must use lstat here. */
ret = SMB_VFS_LSTAT(conn, &local_fname);
diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c
index 4c230a0..6426280 100644
--- a/source3/modules/vfs_fileid.c
+++ b/source3/modules/vfs_fileid.c
@@ -144,7 +144,7 @@ static uint64_t fileid_device_mapping_fsname(struct fileid_handle_data *data,
if (!m) return dev;
if (m->devid == (uint64_t)-1) {
- m->devid = fileid_uint64_hash((uint8_t *)m->mnt_fsname,
+ m->devid = fileid_uint64_hash((const uint8_t *)m->mnt_fsname,
strlen(m->mnt_fsname));
}
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 7d5d199..d52122c 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -998,7 +998,7 @@ static int gpfs_set_xattr(struct vfs_handle_struct *handle, const char *path,
}
- ret = set_gpfs_winattrs(CONST_DISCARD(char *, path),
+ ret = set_gpfs_winattrs(discard_const_p(char, path),
GPFS_WINATTR_SET_ATTRS, &attrs);
if ( ret == -1){
if (errno == ENOSYS) {
@@ -1029,7 +1029,7 @@ static ssize_t gpfs_get_xattr(struct vfs_handle_struct *handle, const char *pat
return SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size);
}
- ret = get_gpfs_winattrs(CONST_DISCARD(char *, path), &attrs);
+ ret = get_gpfs_winattrs(discard_const_p(char, path), &attrs);
if ( ret == -1){
if (errno == ENOSYS) {
return SMB_VFS_NEXT_GETXATTR(handle, path, name, value,
@@ -1083,7 +1083,7 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
errno = map_errno_from_nt_status(status);
return -1;
}
- ret = get_gpfs_winattrs(CONST_DISCARD(char *, fname), &attrs);
+ ret = get_gpfs_winattrs(discard_const_p(char, fname), &attrs);
TALLOC_FREE(fname);
if (ret == 0) {
smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
@@ -1131,7 +1131,7 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
errno = map_errno_from_nt_status(status);
return -1;
}
- ret = get_gpfs_winattrs(CONST_DISCARD(char *, path), &attrs);
+ ret = get_gpfs_winattrs(discard_const_p(char, path), &attrs);
TALLOC_FREE(path);
if (ret == 0) {
smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
@@ -1172,7 +1172,7 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct *handle,
attrs.creationTime.tv_sec = ft->create_time.tv_sec;
attrs.creationTime.tv_nsec = ft->create_time.tv_nsec;
- ret = set_gpfs_winattrs(CONST_DISCARD(char *, path),
+ ret = set_gpfs_winattrs(discard_const_p(char, path),
GPFS_WINATTR_SET_CREATION_TIME, &attrs);
if(ret == -1 && errno != ENOSYS){
DEBUG(1,("vfs_gpfs_ntimes: set GPFS ntimes failed %d\n",ret));
diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c
index 2155945..8a57444 100644
--- a/source3/modules/vfs_hpuxacl.c
+++ b/source3/modules/vfs_hpuxacl.c
@@ -307,7 +307,7 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
}
DEBUG(10, ("resulting acl is valid.\n"));
- ret = acl(CONST_DISCARD(char *, smb_fname->base_name), ACL_SET, count,
+ ret = acl(discard_const_p(char, smb_fname->base_name), ACL_SET, count,
hpux_acl);
if (ret != 0) {
DEBUG(0, ("ERROR calling acl: %s\n", strerror(errno)));
@@ -394,7 +394,7 @@ int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
DEBUG(10, ("resulting acl is not valid!\n"));
goto done;
}
- ret = acl(CONST_DISCARD(char *, path), ACL_SET, count, hpux_acl);
+ ret = acl(discard_const_p(char, path), ACL_SET, count, hpux_acl);
if (ret != 0) {
DEBUG(10, ("settinge file acl failed!\n"));
}
@@ -682,7 +682,7 @@ static bool hpux_acl_get_file(const char *name, HPUX_ACL_T *hpux_acl,
* instantiated or malloced each time this function is
* called). Btw: the count parameter does not seem to matter...
*/
- *count = acl(CONST_DISCARD(char *, name), ACL_CNT, 0, &dummy_ace);
+ *count = acl(discard_const_p(char, name), ACL_CNT, 0, &dummy_ace);
if (*count < 0) {
DEBUG(10, ("acl ACL_CNT failed: %s\n", strerror(errno)));
goto done;
@@ -692,7 +692,7 @@ static bool hpux_acl_get_file(const char *name, HPUX_ACL_T *hpux_acl,
DEBUG(10, ("error allocating memory for hpux acl...\n"));
goto done;
}
- *count = acl(CONST_DISCARD(char *, name), ACL_GET, *count, *hpux_acl);
+ *count = acl(discard_const_p(char, name), ACL_GET, *count, *hpux_acl);
if (*count < 0) {
DEBUG(10, ("acl ACL_GET failed: %s\n", strerror(errno)));
goto done;
diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c
index 82969e4..e4b3a0c 100644
--- a/source3/modules/vfs_preopen.c
+++ b/source3/modules/vfs_preopen.c
@@ -322,7 +322,7 @@ static struct preopen_state *preopen_state_get(vfs_handle_struct *handle)
return NULL;
}
- set_namearray(&state->preopen_names, (char *)namelist);
+ set_namearray(&state->preopen_names, namelist);
if (state->preopen_names == NULL) {
TALLOC_FREE(state);
diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c
index d0eba21..549eb30 100644
--- a/source3/modules/vfs_scannedonly.c
+++ b/source3/modules/vfs_scannedonly.c
@@ -75,12 +75,12 @@ struct Tscannedonly {
bool rm_hidden_files_on_rmdir;
bool hide_nonscanned_files;
bool allow_nonscanned_files;
- char *socketname;
- char *scanhost;
- char *scanning_message;
- char *p_scanned; /* prefix for scanned files */
- char *p_virus; /* prefix for virus containing files */
- char *p_failed; /* prefix for failed to scan files */
+ const char *socketname;
+ const char *scanhost;
+ const char *scanning_message;
+ const char *p_scanned; /* prefix for scanned files */
+ const char *p_virus; /* prefix for virus containing files */
+ const char *p_failed; /* prefix for failed to scan files */
char gsendbuffer[SENDBUFFERSIZE + 1];
};
@@ -146,14 +146,15 @@ static char *cachefile_name_f_fullpath(TALLOC_CTX *ctx,
const char *p_scanned)
{
const char *base;
- char *tmp, *cachefile, *shortname;
+ char *tmp, *cachefile;
+ const char *shortname;
tmp = strrchr(fullpath, '/');
if (tmp) {
base = talloc_strndup(ctx, fullpath, (tmp - fullpath) + 1);
shortname = tmp + 1;
} else {
base = "";
- shortname = (char *)fullpath;
+ shortname = (const char *)fullpath;
}
cachefile = cachefile_name(ctx, shortname, base, p_scanned);
DEBUG(SCANNEDONLY_DEBUG,
@@ -164,7 +165,7 @@ static char *cachefile_name_f_fullpath(TALLOC_CTX *ctx,
static char *construct_full_path(TALLOC_CTX *ctx, vfs_handle_struct * handle,
const char *somepath, bool ending_slash)
{
- char *tmp;
+ const char *tmp;
if (!somepath) {
return NULL;
@@ -175,7 +176,7 @@ static char *construct_full_path(TALLOC_CTX *ctx, vfs_handle_struct * handle,
}
return talloc_strdup(ctx,somepath);
}
- tmp=(char *)somepath;
+ tmp = somepath;
if (tmp[0]=='.'&&tmp[1]=='/') {
tmp+=2;
}
@@ -308,14 +309,14 @@ static void flush_sendbuffer(vfs_handle_struct * handle)
static void notify_scanner(vfs_handle_struct * handle, const char *scanfile)
{
- char *tmp;
+ const char *tmp;
int tmplen, gsendlen;
struct Tscannedonly *so = (struct Tscannedonly *)handle->data;
TALLOC_CTX *ctx=talloc_tos();
if (scanfile[0] != '/') {
tmp = construct_full_path(ctx,handle, scanfile, false);
} else {
- tmp = (char *)scanfile;
+ tmp = (const char *)scanfile;
}
tmplen = strlen(tmp);
gsendlen = strlen(so->gsendbuffer);
@@ -948,15 +949,14 @@ static int scannedonly_connect(struct vfs_handle_struct *handle,
so->domain_socket =
lp_parm_bool(SNUM(handle->conn), "scannedonly",
"domain_socket", True);
- so->socketname =
- (char *)lp_parm_const_string(SNUM(handle->conn),
+ so->socketname = lp_parm_const_string(SNUM(handle->conn),
"scannedonly", "socketname",
"/var/lib/scannedonly/scan");
--
Samba Shared Repository
More information about the samba-cvs
mailing list