summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-08-18 14:05:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:42 -0500
commit0b56ff1ea3bab9f5aebf43e3dfc4847b3f912553 (patch)
tree188f46328aa6f39329c2b4b64ee3742cb0ab6432 /source3
parentf3828606bd7b826dbbb8a56b61750914ea10ecc5 (diff)
downloadsamba-0b56ff1ea3bab9f5aebf43e3dfc4847b3f912553.tar.gz
samba-0b56ff1ea3bab9f5aebf43e3dfc4847b3f912553.tar.bz2
samba-0b56ff1ea3bab9f5aebf43e3dfc4847b3f912553.zip
r17605: Some C++ warnings
(This used to be commit 05268d7a731861b10ce8556fd32a004808383923)
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/client/mount.cifs.c30
-rw-r--r--source3/nsswitch/winbindd_async.c6
-rw-r--r--source3/nsswitch/winbindd_cred_cache.c2
-rw-r--r--source3/nsswitch/winbindd_dual.c6
-rw-r--r--source3/nsswitch/winbindd_group.c24
-rw-r--r--source3/nsswitch/winbindd_misc.c6
-rw-r--r--source3/nsswitch/winbindd_pam.c10
-rw-r--r--source3/nsswitch/winbindd_sid.c9
-rw-r--r--source3/nsswitch/winbindd_user.c11
-rw-r--r--source3/nsswitch/winbindd_util.c2
10 files changed, 63 insertions, 43 deletions
diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index ab1f203412..076001ccc0 100755
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -143,7 +143,7 @@ static int open_cred_file(char * file_name)
fs = fopen(file_name,"r");
if(fs == NULL)
return errno;
- line_buf = malloc(4096);
+ line_buf = (char *)malloc(4096);
if(line_buf == NULL) {
fclose(fs);
return -ENOMEM;
@@ -176,7 +176,7 @@ static int open_cred_file(char * file_name)
exit(1);
} else {
got_user = 1;
- user_name = calloc(1 + length,1);
+ user_name = (char *)calloc(1 + length,1);
/* BB adding free of user_name string before exit,
not really necessary but would be cleaner */
strncpy(user_name,temp_val, length);
@@ -200,7 +200,7 @@ static int open_cred_file(char * file_name)
exit(1);
} else {
if(mountpassword == NULL) {
- mountpassword = calloc(65,1);
+ mountpassword = (char *)calloc(65,1);
} else
memset(mountpassword,0,64);
if(mountpassword) {
@@ -228,7 +228,7 @@ static int open_cred_file(char * file_name)
exit(1);
} else {
if(domain_name == NULL) {
- domain_name = calloc(65,1);
+ domain_name = (char *)calloc(65,1);
} else
memset(domain_name,0,64);
if(domain_name) {
@@ -255,7 +255,7 @@ static int get_password_from_file(int file_descript, char * filename)
char c;
if(mountpassword == NULL)
- mountpassword = calloc(65,1);
+ mountpassword = (char *)calloc(65,1);
else
memset(mountpassword, 0, 64);
@@ -374,7 +374,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
if(percent_char) {
*percent_char = ',';
if(mountpassword == NULL)
- mountpassword = calloc(65,1);
+ mountpassword = (char *)calloc(65,1);
if(mountpassword) {
if(got_password)
printf("\nmount.cifs warning - password specified twice\n");
@@ -596,7 +596,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
if (value)
word_len += 1 + strlen(value);
- out = realloc(out, out_len + word_len + 2);
+ out = (char *)realloc(out, out_len + word_len + 2);
if (out == NULL) {
perror("malloc");
exit(1);
@@ -646,7 +646,7 @@ static void check_for_comma(char ** ppasswrd)
return;
}
- new_pass_buf = malloc(len+number_of_commas+1);
+ new_pass_buf = (char *)malloc(len+number_of_commas+1);
if(new_pass_buf == NULL)
return;
@@ -710,7 +710,7 @@ static char * check_for_domain(char **ppuser)
len = strlen(domainnm);
/* reset domainm to new buffer, and copy
domain name into it */
- domainnm = malloc(len+1);
+ domainnm = (char *)malloc(len+1);
if(domainnm == NULL)
return NULL;
@@ -769,7 +769,7 @@ static char * parse_server(char ** punc_name)
share = strchr(unc_name,':');
if(share) {
free_share_name = 1;
- *punc_name = malloc(length+3);
+ *punc_name = (char *)malloc(length+3);
if(*punc_name == NULL) {
/* put the original string back if
no memory left */
@@ -1030,7 +1030,7 @@ int main(int argc, char ** argv)
break;
case 'p':
if(mountpassword == NULL)
- mountpassword = calloc(65,1);
+ mountpassword = (char *)calloc(65,1);
if(mountpassword) {
got_password = 1;
strncpy(mountpassword,optarg,64);
@@ -1055,7 +1055,7 @@ int main(int argc, char ** argv)
if (getenv("PASSWD")) {
if(mountpassword == NULL)
- mountpassword = calloc(65,1);
+ mountpassword = (char *)calloc(65,1);
if(mountpassword) {
strncpy(mountpassword,getenv("PASSWD"),64);
got_password = 1;
@@ -1075,7 +1075,7 @@ int main(int argc, char ** argv)
}
/* BB save off path and pop after mount returns? */
- resolved_path = malloc(PATH_MAX+1);
+ resolved_path = (char *)malloc(PATH_MAX+1);
if(resolved_path) {
/* Note that if we can not canonicalize the name, we get
another chance to see if it is valid when we chdir to it */
@@ -1141,7 +1141,7 @@ mount_retry:
optlen += strlen(ipaddr) + 4;
if(mountpassword)
optlen += strlen(mountpassword) + 6;
- options = malloc(optlen + 10 + 64 /* space for commas in password */ + 8 /* space for domain= , domain name itself was counted as part of the length username string above */);
+ options = (char *)malloc(optlen + 10 + 64 /* space for commas in password */ + 8 /* space for domain= , domain name itself was counted as part of the length username string above */);
if(options == NULL) {
printf("Could not allocate memory for mount options\n");
@@ -1233,7 +1233,7 @@ mount_retry:
mountent.mnt_fsname = share_name;
mountent.mnt_dir = mountpoint;
mountent.mnt_type = CONST_DISCARD(char *,"cifs");
- mountent.mnt_opts = malloc(220);
+ mountent.mnt_opts = (char *)malloc(220);
if(mountent.mnt_opts) {
char * mount_user = getusername();
memset(mountent.mnt_opts,0,200);
diff --git a/source3/nsswitch/winbindd_async.c b/source3/nsswitch/winbindd_async.c
index 75424db656..696f3501ef 100644
--- a/source3/nsswitch/winbindd_async.c
+++ b/source3/nsswitch/winbindd_async.c
@@ -1532,7 +1532,8 @@ static void winbindd_uid2sid_recv(TALLOC_CTX *mem_ctx, BOOL success,
struct winbindd_response *response,
void *c, void *private_data)
{
- void (*cont)(void *priv, BOOL succ, const char *sid) = c;
+ void (*cont)(void *priv, BOOL succ, const char *sid) =
+ (void (*)(void *, BOOL, const char *))c;
if (!success) {
DEBUG(5, ("Could not trigger uid2sid\n"));
@@ -1587,7 +1588,8 @@ static void winbindd_gid2sid_recv(TALLOC_CTX *mem_ctx, BOOL success,
struct winbindd_response *response,
void *c, void *private_data)
{
- void (*cont)(void *priv, BOOL succ, const char *sid) = c;
+ void (*cont)(void *priv, BOOL succ, const char *sid) =
+ (void (*)(void *, BOOL, const char *))c;
if (!success) {
DEBUG(5, ("Could not trigger gid2sid\n"));
diff --git a/source3/nsswitch/winbindd_cred_cache.c b/source3/nsswitch/winbindd_cred_cache.c
index f5003ac8c6..688c8828d3 100644
--- a/source3/nsswitch/winbindd_cred_cache.c
+++ b/source3/nsswitch/winbindd_cred_cache.c
@@ -249,7 +249,7 @@ NTSTATUS add_ccache_to_list(const char *princ_name,
#ifdef HAVE_MLOCK
size_t len = strlen(pass)+1;
- new_entry->pass = TALLOC_ZERO(mem_ctx, len);
+ new_entry->pass = (char *)TALLOC_ZERO(mem_ctx, len);
NT_STATUS_HAVE_NO_MEMORY(new_entry->pass);
#ifdef DEBUG_PASSWORD
diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c
index 874b480214..32d85688b6 100644
--- a/source3/nsswitch/winbindd_dual.c
+++ b/source3/nsswitch/winbindd_dual.c
@@ -524,7 +524,8 @@ static void account_lockout_policy_handler(struct timed_event *te,
const struct timeval *now,
void *private_data)
{
- struct winbindd_child *child = private_data;
+ struct winbindd_child *child =
+ (struct winbindd_child *)private_data;
struct winbindd_methods *methods;
SAM_UNK_INFO_12 lockout_policy;
@@ -823,7 +824,8 @@ static BOOL fork_domain_child(struct winbindd_child *child)
* structure needs to be fetched via the
* winbindd_cache. Hmm. That needs fixing... */
- if (write_data(state.sock, (void *)&state.response.result,
+ if (write_data(state.sock,
+ (const char *)&state.response.result,
sizeof(state.response.result)) !=
sizeof(state.response.result)) {
DEBUG(0, ("Could not write result\n"));
diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c
index 5cab6eb663..80d103336a 100644
--- a/source3/nsswitch/winbindd_group.c
+++ b/source3/nsswitch/winbindd_group.c
@@ -168,7 +168,7 @@ static BOOL fill_grent_mem(struct winbindd_domain *domain,
/* Allocate buffer */
if (!buf && buf_len != 0) {
- if (!(buf = SMB_MALLOC(buf_len))) {
+ if (!(buf = (char *)SMB_MALLOC(buf_len))) {
DEBUG(1, ("out of memory\n"));
result = False;
goto done;
@@ -730,7 +730,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
break;
}
- name_list = ent->sam_entries;
+ name_list = (struct acct_info *)ent->sam_entries;
if (!(domain =
find_domain_from_name(ent->domain_name))) {
@@ -813,7 +813,8 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
if (result) {
/* Append to group membership list */
- gr_mem_list = SMB_REALLOC( gr_mem_list, gr_mem_list_len + gr_mem_len);
+ gr_mem_list = (char *)SMB_REALLOC(
+ gr_mem_list, gr_mem_list_len + gr_mem_len);
if (!gr_mem_list && (group_list[group_list_ndx].num_gr_mem != 0)) {
DEBUG(0, ("out of memory\n"));
@@ -941,7 +942,8 @@ void winbindd_list_groups(struct winbindd_cli_state *state)
/* Allocate some memory for extra data. Note that we limit
account names to sizeof(fstring) = 128 characters. */
- extra_data = SMB_REALLOC(extra_data, sizeof(fstring) * total_entries);
+ extra_data = (char *)SMB_REALLOC(
+ extra_data, sizeof(fstring) * total_entries);
if (!extra_data) {
DEBUG(0,("failed to enlarge buffer!\n"));
@@ -1072,7 +1074,8 @@ void winbindd_getgroups(struct winbindd_cli_state *state)
static void getgroups_usersid_recv(void *private_data, BOOL success,
const DOM_SID *sid, enum SID_NAME_USE type)
{
- struct getgroups_state *s = private_data;
+ struct getgroups_state *s =
+ (struct getgroups_state *)private_data;
if ((!success) ||
((type != SID_NAME_USER) && (type != SID_NAME_COMPUTER))) {
@@ -1089,7 +1092,8 @@ static void getgroups_usersid_recv(void *private_data, BOOL success,
static void getgroups_tokensids_recv(void *private_data, BOOL success,
DOM_SID *token_sids, size_t num_token_sids)
{
- struct getgroups_state *s = private_data;
+ struct getgroups_state *s =
+ (struct getgroups_state *)private_data;
/* We need at least the user sid and the primary group in the token,
* otherwise it's an error */
@@ -1111,7 +1115,8 @@ static void getgroups_tokensids_recv(void *private_data, BOOL success,
static void getgroups_sid2gid_recv(void *private_data, BOOL success, gid_t gid)
{
- struct getgroups_state *s = private_data;
+ struct getgroups_state *s =
+ (struct getgroups_state *)private_data;
if (success)
add_gid_to_array_unique(NULL, gid,
@@ -1181,7 +1186,8 @@ void winbindd_getusersids(struct winbindd_cli_state *state)
static void getusersids_recv(void *private_data, BOOL success, DOM_SID *sids,
size_t num_sids)
{
- struct winbindd_cli_state *state = private_data;
+ struct winbindd_cli_state *state =
+ (struct winbindd_cli_state *)private_data;
char *ret = NULL;
unsigned ofs, ret_size = 0;
size_t i;
@@ -1198,7 +1204,7 @@ static void getusersids_recv(void *private_data, BOOL success, DOM_SID *sids,
}
/* build the reply */
- ret = SMB_MALLOC(ret_size);
+ ret = (char *)SMB_MALLOC(ret_size);
if (!ret) {
DEBUG(0, ("malloc failed\n"));
request_error(state);
diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c
index d43617f778..9fb05d9df6 100644
--- a/source3/nsswitch/winbindd_misc.c
+++ b/source3/nsswitch/winbindd_misc.c
@@ -301,7 +301,8 @@ void winbindd_show_sequence(struct winbindd_cli_state *state)
static void sequence_recv(void *private_data, BOOL success)
{
- struct sequence_state *state = private_data;
+ struct sequence_state *state =
+ (struct sequence_state *)private_data;
uint32 seq = DOM_SEQUENCE_NONE;
if ((success) && (state->response->result == WINBINDD_OK))
@@ -422,7 +423,8 @@ void winbindd_domain_info(struct winbindd_cli_state *state)
static void domain_info_init_recv(void *private_data, BOOL success)
{
- struct domain_info_state *istate = private_data;
+ struct domain_info_state *istate =
+ (struct domain_info_state *)private_data;
struct winbindd_cli_state *state = istate->cli_state;
struct winbindd_domain *domain = istate->domain;
diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c
index 6af8e31bc0..66d297090b 100644
--- a/source3/nsswitch/winbindd_pam.c
+++ b/source3/nsswitch/winbindd_pam.c
@@ -104,7 +104,7 @@ static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
memset( state->response.extra_data.data, '\0', size );
- prs_copy_all_data_out(state->response.extra_data.data, &ps);
+ prs_copy_all_data_out((char *)state->response.extra_data.data, &ps);
state->response.length += size;
prs_mem_free(&ps);
return NT_STATUS_OK;
@@ -1370,9 +1370,10 @@ done:
state->response.extra_data.data =
afs_createtoken_str(afsname, cell);
- if (state->response.extra_data.data != NULL)
+ if (state->response.extra_data.data != NULL) {
state->response.length +=
- strlen(state->response.extra_data.data)+1;
+ strlen((const char *)state->response.extra_data.data)+1;
+ }
no_token:
TALLOC_FREE(afsname);
@@ -1622,7 +1623,8 @@ enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
result = NT_STATUS_NO_MEMORY;
goto done;
}
- state->response.length += strlen(state->response.extra_data.data)+1;
+ state->response.length +=
+ strlen((const char *)state->response.extra_data.data)+1;
}
if (state->request.flags & WBFLAG_PAM_USER_SESSION_KEY) {
diff --git a/source3/nsswitch/winbindd_sid.c b/source3/nsswitch/winbindd_sid.c
index f38246cfbd..194104915a 100644
--- a/source3/nsswitch/winbindd_sid.c
+++ b/source3/nsswitch/winbindd_sid.c
@@ -328,7 +328,8 @@ void winbindd_uid_to_sid(struct winbindd_cli_state *state)
static void uid2sid_recv(void *private_data, BOOL success, const char *sid)
{
- struct winbindd_cli_state *state = private_data;
+ struct winbindd_cli_state *state =
+ (struct winbindd_cli_state *)private_data;
struct uid2sid_state *uid2sid_state;
if (success) {
@@ -472,7 +473,8 @@ void winbindd_gid_to_sid(struct winbindd_cli_state *state)
static void gid2sid_recv(void *private_data, BOOL success, const char *sid)
{
- struct winbindd_cli_state *state = private_data;
+ struct winbindd_cli_state *state =
+ (struct winbindd_cli_state *)private_data;
struct gid2sid_state *gid2sid_state;
if (success) {
@@ -562,7 +564,8 @@ static void gid2sid_lookupname_recv(void *private_data, BOOL success,
static void gid2sid_idmap_set_mapping_recv(void *private_data, BOOL success)
{
- struct gid2sid_state *state = private_data;
+ struct gid2sid_state *state =
+ (struct gid2sid_state *)private_data;
/* don't fail if we can't store it */
diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c
index f08efa044f..98df77c0f2 100644
--- a/source3/nsswitch/winbindd_user.c
+++ b/source3/nsswitch/winbindd_user.c
@@ -362,7 +362,8 @@ void winbindd_getpwnam(struct winbindd_cli_state *state)
static void getpwnam_name2sid_recv(void *private_data, BOOL success,
const DOM_SID *sid, enum SID_NAME_USE type)
{
- struct winbindd_cli_state *state = private_data;
+ struct winbindd_cli_state *state =
+ (struct winbindd_cli_state *)private_data;
if (!success) {
DEBUG(5, ("Could not lookup name for user %s\n",
@@ -382,7 +383,8 @@ static void getpwnam_name2sid_recv(void *private_data, BOOL success,
static void getpwuid_recv(void *private_data, BOOL success, const char *sid)
{
- struct winbindd_cli_state *state = private_data;
+ struct winbindd_cli_state *state =
+ (struct winbindd_cli_state *)private_data;
DOM_SID user_sid;
if (!success) {
@@ -692,7 +694,7 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
break;
}
- name_list = ent->sam_entries;
+ name_list = (struct getpwent_user *)ent->sam_entries;
/* Lookup user info */
@@ -778,7 +780,8 @@ void winbindd_list_users(struct winbindd_cli_state *state)
/* Allocate some memory for extra data */
total_entries += num_entries;
- extra_data = SMB_REALLOC(extra_data, sizeof(fstring) * total_entries);
+ extra_data = (char *)SMB_REALLOC(
+ extra_data, sizeof(fstring) * total_entries);
if (!extra_data) {
DEBUG(0,("failed to enlarge buffer!\n"));
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 27a00ef0fc..acaca16f0a 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -236,7 +236,7 @@ static void trustdom_recv(void *private_data, BOOL success)
return;
}
- p = response->extra_data.data;
+ p = (char *)response->extra_data.data;
while ((p != NULL) && (*p != '\0')) {
char *q, *sidstr, *alt_name;