r17605: Some C++ warnings
authorVolker Lendecke <vlendec@samba.org>
Fri, 18 Aug 2006 14:05:25 +0000 (14:05 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:42 +0000 (11:38 -0500)
source/client/mount.cifs.c
source/nsswitch/winbindd_async.c
source/nsswitch/winbindd_cred_cache.c
source/nsswitch/winbindd_dual.c
source/nsswitch/winbindd_group.c
source/nsswitch/winbindd_misc.c
source/nsswitch/winbindd_pam.c
source/nsswitch/winbindd_sid.c
source/nsswitch/winbindd_user.c
source/nsswitch/winbindd_util.c

index ab1f203412ff9aaeb3a4876f574724459c7a8e22..076001ccc076ff22e9cb7e7b0b93a69b2f48ef72 100755 (executable)
@@ -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);
index 75424db6563970aeb491d39869aeba52052058d6..696f3501efaa94b1d44730b461a2c7694462c4c7 100644 (file)
@@ -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"));
index f5003ac8c6342df4fb7dcb25af4be13f38b31b15..688c8828d39c7c78a2ec7e99246cffd9b43da708 100644 (file)
@@ -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
index 874b480214007e798f0e675ed6703a975e422683..32d85688b67fe84fc242086ae95127c3b1fe62d4 100644 (file)
@@ -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"));
index 5cab6eb663bdf9d73c839f8224a6b4b4c6d9dcdc..80d103336a697e4021a7aaa2793672c92bbab0d9 100644 (file)
@@ -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);
index d43617f7789630793ee76c1805e9087dc6970ae7..9fb05d9df6e251b00619c9640aee0b592530d81c 100644 (file)
@@ -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;
 
index 6af8e31bc0bdc1e7b10915fcc7459bb0d588d9aa..66d297090bf5d65ec3aab283427e69cbb8b49a78 100644 (file)
@@ -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) {
index f38246cfbd5a97cff674f1ac715648167387be5b..194104915ae68f5f75806b3f14c357a9cc3a43df 100644 (file)
@@ -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 */
 
index f08efa044f32cf375967fb85c120242b8f60c135..98df77c0f218e114fbf9ebf3d510c4b6e7a450e0 100644 (file)
@@ -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"));
index 27a00ef0fc560f8f4dffb5e41f705791495764c3..acaca16f0a4fd003d4eafc6d29a5ac1f918c0355 100644 (file)
@@ -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;